Commit 5cdb56e9 authored by fengruiyu's avatar fengruiyu

修改第一次景点按钮问题

parent 7b9acf59
......@@ -110,9 +110,9 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel
}
//点击地图样式
RxUtils.onMultiClick(binding.imageMapChangeIcon) {
if (dialogMapStyle == null){
if (dialogMapStyle == null) {
viewModel.getMapStyle()
}else{
} else {
if (this@GoogleMapFragment.fragmentManager != null) {
dialogMapStyle?.show(this@GoogleMapFragment.fragmentManager!!, "dialogMapStyle")
}
......@@ -205,13 +205,13 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel
}
//android->js调起付费页面
binding.webview.registerHandler("needPay") { _, _ ->
if(!UserManager.INSTANCE.getVipFlag()){
if (!UserManager.INSTANCE.getVipFlag()) {
startActivity(OpenvipActivity::class.java)
}
}
//android->js调起升级的弹出框
binding.webview.registerHandler("needPayPopup") { _, _ ->
if(!UserManager.INSTANCE.getVipFlag()){
if (!UserManager.INSTANCE.getVipFlag()) {
showUpgradeVipDialog()
}
}
......@@ -231,9 +231,9 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel
}
}
private var upgradeVipDialog: UpgradeVipDialog?=null
private fun showUpgradeVipDialog(){
if (upgradeVipDialog== null){
private var upgradeVipDialog: UpgradeVipDialog? = null
private fun showUpgradeVipDialog() {
if (upgradeVipDialog == null) {
upgradeVipDialog = showupgradevipDialog(this.context)
}
upgradeVipDialog?.show()
......@@ -261,13 +261,17 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel
) {
}
}
/**
* 调用JS
* 第一次加载
*/
private fun beginInitZsMap(lat: Double? = null, lng: Double? = null,
inner: Int = 0,bean: HotViewBean?=null,mapType:String?
,showVrButton:Int?,showScenics:Int?) {
private fun beginInitZsMap(
lat: Double? = null,
lng: Double? = null,
inner: Int = 0,
bean: HotViewBean? = null
) {
val initMapBean = InitMapBean()
initMapBean.lat = lat ?: gps.lat
initMapBean.lng = lng ?: gps.lng
......@@ -278,10 +282,30 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel
//非vip
initMapBean.vip = 0
}
var mapType: String? = null
viewModel.mapStyleSortBean.value?.mapStyleSort?.get(0)?.list?.forEach outside@{ bean ->
if (bean.isSelected == true) {
mapType = bean.key
return@outside
}
}
initMapBean.inner = inner
initMapBean.mapType = mapType
initMapBean.showVrButton = showVrButton
initMapBean.showScenics = showScenics
initMapBean.mapType = mapType ?: "hybrid"
initMapBean.showVrButton = if (viewModel.mapStyleSortBean.value == null) {
1
} else if (viewModel.mapStyleSortBean.value?.isStreetViewMap == true) {
1
} else {
0
}
initMapBean.showScenics = if (viewModel.mapStyleSortBean.value
?.isRecommendedPlaces == true
) {
1
} else {
0
}
initMapBean.scenics = bean?.list
binding.webview.callHandler(
"beginInitZsMap", Gson().toJson(initMapBean)
......@@ -409,7 +433,7 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel
})
//搜索页面回调参数
viewModel.pt.observe(this, Observer {
loadPosition(it.lat, it.lng,it.inner)
loadPosition(it.lat, it.lng, it.inner)
binding.scrollLayout.toggle(ScrollLayout.STATUS_CLOSE)
})
//获取地图展示样式
......@@ -445,18 +469,8 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel
})
viewModel.viewRecommed.observe(this, Observer {
it?.apply {
var mapType:String? = null
viewModel.mapStyleSortBean.value?.mapStyleSort?.get(0)?.list?.forEach outside@{bean->
if(bean.isSelected == true){
mapType = bean.key
return@outside
}
}
beginInitZsMap(gps.lat, gps.lng,bean = this,mapType = mapType?:"hybrid",
showVrButton =if (viewModel.mapStyleSortBean.value
?.isStreetViewMap == true){1}else{0}
,showScenics = if (viewModel.mapStyleSortBean.value
?.isRecommendedPlaces == true){1}else{0})
beginInitZsMap(gps.lat, gps.lng, bean = this)
}
})
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment