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
e4ed1517
Commit
e4ed1517
authored
May 26, 2022
by
upwork.021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 排序代码提交
parent
54348d30
Show whitespace changes
Inline
Side-by-side
Showing
39 changed files
with
1891 additions
and
771 deletions
+1891
-771
DemoGlobalConfig.java
app/src/main/java/com/ydl/component/base/DemoGlobalConfig.java
+2
-2
build.gradle
m-consultant/build.gradle
+1
-1
ExpertSearchActivity.kt
m-consultant/src/main/java/com/yidianling/consultant/ExpertSearchActivity.kt
+103
-151
ExpertSearchFragment.kt
m-consultant/src/main/java/com/yidianling/consultant/ExpertSearchFragment.kt
+129
-277
ExpertSearchPresenter.kt
m-consultant/src/main/java/com/yidianling/consultant/ExpertSearchPresenter.kt
+160
-115
IExpertSearchView.kt
m-consultant/src/main/java/com/yidianling/consultant/IExpertSearchView.kt
+3
-6
CategoryRecyclerViewAdapter.kt
m-consultant/src/main/java/com/yidianling/consultant/adapter/CategoryRecyclerViewAdapter.kt
+1
-1
ExpertSearchAdapter.kt
m-consultant/src/main/java/com/yidianling/consultant/adapter/ExpertSearchAdapter.kt
+43
-43
SortAdapter.kt
m-consultant/src/main/java/com/yidianling/consultant/adapter/SortAdapter.kt
+71
-0
SortRecyclerViewAdapter.kt
m-consultant/src/main/java/com/yidianling/consultant/adapter/SortRecyclerViewAdapter.kt
+1
-1
ExpertSearchProductsBean.kt
m-consultant/src/main/java/com/yidianling/consultant/bean/ExpertSearchProductsBean.kt
+3
-3
ExpertSearchTagsIconBean.kt
m-consultant/src/main/java/com/yidianling/consultant/bean/ExpertSearchTagsIconBean.kt
+5
-5
ExpertSearchHttpImpl.kt
m-consultant/src/main/java/com/yidianling/consultant/http/ExpertSearchHttpImpl.kt
+7
-4
IExpertSearchHttp.kt
m-consultant/src/main/java/com/yidianling/consultant/http/IExpertSearchHttp.kt
+7
-3
FlowLayoutManager.java
m-consultant/src/main/java/com/yidianling/consultant/layoutmanager/FlowLayoutManager.java
+287
-0
OnCategoriesSelectedListener.kt
m-consultant/src/main/java/com/yidianling/consultant/listener/OnCategoriesSelectedListener.kt
+2
-3
SearchApi.kt
m-consultant/src/main/java/com/yidianling/consultant/model/SearchApi.kt
+14
-5
AgeItem.kt
m-consultant/src/main/java/com/yidianling/consultant/model/bean/AgeItem.kt
+2
-1
AllFilter.kt
m-consultant/src/main/java/com/yidianling/consultant/model/bean/AllFilter.kt
+17
-1
CateItem.kt
m-consultant/src/main/java/com/yidianling/consultant/model/bean/CateItem.kt
+16
-23
EnquiryItem.kt
m-consultant/src/main/java/com/yidianling/consultant/model/bean/EnquiryItem.kt
+1
-1
ExpertBean.kt
m-consultant/src/main/java/com/yidianling/consultant/model/bean/ExpertBean.kt
+22
-0
ExpertSearchBean.kt
m-consultant/src/main/java/com/yidianling/consultant/model/bean/ExpertSearchBean.kt
+0
-37
ExpertServiceItem.kt
m-consultant/src/main/java/com/yidianling/consultant/model/bean/ExpertServiceItem.kt
+24
-28
Filters.kt
m-consultant/src/main/java/com/yidianling/consultant/model/bean/Filters.kt
+0
-6
OtherItem.kt
m-consultant/src/main/java/com/yidianling/consultant/model/bean/OtherItem.kt
+8
-1
ReorderItem.kt
m-consultant/src/main/java/com/yidianling/consultant/model/bean/ReorderItem.kt
+8
-1
SortBean.java
m-consultant/src/main/java/com/yidianling/consultant/model/bean/SortBean.java
+26
-0
TempH5RouteUtils.kt
m-consultant/src/main/java/com/yidianling/consultant/modular/utils/TempH5RouteUtils.kt
+1
-1
CategoryPopupWindow.kt
m-consultant/src/main/java/com/yidianling/consultant/ui/view/CategoryPopupWindow.kt
+558
-20
FilterPopupWindow.kt
m-consultant/src/main/java/com/yidianling/consultant/ui/view/FilterPopupWindow.kt
+5
-8
SortPopupWindow.kt
m-consultant/src/main/java/com/yidianling/consultant/ui/view/SortPopupWindow.kt
+2
-7
consultant_ic_sort_close.png
m-consultant/src/main/res/drawable-xhdpi/consultant_ic_sort_close.png
+0
-0
consultant_ic_sort_open.png
m-consultant/src/main/res/drawable-xhdpi/consultant_ic_sort_open.png
+0
-0
consultant_solid_main_theme_color_r_8.xml
m-consultant/src/main/res/drawable/consultant_solid_main_theme_color_r_8.xml
+0
-0
consultant_item_sort1.xml
m-consultant/src/main/res/layout/consultant_item_sort1.xml
+25
-0
consultant_item_sort2.xml
m-consultant/src/main/res/layout/consultant_item_sort2.xml
+26
-0
consultant_item_subject.xml
m-consultant/src/main/res/layout/consultant_item_subject.xml
+1
-1
consultant_ui_subject_popup_window.xml
m-consultant/src/main/res/layout/consultant_ui_subject_popup_window.xml
+310
-15
No files found.
app/src/main/java/com/ydl/component/base/DemoGlobalConfig.java
View file @
e4ed1517
...
...
@@ -21,9 +21,9 @@ import java.util.List;
public
final
class
DemoGlobalConfig
implements
IConfigModule
{
String
APP_DOMAIN
=
"https://api.github.com/"
;
// public static String appEnv = YDLConstants.ENV_AUTO_TEST;
//
public static String appEnv = YDLConstants.ENV_TEST;
public
static
String
appEnv
=
YDLConstants
.
ENV_TEST
;
// public static String appEnv = YDLConstants.ENV_NEW_TEST;//配置未上传到maven库
public
static
String
appEnv
=
YDLConstants
.
ENV_PROD
;
//
public static String appEnv = YDLConstants.ENV_PROD;
@Override
public
void
injectAppLifecycle
(
@NotNull
Context
context
,
@NotNull
List
<
IAppLifecycles
>
lifecycles
)
{
lifecycles
.
add
(
new
DemoAppLifecycles
());
...
...
m-consultant/build.gradle
View file @
e4ed1517
...
...
@@ -68,7 +68,7 @@ dependencies {
androidTestImplementation
'androidx.test.ext:junit:1.1.1'
androidTestImplementation
'androidx.test.espresso:espresso-core:3.1.0'
kapt
'com.alibaba:arouter-compiler:1.2.2'
implementation
rootProject
.
ext
.
dependencies
[
"BaseRecyclerViewAdapterHelper"
]
api
rootProject
.
ext
.
dependencies
[
"ydl-user-router"
]
if
(
rootProject
.
ext
.
dev_mode
){
//开发时使用
...
...
m-consultant/src/main/java/com/yidianling/consultant/ExpertSearchActivity.kt
View file @
e4ed1517
...
...
@@ -177,8 +177,8 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
private
val
allFilter
=
AllFilter
()
//当前筛选
private
val
tempFilter
=
AllFilter
()
//临时筛选,未确认状态
private
var
curPage
=
1
private
val
doctorList
=
ArrayList
<
Doctor
ServiceItem
>()
private
val
serviceList
=
ArrayList
<
Doctor
ServiceItem
>()
private
val
doctorList
=
ArrayList
<
Expert
ServiceItem
>()
private
val
serviceList
=
ArrayList
<
Expert
ServiceItem
>()
private
var
hasMore
=
true
private
var
initCategory
=
"0"
private
var
initShowType
:
Int
=
1
...
...
@@ -331,8 +331,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
override
fun
onLoadMore
(
page
:
Int
,
totalItemsCount
:
Int
,
view
:
RecyclerView
?)
{
if
(
hasMore
)
{
curPage
++
getPresenter
().
fetchListData
(
allFilter
,
curPage
)
getPresenter
().
fetchListData
(
allFilter
,
getPresenter
().
mExtras
)
}
}
}
...
...
@@ -374,9 +373,6 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
override
fun
localData
()
{
}
override
fun
updateCache
(
showType
:
Int
,
searchBean
:
ExpertSearchBean
)
{
}
//路由传递过来的参数
private
fun
getRouterParam
()
{
if
(
null
!=
intent
&&
intent
.
hasExtra
(
"routerParam"
))
{
...
...
@@ -402,7 +398,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
allFilter
.
categories
.
add
(
cat
)
getPresenter
().
fetchListHead
()
//加载本地缓存数据
getPresenter
().
localData
(
initShowType
)
//
getPresenter().localData(initShowType)
refresh
(
false
)
v_loading
.
visibility
=
View
.
VISIBLE
...
...
@@ -785,78 +781,26 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
}
}
//服务列表数据获取到后的回调
override
fun
onServiceListFetched
(
data
:
MutableList
<
DoctorServiceItem
>,
page
:
Int
,
totalPage
:
Int
)
{
LogUtil
.
d
(
"onServiceListFetched"
)
// if (rvExperts.adapter != serviceAdapter) {
// rvExperts.adapter = serviceAdapter
// }
if
(
page
==
1
)
{
if
(
fromPageType
!=
-
1
&&
isDoSearch
)
{
// LogUtil.d("keyword: " + keyWord + " isRecommend: " + isRecommend + " hasResult: " + (data.size > 0 && data != null ?: false) + " location: " + fromPages[fromPageType])
}
serviceList
.
clear
()
hasMore
=
true
// serviceAdapter.hasMore = true
}
if
(
fromPageType
==
-
1
)
{
bury
(
keyWord
?:
""
,
data
.
size
>
0
,
isRecommend
,
"首页分类"
)
}
else
{
bury
(
keyWord
?:
""
,
data
.
size
>
0
,
isRecommend
,
fromPages
[
fromPageType
])
}
if
(
page
>=
totalPage
)
{
hasMore
=
false
// serviceAdapter.hasMore = false
}
serviceList
.
addAll
(
data
)
// serviceAdapter.notifyDataSetChanged()
isRecommend
=
false
isDoSearch
=
false
v_loading
.
visibility
=
View
.
GONE
ll_network_error
.
visibility
=
View
.
GONE
rvExperts
.
visibility
=
View
.
VISIBLE
dismissProgressDialog
()
srlContainer
.
isRefreshing
=
false
}
//专家列表数据获取到后的回调
override
fun
onDoctorListFetched
(
data
:
MutableList
<
DoctorServiceItem
>,
page
:
Int
,
totalPage
:
Int
)
{
override
fun
onDoctorListFetched
(
data
:
MutableList
<
ExpertServiceItem
>,
extras
:
Extras
?,
curPage
:
Int
)
{
LogUtil
.
d
(
"onDoctorListFetched"
)
if
(
rvExperts
.
adapter
!=
doctorAdapter
)
{
rvExperts
.
adapter
=
doctorAdapter
}
LogUtil
.
d
(
"data size "
+
data
.
size
)
if
(
page
==
1
)
{
if
(
fromPageType
!=
-
1
&&
isDoSearch
)
{
// LogUtil.d("keyword: " + keyWord + " isRecommend: " + isRecommend + " hasResult: " + (data.size > 0 && data != null ?: false) + " location: " + fromPages[fromPageType])
}
doctorList
.
clear
()
doctorAdapter
.
hasMore
=
true
hasMore
=
true
}
if
(
fromPageType
==
-
1
)
{
bury
(
keyWord
?:
""
,
data
!=
null
&&
data
.
size
>
0
,
isRecommend
,
"首页分类"
)
bury
(
keyWord
?:
""
,
data
.
size
>
0
,
isRecommend
,
"首页分类"
)
}
else
{
bury
(
keyWord
?:
""
,
data
!=
null
&&
data
.
size
>
0
,
isRecommend
,
fromPages
[
fromPageType
])
bury
(
keyWord
?:
""
,
data
.
size
>
0
,
isRecommend
,
fromPages
[
fromPageType
])
}
if
(
page
>=
totalPage
)
{
if
(
extras
==
null
)
{
hasMore
=
false
doctorAdapter
.
hasMore
=
false
}
if
(
curPage
==
1
){
doctorList
.
clear
()
}
doctorList
.
addAll
(
data
)
doctorAdapter
.
notifyDataSetChanged
()
isDoSearch
=
false
...
...
@@ -866,7 +810,6 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
ll_network_error
.
visibility
=
View
.
GONE
rvExperts
.
visibility
=
View
.
VISIBLE
dismissProgressDialog
()
srlContainer
.
isRefreshing
=
false
}
...
...
@@ -1188,22 +1131,30 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
private
fun
filterLabelSet
()
{
if
((
allFilter
.
others
.
size
+
allFilter
.
ages
.
size
+
allFilter
.
doctorEdu
.
size
+
allFilter
.
enquiries
.
size
+
allFilter
.
title
.
size
+
allFilter
.
specialityCrowd
.
size
)
==
1
)
{
var
text
:
String
?
=
""
if
(
allFilter
.
others
.
size
==
1
)
{
when
{
allFilter
.
others
.
size
==
1
->
{
text
=
allFilter
.
others
[
0
].
value
}
else
if
(
allFilter
.
ages
.
size
==
1
)
{
}
allFilter
.
ages
.
size
==
1
->
{
text
=
allFilter
.
ages
[
0
].
value
}
else
if
(
allFilter
.
enquiries
.
size
==
1
)
{
}
allFilter
.
enquiries
.
size
==
1
->
{
text
=
allFilter
.
enquiries
[
0
].
value
}
else
if
(
allFilter
.
title
.
size
==
1
)
{
}
allFilter
.
title
.
size
==
1
->
{
text
=
allFilter
.
title
[
0
].
value
}
else
if
(
allFilter
.
specialityCrowd
.
size
==
1
)
{
}
allFilter
.
specialityCrowd
.
size
==
1
->
{
text
=
allFilter
.
specialityCrowd
[
0
].
value
}
else
if
(
allFilter
.
doctorEdu
.
size
==
1
){
}
allFilter
.
doctorEdu
.
size
==
1
->
{
//学历
text
=
allFilter
.
doctorEdu
[
0
].
value
}
else
{
}
else
->
{
text
=
"筛选"
}
}
if
(
text
?.
length
?:
0
>
4
)
{
tvFilter
.
text
=
text
?.
substring
(
0
,
3
)
+
"..."
}
else
{
...
...
@@ -1372,27 +1323,27 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
* 显示主题弹窗
*/
private
fun
showSubjectPopupWindow
()
{
tempFilter
.
categories
.
clear
()
tempFilter
.
categories
.
addAll
(
allFilter
.
categories
)
val
categories
=
headData
?.
cates
if
(
categories
!=
null
)
{
categoryPopup
=
CategoryPopupWindow
(
this
,
categories
,
tempFilter
.
categories
)
categoryPopup
!!
.
setOnDismissListener
{
viewDim
.
visibility
=
View
.
INVISIBLE
if
(
allFilter
.
categories
.
size
>
1
||
(
allFilter
.
categories
.
size
==
1
&&
allFilter
.
categories
[
0
]
!=
headData
!!
.
cates
[
0
]))
{
updateFilterTextViewStatus
(
tvSubject
,
FILTER_STATUS_FILTERED
)
}
else
{
updateFilterTextViewStatus
(
tvSubject
,
FILTER_STATUS_NORMAL
)
}
}
categoryPopup
!!
.
onSubjectsSelectedListener
=
this
categoryPopup
!!
.
showAsDropDown
(
viewSep2
)
updateFilterTextViewStatus
(
tvSubject
,
FILTER_STATUS_OPEN
)
viewDim
.
visibility
=
View
.
VISIBLE
}
else
{
ToastUtil
.
toastShort
(
"数据初始化失败,请重试"
)
getPresenter
().
fetchListHead
()
}
//
tempFilter.categories.clear()
//
tempFilter.categories.addAll(allFilter.categories)
//
val categories = headData?.cates
//
if (categories != null) {
// categoryPopup = CategoryPopupWindow(this,
categories)
//
categoryPopup!!.setOnDismissListener {
//
viewDim.visibility = View.INVISIBLE
//
if (allFilter.categories.size > 1 || (allFilter.categories.size == 1 && allFilter.categories[0] != headData!!.cates[0])) {
//
updateFilterTextViewStatus(tvSubject, FILTER_STATUS_FILTERED)
//
} else {
//
updateFilterTextViewStatus(tvSubject, FILTER_STATUS_NORMAL)
//
}
//
}
//
categoryPopup!!.onSubjectsSelectedListener = this
//
categoryPopup!!.showAsDropDown(viewSep2)
//
updateFilterTextViewStatus(tvSubject, FILTER_STATUS_OPEN)
//
viewDim.visibility = View.VISIBLE
//
} else {
//
ToastUtil.toastShort("数据初始化失败,请重试")
//
getPresenter().fetchListHead()
//
}
}
/**
...
...
@@ -1400,58 +1351,58 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
*
* 新增逻辑:当主题选择后,需要判断热门筛选中是否也有该主题,如果有,也需要同步更新选中状态
*/
override
fun
onCategoriesSelected
(
categories
:
ArrayList
<
CateItem
>
)
{
ActionCountUtils
.
count
(
ConsultBIConstants
.
ConsultEvent
.
APP_CONSULT_LIST_THEME_CLICK
,
categories
.
map
{
it
.
cateName
}.
joinToString
(
"|"
)
)
if
(
categories
.
size
==
1
&&
"全部"
!=
categories
[
0
].
cateName
)
{
//显示选中标题
tvSubject
.
text
=
categories
[
0
].
cateName
}
else
{
//显示主标题
tvSubject
.
text
=
"主题"
}
//判断主题选中,判断热门筛选中是否也有该主题
Executors
.
newCachedThreadPool
().
execute
{
if
(
headData
!!
.
highlighter
.
size
>
0
)
{
for
(
index
in
0
.
until
(
headData
!!
.
highlighter
.
size
))
{
if
(
headData
!!
.
highlighter
[
index
].
type
==
"1"
)
{
var
textview
=
lin_filter2
.
getChildAt
(
index
)
as
TextView
this
@ExpertSearchActivity
.
runOnUiThread
{
textview
.
isSelected
=
false
textview
.
paint
.
isFakeBoldText
=
false
}
for
(
bean
in
categories
)
{
if
(
TextUtils
.
equals
(
bean
.
cateName
,
headData
!!
.
highlighter
[
index
].
value
)
)
{
this
@ExpertSearchActivity
.
runOnUiThread
{
textview
.
isSelected
=
true
textview
.
paint
.
isFakeBoldText
=
true
}
break
}
}
}
}
}
}
updateFilterTextViewStatus
(
tvSubject
,
FILTER_STATUS_OPEN
)
// LogUtil.d("theme callback: " + categories.map { it.cateName }.joinToString(","))
// props1.put("filtrate_second", categories.map { it.cateName }.joinToString(","))
// BuryPointUtils.buryPoint("Filtrate", props1)
allFilter
.
categories
.
clear
()
allFilter
.
categories
.
addAll
(
categories
)
refresh
()
if
(
categories
.
size
==
1
)
{
doctorAdapter
?.
cateId
=
"${categories[0].cateId}"
}
else
{
doctorAdapter
?.
cateId
=
""
}
override
fun
onCategoriesSelected
()
{
//
ActionCountUtils.count(
//
ConsultBIConstants.ConsultEvent.APP_CONSULT_LIST_THEME_CLICK,
//
categories.map { it.cateName }.joinToString("|")
//
)
//
if (categories.size == 1 && "全部" != categories[0].cateName) {
//
//显示选中标题
//
tvSubject.text = categories[0].cateName
//
} else {
//
//显示主标题
//
tvSubject.text = "主题"
//
}
//
//判断主题选中,判断热门筛选中是否也有该主题
//
Executors.newCachedThreadPool().execute {
//
if (headData!!.highlighter.size > 0) {
//
for (index in 0.until(headData!!.highlighter.size)) {
//
if (headData!!.highlighter[index].type == "1") {
//
var textview = lin_filter2.getChildAt(index) as TextView
//
this@ExpertSearchActivity.runOnUiThread {
//
textview.isSelected = false
//
textview.paint.isFakeBoldText = false
//
}
//
for (bean in categories) {
//
if (TextUtils.equals(
//
bean.cateName,
//
headData!!.highlighter[index].value
//
)
//
) {
//
this@ExpertSearchActivity.runOnUiThread {
//
textview.isSelected = true
//
textview.paint.isFakeBoldText = true
//
}
//
break
//
}
//
}
//
}
//
}
//
}
//
}
//
//
updateFilterTextViewStatus(tvSubject, FILTER_STATUS_OPEN)
//
//
LogUtil.d("theme callback: " + categories.map { it.cateName }.joinToString(","))
//
//
props1.put("filtrate_second", categories.map { it.cateName }.joinToString(","))
//
//
BuryPointUtils.buryPoint("Filtrate", props1)
//
allFilter.categories.clear()
//
allFilter.categories.addAll(categories)
//
refresh()
//
if (categories.size == 1) {
//
doctorAdapter?.cateId = "${categories[0].cateId}"
//
} else {
//
doctorAdapter?.cateId = ""
//
}
}
override
fun
onRefresh
()
{
...
...
@@ -1468,16 +1419,17 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
}
else
{
allFilter
.
searchWord
=
null
}
curPage
=
1
onScrollListener
.
resetState
()
getPresenter
().
fetchListData
(
allFilter
,
curPage
)
getPresenter
().
mExtras
=
null
getPresenter
().
fetchListData
(
allFilter
,
getPresenter
().
mExtras
)
doctorList
.
clear
()
rvExperts
.
scrollToPosition
(
0
)
}
//执行搜索
private
fun
doSearch
()
{
image_scroll_top
.
visibility
=
View
.
GONE
hideSoftInput
()
;
hideSoftInput
()
// keyWord = etSearch.text.toString()
// if (TextUtils.isEmpty(keyWord?.trim())) {
// ToastUtil.toastShort(this, "请输入搜索内容")
...
...
m-consultant/src/main/java/com/yidianling/consultant/ExpertSearchFragment.kt
View file @
e4ed1517
...
...
@@ -6,7 +6,7 @@ import android.animation.ObjectAnimator
import
android.animation.PropertyValuesHolder
import
android.content.Context
import
android.graphics.Typeface
import
android.os.
Build
import
android.os.
Handler
import
android.text.TextUtils
import
android.view.View
import
android.view.inputmethod.InputMethodManager
...
...
@@ -37,7 +37,6 @@ import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import
com.ydl.ydlcommon.utils.remind.ToastHelper
import
com.ydl.ydlcommon.view.listener.EndlessRecyclerViewScrollListener
import
com.yidianling.common.tools.LogUtil
import
com.yidianling.common.tools.RxDeviceTool
import
com.yidianling.common.tools.RxImageTool
import
com.yidianling.common.tools.ToastUtil
import
com.yidianling.consultant.adapter.ExpertSearchAdapter
...
...
@@ -59,10 +58,10 @@ import kotlinx.android.synthetic.main.consultant_layout_search_content.*
import
kotlinx.android.synthetic.main.consultant_layout_search_toolbar.*
import
org.json.JSONObject
import
java.util.concurrent.Executors
import
kotlin.collections.ArrayList
@Route
(
path
=
"/consultant/consultant"
)
class
ExpertSearchFragment
:
BaseMvpFragment
<
IExpertSearchView
,
ExpertSearchPresenter
>(),
View
.
OnClickListener
,
IExpertSearchView
,
class
ExpertSearchFragment
:
BaseMvpFragment
<
IExpertSearchView
,
ExpertSearchPresenter
>(),
View
.
OnClickListener
,
IExpertSearchView
,
OnCategoriesSelectedListener
,
OnSortItemSelectedListener
,
OnFilterConfirmListener
,
SwipeRefreshLayout
.
OnRefreshListener
{
private
lateinit
var
mContext
:
Context
...
...
@@ -147,9 +146,8 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
private
val
allFilter
=
AllFilter
()
//当前筛选
private
val
tempFilter
=
AllFilter
()
//临时筛选,未确认状态
private
var
curPage
=
1
private
val
doctorList
=
ArrayList
<
DoctorServiceItem
>()
private
val
serviceList
=
ArrayList
<
DoctorServiceItem
>()
private
val
doctorList
=
ArrayList
<
ExpertServiceItem
>()
private
val
serviceList
=
ArrayList
<
ExpertServiceItem
>()
private
var
hasMore
=
true
private
var
initCategory
=
"0"
private
var
initShowType
:
Int
=
0
...
...
@@ -162,7 +160,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
private
var
isRecommend
=
false
//埋点数据
private
var
keyWord
:
String
?
=
null
//埋点数据
private
var
isDoSearch
:
Boolean
=
false
//埋点判断是否通过搜索进入埋点的
private
val
bannerList
=
ArrayList
<
String
>()
//
private val bannerList = ArrayList<String>()
private
var
hasSelectedArea
=
false
//是否选择过地区
private
var
hasSelectedSort
=
false
//是否选择过排序
...
...
@@ -200,18 +198,6 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
srlContainer
.
isEnabled
=
i
>=
0
})
// etSearch.setOnEditorActionListener { _, actionId, _ ->
// if (actionId == EditorInfo.IME_ACTION_SEARCH) {
// doSearch()
// }
// true
// }
// etSearch.setOnClickListener { appbar_layout.setExpanded(false) }
// etSearch.setOnFocusChangeListener { view, b -> if (b) appbar_layout.setExpanded(false) }
// btn_back.setOnClickListener {
// onBackPressed()
// }
doctorAdapter
=
ExpertSearchAdapter
(
mContext
,
this
,
doctorList
)
rvExperts
.
adapter
=
doctorAdapter
...
...
@@ -295,8 +281,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
override
fun
onLoadMore
(
page
:
Int
,
totalItemsCount
:
Int
,
view
:
RecyclerView
?)
{
if
(
hasMore
)
{
curPage
++
getPresenter
().
fetchListData
(
allFilter
,
curPage
)
getPresenter
().
fetchListData
(
allFilter
,
getPresenter
().
mExtras
)
}
}
}
...
...
@@ -359,21 +344,14 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
}
override
fun
localData
()
{
}
override
fun
updateCache
(
showType
:
Int
,
searchBean
:
ExpertSearchBean
)
{
}
private
fun
initData
()
{
allFilter
.
showType
.
key
=
initShowType
val
cat
=
CateItem
()
cat
.
cateId
=
initCategory
allFilter
.
categories
.
clear
()
allFilter
.
categories
.
add
(
cat
)
getPresenter
().
fetchListHead
()
//加载本地缓存数据
getPresenter
().
localData
(
initShowType
)
//refresh(false)
v_loading
.
visibility
=
View
.
VISIBLE
v_loading
.
setViewType
(
LogoLoadingView
.
TYPE_LOADING
,
null
)
...
...
@@ -382,51 +360,58 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
}
/**
*
初始化状态栏位置
*
获取所有的筛选选项数据
*/
private
fun
initStatus
()
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
//4.4以下不支持状态栏变色
StatusBarUtils
.
setTransparentForImageView
(
mActivity
,
null
)
val
statusBarHeight
=
StatusBarUtils
.
getStatusBarHeight
(
mContext
)
val
lp1
=
title_layout
.
layoutParams
as
LinearLayout
.
LayoutParams
lp1
.
height
=
(
RxImageTool
.
dp2px
(
48f
)
+
statusBarHeight
)
title_layout
.
setPadding
(
0
,
statusBarHeight
,
0
,
0
)
}
}
//筛选数据获取后回调
override
fun
onHeadFetched
(
headData
:
HeadData
?)
{
//头部数据获取到后初始化筛选数据
this
.
headData
=
headData
if
(
initCategory
!=
"0"
)
{
if
(
headData
?.
cates
!=
null
)
{
for
(
cate
in
headData
.
cates
)
{
if
(
cate
.
cateId
==
initCategory
)
{
allFilter
.
categories
.
clear
()
allFilter
.
categories
.
add
(
cate
)
if
(
allFilter
.
categories
.
size
==
1
&&
!
"全部"
.
equals
(
allFilter
.
categories
[
0
].
cateName
))
{
//显示选中标题
tvSubject
.
text
=
allFilter
.
categories
[
0
].
cateName
}
else
{
//显示主标题
tvSubject
.
text
=
"主题"
headData
?.
let
{
it
->
// allFilter.reorder = it.reorder[0]
allFilter
.
showType
=
it
.
filters
.
showType
[
initShowType
]
if
(
it
.
highlighter
.
size
>
0
)
{
//设置热门搜索
initHotViews
(
lin_filter2
,
it
.
highlighter
)
}
updateFilterTextViewStatus
(
tvSubject
,
FILTER_STATUS_FILTERED
)
break
it
.
cates
[
0
].
children
?.
forEachIndexed
{
index
,
children
->
val
type
=
if
(
children
.
cate_name
.
length
>
4
)
2
else
1
val
childrenBean
=
ChildrenBean
(
children
.
cate_name
,
children
.
cate_id
,
index
<=
12
,
type
)
allFilter
.
childList
.
add
(
childrenBean
)
}
it
.
cates
[
1
].
children
?.
forEachIndexed
{
index
,
children
->
val
type
=
if
(
children
.
cate_name
.
length
>
4
)
2
else
1
val
childrenBean
=
ChildrenBean
(
children
.
cate_name
,
children
.
cate_id
,
index
<=
12
,
type
)
allFilter
.
stressList
.
add
(
childrenBean
)
}
it
.
cates
[
2
].
children
?.
forEachIndexed
{
index
,
children
->
val
type
=
if
(
children
.
cate_name
.
length
>
4
)
2
else
1
val
childrenBean
=
ChildrenBean
(
children
.
cate_name
,
children
.
cate_id
,
index
<=
12
,
type
)
allFilter
.
loveEmotionList
.
add
(
childrenBean
)
}
initCategory
=
"0"
}
else
{
allFilter
.
categories
.
clear
()
allFilter
.
categories
.
add
(
headData
?.
cates
?.
get
(
0
)
?:
CateItem
())
it
.
cates
[
3
].
children
?.
forEachIndexed
{
index
,
children
->
val
type
=
if
(
children
.
cate_name
.
length
>
4
)
2
else
1
val
childrenBean
=
ChildrenBean
(
children
.
cate_name
,
children
.
cate_id
,
index
<=
12
,
type
)
allFilter
.
marriedFamilyList
.
add
(
childrenBean
)
}
it
.
cates
[
4
].
children
?.
forEachIndexed
{
index
,
children
->
val
type
=
if
(
children
.
cate_name
.
length
>
4
)
2
else
1
val
childrenBean
=
ChildrenBean
(
children
.
cate_name
,
children
.
cate_id
,
index
<=
12
,
type
)
allFilter
.
personalGrowthList
.
add
(
childrenBean
)
}
it
.
cates
[
5
].
children
?.
forEachIndexed
{
index
,
children
->
val
type
=
if
(
children
.
cate_name
.
length
>
4
)
2
else
1
val
childrenBean
=
ChildrenBean
(
children
.
cate_name
,
children
.
cate_id
,
index
<=
12
,
type
)
allFilter
.
interpersonalRelationshipList
.
add
(
childrenBean
)
}
it
.
cates
[
6
].
children
?.
forEachIndexed
{
index
,
children
->
val
type
=
if
(
children
.
cate_name
.
length
>
4
)
2
else
1
val
childrenBean
=
ChildrenBean
(
children
.
cate_name
,
children
.
cate_id
,
index
<=
12
,
type
)
allFilter
.
careerDevelopmentList
.
add
(
childrenBean
)
}
it
.
cates
[
7
].
children
?.
forEachIndexed
{
index
,
children
->
val
type
=
if
(
children
.
cate_name
.
length
>
4
)
2
else
1
val
childrenBean
=
ChildrenBean
(
children
.
cate_name
,
children
.
cate_id
,
index
<=
12
,
type
)
allFilter
.
mentalHealthList
.
add
(
childrenBean
)
}
allFilter
.
reorder
=
headData
?.
reorder
?.
get
(
0
)
?:
ReorderItem
()
allFilter
.
showType
=
headData
?.
filters
?.
showType
?.
get
(
initShowType
)
?:
ShowTypeItem
()
if
(
headData
?.
highlighter
?.
size
?:
0
>
0
)
{
//设置热门搜索
initHotViews
(
lin_filter2
,
headData
!!
.
highlighter
)
}
}
...
...
@@ -437,9 +422,9 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
if
(
view
.
childCount
>
0
)
{
return
}
val
popWidth
=
RxDeviceTool
.
getScreenWidth
(
context
)
val
mWidth
=
(
popWidth
-
RxImageTool
.
dp2px
(
10f
))
/
hotData
.
size
for
(
(
index
,
hot
)
in
hotData
!!
.
withIndex
()
)
{
//
val popWidth = RxDeviceTool.getScreenWidth(context)
//
val mWidth = (popWidth - RxImageTool.dp2px(10f)) / hotData.size
for
(
hot
in
hotData
)
{
val
tv
=
View
.
inflate
(
context
,
R
.
layout
.
consultant_item_filter_online
,
null
)
as
TextView
val
textView
=
tv
.
tvFree
val
params
=
LinearLayout
.
LayoutParams
(
0
,
RxImageTool
.
dp2px
(
22f
))
...
...
@@ -483,32 +468,31 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
private
fun
dealHotSelect
(
hotData
:
HighlighterItem
,
isAdd
:
Boolean
)
{
when
(
hotData
.
type
)
{
"1"
->
{
if
(
headData
?.
cates
!!
.
size
>
0
)
{
for
(
bean
in
headData
?.
cates
!!
)
{
if
(
TextUtils
.
equals
(
hotData
.
id
,
bean
.
cateId
.
toString
()))
{
if
(
isAdd
)
{
if
(
allFilter
.
categories
.
size
==
1
&&
allFilter
.
categories
[
0
].
cateId
==
"0"
)
{
allFilter
.
categories
.
clear
()
}
allFilter
.
categories
.
add
(
bean
)
// if (headData?.cates!!.size > 0) {
// for (bean in headData?.cates!!) {
// if (TextUtils.equals(hotData.id, bean.cateId.toString())) {
// if (isAdd) {
// if (allFilter.categories.size == 1 && allFilter.categories[0].cateId == "0") {
// allFilter.categories.clear()
// }
// updateFilterTextViewStatus(tvSubject, FILTER_STATUS_FILTERED)
// } else {
// allFilter.categories.remove(bean)
// if (allFilter.categories.size == 0) {
// updateFilterTextViewStatus(tvSubject, FILTER_STATUS_NORMAL)
// }
// }
// }
// }
// if (allFilter.categories.size == 1 && "全部" != allFilter.categories[0].cateName) {
// //显示选中标题
// tvSubject.text = allFilter.categories[0].cateName
// } else {
// //显示主标题
// tvSubject.text = "主题"
// }
// }
updateFilterTextViewStatus
(
tvSubject
,
FILTER_STATUS_FILTERED
)
}
else
{
allFilter
.
categories
.
remove
(
bean
)
if
(
allFilter
.
categories
.
size
==
0
)
{
allFilter
.
categories
.
add
(
headData
?.
cates
?.
get
(
0
)
?:
CateItem
())
updateFilterTextViewStatus
(
tvSubject
,
FILTER_STATUS_NORMAL
)
}
}
}
}
if
(
allFilter
.
categories
.
size
==
1
&&
"全部"
!=
allFilter
.
categories
[
0
].
cateName
)
{
//显示选中标题
tvSubject
.
text
=
allFilter
.
categories
[
0
].
cateName
}
else
{
//显示主标题
tvSubject
.
text
=
"主题"
}
}
}
"2"
->
{
//省
if
(
headData
?.
region
!!
.
size
>
0
)
{
...
...
@@ -719,7 +703,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
//用于侧滑筛选过来更新快捷筛选选中状态
private
fun
updateOtherViews
(
other
d
ata
:
List
<
OtherItem
>)
{
private
fun
updateOtherViews
(
other
D
ata
:
List
<
OtherItem
>)
{
if
(
lin_filter2
.
childCount
>
0
)
{
//清空选中
for
(
i
in
0
.
until
(
lin_filter2
.
childCount
))
{
...
...
@@ -728,7 +712,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
textView
.
paint
.
isFakeBoldText
=
false
}
//重置选中状态
for
(
(
index
,
other
)
in
otherdata
.
withIndex
()
)
{
for
(
other
in
otherData
)
{
for
(
i
in
0
until
lin_filter2
.
childCount
)
{
val
textView
=
lin_filter2
.
getChildAt
(
i
)
as
TextView
if
(
textView
.
text
==
other
.
value
)
{
...
...
@@ -740,82 +724,32 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
}
}
//服务列表数据获取到后的回调
override
fun
onServiceListFetched
(
data
:
MutableList
<
DoctorServiceItem
>,
page
:
Int
,
totalPage
:
Int
)
{
LogUtil
.
d
(
"onServiceListFetched"
)
// if (rvExperts.adapter != serviceAdapter) {
// rvExperts.adapter = serviceAdapter
// }
if
(
page
==
1
)
{
if
(
fromPageType
!=
-
1
&&
isDoSearch
)
{
// LogUtil.d("keyword: " + keyWord + " isRecommend: " + isRecommend + " hasResult: " + (data.size > 0 && data != null ?: false) + " location: " + fromPages[fromPageType])
}
serviceList
.
clear
()
hasMore
=
true
// serviceAdapter.hasMore = true
}
if
(
fromPageType
==
-
1
)
{
bury
(
keyWord
?:
""
,
data
.
size
>
0
,
isRecommend
,
"首页分类"
)
}
else
{
bury
(
keyWord
?:
""
,
data
.
size
>
0
,
isRecommend
,
fromPages
[
fromPageType
])
}
if
(
page
>=
totalPage
)
{
hasMore
=
false
// serviceAdapter.hasMore = false
}
serviceList
.
addAll
(
data
)
// serviceAdapter.notifyDataSetChanged()
isRecommend
=
false
isDoSearch
=
false
v_loading
.
visibility
=
View
.
GONE
ll_network_error
.
visibility
=
View
.
GONE
rvExperts
.
visibility
=
View
.
VISIBLE
srlContainer
.
isRefreshing
=
false
}
//专家列表数据获取到后的回调
override
fun
onDoctorListFetched
(
data
:
MutableList
<
DoctorServiceItem
>,
page
:
Int
,
totalPage
:
Int
)
{
/**
* 获取专家列表数据
*/
override
fun
onDoctorListFetched
(
data
:
MutableList
<
ExpertServiceItem
>,
extras
:
Extras
?,
curPage
:
Int
)
{
LogUtil
.
d
(
"onDoctorListFetched"
)
if
(
rvExperts
.
adapter
!=
doctorAdapter
)
{
rvExperts
.
adapter
=
doctorAdapter
}
LogUtil
.
d
(
"data size "
+
data
.
size
)
if
(
page
==
1
)
{
if
(
fromPageType
!=
-
1
&&
isDoSearch
)
{
// LogUtil.d("keyword: " + keyWord + " isRecommend: " + isRecommend + " hasResult: " + (data.size > 0 && data != null ?: false) + " location: " + fromPages[fromPageType])
}
doctorList
.
clear
()
doctorAdapter
.
hasMore
=
true
hasMore
=
true
}
if
(
fromPageType
==
-
1
)
{
bury
(
keyWord
?:
""
,
data
!=
null
&&
data
.
size
>
0
,
isRecommend
,
"首页分类"
)
bury
(
keyWord
?:
""
,
data
.
size
>
0
,
isRecommend
,
"首页分类"
)
}
else
{
bury
(
keyWord
?:
""
,
data
!=
null
&&
data
.
size
>
0
,
isRecommend
,
fromPages
[
fromPageType
])
bury
(
keyWord
?:
""
,
data
.
size
>
0
,
isRecommend
,
fromPages
[
fromPageType
])
}
if
(
curPage
==
1
){
hasMore
=
true
doctorAdapter
.
hasMore
=
true
doctorList
.
clear
()
}
if
(
page
>=
totalPage
)
{
if
(
extras
==
null
||
data
.
size
==
0
)
{
hasMore
=
false
doctorAdapter
.
hasMore
=
false
}
doctorList
.
addAll
(
data
)
//咨询师列表去除重复数据start
var
linkedHashSet
=
LinkedHashSet
(
doctorList
)
doctorList
.
clear
()
doctorList
.
addAll
(
linkedHashSet
)
//咨询师列表去除重复数据end
doctorAdapter
.
notifyDataSetChanged
()
isDoSearch
=
false
isRecommend
=
false
...
...
@@ -831,7 +765,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
isDoSearch
=
false
isRecommend
=
false
if
(
curPage
==
1
)
{
if
(
getPresenter
().
mExtras
==
null
)
{
v_loading
.
setViewType
(
LogoLoadingView
.
TYPE_NET_LOSS
,
getString
(
R
.
string
.
consultant_reload_hint
)
...
...
@@ -892,7 +826,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
appbar_layout
.
setExpanded
(
false
)
appbar_layout
.
postDelayed
({
showSubjectPopupWindow
()
},
300
)
;
},
300
)
}
R
.
id
.
tvArea
->
{
...
...
@@ -1212,19 +1146,23 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
?:
""
)
if
(
sortItem
.
value
.
equals
(
"综合排序"
))
{
when
{
sortItem
.
value
.
equals
(
"综合排序"
)
->
{
tvSort
.
text
=
"排序"
}
else
if
(
sortItem
.
value
?.
length
?:
0
>
4
)
{
}
sortItem
.
value
?.
length
?:
0
>
4
->
{
tvSort
.
text
=
sortItem
.
value
?.
substring
(
0
,
3
)
+
"..."
}
else
{
}
else
->
{
tvSort
.
text
=
sortItem
.
value
}
}
//判断排序选中,判断热门筛选中是否也有该排序
if
(
headData
!!
.
highlighter
.
size
>
0
)
{
for
(
index
in
0
.
until
(
headData
!!
.
highlighter
.
size
))
{
if
(
headData
!!
.
highlighter
[
index
].
type
==
"3"
)
{
va
r
textview
=
lin_filter2
.
getChildAt
(
index
)
as
TextView
va
l
textview
=
lin_filter2
.
getChildAt
(
index
)
as
TextView
if
(
TextUtils
.
equals
(
sortItem
.
value
,
headData
!!
.
highlighter
[
index
].
value
))
{
textview
.
isSelected
=
true
textview
.
paint
.
isFakeBoldText
=
true
...
...
@@ -1327,91 +1265,47 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
}
private
var
categoryPopup
:
CategoryPopupWindow
?
=
null
private
var
mHandler
:
Handler
?=
null
//显示主题弹窗
/**
* 显示八大类弹窗
*/
private
fun
showSubjectPopupWindow
()
{
tempFilter
.
categories
.
clear
()
tempFilter
.
categories
.
addAll
(
allFilter
.
categories
)
val
categories
=
headData
?.
cates
if
(
categories
!=
null
)
{
categoryPopup
=
CategoryPopupWindow
(
mActivity
,
categories
,
tempFilter
.
categories
)
if
(
categoryPopup
==
null
)
{
categoryPopup
=
CategoryPopupWindow
(
mActivity
,
allFilter
)
mHandler
=
Handler
()
mHandler
!!
.
post
{
categoryPopup
!!
.
updateData
()
}
categoryPopup
!!
.
setOnDismissListener
{
viewDim
.
visibility
=
View
.
INVISIBLE
if
(
allFilter
.
categories
.
size
>
1
||
(
allFilter
.
categories
.
size
==
1
&&
allFilter
.
categories
[
0
]
!=
headData
!!
.
cates
[
0
]))
{
updateFilterTextViewStatus
(
tvSubject
,
FILTER_STATUS_FILTERED
)
}
else
{
updateFilterTextViewStatus
(
tvSubject
,
FILTER_STATUS_NORMAL
)
}
showConsultAssistantDialog
()
}
hideConsultAssistantDialog
()
categoryPopup
!!
.
onSubjectsSelectedListener
=
this
categoryPopup
!!
.
showAsDropDown
(
viewSep2
)
updateFilterTextViewStatus
(
tvSubject
,
FILTER_STATUS_OPEN
)
viewDim
.
visibility
=
View
.
VISIBLE
}
else
{
ToastUtil
.
toastShort
(
"数据初始化失败,请重试"
)
getPresenter
().
fetchListHead
()
}
else
{
hideConsultAssistantDialog
()
categoryPopup
!!
.
showAsDropDown
(
viewSep2
)
updateFilterTextViewStatus
(
tvSubject
,
FILTER_STATUS_OPEN
)
viewDim
.
visibility
=
View
.
VISIBLE
}
}
/**
* 主题选择确认回调
*
* 新增逻辑:当主题选择后,需要判断热门筛选中是否也有该主题,如果有,也需要同步更新选中状态
*/
override
fun
onCategoriesSelected
(
categories
:
ArrayList
<
CateItem
>)
{
ActionCountUtils
.
count
(
ConsultBIConstants
.
ConsultEvent
.
APP_CONSULT_LIST_THEME_CLICK
,
categories
.
map
{
it
.
cateName
}.
joinToString
(
"|"
)
)
if
(
categories
.
size
==
1
&&
"全部"
!=
categories
[
0
].
cateName
)
{
//显示选中标题
tvSubject
.
text
=
categories
[
0
].
cateName
}
else
{
//显示主标题
tvSubject
.
text
=
"主题"
}
//如果是亲自教育类别----->点击咨询顾问---会跳转到一个只是亲自教育的导医队列中
override
fun
onCategoriesSelected
()
{
// ActionCountUtils.count(ConsultBIConstants.ConsultEvent.APP_CONSULT_LIST_THEME_CLICK, categories.map { it.cateName }.joinToString("|"))
//判断主题选中,判断热门筛选中是否也有该主题
Executors
.
newCachedThreadPool
().
execute
{
if
(
headData
!!
.
highlighter
.
size
>
0
)
{
for
(
index
in
0
.
until
(
headData
!!
.
highlighter
.
size
))
{
if
(
headData
!!
.
highlighter
[
index
].
type
==
"1"
)
{
val
textview
=
lin_filter2
.
getChildAt
(
index
)
as
TextView
mActivity
.
runOnUiThread
{
textview
.
isSelected
=
false
textview
.
paint
.
isFakeBoldText
=
false
}
for
(
bean
in
categories
)
{
if
(
TextUtils
.
equals
(
bean
.
cateName
,
headData
!!
.
highlighter
[
index
].
value
)
)
{
mActivity
.
runOnUiThread
{
textview
.
isSelected
=
true
textview
.
paint
.
isFakeBoldText
=
true
}
break
}
}
}
}
}
}
updateFilterTextViewStatus
(
tvSubject
,
FILTER_STATUS_OPEN
)
// LogUtil.d("theme callback: " + categories.map { it.cateName }.joinToString(","))
// props1.put("filtrate_second", categories.map { it.cateName }.joinToString(","))
// BuryPointUtils.buryPoint("Filtrate", props1)
allFilter
.
categories
.
clear
()
allFilter
.
categories
.
addAll
(
categories
)
if
(
allFilter
.
categoryId2List
.
size
>
0
||
allFilter
.
categoryId3List
.
size
>
0
){
updateFilterTextViewStatus
(
tvSubject
,
FILTER_STATUS_FILTERED
)
refresh
()
if
(
categories
.
size
==
1
)
{
doctorAdapter
.
cateId
=
"${categories[0].cateId}"
}
else
{
doctorAdapter
.
cateId
=
""
}
else
{
updateFilterTextViewStatus
(
tvSubject
,
FILTER_STATUS_NORMAL
)
}
}
...
...
@@ -1430,55 +1324,12 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
}
else
{
allFilter
.
searchWord
=
null
}
curPage
=
1
onScrollListener
.
resetState
()
getPresenter
().
fetchListData
(
allFilter
,
curPage
)
getPresenter
().
mExtras
=
null
getPresenter
().
fetchListData
(
allFilter
,
getPresenter
().
mExtras
)
rvExperts
.
scrollToPosition
(
0
)
}
//执行搜索
private
fun
doSearch
()
{
image_scroll_top
.
visibility
=
View
.
GONE
hideSoftInput
();
// keyWord = etSearch.text.toString()
// if (TextUtils.isEmpty(keyWord?.trim())) {
// ToastUtil.toastShort(this, "请输入搜索内容")
// return
// }
ActionCountUtils
.
count
(
ConsultBIConstants
.
UserMainEvent
.
YDL_USER_SEARCH_CLICK
,
keyWord
?:
""
)
isDoSearch
=
true
resetFilter
()
refresh
()
}
//重置所有筛选
private
fun
resetFilter
()
{
allFilter
.
categories
.
clear
()
allFilter
.
categories
.
add
(
headData
?.
cates
?.
get
(
0
)
?:
CateItem
())
allFilter
.
reorder
=
headData
?.
reorder
?.
get
(
0
)
?:
ReorderItem
()
allFilter
.
region
=
RegionItem
()
allFilter
.
sub
=
SubItem
()
allFilter
.
enquiries
.
clear
()
allFilter
.
ages
.
clear
()
allFilter
.
others
.
clear
()
updateFilterTextViewStatus
(
tvSubject
,
FILTER_STATUS_NORMAL
)
updateFilterTextViewStatus
(
tvArea
,
FILTER_STATUS_NORMAL
)
updateFilterTextViewStatus
(
tvSort
,
FILTER_STATUS_NORMAL
)
if
(
headData
!=
null
)
{
if
(
allFilter
.
showType
!=
headData
!!
.
filters
.
showType
[
1
])
{
updateFilterTextViewStatus
(
tvFilter
,
FILTER_STATUS_FILTERED
)
}
else
{
updateFilterTextViewStatus
(
tvFilter
,
FILTER_STATUS_NORMAL
)
}
}
}
//设置筛选点击按钮状态
private
fun
updateFilterTextViewStatus
(
tv
:
TextView
,
status
:
Int
)
{
when
(
status
)
{
...
...
@@ -1544,6 +1395,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
override
fun
onDestroy
()
{
super
.
onDestroy
()
mHandler
=
null
ConsultAssistantDialogUtils
.
INSTANCE
.
resetStatus
()
}
}
m-consultant/src/main/java/com/yidianling/consultant/ExpertSearchPresenter.kt
View file @
e4ed1517
...
...
@@ -2,20 +2,21 @@ package com.yidianling.consultant
import
android.annotation.SuppressLint
import
android.text.TextUtils
import
com.google.gson.Gson
import
com.ydl.ydlcommon.base.BaseApp
import
com.ydl.ydlcommon.data.PlatformDataManager
import
com.ydl.ydlcommon.data.http.RxUtils
import
com.ydl.ydlcommon.data.http.ThrowableConsumer
import
com.ydl.ydlcommon.modular.ModularServiceManager
import
com.ydl.ydlcommon.mvp.base.SimplePresenter
import
com.ydl.ydlcommon.utils.RxLifecycleUtils
import
com.ydl.ydlcommon.utils.YDLAsyncUtils
import
com.ydl.ydlcommon.utils.YDLCacheUtils
import
com.ydl.ydlcommon.utils.remind.HttpErrorUtils
import
com.yidianling.common.tools.RxAppTool
import
com.yidianling.consultant.http.ExpertSearchDataManager
import
com.yidianling.consultant.model.SearchApi
import
com.yidianling.consultant.model.bean.AllFilter
import
com.yidianling.consultant.model.bean.Ex
pertSearchBean
import
com.yidianling.consultant.model.bean.Ex
tras
import
com.yidianling.consultant.modular.singlton.ConsultAssistantDialogUtils
import
com.yidianling.user.api.service.IUserService
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.functions.Consumer
import
io.reactivex.schedulers.Schedulers
...
...
@@ -24,6 +25,7 @@ import io.reactivex.schedulers.Schedulers
* 专家搜索页Presenter
*/
class
ExpertSearchPresenter
:
SimplePresenter
<
IExpertSearchView
>()
{
var
mExtras
:
Extras
?
=
null
// 用于分页
@SuppressLint
(
"CheckResult"
)
fun
fetchListHead
()
{
...
...
@@ -41,146 +43,189 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
})
}
/**
* 加载缓存
*/
fun
localData
(
showType
:
Int
)
{
YDLAsyncUtils
.
asyncAsResult
(
object
:
YDLAsyncUtils
.
AsyncObjecyerResult
{
override
fun
doAsyncAction
():
Any
{
return
when
(
showType
)
{
0
->
{
//按专家
YDLCacheUtils
.
getDoctorListData
()
}
1
->
{
//按服务
YDLCacheUtils
.
getServerListData
()
}
else
->
{
YDLCacheUtils
.
getServerListData
()
}
}
}
override
fun
asyncResult
(
`object`
:
Any
?)
{
//如果没有缓存数据,显示加载框
if
(
`object`
!
is
String
||
TextUtils
.
isEmpty
(
`object`
))
{
mView
.
showRefreshLayout
()
}
if
(
`object`
is
String
)
{
val
gson
=
Gson
()
val
bean
=
gson
.
fromJson
<
ExpertSearchBean
>(
`object`
,
ExpertSearchBean
::
class
.
java
)
// val bean = gson.fromJson<ExpertSearchBean>(`object`, object : TypeToken<ExpertSearchBean>() {}.type)
if
(
bean
?.
list
!=
null
)
{
when
(
showType
)
{
0
->
{
mView
.
onDoctorListFetched
(
bean
.
list
,
1
,
1
)
}
1
->
{
mView
.
onServiceListFetched
(
bean
.
list
,
1
,
1
)
}
else
->
{
mView
.
onServiceListFetched
(
bean
.
list
,
1
,
1
)
}
}
}
}
}
})
}
fun
updateCache
(
showType
:
Int
,
searchBean
:
ExpertSearchBean
)
{
val
gson
=
Gson
()
val
json
=
gson
.
toJson
(
searchBean
)
when
(
showType
)
{
0
->
{
YDLCacheUtils
.
saveDoctorListData
(
json
)
}
1
->
{
YDLCacheUtils
.
saveServerListData
(
json
)
}
}
}
@SuppressLint
(
"CheckResult"
)
fun
fetchListData
(
allFilter
:
AllFilter
,
page
:
Int
)
{
fun
fetchListData
(
allFilter
:
AllFilter
,
extras
:
Extras
?
)
{
//是否亲子教育字段
ConsultAssistantDialogUtils
.
REALATION_EDUCATION
=
allFilter
.
categories
.
size
==
1
&&
allFilter
.
categories
[
0
].
cateId
==
"23"
var
showType
=
0
ConsultAssistantDialogUtils
.
REALATION_EDUCATION
=
allFilter
.
categories
.
size
==
1
&&
allFilter
.
categories
[
0
].
cateId
==
"23"
val
sb
=
StringBuffer
()
sb
.
append
(
"searchWord="
)
.
append
(
if
(
TextUtils
.
isEmpty
(
allFilter
.
searchWord
))
""
else
allFilter
.
searchWord
)
val
map
=
HashMap
<
String
,
Any
>()
// filter
val
filterMap
=
HashMap
<
String
,
Any
?>()
// 搜索词
if
(!
TextUtils
.
isEmpty
(
allFilter
.
searchWord
)){
filterMap
[
"__keywords"
]
=
allFilter
.
searchWord
}
// 八大类一级标签
if
(
allFilter
.
categoryId2List
.
isNotEmpty
()){
val
categoryIdMap
=
HashMap
<
String
,
Any
>()
categoryIdMap
[
"in"
]
=
allFilter
.
categoryId2List
filterMap
[
"product_cates.category_id2"
]
=
categoryIdMap
}
// 八大类二级标签
if
(
allFilter
.
categoryId3List
.
isNotEmpty
()){
val
categoryIdMap
=
HashMap
<
String
,
Any
>()
categoryIdMap
[
"in"
]
=
allFilter
.
categoryId3List
filterMap
[
"product_cates.category_id3"
]
=
categoryIdMap
}
// 主题
if
(
allFilter
.
categories
.
isNotEmpty
())
{
va
r
categorys
=
allFilter
.
categories
.
map
{
it
.
cateId
}.
joinToString
(
","
)
if
(
"0"
==
categorys
)
{
categor
ys
=
""
va
l
categories
=
ArrayList
<
String
?>(
)
allFilter
.
categories
.
forEach
{
categor
ies
.
add
(
it
.
cateId
)
}
sb
.
append
(
"&directionTags="
).
append
(
categorys
)
val
categoriesMap
=
HashMap
<
String
,
Any
>()
categoriesMap
[
"in"
]
=
categories
filterMap
[
"tags.tag_id"
]
=
categoriesMap
}
if
(
allFilter
.
region
.
value
==
"海外"
||
allFilter
.
region
.
value
==
"全国"
)
{
sb
.
append
(
"&country="
).
append
(
allFilter
.
sub
.
code
)
// 地区
if
(
allFilter
.
region
.
value
==
"海外"
)
{
filterMap
[
"country_code"
]
=
allFilter
.
sub
.
code
}
else
{
if
(
allFilter
.
region
.
code
!=
null
)
{
sb
.
append
(
"&province="
).
append
(
allFilter
.
region
.
code
)
filterMap
[
"province_code"
]
=
allFilter
.
region
.
code
}
if
(
allFilter
.
sub
.
code
!=
null
)
{
sb
.
append
(
"&city="
).
append
(
allFilter
.
sub
.
code
)
}
filterMap
[
"city_code"
]
=
allFilter
.
sub
.
code
}
if
(
allFilter
.
reorder
.
key
!=
null
)
{
sb
.
append
(
"&reorder="
).
append
(
allFilter
.
reorder
.
key
)
}
// 咨询方式
if
(
allFilter
.
enquiries
.
isNotEmpty
())
{
sb
.
append
(
"&enquirys="
).
append
(
allFilter
.
enquiries
.
map
{
it
.
key
}.
joinToString
(
","
))
val
way
=
ArrayList
<
Int
>()
allFilter
.
enquiries
.
forEach
{
way
.
add
(
it
.
key
)
}
val
wayMap
=
HashMap
<
String
,
Any
>()
wayMap
[
"in"
]
=
way
filterMap
[
"service_type_list.service_type"
]
=
wayMap
}
// 服务均价
if
(
allFilter
.
priceRanges
!=
null
)
{
val
avgPriceMap
=
HashMap
<
String
,
Any
?>()
avgPriceMap
[
"gte"
]
=
allFilter
.
priceRanges
?.
minPrice
avgPriceMap
[
"lte"
]
=
allFilter
.
priceRanges
?.
maxPrice
filterMap
[
"avg_price"
]
=
avgPriceMap
}
// 年龄
if
(
allFilter
.
ages
.
isNotEmpty
())
{
sb
.
append
(
"&ages="
).
append
(
allFilter
.
ages
.
map
{
it
.
key
}.
joinToString
(
","
))
val
age
=
ArrayList
<
Int
>()
allFilter
.
ages
.
forEach
{
age
.
add
(
it
.
key
)
}
if
(
allFilter
.
doctorEdu
.
isNotEmpty
())
{
sb
.
append
(
"&edus="
).
append
(
allFilter
.
doctorEdu
.
map
{
it
.
key
}.
joinToString
(
","
))
val
ageMap
=
HashMap
<
String
,
Any
>()
ageMap
[
"in"
]
=
age
filterMap
[
"years"
]
=
ageMap
}
// 资质
if
(
allFilter
.
title
.
isNotEmpty
())
{
val
title
=
ArrayList
<
String
?>()
allFilter
.
title
.
forEach
{
title
.
add
(
it
.
key
)
}
val
titleMap
=
HashMap
<
String
,
Any
>()
titleMap
[
"in"
]
=
title
filterMap
[
"title"
]
=
titleMap
}
// 擅长人群
拼接
// 擅长人群
if
(
allFilter
.
specialityCrowd
.
isNotEmpty
())
{
sb
.
append
(
"&crowdsTags="
)
.
append
(
allFilter
.
specialityCrowd
.
map
{
it
.
key
}.
joinToString
(
","
))
val
specialityCrowd
=
ArrayList
<
String
?>()
allFilter
.
specialityCrowd
.
forEach
{
specialityCrowd
.
add
(
it
.
key
)
}
val
specialityCrowdMap
=
HashMap
<
String
,
Any
>()
specialityCrowdMap
[
"in"
]
=
specialityCrowdMap
filterMap
[
"doctor_tag_list.list_cate_id"
]
=
specialityCrowdMap
}
// 学历
if
(
allFilter
.
doctorEdu
.
isNotEmpty
())
{
val
edu
=
ArrayList
<
Int
?>()
allFilter
.
doctorEdu
.
forEach
{
edu
.
add
(
it
.
key
)
}
val
eduMap
=
HashMap
<
String
,
Any
>()
eduMap
[
"in"
]
=
edu
filterMap
[
"edu"
]
=
eduMap
}
// 其它
if
(
allFilter
.
others
.
isNotEmpty
())
{
sb
.
append
(
"&others="
).
append
(
allFilter
.
others
.
map
{
it
.
key
}.
joinToString
(
","
))
val
gender
=
ArrayList
<
String
?>()
allFilter
.
others
.
forEach
{
if
(
it
.
key1
==
"gender"
){
gender
.
add
(
it
.
value1
)
}
else
{
filterMap
[
it
.
key1
]
=
it
.
value1
}
// if (allFilter.showType.key != null) {
// showType = allFilter.showType.key!!
// sb.append("&showType=").append(allFilter.showType.key!!)
// }
if
(
allFilter
.
title
.
isNotEmpty
())
{
sb
.
append
(
"&title="
).
append
(
allFilter
.
title
.
map
{
it
.
key
}.
joinToString
(
","
))
}
if
(
allFilter
.
priceRanges
!=
null
)
{
sb
.
append
(
"&minPrice="
).
append
(
allFilter
.
priceRanges
?.
minPrice
)
sb
.
append
(
"&maxPrice="
).
append
(
allFilter
.
priceRanges
?.
maxPrice
)
val
genderMap
=
HashMap
<
String
,
Any
>()
if
(
gender
.
size
>
0
){
genderMap
[
"in"
]
=
gender
filterMap
[
"gender"
]
=
genderMap
}
}
sb
.
append
(
"&page="
).
append
(
page
)
ExpertSearchDataManager
.
getHttp
().
searchDoctor
(
sb
.
toString
())
map
[
"filter"
]
=
filterMap
// sorts
if
(
allFilter
.
reorder
.
key
!=
null
)
{
val
sortsMap
=
HashMap
<
String
,
Any
>()
sortsMap
[
allFilter
.
reorder
.
key1
]
=
allFilter
.
reorder
.
value1
map
[
"sorts"
]
=
sortsMap
}
// fields
val
fieldsMap
=
HashMap
<
String
,
Any
>()
fieldsMap
[
"doctor_id"
]
=
true
fieldsMap
[
"doctor_name"
]
=
true
fieldsMap
[
"uid"
]
=
true
fieldsMap
[
"chat_status"
]
=
true
fieldsMap
[
"consult_status"
]
=
true
fieldsMap
[
"listen_status"
]
=
true
fieldsMap
[
"booking_status"
]
=
true
fieldsMap
[
"gender"
]
=
true
fieldsMap
[
"years"
]
=
true
fieldsMap
[
"head"
]
=
true
fieldsMap
[
"edu"
]
=
true
fieldsMap
[
"province"
]
=
true
fieldsMap
[
"city"
]
=
true
fieldsMap
[
"evaluation_average_score"
]
=
true
fieldsMap
[
"evaluate_num"
]
=
true
fieldsMap
[
"min_price"
]
=
true
fieldsMap
[
"title"
]
=
true
fieldsMap
[
"famous_remark"
]
=
true
fieldsMap
[
"help_num"
]
=
true
fieldsMap
[
"p30d_sold_hour"
]
=
true
fieldsMap
[
"sum_service_time"
]
=
true
fieldsMap
[
"has_servicefree_consult"
]
=
true
fieldsMap
[
"is_new_enter"
]
=
true
fieldsMap
[
"chat_num"
]
=
true
fieldsMap
[
"chat_btn_text"
]
=
true
fieldsMap
[
"feature_tags"
]
=
true
fieldsMap
[
"link_url"
]
=
true
map
[
"fields"
]
=
fieldsMap
val
optionsMap
=
HashMap
<
String
,
Any
?>()
optionsMap
[
"search_scene_id"
]
=
"doctor_main_search"
optionsMap
[
"uid"
]
=
ModularServiceManager
.
provide
(
IUserService
::
class
.
java
).
getUserInfo
()
?.
uid
optionsMap
[
"ffrom"
]
=
PlatformDataManager
.
getRam
().
getChannelName
()
optionsMap
[
"version"
]=
RxAppTool
.
getAppVersionName
(
BaseApp
.
getApp
())
optionsMap
[
"os_type"
]=
2
if
(
extras
!=
null
){
optionsMap
[
"extras"
]
=
extras
}
map
[
"options"
]
=
optionsMap
ExpertSearchDataManager
.
getHttp
()
.
getExpertList
(
map
)
.
compose
(
RxLifecycleUtils
.
bindToLifecycle
(
mView
))
.
compose
(
RxUtils
.
resultJavaData
())
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
(
Consumer
{
if
(
null
!=
it
.
list
&&
it
.
list
.
isNotEmpty
())
{
// if (showType == 0) {
// mView.onDoctorListFetched(it.list!!, page, it.pages)
// } else {
// mView.onServiceListFetched(it.list!!, page, it.pages)
// }
mView
.
onDoctorListFetched
(
it
.
list
,
page
,
it
.
pages
)
//更新缓存 只更新第一页的缓存
if
(
page
==
1
)
{
updateCache
(
showType
,
it
)
}
}
else
{
// 当前页数
val
curPage
=
(
it
.
skip
/
it
.
limit
)+
1
if
(
null
!=
it
.
objects
&&
it
.
objects
.
isNotEmpty
())
{
mExtras
=
it
.
extras
mView
.
onDoctorListFetched
(
it
.
objects
,
mExtras
,
curPage
)
}
else
if
(
curPage
==
1
&&(
null
==
it
.
objects
||
it
.
objects
.
isEmpty
())){
mView
.
fetchListEmpty
(
"没有搜到相关信息,换个关键词看看吧"
)
}
},
object
:
ThrowableConsumer
()
{
...
...
m-consultant/src/main/java/com/yidianling/consultant/IExpertSearchView.kt
View file @
e4ed1517
...
...
@@ -3,23 +3,20 @@ package com.yidianling.consultant
import
android.widget.ImageView
import
com.ydl.ydl_image.config.SimpleImageOpConfiger
import
com.ydl.ydlcommon.mvp.base.IView
import
com.yidianling.consultant.model.bean.DoctorServiceItem
import
com.yidianling.consultant.model.bean.ExpertBannerBean
import
com.yidianling.consultant.model.bean.ExpertSearchBean
import
com.yidianling.consultant.model.bean.ExpertServiceItem
import
com.yidianling.consultant.model.bean.Extras
import
com.yidianling.consultant.model.bean.HeadData
/**
* Created by zqk on 17-9-19.
*/
interface
IExpertSearchView
:
IView
{
fun
onServiceListFetched
(
data
:
MutableList
<
DoctorServiceItem
>,
page
:
Int
,
totalPage
:
Int
)
fun
showRefreshLayout
()
fun
localData
()
fun
updateCache
(
showType
:
Int
,
searchBean
:
ExpertSearchBean
)
fun
onHeadFetched
(
headData
:
HeadData
?)
fun
onDoctorListFetched
(
data
:
MutableList
<
DoctorServiceItem
>,
page
:
Int
,
totalPage
:
Int
)
fun
onDoctorListFetched
(
data
:
MutableList
<
ExpertServiceItem
>,
extras
:
Extras
?,
curPage
:
Int
)
fun
fetchFailed
(
msg
:
String
?)
fun
fetchListFailed
(
msg
:
String
?)
fun
fetchListEmpty
(
msg
:
String
?)
...
...
m-consultant/src/main/java/com/yidianling/consultant/adapter/CategoryRecyclerViewAdapter.kt
View file @
e4ed1517
...
...
@@ -32,7 +32,7 @@ class CategoryRecyclerViewAdapter(private val context: Context, private val cate
override
fun
getItemCount
():
Int
=
categories
.
size
inner
class
ViewHolder
(
itemView
:
View
)
:
RecyclerView
.
ViewHolder
(
itemView
)
{
val
tvSubjectName
:
TextView
=
itemView
.
tv
SubjectN
ame
val
tvSubjectName
:
TextView
=
itemView
.
tv
_sort_n
ame
init
{
itemView
.
setOnClickListener
{
...
...
m-consultant/src/main/java/com/yidianling/consultant/adapter/ExpertSearchAdapter.kt
View file @
e4ed1517
...
...
@@ -15,6 +15,7 @@ import com.ydl.webview.NewH5Activity
import
com.ydl.ydl_image.config.SimpleImageOpConfiger
import
com.ydl.ydl_image.module.GlideApp
import
com.ydl.ydlcommon.base.config.HttpConfig
import
com.ydl.ydlcommon.utils.LogUtil
import
com.ydl.ydlcommon.utils.URLUtils
import
com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import
com.ydl.ydlcommon.utils.remind.ToastHelper
...
...
@@ -22,7 +23,7 @@ import com.yidianling.consultant.ExpertSearchActivity
import
com.yidianling.consultant.IExpertSearchView
import
com.yidianling.consultant.R
import
com.yidianling.consultant.constants.ConsultBIConstants
import
com.yidianling.consultant.model.bean.
Doctor
ServiceItem
import
com.yidianling.consultant.model.bean.
Expert
ServiceItem
import
com.yidianling.consultant.modular.utils.TempH5RouteUtils
import
com.yidianling.consultant.router.ConsultantIn
import
kotlinx.android.synthetic.main.consultant_expert_search_feedbackrate.view.*
...
...
@@ -39,7 +40,7 @@ import java.math.BigDecimal
class
ExpertSearchAdapter
(
private
val
context
:
Context
,
private
val
expertSearchView
:
IExpertSearchView
,
private
val
listData
:
ArrayList
<
Doctor
ServiceItem
>
private
val
listData
:
ArrayList
<
Expert
ServiceItem
>
)
:
RecyclerView
.
Adapter
<
RecyclerView
.
ViewHolder
>()
{
companion
object
{
...
...
@@ -49,7 +50,7 @@ class ExpertSearchAdapter(
}
//记录当前选择主题的id
var
cateId
:
String
?
=
null
var
cateId
:
String
?
=
null
var
hasMore
=
true
...
...
@@ -75,23 +76,23 @@ class ExpertSearchAdapter(
headConfig
)
//姓名
holder
.
tvName
.
text
=
itemBean
.
name
holder
.
tvName
.
text
=
itemBean
.
doctor_
name
//服务中
if
(
itemBean
.
inConsult
||
itemBean
.
isListening
)
{
if
(
itemBean
.
consult_status
==
2
||
itemBean
.
listen_status
==
2
)
{
holder
.
imgHead_online_server
.
visibility
=
View
.
VISIBLE
holder
.
chat_people_in_question
.
visibility
=
View
.
GONE
holder
.
imgHead_online
.
visibility
=
View
.
GONE
}
else
{
//不是服务中且问询人数大于0
when
{
itemBean
.
chat
N
um
>
5
->
{
itemBean
.
chat
_n
um
>
5
->
{
holder
.
chat_people_in_question
.
visibility
=
View
.
VISIBLE
holder
.
chat_people_in_question
.
text
=
"多人在问询"
}
itemBean
.
chat
N
um
>
0
->
{
itemBean
.
chat
_n
um
>
0
->
{
holder
.
chat_people_in_question
.
visibility
=
View
.
VISIBLE
holder
.
chat_people_in_question
.
text
=
"${itemBean.chat
N
um}人在问询"
holder
.
chat_people_in_question
.
text
=
"${itemBean.chat
_n
um}人在问询"
}
else
->
{
holder
.
chat_people_in_question
.
visibility
=
View
.
GONE
...
...
@@ -99,7 +100,7 @@ class ExpertSearchAdapter(
}
//可预约
holder
.
imgHead_online_server
.
visibility
=
View
.
GONE
if
(
itemBean
.
isTodayFree
==
true
)
{
if
(
itemBean
.
booking_status
<
4
)
{
holder
.
imgHead_online
.
visibility
=
View
.
VISIBLE
}
else
{
holder
.
imgHead_online
.
visibility
=
View
.
GONE
...
...
@@ -115,10 +116,10 @@ class ExpertSearchAdapter(
}
//公益图标,不与其他图标冲突
if
(
1
==
itemBean
.
has
ServiceFree
)
{
if
(
null
!=
itemBean
.
tagsIcon
&&
!
TextUtils
.
isEmpty
(
itemBean
.
tagsIcon
.
serviceFreeI
con
))
{
if
(
1
==
itemBean
.
has
_servicefree_consult
)
{
if
(
null
!=
itemBean
.
icons
&&
!
TextUtils
.
isEmpty
(
itemBean
.
icons
.
service_free_i
con
))
{
expertSearchView
.
showImage
(
itemBean
.
tagsIcon
.
serviceFreeI
con
,
itemBean
.
icons
.
service_free_i
con
,
holder
.
imgServiceFree
)
}
else
{
...
...
@@ -133,8 +134,8 @@ class ExpertSearchAdapter(
}
// 展示了抗疫,就不展示其他标签
if
(
itemBean
.
fightEpidemicIconShow
)
{
itemBean
.
tagsIcon
?.
fightEpidemicI
con
?.
let
{
GlideApp
.
with
(
context
).
load
(
itemBean
.
tagsIcon
?.
fightEpidemicI
con
)
itemBean
.
icons
?.
fight_epidemic_i
con
?.
let
{
GlideApp
.
with
(
context
).
load
(
itemBean
.
icons
?.
fight_epidemic_i
con
)
.
into
(
holder
.
imgFightEpidemicIcon
)
holder
.
imgFightEpidemicIcon
.
visibility
=
View
.
VISIBLE
}
...
...
@@ -182,10 +183,10 @@ class ExpertSearchAdapter(
holder
.
imgActivity
.
visibility
=
View
.
GONE
}
//新驻图标
if
(
itemBean
.
is
NewE
nter
)
{
if
(
null
!=
itemBean
.
tagsIcon
&&
!
TextUtils
.
isEmpty
(
itemBean
.
tagsIcon
.
newEnterI
con
))
{
if
(
itemBean
.
is
_new_e
nter
)
{
if
(
null
!=
itemBean
.
icons
&&
!
TextUtils
.
isEmpty
(
itemBean
.
icons
.
new_enter_i
con
))
{
expertSearchView
.
showImage
(
itemBean
.
tagsIcon
.
newEnterI
con
,
itemBean
.
icons
.
new_enter_i
con
,
holder
.
imgNewEnter
)
}
else
{
...
...
@@ -206,10 +207,10 @@ class ExpertSearchAdapter(
holder
.
ll_feedbackRate
,
false
)
if
(
itemBean
.
feedbackRat
e
>=
num
)
{
if
(
itemBean
.
evaluation_average_scor
e
>=
num
)
{
(
view
.
imgRate
as
ImageView
).
background
=
context
.
resources
.
getDrawable
(
R
.
drawable
.
consultant_expert_search_full_star
)
}
else
if
(
itemBean
.
feedbackRate
<
num
&&
itemBean
.
feedbackRat
e
>
num
-
1
)
{
}
else
if
(
itemBean
.
evaluation_average_score
<
num
&&
itemBean
.
evaluation_average_scor
e
>
num
-
1
)
{
(
view
.
imgRate
as
ImageView
).
background
=
context
.
resources
.
getDrawable
(
R
.
drawable
.
consultant_expert_search_half_star
)
}
else
{
...
...
@@ -221,9 +222,9 @@ class ExpertSearchAdapter(
//XXX人点评
val
numSb
=
StringBuffer
()
holder
.
tv_zixunOrderNum
.
text
=
numSb
.
append
(
itemBean
.
zixunOrderN
um
).
append
(
""
).
toString
()
numSb
.
append
(
itemBean
.
evaluate_n
um
).
append
(
""
).
toString
()
//咨询师简介
holder
.
tvTeamCertifications
.
text
=
itemBean
.
t
eamCertifications
holder
.
tvTeamCertifications
.
text
=
itemBean
.
t
itle
//咨询师标签
holder
.
ll_tags
.
removeAllViews
()
itemBean
.
tagList
?.
let
{
...
...
@@ -250,9 +251,9 @@ class ExpertSearchAdapter(
}
//帮助人数
val
orderUser
=
StringBuffer
()
holder
.
tvOrderNum
.
text
=
orderUser
.
append
(
itemBean
.
zixunOrderUser
).
append
(
""
).
toString
()
holder
.
tvOrderNum
.
text
=
orderUser
.
append
(
itemBean
.
help_num
).
append
(
""
).
toString
()
//私聊文案
if
(
TextUtils
.
isEmpty
(
itemBean
.
chat
BtnT
ext
))
{
if
(
TextUtils
.
isEmpty
(
itemBean
.
chat
_btn_t
ext
))
{
holder
.
tvChat
.
text
=
"私聊"
holder
.
tvChat
.
setTextColor
(
ContextCompat
.
getColor
(
...
...
@@ -264,7 +265,7 @@ class ExpertSearchAdapter(
holder
.
tvChat
.
background
=
ContextCompat
.
getDrawable
(
context
,
R
.
drawable
.
consultant_expert_search_chat
)
}
else
{
holder
.
tvChat
.
text
=
itemBean
.
chat
BtnT
ext
holder
.
tvChat
.
text
=
itemBean
.
chat
_btn_t
ext
holder
.
tvChat
.
setTextColor
(
ContextCompat
.
getColor
(
context
,
...
...
@@ -278,36 +279,35 @@ class ExpertSearchAdapter(
}
//服务时长
val
durationStringBuffer
=
StringBuffer
()
holder
.
tvSaleDurationForMonth
.
text
=
durationStringBuffer
.
append
(
itemBean
.
allSaleDuration
.
toInt
()).
append
(
""
).
toString
()
holder
.
tvSaleDurationForMonth
.
text
=
durationStringBuffer
.
append
(
itemBean
.
sum_service_time
.
toInt
()).
append
(
""
).
toString
()
//价格
val
price
=
BigDecimal
(
itemBean
.
min
BookingP
rice
)
//
去掉末尾无用的.00
val
price
=
BigDecimal
(
itemBean
.
min
_p
rice
)
//
去掉末尾无用的.00
holder
.
tvPrice
.
text
=
price
.
stripTrailingZeros
().
toPlainString
()
//套餐
holder
.
ll_products
.
removeAllViews
()
if
(
null
!=
itemBean
.
products
&&
!
itemBean
.
products
.
is
Empty
())
{
for
(
item
in
itemBean
.
products
)
{
if
(
null
!=
itemBean
.
doctor_products
&&
itemBean
.
doctor_products
.
isNot
Empty
())
{
for
(
item
in
itemBean
.
doctor_
products
)
{
val
view
=
LayoutInflater
.
from
(
context
).
inflate
(
R
.
layout
.
consultant_expert_search_products_item
,
holder
.
ll_tags
,
false
)
when
(
item
.
isPackag
e
)
{
1
->
{
when
(
item
.
product_typ
e
)
{
"1"
->
{
view
.
tvTitle
.
text
=
"单次"
view
.
tvTitle
.
setTextColor
(
context
.
resources
.
getColor
(
R
.
color
.
platform_color_1DA1F2
))
view
.
tvTitle
.
background
=
context
.
resources
.
getDrawable
(
R
.
drawable
.
consultant_expert_search_single
)
view
.
tvContent
.
text
=
item
.
name
view
.
tvContent
.
text
=
item
.
product_
name
holder
.
ll_products
.
addView
(
view
)
}
2
->
{
"2"
->
{
view
.
tvTitle
.
text
=
"套餐"
view
.
tvTitle
.
setTextColor
(
context
.
resources
.
getColor
(
R
.
color
.
consultant_color_FF9500
))
view
.
tvTitle
.
background
=
context
.
resources
.
getDrawable
(
R
.
drawable
.
consultant_expert_search_menu
)
view
.
tvContent
.
text
=
item
.
name
view
.
tvContent
.
text
=
item
.
product_
name
holder
.
ll_products
.
addView
(
view
)
}
else
->
{
...
...
@@ -319,11 +319,12 @@ class ExpertSearchAdapter(
}
else
if
(
holder
is
FooterViewHolder
)
{
LogUtil
.
e
(
"${listData.size}"
)
if
(
hasMore
)
{
holder
.
itemView
.
visibility
=
View
.
VISIBLE
holder
.
pbLoading
.
visibility
=
View
.
VISIBLE
holder
.
tvHint
.
text
=
context
.
getString
(
R
.
string
.
consultant_loading
)
}
else
{
}
else
{
holder
.
pbLoading
.
visibility
=
View
.
GONE
holder
.
tvHint
.
text
=
context
.
getString
(
R
.
string
.
platform_no_more
)
}
...
...
@@ -345,8 +346,7 @@ class ExpertSearchAdapter(
NormalViewHolder
(
view
)
}
FOOT_VIEW
->
{
val
view
=
LayoutInflater
.
from
(
context
)
.
inflate
(
R
.
layout
.
consultant_item_footer
,
parent
,
false
)
val
view
=
LayoutInflater
.
from
(
context
).
inflate
(
R
.
layout
.
consultant_item_footer
,
parent
,
false
)
FooterViewHolder
(
view
)
}
else
->
{
...
...
@@ -422,7 +422,7 @@ class ExpertSearchAdapter(
//跳转专家主页
if
(
adapterPosition
!=
RecyclerView
.
NO_POSITION
)
{
val
itemBean
=
listData
[
adapterPosition
]
var
linkUrl
=
itemBean
.
link
U
rl
var
linkUrl
=
itemBean
.
link
_u
rl
if
(!
TextUtils
.
isEmpty
(
cateId
))
{
linkUrl
=
URLUtils
.
appendParmas
(
linkUrl
,
"cateId"
,
cateId
)
...
...
@@ -431,12 +431,12 @@ class ExpertSearchAdapter(
if
(
pageIndex
==
0
)
{
ActionCountUtils
.
count
(
ConsultBIConstants
.
ConsultEvent
.
APP_CONSULT_LIST_DOCTOR_CLICK
,
itemBean
.
doctorI
d
?:
""
itemBean
.
i
d
?:
""
)
}
else
{
ActionCountUtils
.
count
(
ConsultBIConstants
.
ConsultSearchListEvent
.
APP_CONSULT_SEARCH_LIST_CONSULT_ITEM_CLICK
,
itemBean
.
doctorI
d
?:
""
itemBean
.
i
d
?:
""
)
}
...
...
@@ -450,12 +450,12 @@ class ExpertSearchAdapter(
if
(
pageIndex
==
0
)
{
ActionCountUtils
.
count
(
ConsultBIConstants
.
ConsultEvent
.
APP_CONSULT_LIST_CHAT_CLICK
,
doctor
.
doctorI
d
?:
""
doctor
.
i
d
?:
""
)
}
else
{
ActionCountUtils
.
count
(
ConsultBIConstants
.
ConsultSearchListEvent
.
APP_CONSULT_SEARCH_LIST_CHAT_CLICK
,
doctor
.
doctorI
d
?:
""
doctor
.
i
d
?:
""
)
}
//判断是否已登录
...
...
m-consultant/src/main/java/com/yidianling/consultant/adapter/SortAdapter.kt
0 → 100644
View file @
e4ed1517
package
com.yidianling.consultant.adapter
import
android.widget.TextView
import
androidx.core.content.ContextCompat
import
com.chad.library.adapter.base.BaseMultiItemQuickAdapter
import
com.chad.library.adapter.base.BaseViewHolder
import
com.yidianling.consultant.R
import
com.yidianling.consultant.model.bean.ChildrenBean
/**
* Created by Ykai on 2022/5/18.
*/
class
SortAdapter
(
data
:
List
<
ChildrenBean
>)
:
BaseMultiItemQuickAdapter
<
ChildrenBean
,
BaseViewHolder
>(
data
)
{
var
isVisible
=
false
init
{
addItemType
(
1
,
R
.
layout
.
consultant_item_sort1
)
addItemType
(
2
,
R
.
layout
.
consultant_item_sort2
)
}
override
fun
convert
(
holder
:
BaseViewHolder
,
item
:
ChildrenBean
)
{
when
(
holder
.
itemViewType
){
1
->{
holder
.
setGone
(
R
.
id
.
ll_sort_item
,
item
.
isVisible
)
holder
.
setText
(
R
.
id
.
tv_sort_name
,
item
.
cate_name
)
holder
.
getView
<
TextView
>(
R
.
id
.
tv_sort_name
).
isSelected
=
item
.
isSelected
if
(
item
.
isSelected
){
holder
.
setTextColor
(
R
.
id
.
tv_sort_name
,
ContextCompat
.
getColor
(
mContext
,
R
.
color
.
platform_main_theme
))
}
else
{
holder
.
setTextColor
(
R
.
id
.
tv_sort_name
,
ContextCompat
.
getColor
(
mContext
,
R
.
color
.
platform_color_242424
))
}
}
2
->{
holder
.
setGone
(
R
.
id
.
ll_sort_item
,
item
.
isVisible
)
holder
.
setText
(
R
.
id
.
tv_sort_name
,
item
.
cate_name
)
holder
.
getView
<
TextView
>(
R
.
id
.
tv_sort_name
).
isSelected
=
item
.
isSelected
if
(
item
.
isSelected
){
holder
.
setTextColor
(
R
.
id
.
tv_sort_name
,
ContextCompat
.
getColor
(
mContext
,
R
.
color
.
platform_main_theme
))
}
else
{
holder
.
setTextColor
(
R
.
id
.
tv_sort_name
,
ContextCompat
.
getColor
(
mContext
,
R
.
color
.
platform_color_242424
))
}
}
}
}
/**
* 设置大于第12个之后的标签全部显示
*/
fun
setAllVisible
(){
mData
.
forEach
{
bean
->
bean
.
isVisible
=
true
}
notifyDataSetChanged
()
isVisible
=
true
}
/**
* 设置大于第12个之后的标签全部隐藏
*/
fun
setGone
(){
mData
.
forEachIndexed
{
index
,
bean
->
if
(
index
>
12
){
bean
.
isVisible
=
false
}
}
notifyDataSetChanged
()
isVisible
=
false
}
}
\ No newline at end of file
m-consultant/src/main/java/com/yidianling/consultant/adapter/SortRecyclerViewAdapter.kt
View file @
e4ed1517
...
...
@@ -31,7 +31,7 @@ class SortRecyclerViewAdapter(private val context: Context,
val
item
=
sortItems
[
position
]
holder
.
tvSort
.
text
=
item
.
value
if
(
item
.
key
==
selectedSort
.
key
)
{
holder
.
tvSort
.
setTypeface
(
Typeface
.
DEFAULT_BOLD
)
holder
.
tvSort
.
typeface
=
Typeface
.
DEFAULT_BOLD
holder
.
tvSort
.
setTextColor
(
ContextCompat
.
getColor
(
context
,
R
.
color
.
platform_main_theme
))
// holder.ivCheck.visibility = View.VISIBLE
}
...
...
m-consultant/src/main/java/com/yidianling/consultant/bean/ExpertSearchProductsBean.kt
View file @
e4ed1517
...
...
@@ -11,8 +11,8 @@ data class ExpertSearchProductsBean(
/**
* 1.单次/2.套餐
*/
val
isPackage
:
Int
?,
val
product_type
:
String
?,
/**
* 套餐名称
*/
val
name
:
String
?)
\ No newline at end of file
val
product_name
:
String
?)
\ No newline at end of file
m-consultant/src/main/java/com/yidianling/consultant/bean/ExpertSearchTagsIconBean.kt
View file @
e4ed1517
...
...
@@ -11,16 +11,16 @@ data class ExpertSearchTagsIconBean(
/**
* 优质图标
*/
val
ability
LevelI
con
:
String
?,
val
ability
_level_i
con
:
String
?,
/**
* 公益图标
*/
val
service
FreeI
con
:
String
?,
val
service
_free_i
con
:
String
?,
/**
* 新入驻图标
*/
val
new
EnterI
con
:
String
?,
val
new
_enter_i
con
:
String
?,
/**
* 抗疫先锋图标地址
*/
var
fightEpidemicIcon
:
String
?
=
null
)
\ No newline at end of file
var
fight_epidemic_icon
:
String
?
=
null
)
\ No newline at end of file
m-consultant/src/main/java/com/yidianling/consultant/http/ExpertSearchHttpImpl.kt
View file @
e4ed1517
...
...
@@ -5,8 +5,7 @@ import com.ydl.ydlcommon.data.http.BaseAPIResponse
import
com.ydl.ydlnet.YDLHttpUtils
import
com.yidianling.consultant.bean.ExpertSearchTopShowBean
import
com.yidianling.consultant.model.SearchApi
import
com.yidianling.consultant.model.bean.ExpertBannerBean
import
com.yidianling.consultant.model.bean.ExpertSearchBean
import
com.yidianling.consultant.model.bean.ExpertBean
import
io.reactivex.Observable
/**
...
...
@@ -45,9 +44,13 @@ class ExpertSearchHttpImpl : IExpertSearchHttp {
return
searchApi
!!
}
override
fun
searchDoctor
(
params
:
String
?):
Observable
<
BaseAPIResponse
<
ExpertSearchBean
>>
{
return
getSearchApi
().
searchDoctorService
(
HttpConfig
.
JAVA_BASE_URL
+
"doctor/nlist?"
+
params
)
// override fun searchDoctor(params: String?): Observable<BaseAPIResponse<ExpertSearchBean>> {
// return getSearchApi().searchDoctorService(HttpConfig.JAVA_BASE_URL+ "doctor/nlist?"+params)
//
// }
override
fun
getExpertList
(
map
:
Map
<
String
,
Any
>):
Observable
<
BaseAPIResponse
<
ExpertBean
>>
{
return
getSearchApi
().
getExpertList
(
map
)
}
override
fun
getBigShotData
():
Observable
<
BaseAPIResponse
<
ExpertSearchTopShowBean
>>
{
...
...
m-consultant/src/main/java/com/yidianling/consultant/http/IExpertSearchHttp.kt
View file @
e4ed1517
...
...
@@ -2,8 +2,7 @@ package com.yidianling.consultant.http
import
com.ydl.ydlcommon.data.http.BaseAPIResponse
import
com.yidianling.consultant.bean.ExpertSearchTopShowBean
import
com.yidianling.consultant.model.bean.ExpertBannerBean
import
com.yidianling.consultant.model.bean.ExpertSearchBean
import
com.yidianling.consultant.model.bean.ExpertBean
import
io.reactivex.Observable
/**
...
...
@@ -17,7 +16,12 @@ interface IExpertSearchHttp{
/**
* 专家搜索页请求
*/
fun
searchDoctor
(
params
:
String
?):
Observable
<
BaseAPIResponse
<
ExpertSearchBean
>>
// fun searchDoctor(params : String?): Observable<BaseAPIResponse<ExpertSearchBean>>
/**
* 获取专家列表
*/
fun
getExpertList
(
map
:
Map
<
String
,
Any
>):
Observable
<
BaseAPIResponse
<
ExpertBean
>>
/**
* 获取当前筛选条件结果数
...
...
m-consultant/src/main/java/com/yidianling/consultant/layoutmanager/FlowLayoutManager.java
0 → 100644
View file @
e4ed1517
package
com
.
yidianling
.
consultant
.
layoutmanager
;
import
android.graphics.Rect
;
import
android.util.Log
;
import
android.util.SparseArray
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
androidx.recyclerview.widget.RecyclerView
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* Created by Ykai on 2022/2/21.
* 流式布局layoutManager
*/
public
class
FlowLayoutManager
extends
RecyclerView
.
LayoutManager
{
private
static
final
String
TAG
=
FlowLayoutManager
.
class
.
getSimpleName
();
final
FlowLayoutManager
self
=
this
;
protected
int
width
,
height
;
private
int
left
,
top
,
right
;
//最大容器的宽度
private
int
usedMaxWidth
;
//竖直方向上的偏移量
private
int
verticalScrollOffset
=
0
;
public
int
getTotalHeight
()
{
return
totalHeight
;
}
//计算显示的内容的高度
protected
int
totalHeight
=
0
;
private
Row
row
=
new
Row
();
private
List
<
Row
>
lineRows
=
new
ArrayList
<>();
//保存所有的Item的上下左右的偏移量信息
private
SparseArray
<
Rect
>
allItemFrames
=
new
SparseArray
<>();
public
FlowLayoutManager
()
{
//设置主动测量规则,适应recyclerView高度为wrap_content
setAutoMeasureEnabled
(
true
);
}
//每个item的定义
public
class
Item
{
int
useHeight
;
View
view
;
public
void
setRect
(
Rect
rect
)
{
this
.
rect
=
rect
;
}
Rect
rect
;
public
Item
(
int
useHeight
,
View
view
,
Rect
rect
)
{
this
.
useHeight
=
useHeight
;
this
.
view
=
view
;
this
.
rect
=
rect
;
}
}
//行信息的定义
public
class
Row
{
public
void
setCuTop
(
float
cuTop
)
{
this
.
cuTop
=
cuTop
;
}
public
void
setMaxHeight
(
float
maxHeight
)
{
this
.
maxHeight
=
maxHeight
;
}
//每一行的头部坐标
float
cuTop
;
//每一行需要占据的最大高度
float
maxHeight
;
//每一行存储的item
List
<
Item
>
views
=
new
ArrayList
<>();
public
void
addViews
(
Item
view
)
{
views
.
add
(
view
);
}
}
@Override
public
RecyclerView
.
LayoutParams
generateDefaultLayoutParams
()
{
return
new
RecyclerView
.
LayoutParams
(
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
,
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
);
}
//该方法主要用来获取每一个item在屏幕上占据的位置
@Override
public
void
onLayoutChildren
(
RecyclerView
.
Recycler
recycler
,
RecyclerView
.
State
state
)
{
Log
.
d
(
TAG
,
"onLayoutChildren"
);
totalHeight
=
0
;
int
cuLineTop
=
top
;
//当前行使用的宽度
int
cuLineWidth
=
0
;
int
itemLeft
;
int
itemTop
;
int
maxHeightItem
=
0
;
row
=
new
Row
();
lineRows
.
clear
();
allItemFrames
.
clear
();
removeAllViews
();
if
(
getItemCount
()
==
0
)
{
detachAndScrapAttachedViews
(
recycler
);
verticalScrollOffset
=
0
;
return
;
}
if
(
getChildCount
()
==
0
&&
state
.
isPreLayout
())
{
return
;
}
//onLayoutChildren方法在RecyclerView 初始化时 会执行两遍
detachAndScrapAttachedViews
(
recycler
);
if
(
getChildCount
()
==
0
)
{
width
=
getWidth
();
height
=
getHeight
();
left
=
getPaddingLeft
();
right
=
getPaddingRight
();
top
=
getPaddingTop
();
usedMaxWidth
=
width
-
left
-
right
;
}
for
(
int
i
=
0
;
i
<
getItemCount
();
i
++)
{
Log
.
d
(
TAG
,
"index:"
+
i
);
View
childAt
=
recycler
.
getViewForPosition
(
i
);
if
(
View
.
GONE
==
childAt
.
getVisibility
())
{
continue
;
}
measureChildWithMargins
(
childAt
,
0
,
0
);
int
childWidth
=
getDecoratedMeasuredWidth
(
childAt
);
int
childHeight
=
getDecoratedMeasuredHeight
(
childAt
);
int
childUseWidth
=
childWidth
;
int
childUseHeight
=
childHeight
;
//如果加上当前的item还小于最大的宽度的话
if
(
cuLineWidth
+
childUseWidth
<=
usedMaxWidth
)
{
itemLeft
=
left
+
cuLineWidth
;
itemTop
=
cuLineTop
;
Rect
frame
=
allItemFrames
.
get
(
i
);
if
(
frame
==
null
)
{
frame
=
new
Rect
();
}
frame
.
set
(
itemLeft
,
itemTop
,
itemLeft
+
childWidth
,
itemTop
+
childHeight
);
allItemFrames
.
put
(
i
,
frame
);
cuLineWidth
+=
childUseWidth
;
maxHeightItem
=
Math
.
max
(
maxHeightItem
,
childUseHeight
);
row
.
addViews
(
new
Item
(
childUseHeight
,
childAt
,
frame
));
}
else
{
//换行
formatAboveRow
();
cuLineTop
+=
maxHeightItem
;
totalHeight
+=
maxHeightItem
;
itemTop
=
cuLineTop
;
itemLeft
=
left
;
Rect
frame
=
allItemFrames
.
get
(
i
);
if
(
frame
==
null
)
{
frame
=
new
Rect
();
}
frame
.
set
(
itemLeft
,
itemTop
,
itemLeft
+
childWidth
,
itemTop
+
childHeight
);
allItemFrames
.
put
(
i
,
frame
);
cuLineWidth
=
childUseWidth
;
maxHeightItem
=
childUseHeight
;
row
.
addViews
(
new
Item
(
childUseHeight
,
childAt
,
frame
));
}
row
.
setCuTop
(
cuLineTop
);
row
.
setMaxHeight
(
maxHeightItem
);
//不要忘了最后一行进行刷新下布局
if
(
i
==
getItemCount
()
-
1
)
{
formatAboveRow
();
totalHeight
+=
maxHeightItem
;
}
}
totalHeight
=
Math
.
max
(
totalHeight
,
getVerticalSpace
());
Log
.
d
(
TAG
,
"onLayoutChildren totalHeight:"
+
totalHeight
);
fillLayout
(
recycler
,
state
);
}
//对出现在屏幕上的item进行展示,超出屏幕的item回收到缓存中
private
void
fillLayout
(
RecyclerView
.
Recycler
recycler
,
RecyclerView
.
State
state
)
{
if
(
state
.
isPreLayout
()
||
getItemCount
()
==
0
)
{
// 跳过preLayout,preLayout主要用于支持动画
return
;
}
// 当前scroll offset状态下的显示区域
Rect
displayFrame
=
new
Rect
(
getPaddingLeft
(),
getPaddingTop
()
+
verticalScrollOffset
,
getWidth
()
-
getPaddingRight
(),
verticalScrollOffset
+
(
getHeight
()
-
getPaddingBottom
()));
//对所有的行信息进行遍历
for
(
int
j
=
0
;
j
<
lineRows
.
size
();
j
++)
{
Row
row
=
lineRows
.
get
(
j
);
float
lineTop
=
row
.
cuTop
;
float
lineBottom
=
lineTop
+
row
.
maxHeight
;
//如果该行在屏幕中,进行放置item
// if (lineTop < displayFrame.bottom && displayFrame.top < lineBottom) {
List
<
Item
>
views
=
row
.
views
;
for
(
int
i
=
0
;
i
<
views
.
size
();
i
++)
{
View
scrap
=
views
.
get
(
i
).
view
;
measureChildWithMargins
(
scrap
,
0
,
0
);
addView
(
scrap
);
Rect
frame
=
views
.
get
(
i
).
rect
;
//将这个item布局出来
layoutDecoratedWithMargins
(
scrap
,
frame
.
left
,
frame
.
top
-
verticalScrollOffset
,
frame
.
right
,
frame
.
bottom
-
verticalScrollOffset
);
}
// } else {
// //将不在屏幕中的item放到缓存中
// List<Item> views = row.views;
// for (int i = 0; i < views.size(); i++) {
// View scrap = views.get(i).view;
// removeAndRecycleView(scrap, recycler);
// }
// }
}
}
/**
* 计算每一行没有居中的viewgroup,让居中显示
*/
private
void
formatAboveRow
()
{
List
<
Item
>
views
=
row
.
views
;
for
(
int
i
=
0
;
i
<
views
.
size
();
i
++)
{
Item
item
=
views
.
get
(
i
);
View
view
=
item
.
view
;
int
position
=
getPosition
(
view
);
//如果该item的位置不在该行中间位置的话,进行重新放置
if
(
allItemFrames
.
get
(
position
).
top
<
row
.
cuTop
+
(
row
.
maxHeight
-
views
.
get
(
i
).
useHeight
)
/
2
)
{
Rect
frame
=
allItemFrames
.
get
(
position
);
if
(
frame
==
null
)
{
frame
=
new
Rect
();
}
frame
.
set
(
allItemFrames
.
get
(
position
).
left
,
(
int
)
(
row
.
cuTop
+
(
row
.
maxHeight
-
views
.
get
(
i
).
useHeight
)
/
2
),
allItemFrames
.
get
(
position
).
right
,
(
int
)
(
row
.
cuTop
+
(
row
.
maxHeight
-
views
.
get
(
i
).
useHeight
)
/
2
+
getDecoratedMeasuredHeight
(
view
)));
allItemFrames
.
put
(
position
,
frame
);
item
.
setRect
(
frame
);
views
.
set
(
i
,
item
);
}
}
row
.
views
=
views
;
lineRows
.
add
(
row
);
row
=
new
Row
();
}
/**
* 竖直方向需要滑动的条件
*
* @return
*/
@Override
public
boolean
canScrollVertically
()
{
return
true
;
}
//监听竖直方向滑动的偏移量
@Override
public
int
scrollVerticallyBy
(
int
dy
,
RecyclerView
.
Recycler
recycler
,
RecyclerView
.
State
state
)
{
Log
.
d
(
"TAG"
,
"totalHeight:"
+
totalHeight
);
//实际要滑动的距离
int
travel
=
dy
;
//如果滑动到最顶部
if
(
verticalScrollOffset
+
dy
<
0
)
{
//限制滑动到顶部之后,不让继续向上滑动了
travel
=
-
verticalScrollOffset
;
//verticalScrollOffset=0
}
else
if
(
verticalScrollOffset
+
dy
>
totalHeight
-
getVerticalSpace
())
{
//如果滑动到最底部
travel
=
totalHeight
-
getVerticalSpace
()
-
verticalScrollOffset
;
//verticalScrollOffset=totalHeight - getVerticalSpace()
}
//将竖直方向的偏移量+travel
verticalScrollOffset
+=
travel
;
// 平移容器内的item
offsetChildrenVertical
(-
travel
);
fillLayout
(
recycler
,
state
);
return
travel
;
}
private
int
getVerticalSpace
()
{
return
self
.
getHeight
()
-
self
.
getPaddingBottom
()
-
self
.
getPaddingTop
();
}
public
int
getHorizontalSpace
()
{
return
self
.
getWidth
()
-
self
.
getPaddingLeft
()
-
self
.
getPaddingRight
();
}
}
m-consultant/src/main/java/com/yidianling/consultant/listener/OnCategoriesSelectedListener.kt
View file @
e4ed1517
package
com.yidianling.consultant.listener
import
com.yidianling.consultant.model.bean.CateItem
/**
* Created by zqk on 17-9-20.
*/
interface
OnCategoriesSelectedListener
{
fun
onCategoriesSelected
(
categories
:
ArrayList
<
CateItem
>
)
fun
onCategoriesSelected
()
}
\ No newline at end of file
m-consultant/src/main/java/com/yidianling/consultant/model/SearchApi.kt
View file @
e4ed1517
...
...
@@ -9,7 +9,7 @@ import com.ydl.ydlnet.YDLHttpUtils
import
com.yidianling.consultant.bean.ExpertSearchTopShowBean
import
com.yidianling.consultant.bean.GuideBean
import
com.yidianling.consultant.bean.HotSearchBean
import
com.yidianling.consultant.model.bean.Expert
Search
Bean
import
com.yidianling.consultant.model.bean.ExpertBean
import
com.yidianling.consultant.model.bean.HeadData
import
io.reactivex.Observable
import
retrofit2.http.*
...
...
@@ -38,14 +38,23 @@ interface SearchApi {
fun
listHead
(
@FieldMap
maps
:
Map
<
String
,
String
>):
Observable
<
BaseResponse
<
HeadData
>>
//搜索条件
@GET
(
"consult/search/v
2
/conditions"
)
@GET
(
"consult/search/v
3
/conditions"
)
@Headers
(
YDL_DOMAIN
+
YDL_DOMAIN_JAVA
)
fun
searchConditions
(
@Query
(
"cateSource"
)
cateSource
:
Int
):
Observable
<
BaseAPIResponse
<
HeadData
>>
//专家服务搜索
@retrofit2
.
http
.
Headers
(
"Content-Type:application/json"
)
@GET
fun
searchDoctorService
(
@Url
url
:
String
):
Observable
<
BaseAPIResponse
<
ExpertSearchBean
>>
// @retrofit2.http.Headers("Content-Type:application/json")
// @GET
// fun searchDoctorService(@Url url: String): Observable<BaseAPIResponse<ExpertSearchBean>>
/**
* 新咨询师列表接口(包含搜索、筛选咨询师)
*/
@Headers
(
YDL_DOMAIN
+
YDL_DOMAIN_JAVA
,
"X-App-Id: plough_cloud"
)
@POST
(
"smart-rank/v1/search"
)
fun
getExpertList
(
@Body
map
:
Map
<
String
,
@JvmSuppressWildcards
Any
>):
Observable
<
BaseAPIResponse
<
ExpertBean
>>
//搜索页面接口
@retrofit2
.
http
.
Headers
(
YDL_DOMAIN
+
YDL_DOMAIN_JAVA
,
"Content-Type:application/json"
)
...
...
m-consultant/src/main/java/com/yidianling/consultant/model/bean/AgeItem.kt
View file @
e4ed1517
...
...
@@ -7,5 +7,5 @@ data class AgeItem(
val
value
:
String
?
=
null
,
@field
:
SerializedName
(
"key"
)
val
key
:
Int
?
=
null
val
key
:
Int
)
\ No newline at end of file
m-consultant/src/main/java/com/yidianling/consultant/model/bean/AllFilter.kt
View file @
e4ed1517
...
...
@@ -23,5 +23,20 @@ data class AllFilter(
val
others
:
ArrayList
<
OtherItem
>
=
ArrayList
(),
//其他筛选
val
title
:
ArrayList
<
ReorderItem
>
=
ArrayList
(),
//资质
val
specialityCrowd
:
ArrayList
<
SpecialityCrowdBean
>
=
ArrayList
()
// 擅长人群
val
specialityCrowd
:
ArrayList
<
SpecialityCrowdBean
>
=
ArrayList
(),
// 擅长人群
// 八大类标签集合
val
childList
:
ArrayList
<
ChildrenBean
>
=
ArrayList
(),
// 亲子教育
val
stressList
:
ArrayList
<
ChildrenBean
>
=
ArrayList
(),
// 情绪压力
val
loveEmotionList
:
ArrayList
<
ChildrenBean
>
=
ArrayList
(),
// 恋爱情感
val
marriedFamilyList
:
ArrayList
<
ChildrenBean
>
=
ArrayList
(),
// 婚姻家庭
val
personalGrowthList
:
ArrayList
<
ChildrenBean
>
=
ArrayList
(),
// 个人成长
val
interpersonalRelationshipList
:
ArrayList
<
ChildrenBean
>
=
ArrayList
(),
// 人际关系
val
careerDevelopmentList
:
ArrayList
<
ChildrenBean
>
=
ArrayList
(),
// 职场发展
val
mentalHealthList
:
ArrayList
<
ChildrenBean
>
=
ArrayList
(),
// 心理健康
// 八大类已选中标签id集合
val
categoryId2List
:
ArrayList
<
String
>
=
ArrayList
(),
// 一级类目id集合
val
categoryId3List
:
ArrayList
<
String
>
=
ArrayList
()
// 二级类目id集合
)
\ No newline at end of file
m-consultant/src/main/java/com/yidianling/consultant/model/bean/CateItem.kt
View file @
e4ed1517
package
com.yidianling.consultant.model.bean
import
android.os.Parcel
import
android.os.Parcelable
import
com.chad.library.adapter.base.entity.MultiItemEntity
import
com.google.gson.annotations.SerializedName
data class
CateItem
(
...
...
@@ -10,30 +9,23 @@ data class CateItem(
var
cateName
:
String
?
=
null
,
@field
:
SerializedName
(
"cate_id"
)
var
cateId
:
String
?
=
null
)
:
Parcelable
{
constructor
(
parcel
:
Parcel
)
:
this
(
parcel
.
readString
(),
parcel
.
readString
()
)
{
}
var
cateId
:
String
?
=
null
,
override
fun
writeToParcel
(
parcel
:
Parcel
,
flags
:
Int
)
{
parcel
.
writeString
(
cateName
)
parcel
.
writeString
(
cateId
)
}
@field
:
SerializedName
(
"children"
)
var
children
:
ArrayList
<
ChildrenBean
>?=
null
)
override
fun
describeContents
():
Int
{
return
0
}
data class
ChildrenBean
(
var
cate_name
:
String
,
var
cate_id
:
String
,
var
isVisible
:
Boolean
,
var
type
:
Int
):
MultiItemEntity
{
// @field:SerializedName("cate_name")
// var cateName: String? = null,
companion
object
CREATOR
:
Parcelable
.
Creator
<
CateItem
>
{
override
fun
createFromParcel
(
parcel
:
Parcel
):
CateItem
{
return
CateItem
(
parcel
)
}
// @field:SerializedName("cate_id")
// var cateId: String? = null,
override
fun
newArray
(
size
:
Int
):
Array
<
CateItem
?>
{
return
arrayOfNulls
(
size
)
}
// var isVisible: Boolean = false // 是否显示
var
isSelected
:
Boolean
=
false
// 是否选中
override
fun
getItemType
():
Int
{
return
type
}
}
\ No newline at end of file
m-consultant/src/main/java/com/yidianling/consultant/model/bean/EnquiryItem.kt
View file @
e4ed1517
...
...
@@ -8,7 +8,7 @@ data class EnquiryItem(
val
value
:
String
?
=
null
,
@field
:
SerializedName
(
"key"
)
val
key
:
Int
?
=
null
,
val
key
:
Int
,
val
checkRrl
:
String
?,
val
unCheckUrl
:
String
?
...
...
m-consultant/src/main/java/com/yidianling/consultant/model/bean/ExpertBean.kt
0 → 100644
View file @
e4ed1517
package
com.yidianling.consultant.model.bean
/**
* @author yuanWai
* @描述:专家搜索页数据bean
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/12/11
*/
data class
ExpertBean
(
val
amount
:
Int
=
0
,
val
skip
:
Int
=
0
,
val
limit
:
Int
=
0
,
val
size
:
Int
=
10
,
val
objects
:
MutableList
<
ExpertServiceItem
>?,
// 分页需要
val
extras
:
Extras
?)
data class
Extras
(
val
skips
:
HashMap
<
String
,
Int
>
)
\ No newline at end of file
m-consultant/src/main/java/com/yidianling/consultant/model/bean/ExpertSearchBean.kt
deleted
100644 → 0
View file @
54348d30
package
com.yidianling.consultant.model.bean
/**
* @author yuanWai
* @描述:专家搜索页数据bean
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/12/11
*/
data class
ExpertSearchBean
(
val
endRow
:
Int
=
0
,
val
hasNextPage
:
Boolean
=
false
,
val
hasPreviousPage
:
Boolean
=
false
,
val
isFirstPage
:
Boolean
=
false
,
val
isLastPage
:
Boolean
=
false
,
/**
* 数据列表
*/
val
list
:
MutableList
<
DoctorServiceItem
>?,
val
navigateFirstPage
:
Int
=
0
,
val
navigateLastPage
:
Int
=
0
,
val
navigatePages
:
Int
=
0
,
val
navigatepageNums
:
MutableList
<
Int
>?,
val
nextPage
:
Int
=
0
,
val
pageNum
:
Int
=
0
,
val
pageSize
:
Int
=
0
,
/**
* 总页数
*/
val
pages
:
Int
=
0
,
val
prePage
:
Int
=
0
,
val
size
:
Int
=
0
,
val
startRow
:
Int
=
0
,
/**
* 数据总条数
*/
val
total
:
Int
=
0
)
\ No newline at end of file
m-consultant/src/main/java/com/yidianling/consultant/model/bean/
Doctor
ServiceItem.kt
→
m-consultant/src/main/java/com/yidianling/consultant/model/bean/
Expert
ServiceItem.kt
View file @
e4ed1517
...
...
@@ -10,11 +10,11 @@ import com.yidianling.consultant.bean.ExpertSearchTagsIconBean
* @Company 壹点灵
* @date 2018/12/11
*/
data class
Doctor
ServiceItem
(
data class
Expert
ServiceItem
(
/**
* 专家ID
*/
val
doctorI
d
:
String
?,
val
i
d
:
String
?,
/**
* 专家uid
*/
...
...
@@ -22,11 +22,11 @@ data class DoctorServiceItem(
/**
* 专家名称
*/
val
name
:
String
?,
val
doctor_
name
:
String
?,
/**
* 跳转路由地址(正常为专家主页地址)
*/
val
link
U
rl
:
String
?,
val
link
_u
rl
:
String
?,
/**
* 专家头像地址
*/
...
...
@@ -34,7 +34,7 @@ data class DoctorServiceItem(
/**
* 专家是否在线 1.在线
*/
val
isOnline
:
Int
?,
val
chat_status
:
Int
?,
/**
* 能力等级 1.实习 2.新手 3.精英
*/
...
...
@@ -42,7 +42,7 @@ data class DoctorServiceItem(
/**
* 有免费咨询:1.有,2.无
*/
val
has
ServiceFree
:
Int
?,
val
has
_servicefree_consult
:
Int
?,
/**
* 活动图标
*/
...
...
@@ -54,11 +54,11 @@ data class DoctorServiceItem(
/**
* 是否新入驻:true:是,false:否
*/
var
is
NewE
nter
:
Boolean
=
false
,
var
is
_new_e
nter
:
Boolean
=
false
,
/**
* 好评率(倾诉+咨询)
*/
var
feedbackRat
e
:
Float
=
0f
,
var
evaluation_average_scor
e
:
Float
=
0f
,
/**
* 是否抗疫先锋图标
*/
...
...
@@ -66,59 +66,55 @@ data class DoctorServiceItem(
/**
* 评价数(咨询订单数)
*/
var
zixunOrderN
um
:
Int
=
0
,
var
evaluate_n
um
:
Int
=
0
,
/**
* 咨询最低价
*/
val
min
BookingP
rice
:
String
?,
val
min
_p
rice
:
String
?,
/**
* 资质材料
*/
val
teamCertifications
:
String
?,
/**
* 标签分类
*/
val
tags
:
String
?,
val
title
:
String
?,
/**
* 已帮助人数(咨询人数)
*/
val
zixunOrderUser
:
String
?,
val
help_num
:
String
?,
/**
* 月售时长
*/
var
saleDurationForMonth
:
Float
=
0f
,
var
p30d_sold_hour
:
Float
=
0f
,
/**
* 服务时长
*/
var
allSaleDuration
:
Float
=
0f
,
var
sum_service_time
:
Float
=
0f
,
/**
* 服务
*/
val
products
:
MutableList
<
ExpertSearchProductsBean
>?,
val
doctor_
products
:
MutableList
<
ExpertSearchProductsBean
>?,
/**
* 标签图片
*/
val
tagsIcon
:
ExpertSearchTagsIconBean
?,
val
icons
:
ExpertSearchTagsIconBean
?,
/**
* 今日是否可约
*/
val
isTodayFree
:
Boolean
?
,
val
booking_status
:
Int
,
/**
*
是否咨询
中
*
咨询状态 1-待服务 2-服务
中
*/
var
inConsult
:
Boolean
=
false
,
var
consult_status
:
Int
,
/**
*
是否聆听
中
*
倾诉状态 1-待服务 2-服务
中
*/
var
isListening
:
Boolean
=
false
,
var
listen_status
:
Int
,
/**
* 私聊人数
*/
var
chat
N
um
:
Int
=
0
,
var
chat
_n
um
:
Int
=
0
,
/**
* 个人铭言
*/
val
famous
R
emark
:
String
?,
val
famous
_r
emark
:
String
?,
/**
* 省
*/
...
...
@@ -130,7 +126,7 @@ data class DoctorServiceItem(
/**
* 私聊按钮的文案(如果不为空则取这个字段的值,如果为空 则默认为:“私聊”)
*/
val
chat
BtnT
ext
:
String
?,
val
chat
_btn_t
ext
:
String
?,
/**
* 新标签分类
...
...
m-consultant/src/main/java/com/yidianling/consultant/model/bean/Filters.kt
View file @
e4ed1517
...
...
@@ -45,12 +45,6 @@ data class Filters(
@field
:
SerializedName
(
"title"
)
val
title
:
List
<
ReorderItem
>
=
ArrayList
(),
// /**
// * 擅长人群
// */
// @field:SerializedName("crowdsTags")
// val crowdsTags: List<AgeItem> = ArrayList()
/**
* 擅长人群
...
...
m-consultant/src/main/java/com/yidianling/consultant/model/bean/OtherItem.kt
View file @
e4ed1517
...
...
@@ -8,5 +8,11 @@ data class OtherItem(
val
value
:
String
?
=
null
,
@field
:
SerializedName
(
"key"
)
val
key
:
Int
?
=
null
val
key
:
Int
?
=
null
,
@field
:
SerializedName
(
"value1"
)
val
value1
:
String
,
@field
:
SerializedName
(
"key1"
)
val
key1
:
String
)
\ No newline at end of file
m-consultant/src/main/java/com/yidianling/consultant/model/bean/ReorderItem.kt
View file @
e4ed1517
...
...
@@ -8,5 +8,11 @@ data class ReorderItem(
var
value
:
String
?
=
null
,
@field
:
SerializedName
(
"key"
)
var
key
:
String
?
=
null
var
key
:
String
?
=
null
,
@field
:
SerializedName
(
"value1"
)
var
value1
:
String
=
""
,
@field
:
SerializedName
(
"key1"
)
var
key1
:
String
=
""
)
\ No newline at end of file
m-consultant/src/main/java/com/yidianling/consultant/model/bean/SortBean.java
0 → 100644
View file @
e4ed1517
//package com.yidianling.consultant.model.bean;
//
//import com.chad.library.adapter.base.entity.MultiItemEntity;
//
///**
// * Created by Ykai on 2022/5/18.
// */
//
//public class SortBean implements MultiItemEntity {
// public String name;
// int type;
// public boolean isVisible; // 是否显示
// public boolean isSelected; // 是否选中
//
//
// public SortBean(String name, int type){
// this.name = name;
// this.type = type;
// isVisible = true;
// }
//
// @Override
// public int getItemType() {
// return type;
// }
//}
m-consultant/src/main/java/com/yidianling/consultant/modular/utils/TempH5RouteUtils.kt
View file @
e4ed1517
...
...
@@ -53,7 +53,7 @@ object TempH5RouteUtils {
if
(!
TextUtils
.
isEmpty
(
host
)
&&
host
==
"h5"
)
{
//如果是h5,跳转至NewH5Activity
try
{
va
r
params
=
URLDecoder
.
decode
(
linkUri
.
getQueryParameter
(
"params"
),
"UTF-8"
)
va
l
params
=
URLDecoder
.
decode
(
linkUri
.
getQueryParameter
(
"params"
),
"UTF-8"
)
ARouter
.
getInstance
().
build
(
"/new_h5/h5"
).
withSerializable
(
"routerParam"
,
params
).
navigation
()
return
}
catch
(
e
:
NullPointerException
){
...
...
m-consultant/src/main/java/com/yidianling/consultant/ui/view/CategoryPopupWindow.kt
View file @
e4ed1517
...
...
@@ -2,48 +2,585 @@ package com.yidianling.consultant.ui.view
import
android.content.Context
import
android.graphics.drawable.BitmapDrawable
import
androidx.recyclerview.widget.GridLayoutManager
import
androidx.recyclerview.widget.LinearLayoutManager
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
import
android.widget.ImageView
import
android.widget.PopupWindow
import
com.ydl.ydlcommon.view.SpaceItemDecorator2
import
com.yidianling.common.tools.RxImageTool
import
com.yidianling.consultant.R
import
com.yidianling.consultant.adapter.CategoryRecyclerViewAdapter
import
com.yidianling.consultant.adapter.SortAdapter
import
com.yidianling.consultant.layoutmanager.FlowLayoutManager
import
com.yidianling.consultant.listener.OnCategoriesSelectedListener
import
com.yidianling.consultant.model.bean.CateItem
import
com.yidianling.consultant.model.bean.AllFilter
import
com.yidianling.consultant.model.bean.ChildrenBean
import
kotlinx.android.synthetic.main.consultant_ui_subject_popup_window.view.*
/**
* 主题弹窗
* Created by zqk on 17-9-15.
*/
class
CategoryPopupWindow
(
context
:
Context
,
categories
:
ArrayList
<
CateItem
>,
selectedCategories
:
ArrayList
<
CateItem
>)
:
PopupWindow
(
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
)
{
class
CategoryPopupWindow
(
context
:
Context
,
allFilter
:
AllFilter
)
:
PopupWindow
(
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
RxImageTool
.
dp2px
(
566f
))
{
private
var
view
:
View
=
LayoutInflater
.
from
(
context
).
inflate
(
R
.
layout
.
consultant_ui_subject_popup_window
,
null
)
var
mAllFilter
:
AllFilter
private
lateinit
var
ivSortChildEducationOpen
:
ImageView
private
lateinit
var
ivSortEmotionalStress
:
ImageView
private
lateinit
var
ivSortLoveEmotion
:
ImageView
private
lateinit
var
ivSortMarriedFamily
:
ImageView
private
lateinit
var
ivSortPersonalGrowth
:
ImageView
private
lateinit
var
ivSortInterpersonalRelationship
:
ImageView
private
lateinit
var
ivSortCareerDevelopment
:
ImageView
private
lateinit
var
ivSortMentalHealth
:
ImageView
var
onSubjectsSelectedListener
:
OnCategoriesSelectedListener
?
=
null
private
val
childList
=
ArrayList
<
ChildrenBean
>()
private
val
stressList
=
ArrayList
<
ChildrenBean
>()
private
val
loveEmotionList
=
ArrayList
<
ChildrenBean
>()
private
val
marriedFamilyList
=
ArrayList
<
ChildrenBean
>()
private
val
personalGrowthList
=
ArrayList
<
ChildrenBean
>()
private
val
interpersonalRelationshipList
=
ArrayList
<
ChildrenBean
>()
private
val
careerDevelopmentList
=
ArrayList
<
ChildrenBean
>()
private
val
mentalHealthList
=
ArrayList
<
ChildrenBean
>()
private
val
chooseChildIndexList
=
ArrayList
<
Int
>()
private
val
chooseStressIndexList
=
ArrayList
<
Int
>()
private
val
chooseLoveEmotionIndexList
=
ArrayList
<
Int
>()
private
val
chooseMarriedFamilyIndexList
=
ArrayList
<
Int
>()
private
val
choosePersonalGrowthIndexList
=
ArrayList
<
Int
>()
private
val
chooseInterpersonalRelationshipIndexList
=
ArrayList
<
Int
>()
private
val
chooseCareerDevelopmentIndexList
=
ArrayList
<
Int
>()
private
val
chooseMentalHealthIndexList
=
ArrayList
<
Int
>()
private
lateinit
var
childEducationAdapter
:
SortAdapter
private
lateinit
var
stressAdapter
:
SortAdapter
private
lateinit
var
loveEmotionAdapter
:
SortAdapter
private
lateinit
var
marriedFamilyAdapter
:
SortAdapter
private
lateinit
var
personalGrowthAdapter
:
SortAdapter
private
lateinit
var
interpersonalRelationshipAdapter
:
SortAdapter
private
lateinit
var
careerDevelopmentAdapter
:
SortAdapter
private
lateinit
var
mentalHealthAdapter
:
SortAdapter
init
{
val
view
=
LayoutInflater
.
from
(
context
).
inflate
(
R
.
layout
.
consultant_ui_subject_popup_window
,
null
)
this
.
contentView
=
view
this
.
isFocusable
=
true
@Suppress
(
"DEPRECATION"
)
this
.
setBackgroundDrawable
(
BitmapDrawable
())
this
.
isOutsideTouchable
=
true
val
rvSubject
=
view
.
rvSubject
val
adapter
=
CategoryRecyclerViewAdapter
(
context
,
categories
,
selectedCategories
)
rvSubject
.
adapter
=
adapter
rvSubject
.
layoutManager
=
GridLayoutManager
(
context
,
3
,
LinearLayoutManager
.
VERTICAL
,
false
)
rvSubject
.
addItemDecoration
(
SpaceItemDecorator2
(
RxImageTool
.
dp2px
(
5f
),
3
))
inputMethodMode
=
PopupWindow
.
INPUT_METHOD_NEEDED
mAllFilter
=
allFilter
initView
()
}
private
fun
initView
(){
inputMethodMode
=
INPUT_METHOD_NEEDED
// 重置
view
.
btn_reset
.
setOnClickListener
{
if
(
chooseChildIndexList
.
size
>
0
){
chooseChildIndexList
.
forEach
{
childList
[
it
].
isSelected
=
false
}
childEducationAdapter
.
notifyDataSetChanged
()
}
if
(
chooseStressIndexList
.
size
>
0
){
chooseStressIndexList
.
forEach
{
stressList
[
it
].
isSelected
=
false
}
stressAdapter
.
notifyDataSetChanged
()
}
if
(
chooseLoveEmotionIndexList
.
size
>
0
){
chooseLoveEmotionIndexList
.
forEach
{
loveEmotionList
[
it
].
isSelected
=
false
}
loveEmotionAdapter
.
notifyDataSetChanged
()
}
if
(
chooseMarriedFamilyIndexList
.
size
>
0
){
chooseMarriedFamilyIndexList
.
forEach
{
marriedFamilyList
[
it
].
isSelected
=
false
}
marriedFamilyAdapter
.
notifyDataSetChanged
()
}
if
(
choosePersonalGrowthIndexList
.
size
>
0
){
choosePersonalGrowthIndexList
.
forEach
{
personalGrowthList
[
it
].
isSelected
=
false
}
personalGrowthAdapter
.
notifyDataSetChanged
()
}
if
(
chooseInterpersonalRelationshipIndexList
.
size
>
0
){
chooseInterpersonalRelationshipIndexList
.
forEach
{
interpersonalRelationshipList
[
it
].
isSelected
=
false
}
interpersonalRelationshipAdapter
.
notifyDataSetChanged
()
}
if
(
chooseCareerDevelopmentIndexList
.
size
>
0
){
chooseCareerDevelopmentIndexList
.
forEach
{
careerDevelopmentList
[
it
].
isSelected
=
false
}
careerDevelopmentAdapter
.
notifyDataSetChanged
()
}
if
(
chooseMentalHealthIndexList
.
size
>
0
){
chooseMentalHealthIndexList
.
forEach
{
mentalHealthList
[
it
].
isSelected
=
false
}
mentalHealthAdapter
.
notifyDataSetChanged
()
}
mAllFilter
.
categoryId2List
.
clear
()
mAllFilter
.
categoryId3List
.
clear
()
}
// 确定
view
.
btnConfirm
.
setOnClickListener
{
onSubjectsSelectedListener
?.
onCategoriesSelected
(
selectedCategories
)
onSubjectsSelectedListener
?.
onCategoriesSelected
()
dismiss
()
}
// 亲子教育
val
rvSortChildEducation
=
view
.
rv_sort_child_education
ivSortChildEducationOpen
=
view
.
iv_sort_child_education_open
childEducationAdapter
=
SortAdapter
(
childList
)
rvSortChildEducation
.
layoutManager
=
FlowLayoutManager
()
rvSortChildEducation
.
adapter
=
childEducationAdapter
childEducationAdapter
.
setOnItemClickListener
{
adapter
,
view
,
position
->
if
(
position
==
0
){
if
(
childList
[
0
].
isSelected
){
childList
[
0
].
isSelected
=
false
mAllFilter
.
categoryId2List
.
remove
(
childList
[
0
].
cate_id
)
chooseChildIndexList
.
remove
(
position
)
}
else
{
childList
.
forEachIndexed
{
index
,
_
->
childList
[
index
].
isSelected
=
index
==
0
if
(
index
==
0
){
mAllFilter
.
categoryId2List
.
add
(
childList
[
0
].
cate_id
)
}
else
{
mAllFilter
.
categoryId3List
.
remove
(
childList
[
index
].
cate_id
)
}
}
chooseChildIndexList
.
add
(
position
)
}
}
else
{
if
(!
childList
[
position
].
isSelected
&&
childList
[
0
].
isSelected
){
childList
[
0
].
isSelected
=
false
mAllFilter
.
categoryId2List
.
remove
(
childList
[
0
].
cate_id
)
}
childList
[
position
].
isSelected
=
!
childList
[
position
].
isSelected
if
(
childList
[
position
].
isSelected
){
mAllFilter
.
categoryId3List
.
add
(
childList
[
position
].
cate_id
)
chooseChildIndexList
.
add
(
position
)
}
else
{
mAllFilter
.
categoryId3List
.
remove
(
childList
[
position
].
cate_id
)
chooseChildIndexList
.
remove
(
position
)
}
}
childEducationAdapter
.
notifyDataSetChanged
()
}
// 情绪压力
val
rvSortEmotionalStress
=
view
.
rv_sort_emotional_stress
ivSortEmotionalStress
=
view
.
iv_sort_emotional_stress
stressAdapter
=
SortAdapter
(
stressList
)
rvSortEmotionalStress
.
layoutManager
=
FlowLayoutManager
()
rvSortEmotionalStress
.
adapter
=
stressAdapter
stressAdapter
.
setOnItemClickListener
{
adapter
,
view
,
position
->
if
(
position
==
0
){
if
(
stressList
[
0
].
isSelected
){
stressList
[
0
].
isSelected
=
false
mAllFilter
.
categoryId2List
.
remove
(
stressList
[
0
].
cate_id
)
chooseStressIndexList
.
remove
(
position
)
}
else
{
stressList
.
forEachIndexed
{
index
,
_
->
stressList
[
index
].
isSelected
=
index
==
0
if
(
index
==
0
){
mAllFilter
.
categoryId2List
.
add
(
stressList
[
0
].
cate_id
)
}
else
{
mAllFilter
.
categoryId3List
.
remove
(
stressList
[
index
].
cate_id
)
}
}
chooseStressIndexList
.
add
(
position
)
}
}
else
{
if
(!
stressList
[
position
].
isSelected
&&
stressList
[
0
].
isSelected
){
stressList
[
0
].
isSelected
=
false
mAllFilter
.
categoryId2List
.
remove
(
stressList
[
0
].
cate_id
)
}
stressList
[
position
].
isSelected
=
!
stressList
[
position
].
isSelected
if
(
stressList
[
position
].
isSelected
){
mAllFilter
.
categoryId3List
.
add
(
stressList
[
position
].
cate_id
)
chooseStressIndexList
.
add
(
position
)
}
else
{
mAllFilter
.
categoryId3List
.
remove
(
stressList
[
position
].
cate_id
)
chooseStressIndexList
.
remove
(
position
)
}
}
stressAdapter
.
notifyDataSetChanged
()
}
// 恋爱情感
val
rvLoveEmotion
=
view
.
rv_sort_love_emotion
ivSortLoveEmotion
=
view
.
iv_sort_love_emotion
loveEmotionAdapter
=
SortAdapter
(
loveEmotionList
)
rvLoveEmotion
.
layoutManager
=
FlowLayoutManager
()
rvLoveEmotion
.
adapter
=
loveEmotionAdapter
loveEmotionAdapter
.
setOnItemClickListener
{
adapter
,
view
,
position
->
if
(
position
==
0
){
if
(
loveEmotionList
[
0
].
isSelected
){
loveEmotionList
[
0
].
isSelected
=
false
mAllFilter
.
categoryId2List
.
remove
(
loveEmotionList
[
0
].
cate_id
)
chooseLoveEmotionIndexList
.
remove
(
position
)
}
else
{
loveEmotionList
.
forEachIndexed
{
index
,
_
->
loveEmotionList
[
index
].
isSelected
=
index
==
0
if
(
index
==
0
){
mAllFilter
.
categoryId2List
.
add
(
loveEmotionList
[
0
].
cate_id
)
}
else
{
mAllFilter
.
categoryId3List
.
remove
(
loveEmotionList
[
index
].
cate_id
)
}
}
chooseLoveEmotionIndexList
.
add
(
position
)
}
}
else
{
if
(!
loveEmotionList
[
position
].
isSelected
&&
loveEmotionList
[
0
].
isSelected
){
loveEmotionList
[
0
].
isSelected
=
false
mAllFilter
.
categoryId2List
.
remove
(
loveEmotionList
[
0
].
cate_id
)
}
loveEmotionList
[
position
].
isSelected
=
!
loveEmotionList
[
position
].
isSelected
if
(
loveEmotionList
[
position
].
isSelected
){
mAllFilter
.
categoryId3List
.
add
(
loveEmotionList
[
position
].
cate_id
)
chooseLoveEmotionIndexList
.
add
(
position
)
}
else
{
mAllFilter
.
categoryId3List
.
remove
(
loveEmotionList
[
position
].
cate_id
)
chooseLoveEmotionIndexList
.
remove
(
position
)
}
}
loveEmotionAdapter
.
notifyDataSetChanged
()
}
// 婚姻家庭
ivSortMarriedFamily
=
view
.
iv_sort_married_family
val
rvSortMarriedFamily
=
view
.
rv_sort_married_family
marriedFamilyAdapter
=
SortAdapter
(
marriedFamilyList
)
rvSortMarriedFamily
.
layoutManager
=
FlowLayoutManager
()
rvSortMarriedFamily
.
adapter
=
marriedFamilyAdapter
marriedFamilyAdapter
.
setOnItemClickListener
{
adapter
,
view
,
position
->
if
(
position
==
0
){
if
(
marriedFamilyList
[
0
].
isSelected
){
marriedFamilyList
[
0
].
isSelected
=
false
mAllFilter
.
categoryId2List
.
remove
(
marriedFamilyList
[
0
].
cate_id
)
chooseMarriedFamilyIndexList
.
remove
(
position
)
}
else
{
marriedFamilyList
.
forEachIndexed
{
index
,
_
->
marriedFamilyList
[
index
].
isSelected
=
index
==
0
if
(
index
==
0
){
mAllFilter
.
categoryId2List
.
add
(
marriedFamilyList
[
0
].
cate_id
)
}
else
{
mAllFilter
.
categoryId3List
.
remove
(
marriedFamilyList
[
index
].
cate_id
)
}
}
chooseMarriedFamilyIndexList
.
add
(
position
)
}
}
else
{
if
(!
marriedFamilyList
[
position
].
isSelected
&&
marriedFamilyList
[
0
].
isSelected
){
marriedFamilyList
[
0
].
isSelected
=
false
mAllFilter
.
categoryId2List
.
remove
(
marriedFamilyList
[
0
].
cate_id
)
}
marriedFamilyList
[
position
].
isSelected
=
!
marriedFamilyList
[
position
].
isSelected
if
(
marriedFamilyList
[
position
].
isSelected
){
mAllFilter
.
categoryId3List
.
add
(
marriedFamilyList
[
position
].
cate_id
)
chooseMarriedFamilyIndexList
.
add
(
position
)
}
else
{
mAllFilter
.
categoryId3List
.
remove
(
marriedFamilyList
[
position
].
cate_id
)
chooseMarriedFamilyIndexList
.
remove
(
position
)
}
}
marriedFamilyAdapter
.
notifyDataSetChanged
()
}
// 个人成长
ivSortPersonalGrowth
=
view
.
iv_sort_personal_growth
val
rvSortPersonalGrowth
=
view
.
rv_sort_personal_growth
personalGrowthAdapter
=
SortAdapter
(
personalGrowthList
)
rvSortPersonalGrowth
.
layoutManager
=
FlowLayoutManager
()
rvSortPersonalGrowth
.
adapter
=
personalGrowthAdapter
personalGrowthAdapter
.
setOnItemClickListener
{
adapter
,
view
,
position
->
if
(
position
==
0
){
if
(
personalGrowthList
[
0
].
isSelected
){
personalGrowthList
[
0
].
isSelected
=
false
mAllFilter
.
categoryId2List
.
remove
(
personalGrowthList
[
0
].
cate_id
)
choosePersonalGrowthIndexList
.
remove
(
position
)
}
else
{
personalGrowthList
.
forEachIndexed
{
index
,
_
->
personalGrowthList
[
index
].
isSelected
=
index
==
0
if
(
index
==
0
){
mAllFilter
.
categoryId2List
.
add
(
personalGrowthList
[
0
].
cate_id
)
}
else
{
mAllFilter
.
categoryId3List
.
remove
(
personalGrowthList
[
index
].
cate_id
)
}
}
choosePersonalGrowthIndexList
.
add
(
position
)
}
}
else
{
if
(!
personalGrowthList
[
position
].
isSelected
&&
personalGrowthList
[
0
].
isSelected
){
personalGrowthList
[
0
].
isSelected
=
false
mAllFilter
.
categoryId2List
.
remove
(
childList
[
0
].
cate_id
)
}
personalGrowthList
[
position
].
isSelected
=
!
personalGrowthList
[
position
].
isSelected
if
(
personalGrowthList
[
position
].
isSelected
){
mAllFilter
.
categoryId3List
.
add
(
personalGrowthList
[
position
].
cate_id
)
choosePersonalGrowthIndexList
.
add
(
position
)
}
else
{
mAllFilter
.
categoryId3List
.
remove
(
personalGrowthList
[
position
].
cate_id
)
choosePersonalGrowthIndexList
.
remove
(
position
)
}
}
personalGrowthAdapter
.
notifyDataSetChanged
()
}
// 人际关系
ivSortInterpersonalRelationship
=
view
.
iv_sort_interpersonal_relationship
val
rvSortInterpersonalRelationship
=
view
.
rv_sort_interpersonal_relationship
interpersonalRelationshipAdapter
=
SortAdapter
(
interpersonalRelationshipList
)
rvSortInterpersonalRelationship
.
layoutManager
=
FlowLayoutManager
()
rvSortInterpersonalRelationship
.
adapter
=
interpersonalRelationshipAdapter
interpersonalRelationshipAdapter
.
setOnItemClickListener
{
adapter
,
view
,
position
->
if
(
position
==
0
){
if
(
interpersonalRelationshipList
[
0
].
isSelected
){
interpersonalRelationshipList
[
0
].
isSelected
=
false
mAllFilter
.
categoryId2List
.
remove
(
interpersonalRelationshipList
[
0
].
cate_id
)
chooseInterpersonalRelationshipIndexList
.
remove
(
position
)
}
else
{
interpersonalRelationshipList
.
forEachIndexed
{
index
,
_
->
interpersonalRelationshipList
[
index
].
isSelected
=
index
==
0
if
(
index
==
0
){
mAllFilter
.
categoryId2List
.
add
(
interpersonalRelationshipList
[
0
].
cate_id
)
}
else
{
mAllFilter
.
categoryId3List
.
remove
(
interpersonalRelationshipList
[
index
].
cate_id
)
}
}
chooseInterpersonalRelationshipIndexList
.
add
(
position
)
}
}
else
{
if
(!
interpersonalRelationshipList
[
position
].
isSelected
&&
interpersonalRelationshipList
[
0
].
isSelected
){
interpersonalRelationshipList
[
0
].
isSelected
=
false
mAllFilter
.
categoryId2List
.
remove
(
interpersonalRelationshipList
[
0
].
cate_id
)
}
interpersonalRelationshipList
[
position
].
isSelected
=
!
interpersonalRelationshipList
[
position
].
isSelected
if
(
interpersonalRelationshipList
[
position
].
isSelected
){
mAllFilter
.
categoryId3List
.
add
(
interpersonalRelationshipList
[
position
].
cate_id
)
chooseInterpersonalRelationshipIndexList
.
add
(
position
)
}
else
{
mAllFilter
.
categoryId3List
.
remove
(
interpersonalRelationshipList
[
position
].
cate_id
)
chooseInterpersonalRelationshipIndexList
.
remove
(
position
)
}
}
interpersonalRelationshipAdapter
.
notifyDataSetChanged
()
}
// 职场发展
ivSortCareerDevelopment
=
view
.
iv_sort_career_development
val
rvSortCareerDevelopment
=
view
.
rv_sort_career_development
careerDevelopmentAdapter
=
SortAdapter
(
careerDevelopmentList
)
rvSortCareerDevelopment
.
layoutManager
=
FlowLayoutManager
()
rvSortCareerDevelopment
.
adapter
=
careerDevelopmentAdapter
careerDevelopmentAdapter
.
setOnItemClickListener
{
adapter
,
view
,
position
->
if
(
position
==
0
){
if
(
careerDevelopmentList
[
0
].
isSelected
){
careerDevelopmentList
[
0
].
isSelected
=
false
mAllFilter
.
categoryId2List
.
remove
(
childList
[
0
].
cate_id
)
chooseCareerDevelopmentIndexList
.
remove
(
position
)
}
else
{
careerDevelopmentList
.
forEachIndexed
{
index
,
_
->
careerDevelopmentList
[
index
].
isSelected
=
index
==
0
if
(
index
==
0
){
mAllFilter
.
categoryId2List
.
add
(
careerDevelopmentList
[
0
].
cate_id
)
}
else
{
mAllFilter
.
categoryId3List
.
remove
(
careerDevelopmentList
[
index
].
cate_id
)
}
}
chooseCareerDevelopmentIndexList
.
add
(
position
)
}
}
else
{
if
(!
careerDevelopmentList
[
position
].
isSelected
&&
careerDevelopmentList
[
0
].
isSelected
){
careerDevelopmentList
[
0
].
isSelected
=
false
}
careerDevelopmentList
[
position
].
isSelected
=
!
careerDevelopmentList
[
position
].
isSelected
if
(
careerDevelopmentList
[
position
].
isSelected
){
mAllFilter
.
categoryId3List
.
add
(
careerDevelopmentList
[
position
].
cate_id
)
chooseCareerDevelopmentIndexList
.
add
(
position
)
}
else
{
mAllFilter
.
categoryId3List
.
remove
(
careerDevelopmentList
[
position
].
cate_id
)
chooseCareerDevelopmentIndexList
.
remove
(
position
)
}
}
careerDevelopmentAdapter
.
notifyDataSetChanged
()
}
// 心理健康
ivSortMentalHealth
=
view
.
iv_sort_mental_health
val
rvSortMentalHealth
=
view
.
rv_sort_mental_health
mentalHealthAdapter
=
SortAdapter
(
mentalHealthList
)
rvSortMentalHealth
.
layoutManager
=
FlowLayoutManager
()
rvSortMentalHealth
.
adapter
=
mentalHealthAdapter
mentalHealthAdapter
.
setOnItemClickListener
{
adapter
,
view
,
position
->
if
(
position
==
0
){
if
(
mentalHealthList
[
0
].
isSelected
){
mentalHealthList
[
0
].
isSelected
=
false
mAllFilter
.
categoryId2List
.
remove
(
mentalHealthList
[
0
].
cate_id
)
chooseMentalHealthIndexList
.
remove
(
position
)
}
else
{
mentalHealthList
.
forEachIndexed
{
index
,
_
->
mentalHealthList
[
index
].
isSelected
=
index
==
0
if
(
index
==
0
){
mAllFilter
.
categoryId2List
.
add
(
mentalHealthList
[
0
].
cate_id
)
}
else
{
mAllFilter
.
categoryId3List
.
remove
(
mentalHealthList
[
index
].
cate_id
)
}
}
chooseMentalHealthIndexList
.
add
(
position
)
}
}
else
{
if
(!
mentalHealthList
[
position
].
isSelected
&&
mentalHealthList
[
0
].
isSelected
){
mentalHealthList
[
0
].
isSelected
=
false
}
mentalHealthList
[
position
].
isSelected
=
!
mentalHealthList
[
position
].
isSelected
if
(
mentalHealthList
[
position
].
isSelected
){
mAllFilter
.
categoryId3List
.
add
(
mentalHealthList
[
position
].
cate_id
)
chooseMentalHealthIndexList
.
add
(
position
)
}
else
{
mAllFilter
.
categoryId3List
.
remove
(
mentalHealthList
[
position
].
cate_id
)
chooseMentalHealthIndexList
.
remove
(
position
)
}
}
mentalHealthAdapter
.
notifyDataSetChanged
()
}
/**
* 原来的筛选项写在PopupWindow里边,数据太多的情况下,弹窗第一次打开很慢,所以这里做了一个骚操作,
* 先加载亲子教育和情绪压力的12条数据,之后再加载全部,后期时间充裕可以优化,直接做到页面里边,不要写在PopupWindow里边
*/
// 亲子教育
if
(
mAllFilter
.
childList
.
size
>
12
){
childList
.
addAll
(
mAllFilter
.
childList
.
subList
(
0
,
12
))
}
else
{
childList
.
addAll
(
mAllFilter
.
childList
)
}
childEducationAdapter
.
notifyDataSetChanged
()
if
(
mAllFilter
.
childList
.
size
>
12
){
ivSortChildEducationOpen
.
visibility
=
View
.
VISIBLE
view
.
ll_sort_child_education_open
.
setOnClickListener
{
if
(!
childEducationAdapter
.
isVisible
){
if
(
childList
.
size
<=
12
){
childList
.
addAll
(
mAllFilter
.
childList
.
subList
(
12
,
mAllFilter
.
childList
.
size
))
childEducationAdapter
.
notifyDataSetChanged
()
}
childEducationAdapter
.
setAllVisible
()
ivSortChildEducationOpen
.
setImageResource
(
R
.
drawable
.
consultant_ic_sort_open
)
}
else
{
childEducationAdapter
.
setGone
()
ivSortChildEducationOpen
.
setImageResource
(
R
.
drawable
.
consultant_ic_sort_close
)
}
}
}
// 情绪压力
if
(
mAllFilter
.
stressList
.
size
>
12
){
stressList
.
addAll
(
mAllFilter
.
stressList
.
subList
(
0
,
12
))
}
else
{
stressList
.
addAll
(
mAllFilter
.
stressList
)
}
stressAdapter
.
notifyDataSetChanged
()
if
(
mAllFilter
.
stressList
.
size
>
12
){
ivSortEmotionalStress
.
visibility
=
View
.
VISIBLE
view
.
ll_sort_emotional_stress
.
setOnClickListener
{
if
(!
stressAdapter
.
isVisible
){
if
(
stressList
.
size
<=
12
){
stressList
.
addAll
(
mAllFilter
.
stressList
.
subList
(
12
,
mAllFilter
.
stressList
.
size
))
stressAdapter
.
notifyDataSetChanged
()
}
stressAdapter
.
setAllVisible
()
ivSortEmotionalStress
.
setImageResource
(
R
.
drawable
.
consultant_ic_sort_open
)
}
else
{
stressAdapter
.
setGone
()
ivSortEmotionalStress
.
setImageResource
(
R
.
drawable
.
consultant_ic_sort_close
)
}
}
}
}
fun
updateData
(){
// 恋爱情感
loveEmotionList
.
addAll
(
mAllFilter
.
loveEmotionList
)
loveEmotionAdapter
.
notifyDataSetChanged
()
if
(
loveEmotionList
.
size
>
12
){
ivSortLoveEmotion
.
visibility
=
View
.
VISIBLE
view
.
ll_sort_love_emotion
.
setOnClickListener
{
if
(!
loveEmotionAdapter
.
isVisible
){
loveEmotionAdapter
.
setAllVisible
()
ivSortLoveEmotion
.
setImageResource
(
R
.
drawable
.
consultant_ic_sort_open
)
}
else
{
loveEmotionAdapter
.
setGone
()
ivSortLoveEmotion
.
setImageResource
(
R
.
drawable
.
consultant_ic_sort_close
)
}
}
}
// 婚姻家庭
marriedFamilyList
.
addAll
(
mAllFilter
.
marriedFamilyList
)
marriedFamilyAdapter
.
notifyDataSetChanged
()
if
(
marriedFamilyList
.
size
>
12
){
ivSortMarriedFamily
.
visibility
=
View
.
VISIBLE
view
.
ll_sort_married_family
.
setOnClickListener
{
if
(!
marriedFamilyAdapter
.
isVisible
){
marriedFamilyAdapter
.
setAllVisible
()
ivSortMarriedFamily
.
setImageResource
(
R
.
drawable
.
consultant_ic_sort_open
)
}
else
{
marriedFamilyAdapter
.
setGone
()
ivSortMarriedFamily
.
setImageResource
(
R
.
drawable
.
consultant_ic_sort_close
)
}
}
}
// 个人成长
personalGrowthList
.
addAll
(
mAllFilter
.
personalGrowthList
)
personalGrowthAdapter
.
notifyDataSetChanged
()
if
(
personalGrowthList
.
size
>
12
){
ivSortPersonalGrowth
.
visibility
=
View
.
VISIBLE
view
.
ll_sort_personal_growth
.
setOnClickListener
{
if
(!
personalGrowthAdapter
.
isVisible
){
personalGrowthAdapter
.
setAllVisible
()
ivSortPersonalGrowth
.
setImageResource
(
R
.
drawable
.
consultant_ic_sort_open
)
}
else
{
personalGrowthAdapter
.
setGone
()
ivSortPersonalGrowth
.
setImageResource
(
R
.
drawable
.
consultant_ic_sort_close
)
}
}
}
// 人际关系
interpersonalRelationshipList
.
addAll
(
mAllFilter
.
interpersonalRelationshipList
)
interpersonalRelationshipAdapter
.
notifyDataSetChanged
()
if
(
interpersonalRelationshipList
.
size
>
12
){
ivSortInterpersonalRelationship
.
visibility
=
View
.
VISIBLE
view
.
ll_sort_interpersonal_relationship
.
setOnClickListener
{
if
(!
interpersonalRelationshipAdapter
.
isVisible
){
interpersonalRelationshipAdapter
.
setAllVisible
()
ivSortInterpersonalRelationship
.
setImageResource
(
R
.
drawable
.
consultant_ic_sort_open
)
}
else
{
interpersonalRelationshipAdapter
.
setGone
()
ivSortInterpersonalRelationship
.
setImageResource
(
R
.
drawable
.
consultant_ic_sort_close
)
}
}
}
// 职场发展
careerDevelopmentList
.
addAll
(
mAllFilter
.
careerDevelopmentList
)
careerDevelopmentAdapter
.
notifyDataSetChanged
()
if
(
careerDevelopmentList
.
size
>
12
){
ivSortCareerDevelopment
.
visibility
=
View
.
VISIBLE
view
.
ll_sort_career_development
.
setOnClickListener
{
if
(!
careerDevelopmentAdapter
.
isVisible
){
careerDevelopmentAdapter
.
setAllVisible
()
ivSortCareerDevelopment
.
setImageResource
(
R
.
drawable
.
consultant_ic_sort_open
)
}
else
{
careerDevelopmentAdapter
.
setGone
()
ivSortCareerDevelopment
.
setImageResource
(
R
.
drawable
.
consultant_ic_sort_close
)
}
}
}
// 心理健康
mentalHealthList
.
addAll
(
mAllFilter
.
mentalHealthList
)
mentalHealthAdapter
.
notifyDataSetChanged
()
if
(
mentalHealthList
.
size
>
12
){
ivSortMentalHealth
.
visibility
=
View
.
VISIBLE
view
.
ll_sort_mental_health
.
setOnClickListener
{
if
(!
mentalHealthAdapter
.
isVisible
){
mentalHealthAdapter
.
setAllVisible
()
ivSortMentalHealth
.
setImageResource
(
R
.
drawable
.
consultant_ic_sort_open
)
}
else
{
mentalHealthAdapter
.
setGone
()
ivSortMentalHealth
.
setImageResource
(
R
.
drawable
.
consultant_ic_sort_close
)
}
}
}
}
}
\ No newline at end of file
m-consultant/src/main/java/com/yidianling/consultant/ui/view/FilterPopupWindow.kt
View file @
e4ed1517
...
...
@@ -34,17 +34,14 @@ import io.reactivex.schedulers.Schedulers
import
kotlinx.android.synthetic.main.consultant_item_filter.view.*
import
kotlinx.android.synthetic.main.consultant_item_price_range.view.*
import
kotlinx.android.synthetic.main.consultant_ui_filter_popup.view.*
import
kotlin.math.roundToInt
/**
* 筛选弹窗
* Created by zqk on 17-9-15.
*/
class
FilterPopupWindow
(
private
val
context
:
Context
,
private
val
filterData
:
Filters
,
private
val
tempFilter
:
AllFilter
)
:
PopupWindow
(
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
)
{
class
FilterPopupWindow
(
private
val
context
:
Context
,
private
val
filterData
:
Filters
,
private
val
tempFilter
:
AllFilter
)
:
PopupWindow
(
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
)
{
private
val
mDisposableList
=
CompositeDisposable
()
...
...
@@ -121,7 +118,7 @@ class FilterPopupWindow(
@SuppressLint
(
"ClickableViewAccessibility"
)
private
fun
initKeyboardListener
(
view
:
View
)
{
va
r
svFilter
=
view
.
findViewById
<
ScrollView
>(
R
.
id
.
sv_filter
)
va
l
svFilter
=
view
.
findViewById
<
ScrollView
>(
R
.
id
.
sv_filter
)
val
imm
=
context
.
getSystemService
(
Context
.
INPUT_METHOD_SERVICE
)
as
InputMethodManager
svFilter
.
setOnTouchListener
{
_
,
_
->
...
...
@@ -282,7 +279,7 @@ class FilterPopupWindow(
account
+=
tempFilter
.
priceRanges
?.
maxPrice
?.
toDouble
()
!!
}
biEventParams
=
(
Math
.
round
(
account
/
2
)).
toString
()
biEventParams
=
(
(
account
/
2
).
roundToInt
(
)).
toString
()
}
}
...
...
@@ -294,7 +291,7 @@ class FilterPopupWindow(
.
subscribeOn
(
Schedulers
.
io
())
.
compose
(
RxUtils
.
resultJavaData
())
.
map
{
it
}
.
filter
{
it
!=
null
}
.
filter
{
true
}
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
({
...
...
m-consultant/src/main/java/com/yidianling/consultant/ui/view/SortPopupWindow.kt
View file @
e4ed1517
...
...
@@ -16,7 +16,7 @@ import kotlinx.android.synthetic.main.consultant_ui_sort_popup_window.view.*
* 排序弹窗
* Created by zqk on 17-9-15.
*/
class
SortPopupWindow
(
val
context
:
Context
,
private
val
sortItems
:
ArrayList
<
ReorderItem
>,
var
selectedSort
:
ReorderItem
,
private
val
onSortItemSelectedListener
:
OnSortItemSelectedListener
)
class
SortPopupWindow
(
val
context
:
Context
,
sortItems
:
ArrayList
<
ReorderItem
>,
var
selectedSort
:
ReorderItem
,
onSortItemSelectedListener
:
OnSortItemSelectedListener
)
:
PopupWindow
(
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
)
{
private
var
adapter
:
SortRecyclerViewAdapter
...
...
@@ -31,12 +31,7 @@ class SortPopupWindow(val context: Context, private val sortItems: ArrayList<Reo
val
rvSortItem
=
view
.
rvSortItem
adapter
=
SortRecyclerViewAdapter
(
context
,
sortItems
,
selectedSort
,
onSortItemSelectedListener
)
rvSortItem
.
adapter
=
adapter
rvSortItem
.
layoutManager
=
LinearLayoutManager
(
context
,
LinearLayoutManager
.
VERTICAL
,
false
)
rvSortItem
.
layoutManager
=
LinearLayoutManager
(
context
,
LinearLayoutManager
.
VERTICAL
,
false
)
// rvSortItem.addItemDecoration(DividerItemDecoration(context, LinearLayoutManager.VERTICAL))
}
...
...
m-consultant/src/main/res/drawable-xhdpi/consultant_ic_sort_close.png
0 → 100644
View file @
e4ed1517
973 Bytes
m-consultant/src/main/res/drawable-xhdpi/consultant_ic_sort_open.png
0 → 100644
View file @
e4ed1517
1.09 KB
m-consultant/src/main/res/drawable/consultant_solid_
1da1f2
_r_8.xml
→
m-consultant/src/main/res/drawable/consultant_solid_
main_theme_color
_r_8.xml
View file @
e4ed1517
File moved
m-consultant/src/main/res/layout/consultant_item_sort1.xml
0 → 100644
View file @
e4ed1517
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:paddingStart=
"10dp"
android:paddingTop=
"12dp"
android:orientation=
"vertical"
android:id=
"@+id/ll_sort_item"
>
<TextView
android:id=
"@+id/tv_sort_name"
android:layout_width=
"75dp"
android:layout_height=
"34dp"
android:gravity=
"center"
android:textColor=
"@color/consultant_color_search_filter_selector"
android:orientation=
"vertical"
android:background=
"@drawable/consultant_bg_search_filter_selector"
android:textSize=
"14sp"
tools:text=
"恋爱婚姻"
/>
</LinearLayout>
m-consultant/src/main/res/layout/consultant_item_sort2.xml
0 → 100644
View file @
e4ed1517
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:paddingStart=
"10dp"
android:paddingTop=
"12dp"
android:orientation=
"vertical"
android:id=
"@+id/ll_sort_item"
>
<TextView
android:id=
"@+id/tv_sort_name"
android:layout_width=
"wrap_content"
android:layout_height=
"34dp"
android:gravity=
"center"
android:textColor=
"@color/consultant_color_search_filter_selector"
android:orientation=
"vertical"
android:paddingStart=
"8dp"
android:paddingEnd=
"8dp"
android:background=
"@drawable/consultant_bg_search_filter_selector"
android:textSize=
"14sp"
tools:text=
"恋爱婚姻"
/>
</LinearLayout>
m-consultant/src/main/res/layout/consultant_item_subject.xml
View file @
e4ed1517
<?xml version="1.0" encoding="utf-8"?>
<TextView
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
android:id=
"@+id/tv
SubjectName"
android:id=
"@+id/tv
_sort_name"
android:layout_width=
"match_parent"
android:layout_height=
"36dp"
android:gravity=
"center"
...
...
m-consultant/src/main/res/layout/consultant_ui_subject_popup_window.xml
View file @
e4ed1517
<?xml version="1.0" encoding="utf-8"?>
<
Linear
Layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<
androidx.constraintlayout.widget.Constraint
Layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"566dp"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:background=
"@color/platform_white"
android:orientation=
"vertical"
>
<androidx.core.widget.NestedScrollView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
app:layout_constraintTop_toTopOf=
"parent"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
android:layout_marginBottom=
"68dp"
>
<LinearLayout
android:id=
"@+id/ll_sort_child_education_open"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
android:paddingStart=
"@dimen/platform_dp_16"
android:paddingEnd=
"@dimen/platform_dp_16"
android:layout_marginTop=
"@dimen/platform_dp_17"
android:gravity=
"center_vertical"
>
<TextView
android:layout_width=
"0dp"
android:layout_weight=
"1"
android:layout_height=
"wrap_content"
android:text=
"亲子教育"
android:textSize=
"16sp"
android:textColor=
"@color/platform_color_242424"
android:includeFontPadding=
"false"
android:fontFamily=
"sans-serif-medium"
/>
<ImageView
android:id=
"@+id/iv_sort_child_education_open"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:src=
"@drawable/consultant_ic_sort_close"
android:visibility=
"gone"
/>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv_sort_child_education"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"6dp"
android:overScrollMode=
"never"
/>
<LinearLayout
android:id=
"@+id/ll_sort_emotional_stress"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
android:paddingStart=
"@dimen/platform_dp_16"
android:paddingEnd=
"@dimen/platform_dp_16"
android:layout_marginTop=
"@dimen/platform_dp_21"
android:gravity=
"center_vertical"
>
<TextView
android:layout_width=
"0dp"
android:layout_weight=
"1"
android:layout_height=
"wrap_content"
android:text=
"情绪压力"
android:textSize=
"16sp"
android:textColor=
"@color/platform_color_242424"
android:includeFontPadding=
"false"
android:fontFamily=
"sans-serif-medium"
/>
<ImageView
android:id=
"@+id/iv_sort_emotional_stress"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:src=
"@drawable/consultant_ic_sort_close"
android:visibility=
"gone"
/>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv_sort_emotional_stress"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"6dp"
android:overScrollMode=
"never"
/>
<LinearLayout
android:id=
"@+id/ll_sort_love_emotion"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
android:paddingStart=
"@dimen/platform_dp_16"
android:paddingEnd=
"@dimen/platform_dp_16"
android:layout_marginTop=
"@dimen/platform_dp_21"
android:gravity=
"center_vertical"
>
<TextView
android:layout_width=
"0dp"
android:layout_weight=
"1"
android:layout_height=
"wrap_content"
android:text=
"恋爱情感"
android:textSize=
"16sp"
android:textColor=
"@color/platform_color_242424"
android:includeFontPadding=
"false"
android:fontFamily=
"sans-serif-medium"
/>
<ImageView
android:id=
"@+id/iv_sort_love_emotion"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:src=
"@drawable/consultant_ic_sort_close"
android:visibility=
"gone"
/>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv_sort_love_emotion"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"6dp"
android:overScrollMode=
"never"
/>
<LinearLayout
android:id=
"@+id/ll_sort_married_family"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
android:paddingStart=
"@dimen/platform_dp_16"
android:paddingEnd=
"@dimen/platform_dp_16"
android:layout_marginTop=
"@dimen/platform_dp_21"
android:gravity=
"center_vertical"
>
<TextView
android:layout_width=
"0dp"
android:layout_weight=
"1"
android:layout_height=
"wrap_content"
android:text=
"婚姻家庭"
android:textSize=
"16sp"
android:textColor=
"@color/platform_color_242424"
android:includeFontPadding=
"false"
android:fontFamily=
"sans-serif-medium"
/>
<ImageView
android:id=
"@+id/iv_sort_married_family"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:src=
"@drawable/consultant_ic_sort_close"
android:visibility=
"gone"
/>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv_sort_married_family"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"6dp"
android:overScrollMode=
"never"
/>
<LinearLayout
android:id=
"@+id/ll_sort_personal_growth"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
android:paddingStart=
"@dimen/platform_dp_16"
android:paddingEnd=
"@dimen/platform_dp_16"
android:layout_marginTop=
"@dimen/platform_dp_21"
android:gravity=
"center_vertical"
>
<TextView
android:layout_width=
"0dp"
android:layout_weight=
"1"
android:layout_height=
"wrap_content"
android:text=
"个人成长"
android:textSize=
"16sp"
android:textColor=
"@color/platform_color_242424"
android:includeFontPadding=
"false"
android:fontFamily=
"sans-serif-medium"
/>
<ImageView
android:id=
"@+id/iv_sort_personal_growth"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"服务类型"
android:textSize=
"@dimen/platform_dp_16"
android:src=
"@drawable/consultant_ic_sort_close"
android:visibility=
"gone"
/>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv_sort_personal_growth"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"6dp"
android:overScrollMode=
"never"
/>
<LinearLayout
android:id=
"@+id/ll_sort_interpersonal_relationship"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
android:paddingStart=
"@dimen/platform_dp_16"
android:paddingEnd=
"@dimen/platform_dp_16"
android:layout_marginTop=
"@dimen/platform_dp_21"
android:gravity=
"center_vertical"
>
<TextView
android:layout_width=
"0dp"
android:layout_weight=
"1"
android:layout_height=
"wrap_content"
android:text=
"人际关系"
android:textSize=
"16sp"
android:textColor=
"@color/platform_color_242424"
android:textStyle=
"bold"
android:layout_marginTop=
"@dimen/platform_dp_24"
android:layout_marginStart=
"@dimen/platform_dp_15"
android:layout_marginBottom=
"7dp"
/>
android:includeFontPadding=
"false"
android:fontFamily=
"sans-serif-medium"
/>
<ImageView
android:id=
"@+id/iv_sort_interpersonal_relationship"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:src=
"@drawable/consultant_ic_sort_close"
android:visibility=
"gone"
/>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rvSubject
"
android:id=
"@+id/rv_sort_interpersonal_relationship
"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"10dp"
android:layout_marginRight=
"10dp"
android:overScrollMode=
"never"
/>
android:layout_marginStart=
"6dp"
android:overScrollMode=
"never"
/>
<LinearLayout
android:id=
"@+id/ll_sort_career_development"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
android:paddingStart=
"@dimen/platform_dp_16"
android:paddingEnd=
"@dimen/platform_dp_16"
android:layout_marginTop=
"@dimen/platform_dp_21"
android:gravity=
"center_vertical"
>
<TextView
android:layout_width=
"0dp"
android:layout_weight=
"1"
android:layout_height=
"wrap_content"
android:text=
"职场发展"
android:textSize=
"16sp"
android:textColor=
"@color/platform_color_242424"
android:includeFontPadding=
"false"
android:fontFamily=
"sans-serif-medium"
/>
<ImageView
android:id=
"@+id/iv_sort_career_development"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:src=
"@drawable/consultant_ic_sort_close"
android:visibility=
"gone"
/>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv_sort_career_development"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"6dp"
android:overScrollMode=
"never"
/>
<LinearLayout
android:id=
"@+id/ll_sort_mental_health"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
android:paddingStart=
"@dimen/platform_dp_16"
android:paddingEnd=
"@dimen/platform_dp_16"
android:layout_marginTop=
"@dimen/platform_dp_21"
android:gravity=
"center_vertical"
>
<TextView
android:layout_width=
"0dp"
android:layout_weight=
"1"
android:layout_height=
"wrap_content"
android:text=
"心理健康"
android:textSize=
"16sp"
android:textColor=
"@color/platform_color_242424"
android:includeFontPadding=
"false"
android:fontFamily=
"sans-serif-medium"
/>
<ImageView
android:id=
"@+id/iv_sort_mental_health"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:src=
"@drawable/consultant_ic_sort_close"
android:visibility=
"gone"
/>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv_sort_mental_health"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"6dp"
android:overScrollMode=
"never"
/>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
<LinearLayout
android:layout_width=
"match_parent"
...
...
@@ -31,6 +324,8 @@
android:paddingStart=
"16dp"
android:paddingEnd=
"16dp"
android:paddingTop=
"8dp"
android:background=
"@color/white"
app:layout_constraintBottom_toBottomOf=
"parent"
>
<TextView
...
...
@@ -50,12 +345,12 @@
android:layout_weight=
"1"
android:layout_height=
"44dp"
android:layout_marginStart=
"13dp"
android:background=
"@drawable/consultant_solid_
1da1f2
_r_8"
android:background=
"@drawable/consultant_solid_
main_theme_color
_r_8"
android:gravity=
"center"
android:text=
"@string/platform_confirm"
android:textSize=
"16sp"
android:textColor=
"@color/
platform_but_text_color
"
/>
android:textColor=
"@color/
white
"
/>
</LinearLayout>
</
Linear
Layout>
</
androidx.constraintlayout.widget.Constraint
Layout>
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