Commit 36c980dd authored by 张释方's avatar 张释方

完成热门景点接口id数据对接以及跳转

parent a5026e55
......@@ -44,6 +44,7 @@ class ItemHotViewAdapter(val context: Context, val dialog: BottomSheetDialog?, v
RxUtils.onMultiClick(holder.itemView) {
//判断是否当前是否是会员,
if (!UserManager.INSTANCE.userIsLogin()) {
dialog?.dismiss()
//否-跳转到开通vip界面
startActivity(OpenvipActivity::class.java)
} else {
......
......@@ -12,5 +12,14 @@ class HotViewBean : Serializable {
val lng: String? = null
val name: String? = null
val distance: Double? = null
// blng:百度经度
val blng: String? = null
// blat:百度纬度
val blat: String? = null
// bvid: 全景id
val bvid: String? = null
}
}
......@@ -3,7 +3,6 @@ package com.mints.street.main.googlemap
import android.os.Bundle
import android.os.Handler
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.webkit.WebChromeClient
import androidx.lifecycle.Observer
......@@ -11,7 +10,6 @@ import com.baidu.location.BDLocation
import com.baidu.location.BDLocationListener
import com.baidu.location.LocationClient
import com.baidu.location.LocationClientOption
import com.baidu.mapapi.map.MapStatusUpdateFactory
import com.fry.base.base.BaseFragment
import com.github.lzyzsd.jsbridge.CallBackFunction
import com.github.lzyzsd.jsbridge.DefaultHandler
......@@ -25,10 +23,8 @@ import com.mints.street.bean.MutualBean
import com.mints.street.databinding.ActivityGoogleMapBinding
import com.mints.street.main.home.HomeViewModel
import com.mints.street.main.home.SearchMapActivity
import com.mints.street.utils.GPSConverterUtils
import com.mints.street.webview.MintsWebViewActivity
import com.mints.street.widget.ScrollLayout
import com.mints.street.widget.ScrollLayout.STATUS_CLOSE
import com.mints.street.widget.dialog.DialogMapStyle
import com.mints.street.widget.dialog.HotViewDialog
import me.goldze.mvvmhabit.base.AppManager
......@@ -185,28 +181,19 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel
} //点击热门景点
RxUtils.onMultiClick(binding.lyHotview) {
HotViewDialog(requireActivity(), viewModel,
0.0, 0.0,
gps.lat, gps.lng,
this@GoogleMapFragment,object :HotViewDialog.OnHotItemClick{
override fun onItemClick(position: Int, itemBean: HotViewBean.Dataslist?) {
itemBean?.apply {
//todo 冯瑞雨 修改toDouble
viewModel.authorized(name,lat,
lng, false)
viewModel.authorized(bvid,name)
binding.webview.callHandler("initZsMap"
,Gson().toJson(GPS(lat?.toDouble()?:0.0,
lng?.toDouble()?:0.0,0)) ) {
}
}
}
}).init()
.show()
}).init().show()
}
}
......
......@@ -26,9 +26,7 @@ import com.mints.street.R
import com.mints.street.bean.MapBean
import com.mints.street.bean.PositioningBean
import com.mints.street.databinding.FragmentHomeBinding
import com.mints.street.main.my.OpenvipActivity
import com.mints.street.manager.UmengManager
import com.mints.street.manager.UserManager
import com.mints.street.widget.ScrollLayout
import com.mints.street.widget.dialog.DialogMapStyle
import com.mints.street.widget.dialog.DialogUtils
......@@ -48,9 +46,9 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso
private val viewrecommedDialog by lazy {
ViewRecommedDialog(
requireActivity(),
viewModel,
this
requireActivity(),
viewModel,
this
).init()
}
......@@ -104,9 +102,9 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso
override fun initContentView(
inflater: LayoutInflater?,
container: ViewGroup?,
savedInstanceState: Bundle?
inflater: LayoutInflater?,
container: ViewGroup?,
savedInstanceState: Bundle?
) = R.layout.fragment_home
override fun initVariableId() = BR.viewModel
......@@ -135,9 +133,9 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso
}
RxUtils.onMultiClick(binding.ivClick) {
viewModel.authorized(
"",
currentLat.toString(), currentLon.toString(),
false
"",
currentLat.toString(), currentLon.toString(),
false
)
}
RxUtils.onMultiClick(binding.imageMapChangeIcon) {
......@@ -153,12 +151,12 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso
}
//点击热门景点
RxUtils.onMultiClick(binding.lyHotview) {
if ((!UserManager.INSTANCE.userIsLogin() || !UserManager.INSTANCE.getVipFlag())) {
startActivity(OpenvipActivity::class.java)
return@onMultiClick
}
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()
......@@ -225,8 +223,8 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso
currentLon = status?.target?.longitude ?: 0.0
KLog.e(
"zsf__",
"=======移动结束=======${currentLat}================${currentLon}===================="
"zsf__",
"=======移动结束=======${currentLat}================${currentLon}===================="
)
currentMapZoom = status?.zoom ?: 0f
// 发起反地理编码请求
......@@ -271,13 +269,13 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso
private fun initLocation() {
// 获取传感器管理服务
mSensorManager = AppManager.getAppManager().currentActivity
.getSystemService(SENSOR_SERVICE) as SensorManager
.getSystemService(SENSOR_SERVICE) as SensorManager
mCurrentMode = MyLocationConfiguration.LocationMode.NORMAL
// 为系统的方向传感器注册监听器
mSensorManager?.registerListener(
this,
mSensorManager?.getDefaultSensor(Sensor.TYPE_ORIENTATION),
SensorManager.SENSOR_DELAY_UI
this,
mSensorManager?.getDefaultSensor(Sensor.TYPE_ORIENTATION),
SensorManager.SENSOR_DELAY_UI
)
// 开启定位图层
......@@ -324,7 +322,7 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso
val builder = MapStatus.Builder()
builder.target(center).zoom(zoom)
val mapStatusUpdate =
MapStatusUpdateFactory.newMapStatus(builder.build())
MapStatusUpdateFactory.newMapStatus(builder.build())
showupgradevipDialog(requireContext())
// 设置地图状态
mBaiduMap?.animateMapStatus(mapStatusUpdate, 200)
......@@ -426,11 +424,11 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso
mCurrentLon = location?.longitude ?: 0.0
mCurrentAccracy = location?.radius ?: 0f
myLocationData = MyLocationData.Builder()
.accuracy(location?.radius ?: 0f) // 设置定位数据的精度信息,单位:米
.direction(mCurrentDirection.toFloat()) // 此处设置开发者获取到的方向信息,顺时针0-360
.latitude(location?.latitude ?: 0.0)
.longitude(location?.longitude ?: 0.0)
.build()
.accuracy(location?.radius ?: 0f) // 设置定位数据的精度信息,单位:米
.direction(mCurrentDirection.toFloat()) // 此处设置开发者获取到的方向信息,顺时针0-360
.latitude(location?.latitude ?: 0.0)
.longitude(location?.longitude ?: 0.0)
.build()
this.setMyLocationData(myLocationData)
if (isFirstLoc) {
isFirstLoc = false
......@@ -446,15 +444,15 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso
override fun onSensorChanged(sensorEvent: SensorEvent?) {
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) {
mCurrentDirection = x.toInt()
myLocationData = MyLocationData.Builder()
.accuracy(mCurrentAccracy) // 设置定位数据的精度信息,单位:米
.direction(mCurrentDirection.toFloat()) // 此处设置开发者获取到的方向信息,顺时针0-360
.latitude(mCurrentLat)
.longitude(mCurrentLon)
.build()
.accuracy(mCurrentAccracy) // 设置定位数据的精度信息,单位:米
.direction(mCurrentDirection.toFloat()) // 此处设置开发者获取到的方向信息,顺时针0-360
.latitude(mCurrentLat)
.longitude(mCurrentLon)
.build()
mBaiduMap?.setMyLocationData(myLocationData)
}
lastX = x
......
......@@ -197,12 +197,10 @@ class HomeViewModel(application: Application) : BaseViewModel(application) {
override fun onBusinessSuccess(response: BaseResponse<HotViewBean>) {
hotviewData.value = response.result
KLog.e("getmyInfo", response.result.toString())
}
override fun onError(e: Throwable) {
super.onError(e)
KLog.e("getmyInfo", "用户登录信息请求失败")
}
}
......@@ -235,7 +233,7 @@ class HomeViewModel(application: Application) : BaseViewModel(application) {
)
}
fun authorized(name:String?,lat:String? ,lng:String?) {
fun authorized(bvid:String?,name:String?) {
ApiModel.authorized().safeSubscribe(object
: HttpSubscribeImpl<BaseResponse<AuthorizedBean>>(
this@HomeViewModel,false
......@@ -243,7 +241,7 @@ class HomeViewModel(application: Application) : BaseViewModel(application) {
override fun onBusinessSuccess(response: BaseResponse<AuthorizedBean>) {
MintsWebViewActivity.startWebView(
name,
MintsWebViewActivity.toBaduVR(lat, lng, response.result?.bk)
MintsWebViewActivity.toBaduVR(bvid, response.result?.bk)
)
}
......
......@@ -9,6 +9,7 @@
android:orientation="vertical"
>
<com.github.lzyzsd.jsbridge.BridgeWebView
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
......
......@@ -21,7 +21,6 @@
<TextView
android:layout_marginStart="10dp"
android:id="@+id/tv_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
......
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