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
2065d51c
Commit
2065d51c
authored
Sep 07, 2021
by
YKai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 咨询地区筛选接口调整,逻辑调整
parent
4cf90405
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
108 additions
and
129 deletions
+108
-129
DemoGlobalConfig.java
app/src/main/java/com/ydl/component/base/DemoGlobalConfig.java
+2
-2
config.gradle
config.gradle
+2
-2
ExpertSearchActivity.kt
m-consultant/src/main/java/com/yidianling/consultant/ExpertSearchActivity.kt
+13
-22
ExpertSearchFragment.kt
m-consultant/src/main/java/com/yidianling/consultant/ExpertSearchFragment.kt
+17
-29
ExpertSearchPresenter.kt
m-consultant/src/main/java/com/yidianling/consultant/ExpertSearchPresenter.kt
+38
-30
RegionRecyclerViewAdapter.kt
m-consultant/src/main/java/com/yidianling/consultant/adapter/RegionRecyclerViewAdapter.kt
+9
-16
SubRecyclerViewAdapter.kt
m-consultant/src/main/java/com/yidianling/consultant/adapter/SubRecyclerViewAdapter.kt
+6
-15
SearchApi.kt
m-consultant/src/main/java/com/yidianling/consultant/model/SearchApi.kt
+1
-1
RegionItem.kt
m-consultant/src/main/java/com/yidianling/consultant/model/bean/RegionItem.kt
+5
-1
SubItem.kt
m-consultant/src/main/java/com/yidianling/consultant/model/bean/SubItem.kt
+5
-1
AreaPopupWindow.kt
m-consultant/src/main/java/com/yidianling/consultant/ui/view/AreaPopupWindow.kt
+10
-10
No files found.
app/src/main/java/com/ydl/component/base/DemoGlobalConfig.java
View file @
2065d51c
...
@@ -20,9 +20,9 @@ import java.util.List;
...
@@ -20,9 +20,9 @@ import java.util.List;
public
final
class
DemoGlobalConfig
implements
IConfigModule
{
public
final
class
DemoGlobalConfig
implements
IConfigModule
{
String
APP_DOMAIN
=
"https://api.github.com/"
;
String
APP_DOMAIN
=
"https://api.github.com/"
;
// public static String appEnv = YDLConstants.ENV_AUTO_TEST;
// 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_NEW_TEST;//配置未上传到maven库
public
static
String
appEnv
=
YDLConstants
.
ENV_PROD
;
//
public static String appEnv = YDLConstants.ENV_PROD;
@Override
@Override
public
void
injectAppLifecycle
(
@NotNull
Context
context
,
@NotNull
List
<
IAppLifecycles
>
lifecycles
)
{
public
void
injectAppLifecycle
(
@NotNull
Context
context
,
@NotNull
List
<
IAppLifecycles
>
lifecycles
)
{
...
...
config.gradle
View file @
2065d51c
...
@@ -6,7 +6,7 @@ ext {
...
@@ -6,7 +6,7 @@ ext {
// -------------- 业务模块 --------------
// -------------- 业务模块 --------------
//第三步 若干
//第三步 若干
"m-confide"
:
"0.0.49.13"
,
"m-confide"
:
"0.0.49.13"
,
"m-consultant"
:
"0.0.59.9
2
"
,
"m-consultant"
:
"0.0.59.9
3
"
,
"m-fm"
:
"0.0.30.04"
,
"m-fm"
:
"0.0.30.04"
,
"m-user"
:
"0.0.61.56"
,
"m-user"
:
"0.0.61.56"
,
"m-home"
:
"0.0.22.71"
,
"m-home"
:
"0.0.22.71"
,
...
@@ -89,7 +89,7 @@ ext {
...
@@ -89,7 +89,7 @@ ext {
//第三步 若干
//第三步 若干
"m-confide"
:
"0.0.49.13"
,
"m-confide"
:
"0.0.49.13"
,
"m-consultant"
:
"0.0.59.9
2
"
,
"m-consultant"
:
"0.0.59.9
3
"
,
"m-fm"
:
"0.0.30.04"
,
"m-fm"
:
"0.0.30.04"
,
"m-user"
:
"0.0.61.56"
,
"m-user"
:
"0.0.61.56"
,
"m-home"
:
"0.0.22.71"
,
"m-home"
:
"0.0.22.71"
,
...
...
m-consultant/src/main/java/com/yidianling/consultant/ExpertSearchActivity.kt
View file @
2065d51c
...
@@ -561,16 +561,16 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
...
@@ -561,16 +561,16 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
if
(
hasSelectedArea
)
{
if
(
hasSelectedArea
)
{
for
((
index
,
bean
)
in
headData
!!
.
highlighter
.
withIndex
())
{
for
((
index
,
bean
)
in
headData
!!
.
highlighter
.
withIndex
())
{
if
(
bean
.
type
==
"2"
||
bean
.
type
==
"8"
)
{
if
(
bean
.
type
==
"2"
||
bean
.
type
==
"8"
)
{
va
r
textview
=
lin_filter2
.
getChildAt
(
index
)
as
TextView
va
l
textview
=
lin_filter2
.
getChildAt
(
index
)
as
TextView
textview
.
isSelected
=
false
textview
.
isSelected
=
false
textview
.
paint
.
isFakeBoldText
=
false
textview
.
paint
.
isFakeBoldText
=
false
}
}
}
}
}
}
bean
.
key
=
hotData
.
id
bean
.
code
=
hotData
.
id
bean
.
value
=
hotData
.
value
bean
.
value
=
hotData
.
value
for
(
headBean
in
headData
!!
.
region
)
{
for
(
headBean
in
headData
!!
.
region
)
{
if
(
TextUtils
.
equals
(
headBean
.
key
,
bean
.
key
))
{
if
(
TextUtils
.
equals
(
headBean
.
code
,
bean
.
code
))
{
bean
.
sub
=
headBean
.
sub
bean
.
sub
=
headBean
.
sub
break
break
}
}
...
@@ -712,7 +712,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
...
@@ -712,7 +712,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
"8"
->
{
"8"
->
{
//市
//市
if
(
headData
?.
region
!!
.
size
>
0
)
{
if
(
headData
?.
region
!!
.
size
>
0
)
{
va
r
bean
=
SubItem
()
va
l
bean
=
SubItem
()
if
(
isAdd
)
{
if
(
isAdd
)
{
//热门中如果选择过地区、要把其他已选中的置位未选中
//热门中如果选择过地区、要把其他已选中的置位未选中
if
(
hasSelectedArea
)
{
if
(
hasSelectedArea
)
{
...
@@ -725,12 +725,12 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
...
@@ -725,12 +725,12 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
}
}
}
}
bean
.
key
=
hotData
.
id
bean
.
code
=
hotData
.
id
bean
.
value
=
hotData
.
value
bean
.
value
=
hotData
.
value
for
(
headBean
in
headData
!!
.
region
)
{
for
(
headBean
in
headData
!!
.
region
)
{
if
(
TextUtils
.
equals
(
if
(
TextUtils
.
equals
(
headBean
.
key
!!
.
substring
(
0
,
2
),
headBean
.
code
!!
.
substring
(
0
,
2
),
bean
.
key
!!
.
substring
(
0
,
2
)
bean
.
code
!!
.
substring
(
0
,
2
)
)
)
)
{
)
{
allFilter
.
region
=
headBean
allFilter
.
region
=
headBean
...
@@ -1292,24 +1292,15 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
...
@@ -1292,24 +1292,15 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
updateFilterTextViewStatus
(
tvArea
,
FILTER_STATUS_OPEN
)
updateFilterTextViewStatus
(
tvArea
,
FILTER_STATUS_OPEN
)
allFilter
.
region
=
region
allFilter
.
region
=
region
allFilter
.
sub
=
sub
allFilter
.
sub
=
sub
if
(
region
.
key
==
null
&&
sub
.
key
==
null
)
{
if
(
TextUtils
.
isEmpty
(
region
.
code
)
&&
TextUtils
.
isEmpty
(
sub
.
code
))
{
// LogUtil.d("onRegionSelected: " + region.value)
// props1.put("filtrate_second", region.value)
// BuryPointUtils.buryPoint("Filtrate", props1)
tvArea
.
text
=
"地区"
tvArea
.
text
=
"地区"
}
else
if
(
region
.
key
!=
null
&&
sub
.
key
==
null
)
{
}
else
if
(!
TextUtils
.
isEmpty
(
region
.
code
)
&&
!
TextUtils
.
isEmpty
(
sub
.
code
))
{
// LogUtil.d("onRegionSelected: " + region.value)
// props1.put("filtrate_second", region.value)
// BuryPointUtils.buryPoint("Filtrate", props1)
if
(
region
.
value
?.
length
?:
0
>
4
)
{
if
(
region
.
value
?.
length
?:
0
>
4
)
{
tvArea
.
text
=
region
.
value
?.
substring
(
0
,
3
)
+
"..."
tvArea
.
text
=
region
.
value
?.
substring
(
0
,
3
)
+
"..."
}
else
{
}
else
{
tvArea
.
text
=
region
.
value
tvArea
.
text
=
region
.
value
}
}
}
else
{
}
else
{
// LogUtil.d("onRegionSelected: " + sub.value)
// props1.put("filtrate_second", sub.value)
// BuryPointUtils.buryPoint("Filtrate", props1)
if
(
sub
.
value
?.
length
?:
0
>
4
)
{
if
(
sub
.
value
?.
length
?:
0
>
4
)
{
tvArea
.
text
=
sub
.
value
?.
substring
(
0
,
3
)
+
"..."
tvArea
.
text
=
sub
.
value
?.
substring
(
0
,
3
)
+
"..."
}
else
{
}
else
{
...
@@ -1323,12 +1314,12 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
...
@@ -1323,12 +1314,12 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
//更新热门搜索显示状态
//更新热门搜索显示状态
if
(
headData
!!
.
highlighter
.
size
>
0
)
{
if
(
headData
!!
.
highlighter
.
size
>
0
)
{
for
((
index
,
hot
)
in
headData
!!
.
highlighter
!!
.
withIndex
())
{
for
((
index
,
hot
)
in
headData
!!
.
highlighter
.
withIndex
())
{
if
(
hot
.
type
==
"2"
||
hot
.
type
==
"8"
)
{
if
(
hot
.
type
==
"2"
||
hot
.
type
==
"8"
)
{
var
textview
=
lin_filter2
.
getChildAt
(
index
)
as
TextView
var
textview
=
lin_filter2
.
getChildAt
(
index
)
as
TextView
//有选择城市
//有选择城市
if
(!
TextUtils
.
isEmpty
(
sub
.
key
))
{
if
(!
TextUtils
.
isEmpty
(
sub
.
code
))
{
if
(
TextUtils
.
equals
(
sub
.
key
,
hot
.
id
))
{
if
(
TextUtils
.
equals
(
sub
.
code
,
hot
.
id
))
{
textview
.
isSelected
=
true
textview
.
isSelected
=
true
textview
.
paint
.
isFakeBoldText
=
true
textview
.
paint
.
isFakeBoldText
=
true
hasSelectedArea
=
true
hasSelectedArea
=
true
...
@@ -1337,7 +1328,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
...
@@ -1337,7 +1328,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
textview
.
paint
.
isFakeBoldText
=
false
textview
.
paint
.
isFakeBoldText
=
false
}
}
}
else
{
}
else
{
if
(
TextUtils
.
equals
(
region
.
key
,
hot
.
id
))
{
if
(
TextUtils
.
equals
(
region
.
code
,
hot
.
id
))
{
textview
.
isSelected
=
true
textview
.
isSelected
=
true
textview
.
paint
.
isFakeBoldText
=
true
textview
.
paint
.
isFakeBoldText
=
true
hasSelectedArea
=
true
hasSelectedArea
=
true
...
...
m-consultant/src/main/java/com/yidianling/consultant/ExpertSearchFragment.kt
View file @
2065d51c
...
@@ -512,22 +512,22 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
...
@@ -512,22 +512,22 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
}
}
"2"
->
{
//省
"2"
->
{
//省
if
(
headData
?.
region
!!
.
size
>
0
)
{
if
(
headData
?.
region
!!
.
size
>
0
)
{
va
r
bean
=
RegionItem
()
va
l
bean
=
RegionItem
()
if
(
isAdd
)
{
if
(
isAdd
)
{
//热门中如果选择过地区、要把其他已选中的置位未选中
//热门中如果选择过地区、要把其他已选中的置位未选中
if
(
hasSelectedArea
)
{
if
(
hasSelectedArea
)
{
for
((
index
,
bean
)
in
headData
!!
.
highlighter
.
withIndex
())
{
for
((
index
,
bean
)
in
headData
!!
.
highlighter
.
withIndex
())
{
if
(
bean
.
type
==
"2"
||
bean
.
type
==
"8"
)
{
if
(
bean
.
type
==
"2"
||
bean
.
type
==
"8"
)
{
va
r
textview
=
lin_filter2
.
getChildAt
(
index
)
as
TextView
va
l
textview
=
lin_filter2
.
getChildAt
(
index
)
as
TextView
textview
.
isSelected
=
false
textview
.
isSelected
=
false
textview
.
paint
.
isFakeBoldText
=
false
textview
.
paint
.
isFakeBoldText
=
false
}
}
}
}
}
}
bean
.
key
=
hotData
.
id
bean
.
code
=
hotData
.
id
bean
.
value
=
hotData
.
value
bean
.
value
=
hotData
.
value
for
(
headBean
in
headData
!!
.
region
)
{
for
(
headBean
in
headData
!!
.
region
)
{
if
(
TextUtils
.
equals
(
headBean
.
key
,
bean
.
key
))
{
if
(
TextUtils
.
equals
(
headBean
.
code
,
bean
.
code
))
{
bean
.
sub
=
headBean
.
sub
bean
.
sub
=
headBean
.
sub
break
break
}
}
...
@@ -669,25 +669,25 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
...
@@ -669,25 +669,25 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
"8"
->
{
"8"
->
{
//市
//市
if
(
headData
?.
region
!!
.
size
>
0
)
{
if
(
headData
?.
region
!!
.
size
>
0
)
{
va
r
bean
=
SubItem
()
va
l
bean
=
SubItem
()
if
(
isAdd
)
{
if
(
isAdd
)
{
//热门中如果选择过地区、要把其他已选中的置位未选中
//热门中如果选择过地区、要把其他已选中的置位未选中
if
(
hasSelectedArea
)
{
if
(
hasSelectedArea
)
{
for
((
index
,
bean
)
in
headData
!!
.
highlighter
.
withIndex
())
{
for
((
index
,
bean
)
in
headData
!!
.
highlighter
.
withIndex
())
{
if
(
bean
.
type
==
"2"
||
bean
.
type
==
"8"
)
{
if
(
bean
.
type
==
"2"
||
bean
.
type
==
"8"
)
{
va
r
textview
=
lin_filter2
.
getChildAt
(
index
)
as
TextView
va
l
textview
=
lin_filter2
.
getChildAt
(
index
)
as
TextView
textview
.
isSelected
=
false
textview
.
isSelected
=
false
textview
.
paint
.
isFakeBoldText
=
false
textview
.
paint
.
isFakeBoldText
=
false
}
}
}
}
}
}
bean
.
key
=
hotData
.
id
bean
.
code
=
hotData
.
id
bean
.
value
=
hotData
.
value
bean
.
value
=
hotData
.
value
for
(
headBean
in
headData
!!
.
region
)
{
for
(
headBean
in
headData
!!
.
region
)
{
if
(
TextUtils
.
equals
(
if
(
TextUtils
.
equals
(
headBean
.
key
!!
.
substring
(
0
,
2
),
headBean
.
code
!!
.
substring
(
0
,
2
),
bean
.
key
!!
.
substring
(
0
,
2
)
bean
.
code
!!
.
substring
(
0
,
2
)
)
)
)
{
)
{
allFilter
.
region
=
headBean
allFilter
.
region
=
headBean
...
@@ -1237,10 +1237,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
...
@@ -1237,10 +1237,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
//显示地区弹窗
//显示地区弹窗
private
fun
showAreaPopupWindow
()
{
private
fun
showAreaPopupWindow
()
{
if
(
headData
?.
region
!=
null
)
{
if
(
headData
?.
region
!=
null
)
{
val
regionPopupWindow
=
AreaPopupWindow
(
val
regionPopupWindow
=
AreaPopupWindow
(
mActivity
,
headData
?.
region
?:
ArrayList
(),
allFilter
.
region
,
allFilter
.
sub
)
mActivity
,
headData
?.
region
?:
ArrayList
(),
allFilter
.
region
,
allFilter
.
sub
)
regionPopupWindow
.
showAsDropDown
(
viewSep2
)
regionPopupWindow
.
showAsDropDown
(
viewSep2
)
viewDim
.
visibility
=
View
.
VISIBLE
viewDim
.
visibility
=
View
.
VISIBLE
updateFilterTextViewStatus
(
tvArea
,
FILTER_STATUS_OPEN
)
updateFilterTextViewStatus
(
tvArea
,
FILTER_STATUS_OPEN
)
...
@@ -1258,24 +1255,15 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
...
@@ -1258,24 +1255,15 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
updateFilterTextViewStatus
(
tvArea
,
FILTER_STATUS_OPEN
)
updateFilterTextViewStatus
(
tvArea
,
FILTER_STATUS_OPEN
)
allFilter
.
region
=
region
allFilter
.
region
=
region
allFilter
.
sub
=
sub
allFilter
.
sub
=
sub
if
(
region
.
key
==
null
&&
sub
.
key
==
null
)
{
if
(
TextUtils
.
isEmpty
(
region
.
code
)
&&
TextUtils
.
isEmpty
(
sub
.
code
))
{
// LogUtil.d("onRegionSelected: " + region.value)
// props1.put("filtrate_second", region.value)
// BuryPointUtils.buryPoint("Filtrate", props1)
tvArea
.
text
=
"地区"
tvArea
.
text
=
"地区"
}
else
if
(
region
.
key
!=
null
&&
sub
.
key
==
null
)
{
}
else
if
(!
TextUtils
.
isEmpty
(
region
.
code
)
&&
!
TextUtils
.
isEmpty
(
sub
.
code
))
{
// LogUtil.d("onRegionSelected: " + region.value)
// props1.put("filtrate_second", region.value)
// BuryPointUtils.buryPoint("Filtrate", props1)
if
(
region
.
value
?.
length
?:
0
>
4
)
{
if
(
region
.
value
?.
length
?:
0
>
4
)
{
tvArea
.
text
=
region
.
value
?.
substring
(
0
,
3
)
+
"..."
tvArea
.
text
=
region
.
value
?.
substring
(
0
,
3
)
+
"..."
}
else
{
}
else
{
tvArea
.
text
=
region
.
value
tvArea
.
text
=
region
.
value
}
}
}
else
{
}
else
{
// LogUtil.d("onRegionSelected: " + sub.value)
// props1.put("filtrate_second", sub.value)
// BuryPointUtils.buryPoint("Filtrate", props1)
if
(
sub
.
value
?.
length
?:
0
>
4
)
{
if
(
sub
.
value
?.
length
?:
0
>
4
)
{
tvArea
.
text
=
sub
.
value
?.
substring
(
0
,
3
)
+
"..."
tvArea
.
text
=
sub
.
value
?.
substring
(
0
,
3
)
+
"..."
}
else
{
}
else
{
...
@@ -1289,12 +1277,12 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
...
@@ -1289,12 +1277,12 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
//更新热门搜索显示状态
//更新热门搜索显示状态
if
(
headData
!!
.
highlighter
.
size
>
0
)
{
if
(
headData
!!
.
highlighter
.
size
>
0
)
{
for
((
index
,
hot
)
in
headData
!!
.
highlighter
!!
.
withIndex
())
{
for
((
index
,
hot
)
in
headData
!!
.
highlighter
.
withIndex
())
{
if
(
hot
.
type
==
"2"
||
hot
.
type
==
"8"
)
{
if
(
hot
.
type
==
"2"
||
hot
.
type
==
"8"
)
{
va
r
textview
=
lin_filter2
.
getChildAt
(
index
)
as
TextView
va
l
textview
=
lin_filter2
.
getChildAt
(
index
)
as
TextView
//有选择城市
//有选择城市
if
(!
TextUtils
.
isEmpty
(
sub
.
key
))
{
if
(!
TextUtils
.
isEmpty
(
sub
.
code
))
{
if
(
TextUtils
.
equals
(
sub
.
key
,
hot
.
id
))
{
if
(
TextUtils
.
equals
(
sub
.
code
,
hot
.
id
))
{
textview
.
isSelected
=
true
textview
.
isSelected
=
true
textview
.
paint
.
isFakeBoldText
=
true
textview
.
paint
.
isFakeBoldText
=
true
hasSelectedArea
=
true
hasSelectedArea
=
true
...
@@ -1303,7 +1291,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
...
@@ -1303,7 +1291,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
textview
.
paint
.
isFakeBoldText
=
false
textview
.
paint
.
isFakeBoldText
=
false
}
}
}
else
{
}
else
{
if
(
TextUtils
.
equals
(
region
.
key
,
hot
.
id
))
{
if
(
TextUtils
.
equals
(
region
.
code
,
hot
.
id
))
{
textview
.
isSelected
=
true
textview
.
isSelected
=
true
textview
.
paint
.
isFakeBoldText
=
true
textview
.
paint
.
isFakeBoldText
=
true
hasSelectedArea
=
true
hasSelectedArea
=
true
...
...
m-consultant/src/main/java/com/yidianling/consultant/ExpertSearchPresenter.kt
View file @
2065d51c
...
@@ -44,17 +44,17 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
...
@@ -44,17 +44,17 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
/**
/**
* 加载缓存
* 加载缓存
*/
*/
fun
localData
(
showType
:
Int
)
{
fun
localData
(
showType
:
Int
)
{
YDLAsyncUtils
.
asyncAsResult
(
object
:
YDLAsyncUtils
.
AsyncObjecyerResult
{
YDLAsyncUtils
.
asyncAsResult
(
object
:
YDLAsyncUtils
.
AsyncObjecyerResult
{
override
fun
doAsyncAction
():
Any
{
override
fun
doAsyncAction
():
Any
{
return
when
(
showType
)
{
return
when
(
showType
)
{
0
->{
//按专家
0
->
{
//按专家
YDLCacheUtils
.
getDoctorListData
()
YDLCacheUtils
.
getDoctorListData
()
}
}
1
->{
//按服务
1
->
{
//按服务
YDLCacheUtils
.
getServerListData
()
YDLCacheUtils
.
getServerListData
()
}
}
else
->{
else
->
{
YDLCacheUtils
.
getServerListData
()
YDLCacheUtils
.
getServerListData
()
}
}
}
}
...
@@ -62,23 +62,24 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
...
@@ -62,23 +62,24 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
override
fun
asyncResult
(
`object`
:
Any
?)
{
override
fun
asyncResult
(
`object`
:
Any
?)
{
//如果没有缓存数据,显示加载框
//如果没有缓存数据,显示加载框
if
(
`object`
!
is
String
||
TextUtils
.
isEmpty
(
`object`
)){
if
(
`object`
!
is
String
||
TextUtils
.
isEmpty
(
`object`
))
{
mView
.
showRefreshLayout
()
mView
.
showRefreshLayout
()
}
}
if
(
`object`
is
String
){
if
(
`object`
is
String
)
{
val
gson
=
Gson
()
val
gson
=
Gson
()
val
bean
=
gson
.
fromJson
<
ExpertSearchBean
>(
`object`
,
ExpertSearchBean
::
class
.
java
)
val
bean
=
gson
.
fromJson
<
ExpertSearchBean
>(
`object`
,
ExpertSearchBean
::
class
.
java
)
// val bean = gson.fromJson<ExpertSearchBean>(`object`, object : TypeToken<ExpertSearchBean>() {}.type)
// val bean = gson.fromJson<ExpertSearchBean>(`object`, object : TypeToken<ExpertSearchBean>() {}.type)
if
(
bean
?.
list
!=
null
)
{
if
(
bean
?.
list
!=
null
)
{
when
(
showType
)
{
when
(
showType
)
{
0
->{
0
->
{
mView
.
onDoctorListFetched
(
bean
.
list
,
1
,
1
)
mView
.
onDoctorListFetched
(
bean
.
list
,
1
,
1
)
}
}
1
->{
1
->
{
mView
.
onServiceListFetched
(
bean
.
list
,
1
,
1
)
mView
.
onServiceListFetched
(
bean
.
list
,
1
,
1
)
}
}
else
->{
else
->
{
mView
.
onServiceListFetched
(
bean
.
list
,
1
,
1
)
mView
.
onServiceListFetched
(
bean
.
list
,
1
,
1
)
}
}
}
}
...
@@ -89,14 +90,14 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
...
@@ -89,14 +90,14 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
})
})
}
}
fun
updateCache
(
showType
:
Int
,
searchBean
:
ExpertSearchBean
)
{
fun
updateCache
(
showType
:
Int
,
searchBean
:
ExpertSearchBean
)
{
val
gson
=
Gson
()
val
gson
=
Gson
()
val
json
=
gson
.
toJson
(
searchBean
)
val
json
=
gson
.
toJson
(
searchBean
)
when
(
showType
)
{
when
(
showType
)
{
0
->{
0
->
{
YDLCacheUtils
.
saveDoctorListData
(
json
)
YDLCacheUtils
.
saveDoctorListData
(
json
)
}
}
1
->{
1
->
{
YDLCacheUtils
.
saveServerListData
(
json
)
YDLCacheUtils
.
saveServerListData
(
json
)
}
}
}
}
...
@@ -105,11 +106,13 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
...
@@ -105,11 +106,13 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
@SuppressLint
(
"CheckResult"
)
@SuppressLint
(
"CheckResult"
)
fun
fetchListData
(
allFilter
:
AllFilter
,
page
:
Int
)
{
fun
fetchListData
(
allFilter
:
AllFilter
,
page
:
Int
)
{
//是否亲子教育字段
//是否亲子教育字段
ConsultAssistantDialogUtils
.
REALATION_EDUCATION
=
allFilter
.
categories
.
size
==
1
&&
allFilter
.
categories
[
0
].
cateId
==
"23"
ConsultAssistantDialogUtils
.
REALATION_EDUCATION
=
allFilter
.
categories
.
size
==
1
&&
allFilter
.
categories
[
0
].
cateId
==
"23"
var
showType
=
0
var
showType
=
0
val
sb
=
StringBuffer
()
val
sb
=
StringBuffer
()
sb
.
append
(
"searchWord="
).
append
(
if
(
TextUtils
.
isEmpty
(
allFilter
.
searchWord
))
""
else
allFilter
.
searchWord
)
sb
.
append
(
"searchWord="
)
.
append
(
if
(
TextUtils
.
isEmpty
(
allFilter
.
searchWord
))
""
else
allFilter
.
searchWord
)
if
(
allFilter
.
categories
.
isNotEmpty
())
{
if
(
allFilter
.
categories
.
isNotEmpty
())
{
var
categorys
=
allFilter
.
categories
.
map
{
it
.
cateId
}.
joinToString
(
","
)
var
categorys
=
allFilter
.
categories
.
map
{
it
.
cateId
}.
joinToString
(
","
)
if
(
"0"
==
categorys
)
{
if
(
"0"
==
categorys
)
{
...
@@ -117,11 +120,15 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
...
@@ -117,11 +120,15 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
}
}
sb
.
append
(
"&directionTags="
).
append
(
categorys
)
sb
.
append
(
"&directionTags="
).
append
(
categorys
)
}
}
if
(
allFilter
.
sub
.
key
!=
null
)
{
if
(
allFilter
.
region
.
value
==
"海外"
||
allFilter
.
region
.
value
==
"全国"
)
{
sb
.
append
(
"&city="
).
append
(
Integer
.
parseInt
(
allFilter
.
sub
.
key
))
sb
.
append
(
"&country="
).
append
(
allFilter
.
sub
.
code
)
}
else
{
if
(
allFilter
.
region
.
code
!=
null
)
{
sb
.
append
(
"&province="
).
append
(
allFilter
.
region
.
code
)
}
if
(
allFilter
.
sub
.
code
!=
null
)
{
sb
.
append
(
"&city="
).
append
(
allFilter
.
sub
.
code
)
}
}
if
(
allFilter
.
region
.
key
!=
null
)
{
sb
.
append
(
"&province="
).
append
(
Integer
.
parseInt
(
allFilter
.
region
.
key
))
}
}
if
(
allFilter
.
reorder
.
key
!=
null
)
{
if
(
allFilter
.
reorder
.
key
!=
null
)
{
sb
.
append
(
"&reorder="
).
append
(
allFilter
.
reorder
.
key
)
sb
.
append
(
"&reorder="
).
append
(
allFilter
.
reorder
.
key
)
...
@@ -133,8 +140,9 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
...
@@ -133,8 +140,9 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
sb
.
append
(
"&ages="
).
append
(
allFilter
.
ages
.
map
{
it
.
key
}.
joinToString
(
","
))
sb
.
append
(
"&ages="
).
append
(
allFilter
.
ages
.
map
{
it
.
key
}.
joinToString
(
","
))
}
}
// 擅长人群拼接
// 擅长人群拼接
if
(
allFilter
.
specialityCrowd
.
isNotEmpty
()){
if
(
allFilter
.
specialityCrowd
.
isNotEmpty
())
{
sb
.
append
(
"&crowdsTags="
).
append
(
allFilter
.
specialityCrowd
.
map
{
it
.
key
}.
joinToString
(
","
))
sb
.
append
(
"&crowdsTags="
)
.
append
(
allFilter
.
specialityCrowd
.
map
{
it
.
key
}.
joinToString
(
","
))
}
}
if
(
allFilter
.
others
.
isNotEmpty
())
{
if
(
allFilter
.
others
.
isNotEmpty
())
{
sb
.
append
(
"&others="
).
append
(
allFilter
.
others
.
map
{
it
.
key
}.
joinToString
(
","
))
sb
.
append
(
"&others="
).
append
(
allFilter
.
others
.
map
{
it
.
key
}.
joinToString
(
","
))
...
@@ -143,10 +151,10 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
...
@@ -143,10 +151,10 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
// showType = allFilter.showType.key!!
// showType = allFilter.showType.key!!
// sb.append("&showType=").append(allFilter.showType.key!!)
// sb.append("&showType=").append(allFilter.showType.key!!)
// }
// }
if
(
allFilter
.
title
.
isNotEmpty
())
{
if
(
allFilter
.
title
.
isNotEmpty
())
{
sb
.
append
(
"&title="
).
append
(
allFilter
.
title
.
map
{
it
.
key
}.
joinToString
(
","
))
sb
.
append
(
"&title="
).
append
(
allFilter
.
title
.
map
{
it
.
key
}.
joinToString
(
","
))
}
}
if
(
allFilter
.
priceRanges
!=
null
)
{
if
(
allFilter
.
priceRanges
!=
null
)
{
sb
.
append
(
"&minPrice="
).
append
(
allFilter
.
priceRanges
?.
minPrice
)
sb
.
append
(
"&minPrice="
).
append
(
allFilter
.
priceRanges
?.
minPrice
)
sb
.
append
(
"&maxPrice="
).
append
(
allFilter
.
priceRanges
?.
maxPrice
)
sb
.
append
(
"&maxPrice="
).
append
(
allFilter
.
priceRanges
?.
maxPrice
)
}
}
...
@@ -165,8 +173,8 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
...
@@ -165,8 +173,8 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
// }
// }
mView
.
onDoctorListFetched
(
it
.
list
,
page
,
it
.
pages
)
mView
.
onDoctorListFetched
(
it
.
list
,
page
,
it
.
pages
)
//更新缓存 只更新第一页的缓存
//更新缓存 只更新第一页的缓存
if
(
page
==
1
){
if
(
page
==
1
)
{
updateCache
(
showType
,
it
)
updateCache
(
showType
,
it
)
}
}
}
else
{
}
else
{
mView
.
fetchListEmpty
(
"没有搜到相关信息,换个关键词看看吧"
)
mView
.
fetchListEmpty
(
"没有搜到相关信息,换个关键词看看吧"
)
...
...
m-consultant/src/main/java/com/yidianling/consultant/adapter/RegionRecyclerViewAdapter.kt
View file @
2065d51c
...
@@ -16,35 +16,32 @@ import kotlinx.android.synthetic.main.consultant_item_region.view.*
...
@@ -16,35 +16,32 @@ import kotlinx.android.synthetic.main.consultant_item_region.view.*
* 省份列表适配器
* 省份列表适配器
* Created by zqk on 17-7-21.
* Created by zqk on 17-7-21.
*/
*/
class
RegionRecyclerViewAdapter
(
val
context
:
Context
,
val
regionList
:
ArrayList
<
RegionItem
>,
var
selectedRegion
:
RegionItem
)
:
RecyclerView
.
Adapter
<
RegionRecyclerViewAdapter
.
ViewHolder
>()
{
class
RegionRecyclerViewAdapter
(
val
context
:
Context
,
val
regionList
:
ArrayList
<
RegionItem
>,
var
selectedRegion
:
RegionItem
)
:
RecyclerView
.
Adapter
<
RegionRecyclerViewAdapter
.
ViewHolder
>()
{
var
onItemClickListener
:
MyBaseAdapter
.
OnItemClickListener
<
RegionItem
>?
=
null
var
onItemClickListener
:
MyBaseAdapter
.
OnItemClickListener
<
RegionItem
>?
=
null
override
fun
onBindViewHolder
(
holder
:
ViewHolder
,
position
:
Int
)
{
override
fun
onBindViewHolder
(
holder
:
ViewHolder
,
position
:
Int
)
{
var
region
=
RegionItem
(
ArrayList
(),
"全国"
,
null
)
val
region
=
regionList
[
position
]
if
(
position
>
0
)
{
region
=
regionList
[
position
-
1
]
}
holder
.
itemView
.
tvRegionName
.
text
=
region
.
value
holder
.
itemView
.
tvRegionName
.
text
=
region
.
value
if
(
selectedRegion
.
key
==
region
.
key
)
{
if
(
selectedRegion
.
code
==
region
.
code
)
{
//选中状态
//选中状态
holder
.
itemView
.
tvRegionName
.
setTypeface
(
Typeface
.
DEFAULT_BOLD
)
holder
.
itemView
.
tvRegionName
.
setTypeface
(
Typeface
.
DEFAULT_BOLD
)
// holder.itemView.tvRegionName.setBackgroundColor(Color.rgb(255, 255, 255))
holder
.
itemView
.
tvRegionName
.
setTextColor
(
context
.
resources
.
getColor
(
R
.
color
.
platform_main_theme
))
holder
.
itemView
.
tvRegionName
.
setTextColor
(
context
.
resources
.
getColor
(
R
.
color
.
platform_main_theme
))
holder
.
itemView
.
view_select
.
visibility
=
View
.
VISIBLE
holder
.
itemView
.
view_select
.
visibility
=
View
.
VISIBLE
}
else
{
}
else
{
//未选中状态
//未选中状态
holder
.
itemView
.
tvRegionName
.
setTypeface
(
Typeface
.
DEFAULT
)
holder
.
itemView
.
tvRegionName
.
setTypeface
(
Typeface
.
DEFAULT
)
// holder.itemView.tvRegionName.setBackgroundColor(Color.rgb(245, 245, 245))
holder
.
itemView
.
tvRegionName
.
setTextColor
(
context
.
resources
.
getColor
(
R
.
color
.
platform_default_text_color
))
holder
.
itemView
.
tvRegionName
.
setTextColor
(
context
.
resources
.
getColor
(
R
.
color
.
platform_default_text_color
))
holder
.
itemView
.
view_select
.
visibility
=
View
.
INVISIBLE
holder
.
itemView
.
view_select
.
visibility
=
View
.
INVISIBLE
}
}
}
}
override
fun
getItemCount
():
Int
=
regionList
.
size
+
1
override
fun
getItemCount
():
Int
=
regionList
.
size
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
viewType
:
Int
):
ViewHolder
{
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
viewType
:
Int
):
ViewHolder
{
val
view
=
LayoutInflater
.
from
(
context
).
inflate
(
R
.
layout
.
consultant_item_region
,
parent
,
false
)
val
view
=
LayoutInflater
.
from
(
context
).
inflate
(
R
.
layout
.
consultant_item_region
,
parent
,
false
)
return
ViewHolder
(
view
)
return
ViewHolder
(
view
)
}
}
...
@@ -53,13 +50,9 @@ class RegionRecyclerViewAdapter(val context: Context, val regionList: ArrayList<
...
@@ -53,13 +50,9 @@ class RegionRecyclerViewAdapter(val context: Context, val regionList: ArrayList<
itemView
.
setOnClickListener
{
itemView
.
setOnClickListener
{
val
position
=
adapterPosition
val
position
=
adapterPosition
if
(
position
!=
RecyclerView
.
NO_POSITION
)
{
if
(
position
!=
RecyclerView
.
NO_POSITION
)
{
selectedRegion
=
if
(
position
==
0
)
{
selectedRegion
=
regionList
[
position
]
RegionItem
(
ArrayList
(),
"全国"
,
null
)
}
else
{
regionList
[
position
-
1
]
}
notifyDataSetChanged
()
onItemClickListener
?.
onItemClickListener
(
itemView
,
adapterPosition
,
selectedRegion
)
onItemClickListener
?.
onItemClickListener
(
itemView
,
adapterPosition
,
selectedRegion
)
notifyDataSetChanged
()
}
}
}
}
}
}
...
...
m-consultant/src/main/java/com/yidianling/consultant/adapter/SubRecyclerViewAdapter.kt
View file @
2065d51c
...
@@ -21,25 +21,20 @@ class SubRecyclerViewAdapter(val context: Context, val subList: ArrayList<SubIte
...
@@ -21,25 +21,20 @@ class SubRecyclerViewAdapter(val context: Context, val subList: ArrayList<SubIte
var
onItemClickListener
:
MyBaseAdapter
.
OnItemClickListener
<
SubItem
>?
=
null
var
onItemClickListener
:
MyBaseAdapter
.
OnItemClickListener
<
SubItem
>?
=
null
override
fun
onBindViewHolder
(
holder
:
ViewHolder
,
position
:
Int
)
{
override
fun
onBindViewHolder
(
holder
:
ViewHolder
,
position
:
Int
)
{
var
region
=
SubItem
(
"不限"
,
null
)
val
subItem
=
subList
[
position
]
if
(
position
>
0
)
{
holder
.
itemView
.
tvConsultTypeName
.
text
=
subItem
.
value
region
=
subList
[
position
-
1
]
if
(
selectedSub
.
code
==
subItem
.
code
)
{
}
holder
.
itemView
.
tvConsultTypeName
.
text
=
region
.
value
if
(
selectedSub
.
key
==
region
.
key
)
{
//选中状态
//选中状态
holder
.
itemView
.
tvConsultTypeName
.
setTypeface
(
Typeface
.
DEFAULT_BOLD
)
holder
.
itemView
.
tvConsultTypeName
.
setTypeface
(
Typeface
.
DEFAULT_BOLD
)
holder
.
itemView
.
tvConsultTypeName
.
setTextColor
(
ContextCompat
.
getColor
(
context
,
R
.
color
.
platform_main_theme
))
holder
.
itemView
.
tvConsultTypeName
.
setTextColor
(
ContextCompat
.
getColor
(
context
,
R
.
color
.
platform_main_theme
))
// holder.itemView.ivCheckCircle.visibility = View.VISIBLE
}
else
{
}
else
{
//未选中状态
//未选中状态
holder
.
itemView
.
tvConsultTypeName
.
setTypeface
(
Typeface
.
DEFAULT
)
holder
.
itemView
.
tvConsultTypeName
.
setTypeface
(
Typeface
.
DEFAULT
)
holder
.
itemView
.
tvConsultTypeName
.
setTextColor
(
ContextCompat
.
getColor
(
context
,
R
.
color
.
platform_default_text_color
))
holder
.
itemView
.
tvConsultTypeName
.
setTextColor
(
ContextCompat
.
getColor
(
context
,
R
.
color
.
platform_default_text_color
))
// holder.itemView.ivCheckCircle.visibility = View.INVISIBLE
}
}
}
}
override
fun
getItemCount
():
Int
=
subList
.
size
+
1
override
fun
getItemCount
():
Int
=
subList
.
size
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
viewType
:
Int
):
ViewHolder
{
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
viewType
:
Int
):
ViewHolder
{
val
view
=
LayoutInflater
.
from
(
context
).
inflate
(
R
.
layout
.
consultant_item_consult_type
,
parent
,
false
)
val
view
=
LayoutInflater
.
from
(
context
).
inflate
(
R
.
layout
.
consultant_item_consult_type
,
parent
,
false
)
...
@@ -51,13 +46,9 @@ class SubRecyclerViewAdapter(val context: Context, val subList: ArrayList<SubIte
...
@@ -51,13 +46,9 @@ class SubRecyclerViewAdapter(val context: Context, val subList: ArrayList<SubIte
itemView
.
setOnClickListener
{
itemView
.
setOnClickListener
{
val
position
=
adapterPosition
val
position
=
adapterPosition
if
(
position
!=
RecyclerView
.
NO_POSITION
)
{
if
(
position
!=
RecyclerView
.
NO_POSITION
)
{
selectedSub
=
if
(
position
==
0
)
{
selectedSub
=
subList
[
adapterPosition
]
SubItem
(
"不限"
,
null
)
}
else
{
subList
[
adapterPosition
-
1
]
}
notifyDataSetChanged
()
onItemClickListener
?.
onItemClickListener
(
itemView
,
adapterPosition
,
selectedSub
)
onItemClickListener
?.
onItemClickListener
(
itemView
,
adapterPosition
,
selectedSub
)
notifyDataSetChanged
()
}
}
}
}
}
}
...
...
m-consultant/src/main/java/com/yidianling/consultant/model/SearchApi.kt
View file @
2065d51c
...
@@ -38,7 +38,7 @@ interface SearchApi {
...
@@ -38,7 +38,7 @@ interface SearchApi {
fun
listHead
(
@FieldMap
maps
:
Map
<
String
,
String
>):
Observable
<
BaseResponse
<
HeadData
>>
fun
listHead
(
@FieldMap
maps
:
Map
<
String
,
String
>):
Observable
<
BaseResponse
<
HeadData
>>
//搜索条件
//搜索条件
@GET
(
"consult/search/conditions"
)
@GET
(
"consult/search/
v2/
conditions"
)
@Headers
(
YDL_DOMAIN
+
YDL_DOMAIN_JAVA
)
@Headers
(
YDL_DOMAIN
+
YDL_DOMAIN_JAVA
)
fun
searchConditions
(
@Query
(
"cateSource"
)
cateSource
:
Int
):
Observable
<
BaseAPIResponse
<
HeadData
>>
fun
searchConditions
(
@Query
(
"cateSource"
)
cateSource
:
Int
):
Observable
<
BaseAPIResponse
<
HeadData
>>
...
...
m-consultant/src/main/java/com/yidianling/consultant/model/bean/RegionItem.kt
View file @
2065d51c
...
@@ -11,5 +11,8 @@ data class RegionItem(
...
@@ -11,5 +11,8 @@ data class RegionItem(
var
value
:
String
?
=
null
,
var
value
:
String
?
=
null
,
@field
:
SerializedName
(
"key"
)
@field
:
SerializedName
(
"key"
)
var
key
:
String
?
=
null
var
key
:
String
?
=
null
,
@field
:
SerializedName
(
"code"
)
var
code
:
String
?=
null
)
)
\ No newline at end of file
m-consultant/src/main/java/com/yidianling/consultant/model/bean/SubItem.kt
View file @
2065d51c
...
@@ -8,5 +8,8 @@ data class SubItem(
...
@@ -8,5 +8,8 @@ data class SubItem(
var
value
:
String
?
=
null
,
var
value
:
String
?
=
null
,
@field
:
SerializedName
(
"key"
)
@field
:
SerializedName
(
"key"
)
var
key
:
String
?
=
null
var
key
:
String
?
=
null
,
@field
:
SerializedName
(
"code"
)
var
code
:
String
?=
null
)
)
\ No newline at end of file
m-consultant/src/main/java/com/yidianling/consultant/ui/view/AreaPopupWindow.kt
View file @
2065d51c
...
@@ -20,18 +20,16 @@ import kotlinx.android.synthetic.main.consultant_ui_region_popup_window.view.*
...
@@ -20,18 +20,16 @@ import kotlinx.android.synthetic.main.consultant_ui_region_popup_window.view.*
/**
/**
* 地区选择弹窗
* 地区选择弹窗
*/
*/
class
AreaPopupWindow
(
val
context
:
Context
,
regionList
:
ArrayList
<
RegionItem
>,
class
AreaPopupWindow
(
val
context
:
Context
,
regionList
:
ArrayList
<
RegionItem
>,
private
var
selectedRegion
:
RegionItem
,
private
var
selectedSub
:
SubItem
)
private
var
selectedRegion
:
RegionItem
,
private
var
selectedSub
:
SubItem
)
:
PopupWindow
(
null
,
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
RxImageTool
.
dp2px
(
369f
))
{
:
PopupWindow
(
null
,
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
RxImageTool
.
dp2px
(
369f
))
{
private
val
subList
=
ArrayList
<
SubItem
>()
private
val
subList
=
ArrayList
<
SubItem
>()
private
val
regionAdapter
=
RegionRecyclerViewAdapter
(
context
,
regionList
,
selectedRegion
)
private
val
regionAdapter
=
RegionRecyclerViewAdapter
(
context
,
regionList
,
selectedRegion
)
private
va
l
subAdapter
=
SubRecyclerViewAdapter
(
context
,
subList
,
selectedSub
)
private
va
r
subAdapter
:
SubRecyclerViewAdapter
var
onRegionSelectedListener
:
OnRegionSelectedListener
?
=
null
var
onRegionSelectedListener
:
OnRegionSelectedListener
?
=
null
init
{
init
{
subList
.
addAll
(
selectedRegion
.
sub
)
val
view
=
LayoutInflater
.
from
(
context
).
inflate
(
R
.
layout
.
consultant_ui_region_popup_window
,
null
)
val
view
=
LayoutInflater
.
from
(
context
).
inflate
(
R
.
layout
.
consultant_ui_region_popup_window
,
null
)
this
.
contentView
=
view
this
.
contentView
=
view
this
.
isFocusable
=
true
this
.
isFocusable
=
true
...
@@ -40,6 +38,13 @@ class AreaPopupWindow(val context: Context, regionList: ArrayList<RegionItem>,
...
@@ -40,6 +38,13 @@ class AreaPopupWindow(val context: Context, regionList: ArrayList<RegionItem>,
this
.
isOutsideTouchable
=
true
this
.
isOutsideTouchable
=
true
this
.
height
=
((
RxDeviceTool
.
getScreenHeight
(
context
)
-
RxImageTool
.
dp2px
(
90f
))
*
0.618
).
toInt
()
//设置高度为屏幕的80%
this
.
height
=
((
RxDeviceTool
.
getScreenHeight
(
context
)
-
RxImageTool
.
dp2px
(
90f
))
*
0.618
).
toInt
()
//设置高度为屏幕的80%
if
(
selectedRegion
.
sub
.
isNotEmpty
()){
subList
.
addAll
(
selectedRegion
.
sub
)
}
else
{
subList
.
addAll
(
regionList
[
0
].
sub
)
}
subAdapter
=
SubRecyclerViewAdapter
(
context
,
subList
,
selectedSub
)
view
.
rvRegion
.
layoutManager
=
view
.
rvRegion
.
layoutManager
=
LinearLayoutManager
(
LinearLayoutManager
(
context
,
context
,
...
@@ -54,13 +59,10 @@ class AreaPopupWindow(val context: Context, regionList: ArrayList<RegionItem>,
...
@@ -54,13 +59,10 @@ class AreaPopupWindow(val context: Context, regionList: ArrayList<RegionItem>,
view
.
rvSub
.
scrollToPosition
(
0
)
view
.
rvSub
.
scrollToPosition
(
0
)
}
}
view
.
rvRegion
.
adapter
=
regionAdapter
view
.
rvRegion
.
adapter
=
regionAdapter
// view.rvRegion.addItemDecoration(DividerItemDecoration(context, LinearLayoutManager.VERTICAL))
val
helper
=
LinearSnapHelper
()
// LinearSnapHelper().attachToRecyclerView(view.rvRegion)
val
i
=
regionList
val
i
=
regionList
.
takeWhile
{
it
.
key
!=
selectedRegion
.
key
}
.
takeWhile
{
it
.
key
!=
selectedRegion
.
key
}
.
count
()
.
count
()
view
.
rvRegion
.
scrollToPosition
(
i
+
1
)
view
.
rvRegion
.
scrollToPosition
(
i
)
view
.
rvSub
.
layoutManager
=
view
.
rvSub
.
layoutManager
=
...
@@ -74,8 +76,6 @@ class AreaPopupWindow(val context: Context, regionList: ArrayList<RegionItem>,
...
@@ -74,8 +76,6 @@ class AreaPopupWindow(val context: Context, regionList: ArrayList<RegionItem>,
onRegionSelectedListener
?.
onRegionSelected
(
selectedRegion
,
selectedSub
)
onRegionSelectedListener
?.
onRegionSelected
(
selectedRegion
,
selectedSub
)
}
}
view
.
rvSub
.
adapter
=
subAdapter
view
.
rvSub
.
adapter
=
subAdapter
// view.rvSub.addItemDecoration(DividerItemDecoration(context, LinearLayoutManager.VERTICAL))
// LinearSnapHelper().attachToRecyclerView(view.rvSub)
view
.
rvSub
.
scrollToPosition
(
subList
.
indexOf
(
selectedSub
)
+
1
)
view
.
rvSub
.
scrollToPosition
(
subList
.
indexOf
(
selectedSub
)
+
1
)
}
}
...
...
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