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
1183915e
Commit
1183915e
authored
Aug 09, 2022
by
霍志良
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:BUG修改
parent
1899cb1a
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
269 additions
and
85 deletions
+269
-85
ExpertSearchActivity.kt
m-consultant/src/main/java/com/yidianling/consultant/ExpertSearchActivity.kt
+116
-15
ExpertSearchFragment.kt
m-consultant/src/main/java/com/yidianling/consultant/ExpertSearchFragment.kt
+88
-10
AreaPopupWindow.kt
m-consultant/src/main/java/com/yidianling/consultant/ui/view/AreaPopupWindow.kt
+19
-46
FilterPopupWindow.kt
m-consultant/src/main/java/com/yidianling/consultant/ui/view/FilterPopupWindow.kt
+1
-12
PricePopupWindow.kt
m-consultant/src/main/java/com/yidianling/consultant/ui/view/PricePopupWindow.kt
+44
-1
consultant_ui_price_popup_window.xml
m-consultant/src/main/res/layout/consultant_ui_price_popup_window.xml
+1
-1
No files found.
m-consultant/src/main/java/com/yidianling/consultant/ExpertSearchActivity.kt
View file @
1183915e
This diff is collapsed.
Click to expand it.
m-consultant/src/main/java/com/yidianling/consultant/ExpertSearchFragment.kt
View file @
1183915e
...
...
@@ -48,6 +48,7 @@ import com.yidianling.common.tools.LogUtil
import
com.yidianling.common.tools.RxImageTool
import
com.yidianling.common.tools.ToastUtil
import
com.yidianling.consultant.adapter.ExpertSearchAdapter
import
com.yidianling.consultant.bean.ConsultantRecentCity
import
com.yidianling.consultant.constants.ConsultBIConstants
import
com.yidianling.consultant.constants.ConsultBIConstants.ConsultantLocationAuth.Companion.WHETHER_LOCATION_AUTH
import
com.yidianling.consultant.listener.*
...
...
@@ -56,6 +57,7 @@ import com.yidianling.consultant.listener.OnCategoriesSelectedListener
import
com.yidianling.consultant.listener.OnExpertClickListener
import
com.yidianling.consultant.listener.OnFilterConfirmListener
import
com.yidianling.consultant.listener.OnSortItemSelectedListener
import
com.yidianling.consultant.model.SearchApi
import
com.yidianling.consultant.model.bean.*
import
com.yidianling.consultant.modular.singlton.ConsultAssistantDialogUtils
import
com.yidianling.consultant.router.ConsultantIn
...
...
@@ -89,6 +91,11 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
var
bottomWordDisposable
:
Disposable
?
=
null
var
isShow
:
Boolean
=
false
private
lateinit
var
bottomWordlist
:
List
<
FunctionWordBean
>
private
var
subLocationItem
:
SubItem
?
=
SubItem
()
private
var
locationRegionItem
:
RegionItem
?
=
null
private
var
locationList
:
ArrayList
<
SubItem
>?
=
arrayListOf
()
private
var
locationHistoryList
:
ArrayList
<
RegionItem
>?
=
arrayListOf
()
override
fun
layoutResId
():
Int
{
return
R
.
layout
.
consultant_activity_expert_search_list
}
...
...
@@ -1310,20 +1317,95 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
refresh
()
}
@SuppressLint
(
"CheckResult"
)
fun
getRegionByIp
(
agreeLocation
:
Boolean
)
{
if
(
agreeLocation
)
{
SearchApi
.
getSearchApi
().
getCityByIp
()
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
({
if
(
it
.
code
==
"200"
)
{
locationList
?.
clear
()
subLocationItem
?.
code
=
it
.
data
.
city_code
subLocationItem
?.
key
=
it
.
data
.
city_code
subLocationItem
?.
value
=
it
.
data
.
city_name
subLocationItem
?.
locationCode
=
"-1"
subLocationItem
?.
let
{
locationList
?.
add
(
it
)
}
locationRegionItem
=
locationList
?.
let
{
it1
->
RegionItem
(
it1
,
value
=
"定位"
,
key
=
it
.
data
.
province_code
,
code
=
it
.
data
.
province_code
)
}
locationRegionItem
?.
let
{
locationHistoryList
?.
add
(
0
,
it
)
}
showAreaPoPup
(
agreeLocation
)
}
},
{})
}
else
{
locationList
?.
clear
()
subLocationItem
?.
code
=
null
subLocationItem
?.
key
=
null
subLocationItem
?.
value
=
"开启授权,获得定位城市"
subLocationItem
?.
locationCode
=
"NotAuth"
subLocationItem
?.
let
{
locationList
?.
add
(
it
)
}
locationRegionItem
=
locationList
?.
let
{
it1
->
RegionItem
(
it1
,
value
=
"定位"
,
key
=
null
,
code
=
null
)
}
locationRegionItem
?.
let
{
locationHistoryList
?.
add
(
0
,
it
)
}
showAreaPoPup
(
agreeLocation
)
}
}
//显示地区弹窗
private
fun
showAreaPopupWindow
(
isAgreeLocation
:
Boolean
)
{
if
(
headData
?.
region
!=
null
)
{
val
regionPopupWindow
=
AreaPopupWindow
(
locationHistoryList
?.
clear
()
//添加历史搜索
var
recentCityBean
=
MMKV
.
defaultMMKV
().
decodeParcelable
(
ConsultBIConstants
.
ConsultantLocationAuth
.
RECENT_CITY
,
ConsultantRecentCity
::
class
.
java
)
if
(
recentCityBean
==
null
)
recentCityBean
=
ConsultantRecentCity
(
arrayListOf
())
locationHistoryList
?.
add
(
RegionItem
(
recentCityBean
!!
.
recentCity
,
value
=
"历史"
,
key
=
"0"
,
code
=
"0"
)
)
//添加定位
getRegionByIp
(
isAgreeLocation
)
}
else
{
ToastUtil
.
toastShort
(
"数据初始化失败,请重试"
)
getPresenter
().
fetchListHead
()
}
}
private
fun
showAreaPoPup
(
isAgreeLocation
:
Boolean
)
{
locationHistoryList
?.
addAll
(
headData
?.
region
?:
ArrayList
())
if
(
allFilter
.
region
.
value
==
null
)
allFilter
.
region
=
locationRegionItem
!!
val
regionPopupWindow
=
locationHistoryList
?.
let
{
AreaPopupWindow
(
mActivity
,
headData
?.
region
?:
ArrayList
()
,
it
,
allFilter
.
region
,
allFilter
.
sub
,
isAgreeLocation
)
regionPopupWindow
.
showAsDropDown
(
viewSep2
)
}
regionPopupWindow
?.
showAsDropDown
(
viewSep2
)
viewDim
.
visibility
=
View
.
VISIBLE
updateFilterTextViewStatus
(
tvArea
,
FILTER_STATUS_OPEN
)
regionPopupWindow
.
setOnDismissListener
{
regionPopupWindow
?
.
setOnDismissListener
{
viewDim
.
visibility
=
View
.
INVISIBLE
if
(
tvArea
.
text
!=
"城市"
)
{
updateFilterTextViewStatus
(
tvArea
,
FILTER_STATUS_FILTERED
)
...
...
@@ -1331,7 +1413,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
updateFilterTextViewStatus
(
tvArea
,
FILTER_STATUS_NORMAL
)
}
}
regionPopupWindow
.
onRegionSelectedListener
=
regionPopupWindow
?
.
onRegionSelectedListener
=
object
:
AreaPopupWindow
.
OnRegionSelectedListener
{
override
fun
onRegionSelected
(
region
:
RegionItem
,
sub
:
SubItem
)
{
updateFilterTextViewStatus
(
tvArea
,
FILTER_STATUS_OPEN
)
...
...
@@ -1385,14 +1467,10 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
}
}
}
regionPopupWindow
.
dismiss
()
regionPopupWindow
?
.
dismiss
()
refresh
()
}
}
}
else
{
ToastUtil
.
toastShort
(
"数据初始化失败,请重试"
)
getPresenter
().
fetchListHead
()
}
}
private
var
mHandler
:
Handler
?
=
null
...
...
m-consultant/src/main/java/com/yidianling/consultant/ui/view/AreaPopupWindow.kt
View file @
1183915e
...
...
@@ -44,12 +44,11 @@ class AreaPopupWindow(
private
var
recentCityBean
:
ConsultantRecentCity
?
=
ConsultantRecentCity
(
arrayListOf
())
var
onRegionSelectedListener
:
OnRegionSelectedListener
?
=
null
private
var
subLocationItem
:
SubItem
?
=
SubItem
()
private
var
locationHistoryList
:
ArrayList
<
RegionItem
>?
=
arrayListOf
()
private
val
locationCode
=
"-1"
private
val
recentCityCode
=
"0"
private
var
locationRegionItem
:
RegionItem
?
=
null
private
var
locationList
:
ArrayList
<
SubItem
>?
=
arrayListOf
()
private
var
locationHistoryList
=
regionList
init
{
val
view
=
LayoutInflater
.
from
(
context
).
inflate
(
R
.
layout
.
consultant_ui_region_popup_window
,
null
)
...
...
@@ -60,27 +59,12 @@ class AreaPopupWindow(
this
.
isOutsideTouchable
=
true
this
.
height
=
((
RxDeviceTool
.
getScreenHeight
(
context
)
-
RxImageTool
.
dp2px
(
90f
))
*
0.618
).
toInt
()
//设置高度为屏幕的80%
//根据IP获取当前城市
getRegionByIp
(
isAgree
,
true
)
recentCityBean
=
MMKV
.
defaultMMKV
().
decodeParcelable
(
RECENT_CITY
,
ConsultantRecentCity
::
class
.
java
)
if
(
recentCityBean
==
null
)
recentCityBean
=
ConsultantRecentCity
(
arrayListOf
())
locationHistoryList
?.
add
(
RegionItem
(
recentCityBean
!!
.
recentCity
,
value
=
"历史"
,
key
=
recentCityCode
,
code
=
recentCityCode
)
)
locationHistoryList
?.
addAll
(
regionList
)
regionAdapter
.
regionList
=
locationHistoryList
!!
regionAdapter
.
regionList
=
regionList
if
(
selectedRegion
.
sub
.
isNotEmpty
())
{
subList
.
addAll
(
selectedRegion
.
sub
)
}
else
{
subList
.
addAll
(
regionList
[
0
].
sub
)
}
subAdapter
=
SubRecyclerViewAdapter
(
context
,
subList
,
selectedSub
,
locationCode
)
subAdapter
.
setOnAuthClickLister
(
object
:
SubRecyclerViewAdapter
.
OnAuthClickLister
{
override
fun
onAuthClick
()
{
...
...
@@ -88,7 +72,6 @@ class AreaPopupWindow(
.
setTitle
(
"温馨提示"
)
.
setMessage
(
"建议您授权定位权限,就能轻松获取周边优秀咨询师和其他服务"
)
.
setLeftOnclick
(
"暂不"
)
{
v1
->
dismiss
()
}.
setRightClick
(
"授权"
)
{
v12
->
MMKV
.
defaultMMKV
().
encode
(
ConsultBIConstants
.
ConsultantLocationAuth
.
WHETHER_LOCATION_AUTH
,
...
...
@@ -114,10 +97,10 @@ class AreaPopupWindow(
view
.
rvSub
.
scrollToPosition
(
0
)
}
view
.
rvRegion
.
adapter
=
regionAdapter
// val i = locationHistoryList!!
//
.takeWhile { it.key != selectedRegion.key }
//
.count()
//
view.rvRegion.scrollToPosition(i)
val
i
=
regionList
.
takeWhile
{
it
.
key
!=
selectedRegion
.
key
}
.
count
()
view
.
rvRegion
.
scrollToPosition
(
i
)
view
.
rvSub
.
layoutManager
=
...
...
@@ -137,6 +120,7 @@ class AreaPopupWindow(
//倒序保留最近五次的搜索历史记录并去重
private
fun
saveCitySearchRecord
(
data
:
SubItem
)
{
if
(
data
.
value
==
"不限"
)
return
recentCityBean
?.
let
{
if
(
it
.
recentCity
.
size
<
5
)
{
it
.
recentCity
.
add
(
0
,
data
)
...
...
@@ -163,26 +147,15 @@ class AreaPopupWindow(
subLocationItem
?.
key
=
it
.
data
.
city_code
subLocationItem
?.
value
=
it
.
data
.
city_name
subLocationItem
?.
locationCode
=
locationCode
locationList
?.
clear
()
subLocationItem
?.
let
{
locationList
?.
add
(
it
)
}
locationRegionItem
=
locationList
?.
let
{
RegionItem
(
it
,
value
=
"定位"
,
key
=
locationCode
,
code
=
locationCode
)
}
locationRegionItem
?.
let
{
locationHistoryList
?.
add
(
0
,
it
)
}
if
(
locationRegionItem
!=
null
)
{
selectedRegion
=
locationRegionItem
!!
regionAdapter
.
selectedRegion
=
selectedRegion
}
if
(
selectedRegion
.
sub
.
isNotEmpty
())
{
subList
.
addAll
(
selectedRegion
.
sub
)
}
locationHistoryList
.
get
(
0
).
code
=
it
.
data
.
province_code
locationHistoryList
.
get
(
0
).
key
=
it
.
data
.
province_code
locationHistoryList
.
get
(
0
).
value
=
"定位"
locationList
?.
let
{
locationHistoryList
.
get
(
0
).
sub
=
it
}
subList
.
clear
()
locationList
?.
let
{
it1
->
subList
.
addAll
(
it1
)
}
subAdapter
.
notifyDataSetChanged
()
regionAdapter
.
notifyDataSetChanged
()
}
...
...
m-consultant/src/main/java/com/yidianling/consultant/ui/view/FilterPopupWindow.kt
View file @
1183915e
...
...
@@ -208,10 +208,7 @@ class FilterPopupWindow(
tempFilter
.
specialityCrowd
.
clear
()
tempFilter
.
others
.
clear
()
tempFilter
.
title
.
clear
()
tempFilter
.
priceRangesView
=
null
tempFilter
.
priceRanges
=
null
etMinPrice
?.
setText
(
""
)
etMaxPrice
?.
setText
(
""
)
for
(
v
in
showTypeViews
)
{
v
.
isSelected
=
false
...
...
@@ -257,14 +254,6 @@ class FilterPopupWindow(
v
.
paint
.
isFakeBoldText
=
false
}
}
for
(
v
in
priceRangeViews
)
{
v
.
isSelected
=
false
if
(
v
is
TextView
)
{
v
.
paint
.
isFakeBoldText
=
false
}
}
updateCount
(
ConsultBIConstants
.
POSITION_CONSULT_FILTER_RESET_CLICK
)
}
...
...
m-consultant/src/main/java/com/yidianling/consultant/ui/view/PricePopupWindow.kt
View file @
1183915e
...
...
@@ -63,6 +63,35 @@ class PricePopupWindow(
onPriceItemSelectedListener
.
onPriceItemSelected
(
priceRangesItem
)
dismiss
()
}
contentView
.
price_reset
.
setOnClickListener
{
//重置
contentView
.
range_price_seekbar
.
setProgress
(
0f
,
100f
)
reset
()
}
if
(
tempFilter
.
priceRanges
!=
null
)
{
if
(
tempFilter
.
priceRanges
?.
min_price
.
isNullOrEmpty
())
{
min_Price
=
"0"
SeekBarLeftValue
=
0f
}
else
{
min_Price
=
tempFilter
.
priceRanges
?.
min_price
.
toString
()
SeekBarLeftValue
=
(
tempFilter
.
priceRanges
?.
min_price
.
toString
().
toFloat
()
/
maxPriceValue
)
*
100f
}
if
(
tempFilter
.
priceRanges
?.
max_price
.
isNullOrEmpty
())
{
max_Price
=
infiniteText
SeekBarRightValue
=
100f
}
else
{
max_Price
=
tempFilter
.
priceRanges
?.
max_price
.
toString
()
+
"元"
SeekBarRightValue
=
(
tempFilter
.
priceRanges
?.
max_price
.
toString
().
toFloat
()
/
maxPriceValue
)
*
100f
}
if
(
SeekBarRightValue
>
100f
)
SeekBarRightValue
=
100f
contentView
.
tv_start_end_price
.
text
=
"$min_Price-$max_Price"
contentView
.
range_price_seekbar
.
setProgress
(
SeekBarLeftValue
,
SeekBarRightValue
)
}
else
{
contentView
.
range_price_seekbar
.
setProgress
(
0f
,
100f
)
}
contentView
.
range_price_seekbar
.
setOnRangeChangedListener
(
object
:
OnRangeChangedListener
{
override
fun
onRangeChanged
(
view
:
RangeSeekBar
?,
...
...
@@ -80,6 +109,7 @@ class PricePopupWindow(
}
override
fun
onStartTrackingTouch
(
view
:
RangeSeekBar
?,
isLeft
:
Boolean
)
{
reset
()
}
override
fun
onStopTrackingTouch
(
view
:
RangeSeekBar
?,
isLeft
:
Boolean
)
{
...
...
@@ -88,6 +118,19 @@ class PricePopupWindow(
})
}
private
fun
reset
()
{
tempFilter
.
priceRangesView
=
null
tempFilter
.
priceRanges
=
null
contentView
?.
tv_start_end_price
?.
text
=
"0-无限"
for
(
v
in
priceRangeViews
)
{
v
.
isSelected
=
false
if
(
v
is
TextView
)
{
v
.
paint
.
isFakeBoldText
=
false
}
}
initPriceTag
()
}
fun
initPriceTag
()
{
val
mWidth
=
(
popWidth
-
RxImageTool
.
dp2px
(
52f
))
/
enquirySize
for
((
index
,
priceRangesItem
)
in
filterData
.
priceRanges
.
withIndex
())
{
...
...
@@ -164,7 +207,7 @@ class PricePopupWindow(
max_Price
=
infiniteText
SeekBarRightValue
=
100f
}
else
{
max_Price
=
priceRangesItem
.
max_price
.
toString
()
max_Price
=
priceRangesItem
.
max_price
.
toString
()
+
"元"
SeekBarRightValue
=
(
priceRangesItem
.
max_price
.
toString
().
toFloat
()
/
maxPriceValue
)
*
100f
}
...
...
m-consultant/src/main/res/layout/consultant_ui_price_popup_window.xml
View file @
1183915e
...
...
@@ -22,7 +22,7 @@
android:id=
"@+id/tv_start_end_price"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"
200-500
"
android:text=
"
0-不限
"
app:layout_constraintEnd_toEndOf=
"parent"
android:layout_marginTop=
"@dimen/platform_dp_30"
android:textColor=
"@color/platform_color_black_333333"
...
...
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