Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_freeworld
Project
Project
Details
Activity
Releases
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
android
android_freeworld
Commits
a5026e55
Commit
a5026e55
authored
Aug 12, 2021
by
fengruiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
热门景点弹出框点击之后回调到google地图功能已完成
parent
9efbbe1d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
87 additions
and
38 deletions
+87
-38
ItemHotViewAdapter.kt
.../main/java/com/mints/street/adapter/ItemHotViewAdapter.kt
+8
-3
HotViewBean.kt
app/src/main/java/com/mints/street/bean/HotViewBean.kt
+2
-2
GoogleMapFragment.kt
...java/com/mints/street/main/googlemap/GoogleMapFragment.kt
+26
-4
HomeFragment.kt
app/src/main/java/com/mints/street/main/home/HomeFragment.kt
+43
-26
HotViewDialog.kt
...main/java/com/mints/street/widget/dialog/HotViewDialog.kt
+8
-3
No files found.
app/src/main/java/com/mints/street/adapter/ItemHotViewAdapter.kt
View file @
a5026e55
...
@@ -8,17 +8,21 @@ import com.blankj.utilcode.util.ActivityUtils.startActivity
...
@@ -8,17 +8,21 @@ import com.blankj.utilcode.util.ActivityUtils.startActivity
import
com.bumptech.glide.Glide
import
com.bumptech.glide.Glide
import
com.fry.base.adapter.AbstractVLayoutBaseAdapter
import
com.fry.base.adapter.AbstractVLayoutBaseAdapter
import
com.fry.base.adapter.BindingViewHolder
import
com.fry.base.adapter.BindingViewHolder
import
com.google.android.material.bottomsheet.BottomSheetDialog
import
com.mints.street.R
import
com.mints.street.R
import
com.mints.street.bean.HotViewBean
import
com.mints.street.bean.HotViewBean
import
com.mints.street.databinding.ItemHotViewAdapterBinding
import
com.mints.street.databinding.ItemHotViewAdapterBinding
import
com.mints.street.main.home.HomeViewModel
import
com.mints.street.main.home.HomeViewModel
import
com.mints.street.main.my.OpenvipActivity
import
com.mints.street.main.my.OpenvipActivity
import
com.mints.street.manager.UserManager
import
com.mints.street.manager.UserManager
import
com.mints.street.widget.dialog.HotViewDialog
import
me.goldze.mvvmhabit.utils.RxUtils
import
me.goldze.mvvmhabit.utils.RxUtils
import
java.text.DecimalFormat
import
java.text.DecimalFormat
class
ItemHotViewAdapter
(
val
context
:
Context
,
var
list
:
List
<
HotViewBean
.
dataslist
>?,
val
viewModel
:
HomeViewModel
,
val
mCurrentLat
:
Double
,
val
mCurrentLon
:
Double
)
:
class
ItemHotViewAdapter
(
val
context
:
Context
,
val
dialog
:
BottomSheetDialog
?,
var
list
:
List
<
HotViewBean
.
Dataslist
>?,
AbstractVLayoutBaseAdapter
<
ItemHotViewAdapterBinding
,
List
<
HotViewBean
.
dataslist
>?>(
val
viewModel
:
HomeViewModel
,
val
mCurrentLat
:
Double
,
val
mCurrentLon
:
Double
,
val
onHotItemClick
:
HotViewDialog
.
OnHotItemClick
?=
null
)
:
AbstractVLayoutBaseAdapter
<
ItemHotViewAdapterBinding
,
List
<
HotViewBean
.
Dataslist
>?>(
context
,
list
,
1
context
,
list
,
1
)
{
)
{
override
fun
onBindViewHolder
(
holder
:
BindingViewHolder
<
ItemHotViewAdapterBinding
>,
position
:
Int
)
{
override
fun
onBindViewHolder
(
holder
:
BindingViewHolder
<
ItemHotViewAdapterBinding
>,
position
:
Int
)
{
...
@@ -43,7 +47,8 @@ class ItemHotViewAdapter(val context: Context, var list: List<HotViewBean.datasl
...
@@ -43,7 +47,8 @@ class ItemHotViewAdapter(val context: Context, var list: List<HotViewBean.datasl
//否-跳转到开通vip界面
//否-跳转到开通vip界面
startActivity
(
OpenvipActivity
::
class
.
java
)
startActivity
(
OpenvipActivity
::
class
.
java
)
}
else
{
}
else
{
viewModel
.
authorized
(
list
?.
get
(
position
)
?.
name
,
list
?.
get
(
position
)
?.
lat
,
list
?.
get
(
position
)
?.
lng
)
dialog
?.
dismiss
()
onHotItemClick
?.
onItemClick
(
position
,
list
?.
get
(
position
))
}
}
}
}
}
}
...
...
app/src/main/java/com/mints/street/bean/HotViewBean.kt
View file @
a5026e55
...
@@ -3,9 +3,9 @@ package com.mints.street.bean
...
@@ -3,9 +3,9 @@ package com.mints.street.bean
import
java.io.Serializable
import
java.io.Serializable
class
HotViewBean
:
Serializable
{
class
HotViewBean
:
Serializable
{
val
list
:
List
<
d
ataslist
>?
=
null
public
val
list
:
List
<
D
ataslist
>?
=
null
inner
class
d
ataslist
:
Serializable
{
inner
class
D
ataslist
:
Serializable
{
val
desc
:
String
?
=
null
val
desc
:
String
?
=
null
val
img
:
String
?
=
null
val
img
:
String
?
=
null
val
lat
:
String
?
=
null
val
lat
:
String
?
=
null
...
...
app/src/main/java/com/mints/street/main/googlemap/GoogleMapFragment.kt
View file @
a5026e55
...
@@ -20,6 +20,7 @@ import com.lxj.xpopup.interfaces.OnConfirmListener
...
@@ -20,6 +20,7 @@ import com.lxj.xpopup.interfaces.OnConfirmListener
import
com.mints.street.BR
import
com.mints.street.BR
import
com.mints.street.R
import
com.mints.street.R
import
com.mints.street.bean.GPS
import
com.mints.street.bean.GPS
import
com.mints.street.bean.HotViewBean
import
com.mints.street.bean.MutualBean
import
com.mints.street.bean.MutualBean
import
com.mints.street.databinding.ActivityGoogleMapBinding
import
com.mints.street.databinding.ActivityGoogleMapBinding
import
com.mints.street.main.home.HomeViewModel
import
com.mints.street.main.home.HomeViewModel
...
@@ -183,7 +184,28 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel
...
@@ -183,7 +184,28 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel
}
//点击热门景点
}
//点击热门景点
RxUtils
.
onMultiClick
(
binding
.
lyHotview
)
{
RxUtils
.
onMultiClick
(
binding
.
lyHotview
)
{
HotViewDialog
(
requireActivity
(),
viewModel
,
0.0
,
0.0
,
this
@GoogleMapFragment
).
init
()
HotViewDialog
(
requireActivity
(),
viewModel
,
0.0
,
0.0
,
this
@GoogleMapFragment
,
object
:
HotViewDialog
.
OnHotItemClick
{
override
fun
onItemClick
(
position
:
Int
,
itemBean
:
HotViewBean
.
Dataslist
?)
{
itemBean
?.
apply
{
//todo 冯瑞雨 修改toDouble
viewModel
.
authorized
(
name
,
lat
,
lng
,
false
)
binding
.
webview
.
callHandler
(
"initZsMap"
,
Gson
().
toJson
(
GPS
(
lat
?.
toDouble
()
?:
0.0
,
lng
?.
toDouble
()
?:
0.0
,
0
))
)
{
}
}
}
}).
init
()
.
show
()
.
show
()
}
}
...
@@ -249,10 +271,10 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel
...
@@ -249,10 +271,10 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel
super
.
initViewObservable
()
super
.
initViewObservable
()
viewModel
.
authorizedBean
.
observe
(
this
,
Observer
{
viewModel
.
authorizedBean
.
observe
(
this
,
Observer
{
it
?.
apply
{
it
?.
apply
{
// binding.webview.loadUrl("file:///android_asset/web/zsmap.html?u=${u
binding
.
webview
.
loadUrl
(
"file:///android_asset/web/zsmap.html?u=${u
// }&gk=${gk}&bk=${bk}&base=${base}&ut=${ut}")
binding
.
webview
.
loadUrl
(
"http://192.168.110.7:9999/z/zsmap.html?u=${u
}&
gk
=
$
{
gk
}&
bk
=
$
{
bk
}&
base
=
$
{
base
}&
ut
=
$
{
ut
}
")
}&
gk
=
$
{
gk
}&
bk
=
$
{
bk
}&
base
=
$
{
base
}&
ut
=
$
{
ut
}
")
// binding.webview.loadUrl("http://192.168.110.7:9999/z/zsmap.html?u=${u
// }&gk=${gk}&bk=${bk}&base=${base}&ut=${ut}")
}
}
})
})
viewModel
.
pt
.
observe
(
this
,
Observer
{
viewModel
.
pt
.
observe
(
this
,
Observer
{
...
...
app/src/main/java/com/mints/street/main/home/HomeFragment.kt
View file @
a5026e55
...
@@ -26,7 +26,9 @@ import com.mints.street.R
...
@@ -26,7 +26,9 @@ import com.mints.street.R
import
com.mints.street.bean.MapBean
import
com.mints.street.bean.MapBean
import
com.mints.street.bean.PositioningBean
import
com.mints.street.bean.PositioningBean
import
com.mints.street.databinding.FragmentHomeBinding
import
com.mints.street.databinding.FragmentHomeBinding
import
com.mints.street.main.my.OpenvipActivity
import
com.mints.street.manager.UmengManager
import
com.mints.street.manager.UmengManager
import
com.mints.street.manager.UserManager
import
com.mints.street.widget.ScrollLayout
import
com.mints.street.widget.ScrollLayout
import
com.mints.street.widget.dialog.DialogMapStyle
import
com.mints.street.widget.dialog.DialogMapStyle
import
com.mints.street.widget.dialog.DialogUtils
import
com.mints.street.widget.dialog.DialogUtils
...
@@ -44,7 +46,13 @@ import me.goldze.mvvmhabit.utils.SPUtils
...
@@ -44,7 +46,13 @@ import me.goldze.mvvmhabit.utils.SPUtils
*/
*/
class
HomeFragment
()
:
BaseFragment
<
FragmentHomeBinding
,
HomeViewModel
>(),
SensorEventListener
{
class
HomeFragment
()
:
BaseFragment
<
FragmentHomeBinding
,
HomeViewModel
>(),
SensorEventListener
{
private
val
viewrecommedDialog
by
lazy
{
ViewRecommedDialog
(
requireActivity
(),
viewModel
,
this
).
init
()
}
private
val
viewrecommedDialog
by
lazy
{
ViewRecommedDialog
(
requireActivity
(),
viewModel
,
this
).
init
()
}
companion
object
{
companion
object
{
val
IS_FIRST_OPEN
:
String
=
"isFirstOpen"
val
IS_FIRST_OPEN
:
String
=
"isFirstOpen"
...
@@ -96,9 +104,9 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso
...
@@ -96,9 +104,9 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso
override
fun
initContentView
(
override
fun
initContentView
(
inflater
:
LayoutInflater
?,
inflater
:
LayoutInflater
?,
container
:
ViewGroup
?,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?
savedInstanceState
:
Bundle
?
)
=
R
.
layout
.
fragment_home
)
=
R
.
layout
.
fragment_home
override
fun
initVariableId
()
=
BR
.
viewModel
override
fun
initVariableId
()
=
BR
.
viewModel
...
@@ -127,9 +135,9 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso
...
@@ -127,9 +135,9 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso
}
}
RxUtils
.
onMultiClick
(
binding
.
ivClick
)
{
RxUtils
.
onMultiClick
(
binding
.
ivClick
)
{
viewModel
.
authorized
(
viewModel
.
authorized
(
""
,
""
,
currentLat
.
toString
(),
currentLon
.
toString
(),
currentLat
.
toString
(),
currentLon
.
toString
(),
false
false
)
)
}
}
RxUtils
.
onMultiClick
(
binding
.
imageMapChangeIcon
)
{
RxUtils
.
onMultiClick
(
binding
.
imageMapChangeIcon
)
{
...
@@ -145,7 +153,13 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso
...
@@ -145,7 +153,13 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso
}
}
//点击热门景点
//点击热门景点
RxUtils
.
onMultiClick
(
binding
.
lyHotview
)
{
RxUtils
.
onMultiClick
(
binding
.
lyHotview
)
{
HotViewDialog
(
requireActivity
(),
viewModel
,
currentLat
,
currentLon
,
this
).
init
().
show
()
if
((!
UserManager
.
INSTANCE
.
userIsLogin
()
||
!
UserManager
.
INSTANCE
.
getVipFlag
()))
{
startActivity
(
OpenvipActivity
::
class
.
java
)
return
@onMultiClick
}
HotViewDialog
(
requireActivity
(),
viewModel
,
currentLat
,
currentLon
,
this
).
init
().
show
()
}
}
viewModel
.
getMapBean
()
viewModel
.
getMapBean
()
}
}
...
@@ -210,7 +224,10 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso
...
@@ -210,7 +224,10 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso
currentLat
=
status
?.
target
?.
latitude
?:
0.0
currentLat
=
status
?.
target
?.
latitude
?:
0.0
currentLon
=
status
?.
target
?.
longitude
?:
0.0
currentLon
=
status
?.
target
?.
longitude
?:
0.0
KLog
.
e
(
"zsf__"
,
"=======移动结束=======${currentLat}================${currentLon}===================="
)
KLog
.
e
(
"zsf__"
,
"=======移动结束=======${currentLat}================${currentLon}===================="
)
currentMapZoom
=
status
?.
zoom
?:
0f
currentMapZoom
=
status
?.
zoom
?:
0f
// 发起反地理编码请求
// 发起反地理编码请求
mSearch
.
reverseGeoCode
(
ReverseGeoCodeOption
().
location
(
status
?.
target
))
mSearch
.
reverseGeoCode
(
ReverseGeoCodeOption
().
location
(
status
?.
target
))
...
@@ -244,7 +261,7 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso
...
@@ -244,7 +261,7 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso
//定位初始化
//定位初始化
initLocation
()
initLocation
()
// 设置比例尺控件的位置,必须在地图加载完成之后
// 设置比例尺控件的位置,必须在地图加载完成之后
Handler
().
postDelayed
({
binding
.
bmapView
.
scaleControlPosition
=
Point
(
20
,
60
)
},
500
)
Handler
().
postDelayed
({
binding
.
bmapView
.
scaleControlPosition
=
Point
(
20
,
60
)
},
500
)
}
}
...
@@ -254,13 +271,13 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso
...
@@ -254,13 +271,13 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso
private
fun
initLocation
()
{
private
fun
initLocation
()
{
// 获取传感器管理服务
// 获取传感器管理服务
mSensorManager
=
AppManager
.
getAppManager
().
currentActivity
mSensorManager
=
AppManager
.
getAppManager
().
currentActivity
.
getSystemService
(
SENSOR_SERVICE
)
as
SensorManager
.
getSystemService
(
SENSOR_SERVICE
)
as
SensorManager
mCurrentMode
=
MyLocationConfiguration
.
LocationMode
.
NORMAL
mCurrentMode
=
MyLocationConfiguration
.
LocationMode
.
NORMAL
// 为系统的方向传感器注册监听器
// 为系统的方向传感器注册监听器
mSensorManager
?.
registerListener
(
mSensorManager
?.
registerListener
(
this
,
this
,
mSensorManager
?.
getDefaultSensor
(
Sensor
.
TYPE_ORIENTATION
),
mSensorManager
?.
getDefaultSensor
(
Sensor
.
TYPE_ORIENTATION
),
SensorManager
.
SENSOR_DELAY_UI
SensorManager
.
SENSOR_DELAY_UI
)
)
// 开启定位图层
// 开启定位图层
...
@@ -307,7 +324,7 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso
...
@@ -307,7 +324,7 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso
val
builder
=
MapStatus
.
Builder
()
val
builder
=
MapStatus
.
Builder
()
builder
.
target
(
center
).
zoom
(
zoom
)
builder
.
target
(
center
).
zoom
(
zoom
)
val
mapStatusUpdate
=
val
mapStatusUpdate
=
MapStatusUpdateFactory
.
newMapStatus
(
builder
.
build
())
MapStatusUpdateFactory
.
newMapStatus
(
builder
.
build
())
showupgradevipDialog
(
requireContext
())
showupgradevipDialog
(
requireContext
())
// 设置地图状态
// 设置地图状态
mBaiduMap
?.
animateMapStatus
(
mapStatusUpdate
,
200
)
mBaiduMap
?.
animateMapStatus
(
mapStatusUpdate
,
200
)
...
@@ -409,11 +426,11 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso
...
@@ -409,11 +426,11 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso
mCurrentLon
=
location
?.
longitude
?:
0.0
mCurrentLon
=
location
?.
longitude
?:
0.0
mCurrentAccracy
=
location
?.
radius
?:
0f
mCurrentAccracy
=
location
?.
radius
?:
0f
myLocationData
=
MyLocationData
.
Builder
()
myLocationData
=
MyLocationData
.
Builder
()
.
accuracy
(
location
?.
radius
?:
0f
)
// 设置定位数据的精度信息,单位:米
.
accuracy
(
location
?.
radius
?:
0f
)
// 设置定位数据的精度信息,单位:米
.
direction
(
mCurrentDirection
.
toFloat
())
// 此处设置开发者获取到的方向信息,顺时针0-360
.
direction
(
mCurrentDirection
.
toFloat
())
// 此处设置开发者获取到的方向信息,顺时针0-360
.
latitude
(
location
?.
latitude
?:
0.0
)
.
latitude
(
location
?.
latitude
?:
0.0
)
.
longitude
(
location
?.
longitude
?:
0.0
)
.
longitude
(
location
?.
longitude
?:
0.0
)
.
build
()
.
build
()
this
.
setMyLocationData
(
myLocationData
)
this
.
setMyLocationData
(
myLocationData
)
if
(
isFirstLoc
)
{
if
(
isFirstLoc
)
{
isFirstLoc
=
false
isFirstLoc
=
false
...
@@ -429,15 +446,15 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso
...
@@ -429,15 +446,15 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso
override
fun
onSensorChanged
(
sensorEvent
:
SensorEvent
?)
{
override
fun
onSensorChanged
(
sensorEvent
:
SensorEvent
?)
{
val
x
:
Double
=
val
x
:
Double
=
sensorEvent
?.
values
?.
get
(
SensorManager
.
DATA_X
)
?.
toDouble
()
?:
0.0
sensorEvent
?.
values
?.
get
(
SensorManager
.
DATA_X
)
?.
toDouble
()
?:
0.0
if
(
kotlin
.
math
.
abs
(
x
-
lastX
)
>
1.0
)
{
if
(
kotlin
.
math
.
abs
(
x
-
lastX
)
>
1.0
)
{
mCurrentDirection
=
x
.
toInt
()
mCurrentDirection
=
x
.
toInt
()
myLocationData
=
MyLocationData
.
Builder
()
myLocationData
=
MyLocationData
.
Builder
()
.
accuracy
(
mCurrentAccracy
)
// 设置定位数据的精度信息,单位:米
.
accuracy
(
mCurrentAccracy
)
// 设置定位数据的精度信息,单位:米
.
direction
(
mCurrentDirection
.
toFloat
())
// 此处设置开发者获取到的方向信息,顺时针0-360
.
direction
(
mCurrentDirection
.
toFloat
())
// 此处设置开发者获取到的方向信息,顺时针0-360
.
latitude
(
mCurrentLat
)
.
latitude
(
mCurrentLat
)
.
longitude
(
mCurrentLon
)
.
longitude
(
mCurrentLon
)
.
build
()
.
build
()
mBaiduMap
?.
setMyLocationData
(
myLocationData
)
mBaiduMap
?.
setMyLocationData
(
myLocationData
)
}
}
lastX
=
x
lastX
=
x
...
...
app/src/main/java/com/mints/street/widget/dialog/HotViewDialog.kt
View file @
a5026e55
...
@@ -13,11 +13,13 @@ import com.alibaba.android.vlayout.VirtualLayoutManager
...
@@ -13,11 +13,13 @@ import com.alibaba.android.vlayout.VirtualLayoutManager
import
com.google.android.material.bottomsheet.BottomSheetDialog
import
com.google.android.material.bottomsheet.BottomSheetDialog
import
com.mints.street.R
import
com.mints.street.R
import
com.mints.street.adapter.ItemHotViewAdapter
import
com.mints.street.adapter.ItemHotViewAdapter
import
com.mints.street.bean.HotViewBean
import
com.mints.street.main.home.HomeFragment
import
com.mints.street.main.home.HomeFragment
import
com.mints.street.main.home.HomeViewModel
import
com.mints.street.main.home.HomeViewModel
import
com.mints.street.widget.GridItemDecoration
import
com.mints.street.widget.GridItemDecoration
class
HotViewDialog
(
context
:
FragmentActivity
,
viewModel
:
HomeViewModel
,
mCurrentLat
:
Double
,
mCurrentLon
:
Double
,
fragment
:
Fragment
)
{
class
HotViewDialog
(
context
:
FragmentActivity
,
viewModel
:
HomeViewModel
,
mCurrentLat
:
Double
,
mCurrentLon
:
Double
,
fragment
:
Fragment
,
val
onHotItemClick
:
OnHotItemClick
?=
null
)
{
private
var
mBottomSheetDialog
:
BottomSheetDialog
?
=
null
private
var
mBottomSheetDialog
:
BottomSheetDialog
?
=
null
private
var
context
:
FragmentActivity
private
var
context
:
FragmentActivity
...
@@ -62,7 +64,8 @@ class HotViewDialog(context: FragmentActivity, viewModel: HomeViewModel, mCurren
...
@@ -62,7 +64,8 @@ class HotViewDialog(context: FragmentActivity, viewModel: HomeViewModel, mCurren
viewModel
?.
getHotView
()
viewModel
?.
getHotView
()
viewModel
?.
hotviewData
?.
observe
(
fragment
!!
,
androidx
.
lifecycle
.
Observer
{
viewModel
?.
hotviewData
?.
observe
(
fragment
!!
,
androidx
.
lifecycle
.
Observer
{
if
(
itemHotViewAdapter
==
null
)
{
if
(
itemHotViewAdapter
==
null
)
{
itemHotViewAdapter
=
ItemHotViewAdapter
(
context
,
it
.
list
,
viewModel
!!
,
mCurrentLat
!!
,
mCurrentLon
!!
)
itemHotViewAdapter
=
ItemHotViewAdapter
(
context
,
mBottomSheetDialog
,
it
.
list
,
viewModel
!!
,
mCurrentLat
!!
,
mCurrentLon
!!
,
onHotItemClick
)
mAdapter
?.
addAdapter
(
itemHotViewAdapter
)
mAdapter
?.
addAdapter
(
itemHotViewAdapter
)
}
}
mAdapter
?.
notifyDataSetChanged
()
mAdapter
?.
notifyDataSetChanged
()
...
@@ -84,6 +87,8 @@ class HotViewDialog(context: FragmentActivity, viewModel: HomeViewModel, mCurren
...
@@ -84,6 +87,8 @@ class HotViewDialog(context: FragmentActivity, viewModel: HomeViewModel, mCurren
fun
onDestroy
()
{
fun
onDestroy
()
{
mBottomSheetDialog
=
null
mBottomSheetDialog
=
null
}
}
interface
OnHotItemClick
{
fun
onItemClick
(
position
:
Int
,
itemBean
:
HotViewBean
.
Dataslist
?)
}
}
}
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