Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YDL-Component-Medical
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨凯
YDL-Component-Medical
Commits
b6d32c3b
Commit
b6d32c3b
authored
Jun 29, 2022
by
fengquan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 测评精品搜索页面调整
parent
f26136ca
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
114 additions
and
70 deletions
+114
-70
TestCategoryListActivity.kt
m-tests/src/main/java/com/yidianling/tests/list/view/TestCategoryListActivity.kt
+95
-57
TestListRecyclerAdapter.kt
m-tests/src/main/java/com/yidianling/tests/list/view/adapter/TestListRecyclerAdapter.kt
+2
-2
tests_testhome_recom_price_red_bg.xml
m-tests/src/main/res/drawable/tests_testhome_recom_price_red_bg.xml
+8
-0
tests_activity_test_category_list.xml
m-tests/src/main/res/layout/tests_activity_test_category_list.xml
+9
-11
No files found.
m-tests/src/main/java/com/yidianling/tests/list/view/TestCategoryListActivity.kt
View file @
b6d32c3b
...
...
@@ -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
)
update
FilterTextViewStatus
(
dr_filter
,
selectFilterItem
.
value
!!
,
true
)
update
TabLayoutStatus
(
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
?:
""
)
}
...
...
m-tests/src/main/java/com/yidianling/tests/list/view/adapter/TestListRecyclerAdapter.kt
View file @
b6d32c3b
...
...
@@ -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
(
"#
34CD6
5"
))
textView
.
setBackgroundResource
(
R
.
drawable
.
tests_testhome_recom_price_
red_
bg
)
textView
.
setTextColor
(
Color
.
parseColor
(
"#
FF5B0
5"
))
}
else
{
var
newPrice
=
TestHomeUtils
.
getOriginalPrice
(
tvCoupon
,
price
,
couponMoney
)
textView
.
setPadding
(
0
,
dp5
!!
,
dp5
!!
,
0
)
...
...
m-tests/src/main/res/drawable/tests_testhome_recom_price_red_bg.xml
0 → 100644
View file @
b6d32c3b
<?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
m-tests/src/main/res/layout/tests_activity_test_category_list.xml
View file @
b6d32c3b
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment