Commit 5cdb56e9 authored by fengruiyu's avatar fengruiyu

修改第一次景点按钮问题

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