Commit 487e0c3c by fengquan

fix: 测评搜索页面UI调整

parent 988f163a
package com.yidianling.tests.list.model.bean;
import com.flyco.tablayout.listener.CustomTabEntity;
/**
* @author jiucheng
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/7/27
*/
public class TrendTabEntity implements CustomTabEntity {
public String title;
public int selectedIcon;
public int unSelectedIcon;
public TrendTabEntity(String title, int selectedIcon, int unSelectedIcon) {
this.title = title;
this.selectedIcon = selectedIcon;
this.unSelectedIcon = unSelectedIcon;
}
@Override
public String getTabTitle() {
return title;
}
@Override
public int getTabSelectedIcon() {
return selectedIcon;
}
@Override
public int getTabUnselectedIcon() {
return unSelectedIcon;
}
}
...@@ -9,7 +9,9 @@ import android.widget.TextView ...@@ -9,7 +9,9 @@ import android.widget.TextView
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.viewpager.widget.ViewPager import androidx.viewpager.widget.ViewPager
import com.alibaba.android.arouter.facade.annotation.Route import com.alibaba.android.arouter.facade.annotation.Route
import com.google.android.material.tabs.TabLayout import com.flyco.tablayout.CommonTabLayout
import com.flyco.tablayout.listener.CustomTabEntity
import com.flyco.tablayout.listener.OnTabSelectListener
import com.ydl.ydlcommon.base.BaseMvpActivity import com.ydl.ydlcommon.base.BaseMvpActivity
import com.ydl.ydlcommon.bean.StatusBarOptions import com.ydl.ydlcommon.bean.StatusBarOptions
import com.ydl.ydlcommon.utils.BuryPointUtils import com.ydl.ydlcommon.utils.BuryPointUtils
...@@ -24,6 +26,7 @@ import com.yidianling.tests.home.utils.TestHomeUtils ...@@ -24,6 +26,7 @@ import com.yidianling.tests.home.utils.TestHomeUtils
import com.yidianling.tests.list.model.bean.CategotyPopItem import com.yidianling.tests.list.model.bean.CategotyPopItem
import com.yidianling.tests.list.model.bean.TestCategory import com.yidianling.tests.list.model.bean.TestCategory
import com.yidianling.tests.list.model.bean.TestsRedPacketBean import com.yidianling.tests.list.model.bean.TestsRedPacketBean
import com.yidianling.tests.list.model.bean.TrendTabEntity
import com.yidianling.tests.list.presenter.TestListActivityPresenter import com.yidianling.tests.list.presenter.TestListActivityPresenter
import com.yidianling.tests.list.view.adapter.CategoryConditionRecyclerViewAdapter import com.yidianling.tests.list.view.adapter.CategoryConditionRecyclerViewAdapter
import com.yidianling.tests.list.view.adapter.TestListPagerAdapter import com.yidianling.tests.list.view.adapter.TestListPagerAdapter
...@@ -43,6 +46,7 @@ class TestCategoryListActivity : BaseMvpActivity<TestListActivityView, TestListA ...@@ -43,6 +46,7 @@ class TestCategoryListActivity : BaseMvpActivity<TestListActivityView, TestListA
private var testCategory: MutableList<TestCategory> = ArrayList() private var testCategory: MutableList<TestCategory> = ArrayList()
private var sortList: MutableList<CategotyPopItem> = ArrayList() private var sortList: MutableList<CategotyPopItem> = ArrayList()
private var filterList: MutableList<CategotyPopItem> = ArrayList() private var filterList: MutableList<CategotyPopItem> = ArrayList()
private val titleList = java.util.ArrayList<CustomTabEntity>()
var sortConditionDefaultKey: String = "1" var sortConditionDefaultKey: String = "1"
var filterConditionDefaultKey: String = "1" var filterConditionDefaultKey: String = "1"
...@@ -59,7 +63,7 @@ class TestCategoryListActivity : BaseMvpActivity<TestListActivityView, TestListA ...@@ -59,7 +63,7 @@ class TestCategoryListActivity : BaseMvpActivity<TestListActivityView, TestListA
val SELECT_SORT: String = "SELECT_SORT" val SELECT_SORT: String = "SELECT_SORT"
val SELECT_FILTER: String = "SELECT_FILTER" val SELECT_FILTER: String = "SELECT_FILTER"
private var testCategoryAdapter: TestListPagerAdapter? = null private var testCategoryAdapter: TestListPagerAdapter? = null
var title = arrayOf("全部", "付费", "免费")
companion object { companion object {
private const val EXTRA_IS_MINE = "is_mine" private const val EXTRA_IS_MINE = "is_mine"
...@@ -119,23 +123,24 @@ class TestCategoryListActivity : BaseMvpActivity<TestListActivityView, TestListA ...@@ -119,23 +123,24 @@ class TestCategoryListActivity : BaseMvpActivity<TestListActivityView, TestListA
showSortPopupWindow() showSortPopupWindow()
} }
for (i in title) { titleList.add(TrendTabEntity("全部", 0, 0));
val tab = tab_tabLayout.newTab().setText(i) titleList.add(TrendTabEntity("付费", 0, 0));
tab_tabLayout.addTab(tab) titleList.add(TrendTabEntity("免费", 0, 0));
}
tab_tabLayout.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener { tab_tabLayout.setTabData(titleList)
override fun onTabSelected(tab: TabLayout.Tab?) {
when (tab?.text.toString()) { tab_tabLayout.setOnTabSelectListener(object : OnTabSelectListener {
"全部" -> { override fun onTabSelect(position: Int) {
when (position) {
0 -> {
selectFilterItem = filterList[0] selectFilterItem = filterList[0]
} }
"付费" -> { 1 -> {
selectFilterItem = filterList[1] selectFilterItem = filterList[1]
} }
"免费" -> { 2 -> {
selectFilterItem = filterList[2] selectFilterItem = filterList[2]
} }
} }
...@@ -143,14 +148,7 @@ class TestCategoryListActivity : BaseMvpActivity<TestListActivityView, TestListA ...@@ -143,14 +148,7 @@ class TestCategoryListActivity : BaseMvpActivity<TestListActivityView, TestListA
onDismiss() onDismiss()
} }
override fun onTabUnselected(tab: TabLayout.Tab?) { override fun onTabReselect(position: Int) {}
}
override fun onTabReselected(tab: TabLayout.Tab?) {
}
}) })
mPresenter.fetchTestTypeList() mPresenter.fetchTestTypeList()
...@@ -183,6 +181,7 @@ class TestCategoryListActivity : BaseMvpActivity<TestListActivityView, TestListA ...@@ -183,6 +181,7 @@ class TestCategoryListActivity : BaseMvpActivity<TestListActivityView, TestListA
} }
}) })
StatusBarUtils.statusBarLightMode(this) StatusBarUtils.statusBarLightMode(this)
} }
private fun initConditionView() { private fun initConditionView() {
...@@ -333,18 +332,18 @@ class TestCategoryListActivity : BaseMvpActivity<TestListActivityView, TestListA ...@@ -333,18 +332,18 @@ class TestCategoryListActivity : BaseMvpActivity<TestListActivityView, TestListA
} }
} }
private fun updateTabLayoutStatus(tabLayout: TabLayout, text: String) { private fun updateTabLayoutStatus(tabLayout: CommonTabLayout, text: String) {
when (text) { when (text) {
"全部" -> { "全部" -> {
tabLayout.getTabAt(0)?.select() tabLayout.currentTab = 0
} }
"付费" -> { "付费" -> {
tabLayout.getTabAt(1)?.select() tabLayout.currentTab = 1
} }
"免费" -> { "免费" -> {
tabLayout.getTabAt(2)?.select() tabLayout.currentTab = 2
} }
} }
} }
......
...@@ -212,6 +212,7 @@ class TestSearchKeyActivity : BaseMvpActivity<TestSearchView, TestSearchPresente ...@@ -212,6 +212,7 @@ class TestSearchKeyActivity : BaseMvpActivity<TestSearchView, TestSearchPresente
override fun showNoResultView() { override fun showNoResultView() {
llKeyEmpty.visibility = View.VISIBLE llKeyEmpty.visibility = View.VISIBLE
iv_Key_empty.visibility = View.VISIBLE iv_Key_empty.visibility = View.VISIBLE
tv_text_search_empty.visibility = View.VISIBLE
} }
override fun hideNoResultView() { override fun hideNoResultView() {
......
...@@ -81,25 +81,27 @@ ...@@ -81,25 +81,27 @@
android:background="@color/white" android:background="@color/white"
android:orientation="horizontal"> android:orientation="horizontal">
<com.google.android.material.tabs.TabLayout <com.flyco.tablayout.CommonTabLayout
android:id="@+id/tab_tabLayout" android:id="@+id/tab_tabLayout"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="44dp"
android:layout_weight="1" android:layout_weight="1"
app:tabIndicator="@drawable/tests_bg_indicator_search" android:layout_height="44dp"
app:tabIndicatorColor="#2BB5F5" android:layout_centerInParent="true"
app:tabIndicatorFullWidth="false" app:tl_indicator_anim_enable="true"
app:tabSelectedTextColor="@color/platform_black" app:tl_indicator_color="#2BB5F5"
app:tabTextColor="@color/platform_color_999999" app:tl_indicator_height="4dp"
app:tabTextAppearance="@style/tests_MyTabLayout" app:tl_textBold="BOTH"
app:tabPaddingTop="@dimen/platform_dp_5" /> app:tl_indicator_corner_radius="@dimen/platform_dp_5"
app:tl_indicator_width="@dimen/platform_dp_20"
app:tl_textSelectColor="@color/platform_black"
app:tl_textUnselectColor="@color/platform_color_999999"
app:tl_textsize="@dimen/platform_sp_16" />
<com.ydl.ydlcommon.view.DrawableRightTextView <com.ydl.ydlcommon.view.DrawableRightTextView
android:id="@+id/dr_sort" android:id="@+id/dr_sort"
style="@style/tests_FilterTextViewStyle" style="@style/tests_FilterTextViewStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_marginTop="@dimen/platform_dp_4" android:layout_height="44dp"
android:layout_height="@dimen/platform_dp_40"
android:layout_marginLeft="@dimen/platform_dp_26" android:layout_marginLeft="@dimen/platform_dp_26"
android:drawableEnd="@drawable/platform_ic_arrow_drop_down_grey_500_18dp" android:drawableEnd="@drawable/platform_ic_arrow_drop_down_grey_500_18dp"
android:drawableRight="@drawable/platform_ic_arrow_drop_down_grey_500_18dp" android:drawableRight="@drawable/platform_ic_arrow_drop_down_grey_500_18dp"
......
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
android:id="@+id/tv_search_key_empty" android:id="@+id/tv_search_key_empty"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:visibility="gone"
android:padding="15dp" /> android:padding="15dp" />
...@@ -99,6 +100,14 @@ ...@@ -99,6 +100,14 @@
android:src="@drawable/platform_ico_img_zixun_empty" android:src="@drawable/platform_ico_img_zixun_empty"
android:visibility="gone" android:visibility="gone"
tools:visibility="visible" /> tools:visibility="visible" />
<TextView
android:id="@+id/tv_text_search_empty"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="没有搜到相关信息,换个关键词看看吧"
android:visibility="gone"
android:gravity="center" />
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment