Commit 84ad71dd by 刘鹏

Merge branch 'feat/fq/fq_evaluation_4.3.99' into 'd/v4.3.99'

Feat/fq/fq evaluation 4.3.99

See merge request app_android_lib/YDL-Component!208
parents f26136ca d95cbc7a
......@@ -18,6 +18,9 @@
android:screenOrientation="portrait"
android:theme="@style/tests_NoTitleTheme"
/>
<activity android:name=".search.TestSearchKeyActivity"
android:screenOrientation="portrait"
android:theme="@style/tests_NoTitleTheme"/>
<!--测评首页-->
<activity
android:name=".home.NewTestHomeActivity"
......
......@@ -14,4 +14,6 @@ class TestListCommand : BaseCommand() {
var tab: String? = null
@JvmField
var keyword: String? = null
@JvmField
var type: Int = 0
}
\ No newline at end of file
......@@ -3,12 +3,13 @@ package com.yidianling.tests.list.view
import android.app.Activity
import android.content.Context
import android.content.Intent
import androidx.core.content.ContextCompat
import androidx.viewpager.widget.ViewPager
import android.view.View
import android.widget.PopupWindow
import android.widget.TextView
import androidx.core.content.ContextCompat
import androidx.viewpager.widget.ViewPager
import com.alibaba.android.arouter.facade.annotation.Route
import com.google.android.material.tabs.TabLayout
import com.ydl.ydlcommon.base.BaseMvpActivity
import com.ydl.ydlcommon.bean.StatusBarOptions
import com.ydl.ydlcommon.utils.BuryPointUtils
......@@ -32,7 +33,8 @@ import com.yidianling.tests.search.TestSearchActivity
import kotlinx.android.synthetic.main.tests_activity_test_category_list.*
@Route(path = "/ceshi/category_list")
class TestCategoryListActivity : BaseMvpActivity<TestListActivityView, TestListActivityPresenter>(), TestListActivityView, PopupWindow.OnDismissListener {
class TestCategoryListActivity : BaseMvpActivity<TestListActivityView, TestListActivityPresenter>(),
TestListActivityView, PopupWindow.OnDismissListener {
private var isMine: Boolean = false
private var tabName: String? = null
......@@ -51,12 +53,13 @@ class TestCategoryListActivity : BaseMvpActivity<TestListActivityView, TestListA
var selectedConditionList: HashMap<Int, HashMap<String, CategotyPopItem>> = HashMap()
var sortPopup: CategoryPopupWindow? = null;
var filterPopup: CategoryPopupWindow? = null;
var currentPageIndex: Int = 0
val SELECT_SORT: String = "SELECT_SORT"
val SELECT_FILTER: String = "SELECT_FILTER"
private var testCategoryAdapter: TestListPagerAdapter? = null
var title = arrayOf("全部", "付费", "免费")
companion object {
private const val EXTRA_IS_MINE = "is_mine"
......@@ -116,15 +119,50 @@ class TestCategoryListActivity : BaseMvpActivity<TestListActivityView, TestListA
showSortPopupWindow()
}
dr_filter.setOnClickListener {
showFilterPopupWindow()
for (i in title) {
val tab = tab_tabLayout.newTab().setText(i);
tab_tabLayout.addTab(tab)
}
tab_tabLayout.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener {
override fun onTabSelected(tab: TabLayout.Tab?) {
when (tab?.text.toString()) {
"全部" -> {
selectFilterItem = filterList[0]
}
"付费" -> {
selectFilterItem = filterList[1]
}
"免费" -> {
selectFilterItem = filterList[2]
}
}
onDismiss()
}
override fun onTabUnselected(tab: TabLayout.Tab?) {
}
override fun onTabReselected(tab: TabLayout.Tab?) {
}
})
mPresenter.fetchTestTypeList()
vvp_test.addOnPageChangeListener(object : ViewPager.OnPageChangeListener {
override fun onPageScrollStateChanged(state: Int) {}
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {}
override fun onPageScrolled(
position: Int,
positionOffset: Float,
positionOffsetPixels: Int
) {
}
override fun onPageSelected(position: Int) {
currentPageIndex = position
......@@ -134,10 +172,13 @@ class TestCategoryListActivity : BaseMvpActivity<TestListActivityView, TestListA
LogUtil.d("page selected: " + testCategory?.get(position)?.name)
BuryPointUtils.getInstance().createMap()
.put("test_type_click", testCategory?.get(position)?.name + "")
.burryPoint("Testtype_click")
if (("my" == testCategory?.get(position)?.tab || "unpay" == testCategory?.get(position)?.tab) ) {
TestsIn.loginByOneKeyLogin(this@TestCategoryListActivity,true)
.put("test_type_click", testCategory?.get(position)?.name + "")
.burryPoint("Testtype_click")
if (("my" == testCategory?.get(position)?.tab || "unpay" == testCategory?.get(
position
)?.tab)
) {
TestsIn.loginByOneKeyLogin(this@TestCategoryListActivity, true)
}
}
})
......@@ -154,33 +195,21 @@ class TestCategoryListActivity : BaseMvpActivity<TestListActivityView, TestListA
filterList.add(CategotyPopItem("免费", "2"))
sortPopup = CategoryPopupWindow(this,
sortList.toList() as ArrayList<CategotyPopItem>, object : CategoryConditionRecyclerViewAdapter.OnItemSelectedListener {
override fun onSortItemSelected(sortItem: CategotyPopItem) {
selectSortItem = sortItem
if (selectSortItem.key == sortConditionDefaultKey) {
updateFilterTextViewStatus(dr_sort, sortItem.value!!, true)
} else {
updateFilterTextViewStatus(dr_sort, sortItem.value!!, false)
sortList.toList() as ArrayList<CategotyPopItem>,
object : CategoryConditionRecyclerViewAdapter.OnItemSelectedListener {
override fun onSortItemSelected(sortItem: CategotyPopItem) {
selectSortItem = sortItem
if (selectSortItem.key == sortConditionDefaultKey) {
updateFilterTextViewStatus(dr_sort, sortItem.value!!, true)
} else {
updateFilterTextViewStatus(dr_sort, sortItem.value!!, false)
}
sortPopup?.dismiss()
}
sortPopup?.dismiss()
}
})
filterPopup = CategoryPopupWindow(this,
filterList.toList() as ArrayList<CategotyPopItem>, object : CategoryConditionRecyclerViewAdapter.OnItemSelectedListener {
override fun onSortItemSelected(sortItem: CategotyPopItem) {
selectFilterItem = sortItem
if (selectFilterItem.key == filterConditionDefaultKey) {
updateFilterTextViewStatus(dr_filter, sortItem.value!!, true)
} else {
updateFilterTextViewStatus(dr_filter, sortItem.value!!, false)
}
filterPopup?.dismiss()
}
})
})
sortPopup?.setOnDismissListener(this)
filterPopup?.setOnDismissListener(this)
}
override fun onDismiss() {
......@@ -200,24 +229,18 @@ class TestCategoryListActivity : BaseMvpActivity<TestListActivityView, TestListA
updateFilterTextViewStatus(dr_sort, selectSortItem.value!!, false)
}
if (selectFilterItem.key == filterConditionDefaultKey) {
updateFilterTextViewStatus(dr_filter, selectFilterItem.value!!, true)
} else {
updateFilterTextViewStatus(dr_filter, selectFilterItem.value!!, false)
}
}else{
selectSortItem = CategotyPopItem("综合排序", sortConditionDefaultKey)
selectFilterItem= CategotyPopItem("全部", filterConditionDefaultKey)
updateTabLayoutStatus(tab_tabLayout, selectFilterItem.value!!)
} else {
selectSortItem = CategotyPopItem("综合排序", sortConditionDefaultKey)
selectFilterItem = CategotyPopItem("全部", filterConditionDefaultKey)
updateFilterTextViewStatus(dr_sort, selectSortItem.value!!, true)
updateFilterTextViewStatus(dr_filter, selectFilterItem.value!!, true)
updateTabLayoutStatus(tab_tabLayout, selectFilterItem.value!!)
}
sortPopup?.adapter?.lastSelectText = selectSortItem.value
filterPopup?.adapter?.lastSelectText = selectFilterItem.value
sortPopup?.adapter?.notifyDataSetChanged()
filterPopup?.adapter?.notifyDataSetChanged()
}
private fun updateConditionList() {
......@@ -229,11 +252,11 @@ class TestCategoryListActivity : BaseMvpActivity<TestListActivityView, TestListA
conditionList[SELECT_FILTER] = selectFilterItem
selectedConditionList[currentPageIndex] = conditionList
refreshFragmentPageData(selectSortItem.key!!,selectFilterItem.key!!)
refreshFragmentPageData(selectSortItem.key!!, selectFilterItem.key!!)
}
private fun refreshFragmentPageData(sort:String,filter:String) {
testCategoryAdapter?.getFragmentByPosition(currentPageIndex)?.refreshListData(sort,filter)
private fun refreshFragmentPageData(sort: String, filter: String) {
testCategoryAdapter?.getFragmentByPosition(currentPageIndex)?.refreshListData(sort, filter)
}
......@@ -294,23 +317,38 @@ class TestCategoryListActivity : BaseMvpActivity<TestListActivityView, TestListA
view_mask.visibility = View.VISIBLE
}
//显示筛选弹窗
private fun showFilterPopupWindow() {
filterPopup?.showAsDropDown(ll_sort)
view_mask.visibility = View.VISIBLE
}
private fun updateFilterTextViewStatus(tv: TextView, text: String, isNormal: Boolean) {
tv.text = text
if (isNormal) {
tv.setTextColor(ContextCompat.getColor(this, R.color.platform_colorTextDefault))
tv.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.platform_ic_arrow_drop_down_grey_500_18dp, 0)
tv.setCompoundDrawablesWithIntrinsicBounds(
0,
0,
R.drawable.platform_ic_arrow_drop_down_grey_500_18dp,
0
)
} else {
tv.setTextColor(ContextCompat.getColor(this, R.color.platform_main_theme))
tv.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.tests_ic_arrow_drop_down, 0)
}
}
private fun updateTabLayoutStatus(tabLayout: TabLayout, text: String) {
when (text) {
"全部" -> {
tabLayout.getTabAt(0)?.select()
}
"付费" -> {
tabLayout.getTabAt(1)?.select()
}
"免费" -> {
tabLayout.getTabAt(2)?.select()
}
}
}
override fun onFailed(msg: String?) {
ToastUtil.toastShort(msg ?: "")
}
......
......@@ -117,8 +117,8 @@ class TestListRecyclerAdapter(private val context: Context,
tvCoupon.visibility = View.GONE
textView.setPadding(dp5!!,dp2!!,dp5!!,dp2!!)
textView.text = "免费"
textView.setBackgroundResource(R.drawable.tests_testhome_recom_price_bg)
textView.setTextColor(Color.parseColor("#34CD65"))
textView.setBackgroundResource(R.drawable.tests_testhome_recom_price_red_bg)
textView.setTextColor(Color.parseColor("#FF5B05"))
}else{
var newPrice = TestHomeUtils.getOriginalPrice(tvCoupon,price,couponMoney)
textView.setPadding(0,dp5!!,dp5!!,0)
......
......@@ -33,8 +33,9 @@ import de.greenrobot.event.EventBus
import kotlinx.android.synthetic.main.tests_activity_test_search.*
import kotlinx.android.synthetic.main.tests_item_hot_search.view.*
@Route(path ="/tests/search")
class TestSearchActivity : BaseMvpActivity<TestSearchView, TestSearchPresenter>(), TestSearchView, View.OnClickListener {
@Route(path = "/tests/search")
class TestSearchActivity : BaseMvpActivity<TestSearchView, TestSearchPresenter>(), TestSearchView,
View.OnClickListener {
private var isFirstLoad = true
override fun getStatusViewOptions(): StatusBarOptions {
......@@ -76,7 +77,8 @@ class TestSearchActivity : BaseMvpActivity<TestSearchView, TestSearchPresenter>(
}
fun initData() {
var lastCouponMoney = SharedPreferencesEditor.getString(TestHomeUtils.TEST_MAX_COUPON_MONEY_SP_KEY)
var lastCouponMoney =
SharedPreferencesEditor.getString(TestHomeUtils.TEST_MAX_COUPON_MONEY_SP_KEY)
if (!TextUtils.isEmpty(lastCouponMoney)) {
searchAdapter?.couponMoney = lastCouponMoney
hotSearchAdapter?.couponMoney = lastCouponMoney
......@@ -95,8 +97,16 @@ class TestSearchActivity : BaseMvpActivity<TestSearchView, TestSearchPresenter>(
private fun initRecyclerView() {
swipe_refresh_layout.isEnabled = false
searchAdapter = TestListRecyclerAdapter(this, searchedTestList, TestListRecyclerAdapter.PAGE_TYPE_SEARCH)
hotSearchAdapter = TestListRecyclerAdapter(this, hotSearchedTestList, TestListRecyclerAdapter.PAGE_TYPE_SEARCH)
searchAdapter = TestListRecyclerAdapter(
this,
searchedTestList,
TestListRecyclerAdapter.PAGE_TYPE_SEARCH
)
hotSearchAdapter = TestListRecyclerAdapter(
this,
hotSearchedTestList,
TestListRecyclerAdapter.PAGE_TYPE_SEARCH
)
searchAdapter?.onItemClickListener = MyBaseAdapter.OnItemClickListener { _, _, data ->
TestsIn.getTestsImpl().testDetailH5(data.id.toString())
......@@ -106,7 +116,8 @@ class TestSearchActivity : BaseMvpActivity<TestSearchView, TestSearchPresenter>(
TestsIn.getTestsImpl().testDetailH5(data.id.toString())
}
headerHotSearch = View.inflate(this, R.layout.tests_header_hot_search, null) as LinearLayout?;
headerHotSearch =
View.inflate(this, R.layout.tests_header_hot_search, null) as LinearLayout?;
searchHeader = View.inflate(this, R.layout.tests_header_search_list, null);
tvSearchHint = searchHeader?.findViewById(R.id.tv_search_hint);
......@@ -135,13 +146,13 @@ class TestSearchActivity : BaseMvpActivity<TestSearchView, TestSearchPresenter>(
onScrollListener = object : EndlessRecyclerViewScrollListener(layoutManager) {
override fun onLoadMore(page: Int, totalItemsCount: Int, view: RecyclerView?) {
if (isSearch) {
mPresenter.searchTests(keyword, searchListCurrentPage)
mPresenter.searchTests(keyword, searchListCurrentPage, 0)
}
}
}
rv_hot_list.addOnScrollListener(object : RecyclerView.OnScrollListener() {
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
if (!isFirstLoad && dx!=0 && dx!=0) {
if (!isFirstLoad && dx != 0 && dx != 0) {
hideSoftInput()
}
}
......@@ -168,7 +179,14 @@ class TestSearchActivity : BaseMvpActivity<TestSearchView, TestSearchPresenter>(
})
etSearch.setOnEditorActionListener { _, actionId, _ ->
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
doSearch()
keyword = etSearch.text.toString()
if (TextUtils.isEmpty(keyword)) {
ToastUtil.toastShort(getString(R.string.tests_no_search_keyword_hint))
} else {
val intent = Intent(this, TestSearchKeyActivity::class.java)
intent.putExtra("keyword", keyword)
startActivity(intent)
}
}
true
}
......@@ -193,7 +211,7 @@ class TestSearchActivity : BaseMvpActivity<TestSearchView, TestSearchPresenter>(
isSearch = true
searchListCurrentPage = 1
onScrollListener.resetState()
mPresenter.searchTests(keyword, searchListCurrentPage)
mPresenter.searchTests(keyword, searchListCurrentPage, 0)
}
fun hideSoftInput() {
......@@ -241,11 +259,13 @@ class TestSearchActivity : BaseMvpActivity<TestSearchView, TestSearchPresenter>(
headerHotSearch?.visibility = View.VISIBLE
flHotSearch?.removeAllViews()
for (index in keywordData.indices) {
val view = LayoutInflater.from(this).inflate(R.layout.tests_item_recommend_hot_search, flHotSearch, false)
val view = LayoutInflater.from(this)
.inflate(R.layout.tests_item_recommend_hot_search, flHotSearch, false)
view.tvHotSearch.text = keywordData[index].keyWord
view.setOnClickListener {
etSearch.setText(keywordData[index].keyWord)
doSearch()
val intent = Intent(this, TestSearchKeyActivity::class.java)
intent.putExtra("keyword", keywordData[index].keyWord)
startActivity(intent)
}
flHotSearch?.addView(view)
......
package com.yidianling.tests.search
import android.content.Context
import androidx.recyclerview.widget.LinearLayoutManager
import android.text.Editable
import android.text.TextUtils
import android.text.TextWatcher
import android.view.View
import android.view.inputmethod.EditorInfo
import android.view.inputmethod.InputMethodManager
import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.tabs.TabLayout
import com.ydl.ydlcommon.adapter.MyBaseAdapter
import com.ydl.ydlcommon.base.BaseMvpActivity
import com.ydl.ydlcommon.bean.StatusBarOptions
import com.ydl.ydlcommon.utils.SharedPreferencesEditor
import com.ydl.ydlcommon.view.listener.EndlessRecyclerViewScrollListener
import com.yidianling.common.tools.ToastUtil
import com.yidianling.tests.R
import com.yidianling.tests.home.event.UpdateCouponMoneyEvent
import com.yidianling.tests.home.utils.TestHomeUtils
import com.yidianling.tests.list.model.bean.RecommendSearchItemBean
import com.yidianling.tests.list.model.bean.Test
import com.yidianling.tests.list.view.adapter.TestListRecyclerAdapter
import com.yidianling.tests.router.TestsIn
import de.greenrobot.event.EventBus
import kotlinx.android.synthetic.main.tests_activity_test_key_search.*
class TestSearchKeyActivity : BaseMvpActivity<TestSearchView, TestSearchPresenter>(),
TestSearchView, View.OnClickListener {
private var keyWord: String? = ""
private var searchListCurrentAllPage = 1
private var searchListCurrentPastPage = 1
private var searchListCurrentFreePage = 1
private val TYPE_ALL = "all"
private val TYPE_PAST = "past"
private val TYPE_FREE = "free"
private lateinit var onScrollListener: EndlessRecyclerViewScrollListener
private var currentSelectedPage = TYPE_ALL
var title = arrayOf("全部", "付费", "免费")
private var searchAdapter: TestListRecyclerAdapter? = null
private val searchedTestList: MutableList<Test> = ArrayList()
override fun createPresenter(): TestSearchPresenter = TestSearchPresenter()
override fun layoutResId(): Int {
return R.layout.tests_activity_test_key_search
}
override fun getStatusViewOptions(): StatusBarOptions {
return StatusBarOptions(true, statusBarDarkMode = true)
}
override fun initDataAndEvent() {
EventBus.getDefault().register(this)
this.keyWord = intent.getStringExtra("keyword")
setupListeners()
initView()
initRecyclerView()
tv_search_key_empty?.text = String.format("为您找到以下跟“%s”有关的内容", keyWord)
etKeySearch?.setText(keyWord)
}
private fun initView() {
for (i in title) {
val tab = tabLayout.newTab().setText(i);
tabLayout.addTab(tab)
}
}
private fun initRecyclerView() {
swipe_refresh_layout_key.isEnabled = false
searchAdapter = TestListRecyclerAdapter(
this,
searchedTestList,
TestListRecyclerAdapter.PAGE_TYPE_SEARCH
)
var lastCouponMoney =
SharedPreferencesEditor.getString(TestHomeUtils.TEST_MAX_COUPON_MONEY_SP_KEY)
if (!TextUtils.isEmpty(lastCouponMoney)) {
searchAdapter?.couponMoney = lastCouponMoney
}
searchAdapter?.onItemClickListener = MyBaseAdapter.OnItemClickListener { _, _, data ->
TestsIn.getTestsImpl().testDetailH5(data.id.toString())
}
rv_search_key_list.adapter = searchAdapter
val layoutManager = LinearLayoutManager(
this,
LinearLayoutManager.VERTICAL,
false
)
rv_search_key_list.layoutManager = layoutManager
onScrollListener = object : EndlessRecyclerViewScrollListener(layoutManager) {
override fun onLoadMore(page: Int, totalItemsCount: Int, view: RecyclerView?) {
when (currentSelectedPage) {
TYPE_ALL -> {
mPresenter.searchTests(keyWord, searchListCurrentAllPage, 0)
}
TYPE_PAST -> {
mPresenter.searchTests(keyWord, searchListCurrentPastPage, 1)
}
TYPE_FREE -> {
mPresenter.searchTests(keyWord, searchListCurrentFreePage, 2)
}
}
}
}
rv_search_key_list.addOnScrollListener(onScrollListener)
}
private fun setupListeners() {
tvKeyBack.setOnClickListener(this)
etKeySearch.addTextChangedListener(object : TextWatcher {
override fun afterTextChanged(s: Editable?) {
}
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
}
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
if (TextUtils.isEmpty(s.toString())) {
}
}
})
etKeySearch.setOnEditorActionListener { _, actionId, _ ->
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
this.keyWord = etKeySearch.text.toString()
tv_search_key_empty?.text = String.format("为您找到以下跟“%s”有关的内容", keyWord)
if (TextUtils.isEmpty(keyWord)) {
ToastUtil.toastShort(getString(R.string.tests_no_search_keyword_hint))
} else {
doSearch(keyWord)
}
}
true
}
tabLayout.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener {
override fun onTabSelected(tab: TabLayout.Tab?) {
when (tab?.text.toString()) {
"全部" -> {
currentSelectedPage = TYPE_ALL
searchListCurrentAllPage = 1
mPresenter.searchTests(keyWord, searchListCurrentAllPage, 0)
}
"付费" -> {
currentSelectedPage = TYPE_PAST
searchListCurrentPastPage = 1
mPresenter.searchTests(keyWord, searchListCurrentPastPage, 1)
}
"免费" -> {
currentSelectedPage = TYPE_FREE
searchListCurrentFreePage = 1
mPresenter.searchTests(keyWord, searchListCurrentFreePage, 2)
}
}
}
override fun onTabUnselected(tab: TabLayout.Tab?) {
}
override fun onTabReselected(tab: TabLayout.Tab?) {
}
})
}
fun doSearch(keyword: String?) {
currentSelectedPage = TYPE_ALL
searchListCurrentAllPage = 1
mPresenter.searchTests(keyword, searchListCurrentAllPage, 0)
tabLayout.getTabAt(0)?.select()
}
override fun showLoadingView() {
swipe_refresh_layout_key.isRefreshing = true
}
override fun hideLoadingView() {
swipe_refresh_layout_key.isRefreshing = false
}
override fun showError(msg: String) {
ToastUtil.toastShort(msg)
}
override fun showNoResultView() {
llKeyEmpty.visibility = View.VISIBLE
iv_Key_empty.visibility = View.VISIBLE
}
override fun hideNoResultView() {
llKeyEmpty.visibility = View.GONE
}
override fun showSearchResultView(testList: List<Test>?, page: Int) {
hideSoftInput()
if (page == 1) {
rv_search_key_list.adapter = searchAdapter
onScrollListener.resetState()
searchedTestList.clear()
}
if (testList != null && testList.isNotEmpty()) {
searchedTestList.addAll(testList)
searchAdapter?.notifyDataSetChanged()
} else {
searchAdapter?.hasMore = false
searchAdapter?.notifyDataSetChanged()
}
when (currentSelectedPage) {
TYPE_ALL -> {
searchListCurrentAllPage++
}
TYPE_PAST -> {
searchListCurrentPastPage++
}
TYPE_FREE -> {
searchListCurrentFreePage++
}
}
}
fun hideSoftInput() {
val view = this.currentFocus
if (view != null) {
val imm = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
imm.hideSoftInputFromWindow(view.windowToken, 0)
}
}
override fun onRecommendSearchListResponse(testList: List<RecommendSearchItemBean>) {
}
override fun onHotRecommendResponse(datalist: List<Test>) {
}
override fun onClick(v: View?) {
when (v?.id) {
R.id.tvKeyBack -> {
finish()
}
}
}
override fun onResume() {
super.onResume()
//每次可见,更新优惠券信息
TestHomeUtils.updateCouponMoney()
}
fun onEvent(updateCouponMoneyEvent: UpdateCouponMoneyEvent) {
searchAdapter?.couponMoney = updateCouponMoneyEvent.money
searchAdapter?.notifyDataSetChanged()
}
override fun onDestroy() {
super.onDestroy()
EventBus.getDefault().unregister(this)
}
}
......@@ -79,7 +79,7 @@ class TestSearchPresenter : SimplePresenter<TestSearchView>() {
})
}
fun searchTests(keyword: String?, page: Int) {
fun searchTests(keyword: String?, page: Int, type: Int) {
if (page == 1) {
mView.showLoadingView()
}
......@@ -88,6 +88,7 @@ class TestSearchPresenter : SimplePresenter<TestSearchView>() {
cmd.tab = "search"
cmd.page = page
cmd.keyword = keyword
cmd.type = type
TestRetrofitApi.getTestRetrofitApi()
.fetchTestList(NetworkParamsUtils.getMaps(cmd))
.subscribeOn(Schedulers.io())
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="3dp" />
<solid android:color="#1AFF5B05" />
</shape>
\ No newline at end of file
......@@ -87,6 +87,15 @@
android:orientation="horizontal"
>
<com.google.android.material.tabs.TabLayout
android:id="@+id/tab_tabLayout"
android:layout_width="0dp"
android:layout_height="44dp"
app:tabIndicatorColor="@color/blue"
app:tabIndicatorHeight="3dp"
app:tabIndicatorFullWidth="false"
android:layout_weight="1"/>
<com.ydl.ydlcommon.view.DrawableRightTextView
android:id="@+id/dr_sort"
style="@style/tests_FilterTextViewStyle"
......@@ -99,17 +108,6 @@
android:textColor="@color/platform_color_242424"
/>
<com.ydl.ydlcommon.view.DrawableRightTextView
android:id="@+id/dr_filter"
style="@style/tests_FilterTextViewStyle"
android:layout_width="wrap_content"
android:layout_height="44dp"
android:drawableEnd="@drawable/platform_ic_arrow_drop_down_grey_500_18dp"
android:drawableRight="@drawable/platform_ic_arrow_drop_down_grey_500_18dp"
android:paddingLeft="15dp"
android:text="全部"
android:textColor="@color/platform_color_242424"
/>
</LinearLayout>
<RelativeLayout
......
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/clContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical"
tools:context=".search.TestSearchActivity">
<LinearLayout
android:id="@+id/ll_title"
android:layout_width="match_parent"
android:layout_height="45dp"
android:gravity="center_vertical"
app:layout_constraintTop_toTopOf="parent">
<com.ydl.ydlcommon.view.DeleteEditTextView
android:id="@+id/etKeySearch"
android:layout_width="0dp"
android:layout_height="36dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="5dp"
android:layout_weight="1"
android:background="@drawable/tests_bg_test_search_input"
android:drawableStart="@drawable/tests_search_gray"
android:drawableLeft="@drawable/tests_search_gray"
android:drawablePadding="8dp"
android:ems="10"
android:hint="输入标题与内容"
android:imeOptions="actionSearch"
android:inputType="text|textPersonName"
android:lines="1"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:textCursorDrawable="@color/platform_color_42C1FF"
android:textSize="14sp" />
<TextView
android:id="@+id/tvKeyBack"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="6dp"
android:padding="10dp"
android:text="@string/platform_cancel"
android:textColor="@color/platform_color_999999" />
</LinearLayout>
<TextView
android:id="@+id/tv_search_key_empty"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="15dp" />
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="44dp"
app:tabIndicatorColor="@color/blue"
app:tabIndicatorFullWidth="false"
app:tabIndicatorHeight="3dp" />
<View style="@style/platform_viewline" />
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swipe_refresh_layout_key"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_search_key_list"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<LinearLayout
android:id="@+id/llKeyEmpty"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:visibility="gone"
tools:visibility="visible">
<ImageView
android:id="@+id/iv_Key_empty"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="30dp"
android:src="@drawable/platform_ico_img_zixun_empty"
android:visibility="gone"
tools:visibility="visible" />
</LinearLayout>
</RelativeLayout>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</LinearLayout>
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