Commit 9efbbe1d authored by fengruiyu's avatar fengruiyu

修改比例尺的位置

google页面添加热门景点弹出框
parent 49584319
...@@ -43,7 +43,7 @@ class ItemHotViewAdapter(val context: Context, var list: List<HotViewBean.datasl ...@@ -43,7 +43,7 @@ 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?.toDouble(), list?.get(position)?.lng?.toDouble()) viewModel.authorized(list?.get(position)?.name, list?.get(position)?.lat, list?.get(position)?.lng)
} }
} }
} }
......
...@@ -28,6 +28,8 @@ import com.mints.street.utils.GPSConverterUtils ...@@ -28,6 +28,8 @@ import com.mints.street.utils.GPSConverterUtils
import com.mints.street.webview.MintsWebViewActivity import com.mints.street.webview.MintsWebViewActivity
import com.mints.street.widget.ScrollLayout import com.mints.street.widget.ScrollLayout
import com.mints.street.widget.ScrollLayout.STATUS_CLOSE 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 import me.goldze.mvvmhabit.base.AppManager
import me.goldze.mvvmhabit.utils.CommonDialogUtils import me.goldze.mvvmhabit.utils.CommonDialogUtils
import me.goldze.mvvmhabit.utils.KLog import me.goldze.mvvmhabit.utils.KLog
...@@ -43,6 +45,8 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel ...@@ -43,6 +45,8 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel
var mLocationClient: LocationClient? = null var mLocationClient: LocationClient? = null
private val myListener: MyLocationListener = MyLocationListener() private val myListener: MyLocationListener = MyLocationListener()
private var isScrollLayoutClose: Boolean = false private var isScrollLayoutClose: Boolean = false
//弹出框
private var dialogMapStyle: DialogMapStyle? = null
private var gps = GPS(39.915121, 116.403947,0) private var gps = GPS(39.915121, 116.403947,0)
...@@ -167,6 +171,21 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel ...@@ -167,6 +171,21 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel
RxUtils.onMultiClick(binding.stbBgSearch) { RxUtils.onMultiClick(binding.stbBgSearch) {
SearchMapActivity.startSearchMapActivity(this) SearchMapActivity.startSearchMapActivity(this)
} }
RxUtils.onMultiClick(binding.imageMapChangeIcon) {
context?.apply {
if (dialogMapStyle == null) {
dialogMapStyle = DialogMapStyle(this)
}
if (this@GoogleMapFragment.fragmentManager != null) {
dialogMapStyle?.show(this@GoogleMapFragment.fragmentManager!!, "dialogMapStyle")
}
}
} //点击热门景点
RxUtils.onMultiClick(binding.lyHotview) {
HotViewDialog(requireActivity(), viewModel, 0.0, 0.0, this@GoogleMapFragment).init()
.show()
}
} }
...@@ -230,9 +249,10 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel ...@@ -230,9 +249,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}")
KLog.e("file:///android_asset/w")
} }
}) })
viewModel.pt.observe(this, Observer { viewModel.pt.observe(this, Observer {
......
package com.mints.street.main.home package com.mints.street.main.home
import android.content.Context.SENSOR_SERVICE import android.content.Context.SENSOR_SERVICE
import android.graphics.Point
import android.hardware.Sensor import android.hardware.Sensor
import android.hardware.SensorEvent import android.hardware.SensorEvent
import android.hardware.SensorEventListener import android.hardware.SensorEventListener
...@@ -143,10 +144,9 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso ...@@ -143,10 +144,9 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso
} }
//点击热门景点 //点击热门景点
RxUtils.onMultiClick(binding.lyHotview, { RxUtils.onMultiClick(binding.lyHotview) {
val hotViewDialog:HotViewDialog?=HotViewDialog(requireActivity(), viewModel, currentLat,currentLon,this) HotViewDialog(requireActivity(), viewModel, currentLat, currentLon, this).init().show()
hotViewDialog?.init()?.show() }
})
viewModel.getMapBean() viewModel.getMapBean()
} }
...@@ -243,6 +243,9 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso ...@@ -243,6 +243,9 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso
} }
//定位初始化 //定位初始化
initLocation() initLocation()
// 设置比例尺控件的位置,必须在地图加载完成之后
Handler().postDelayed({ binding.bmapView.scaleControlPosition = Point(20, 60) }, 500)
} }
/** /**
......
...@@ -235,7 +235,7 @@ class HomeViewModel(application: Application) : BaseViewModel(application) { ...@@ -235,7 +235,7 @@ class HomeViewModel(application: Application) : BaseViewModel(application) {
) )
} }
fun authorized(name:String?,lat:Double?=0.0 ,lng:Double?=0.0) { fun authorized(name:String?,lat:String? ,lng:String?) {
ApiModel.authorized().safeSubscribe(object ApiModel.authorized().safeSubscribe(object
: HttpSubscribeImpl<BaseResponse<AuthorizedBean>>( : HttpSubscribeImpl<BaseResponse<AuthorizedBean>>(
this@HomeViewModel,false this@HomeViewModel,false
...@@ -243,14 +243,7 @@ class HomeViewModel(application: Application) : BaseViewModel(application) { ...@@ -243,14 +243,7 @@ class HomeViewModel(application: Application) : BaseViewModel(application) {
override fun onBusinessSuccess(response: BaseResponse<AuthorizedBean>) { override fun onBusinessSuccess(response: BaseResponse<AuthorizedBean>) {
MintsWebViewActivity.startWebView( MintsWebViewActivity.startWebView(
name, name,
MintsWebViewActivity.toGoogleVR( MintsWebViewActivity.toBaduVR(lat, lng, response.result?.bk)
response.result.u,
response.result.gk,
response.result.base,
lat.toString(),
lng.toString(),
response.result.ut
)
) )
} }
......
...@@ -23,6 +23,7 @@ import me.goldze.mvvmhabit.utils.KLog ...@@ -23,6 +23,7 @@ import me.goldze.mvvmhabit.utils.KLog
class MintsWebViewActivity : BaseActivity<ActivityMintsWebViewBinding, MintsWebViewModel>() { class MintsWebViewActivity : BaseActivity<ActivityMintsWebViewBinding, MintsWebViewModel>() {
companion object{ companion object{
//打开地图的webView
fun startWebView(name:String?=null,url:String?=null){ fun startWebView(name:String?=null,url:String?=null){
AppManager.getAppManager().currentActivity?.apply { AppManager.getAppManager().currentActivity?.apply {
val intent = Intent(this,MintsWebViewActivity::class.java) val intent = Intent(this,MintsWebViewActivity::class.java)
...@@ -31,18 +32,20 @@ class MintsWebViewActivity : BaseActivity<ActivityMintsWebViewBinding, MintsWebV ...@@ -31,18 +32,20 @@ class MintsWebViewActivity : BaseActivity<ActivityMintsWebViewBinding, MintsWebV
this.startActivity(intent) this.startActivity(intent)
} }
} }
//谷歌地址拼接
fun toGoogleVR(u:String?,gk:String?,base:String?,lat:String?,lng:String?,ut:String?):String{ fun toGoogleVR(u:String?,gk:String?,base:String?,lat:String?,lng:String?,ut:String?):String{
KLog.i("MintsWebViewActivity","file:///android_asset/web/streets.html?u=${u KLog.i("MintsWebViewActivity","file:///android_asset/web/streets.html?u=${u
}&gk=${gk}&base=${base}&lat=${lat}&lng=${lng}&ut=${ut}") }&gk=${gk}&base=${base}&lat=${lat}&lng=${lng}&ut=${ut}")
return "file:///android_asset/web/streets.html?u=${u return "file:///android_asset/web/streets.html?u=${u
}&gk=${gk}&base=${base}&lat=${lat}&lng=${lng}&ut=${ut}" }&gk=${gk}&base=${base}&lat=${lat}&lng=${lng}&ut=${ut}"
} }
//地图上跳转百度的地址拼接
fun toBaduVR(d:String?,bk:String?):String{ fun toBaduVR(d:String?,bk:String?):String{
KLog.i("MintsWebViewActivity","file:///android_asset/web/mr.html?d=${d}&bk=${bk}") KLog.i("MintsWebViewActivity","file:///android_asset/web/mr.html?d=${d}&bk=${bk}")
return "file:///android_asset/web/mr.html?d=${d}&bk=${bk}" return "file:///android_asset/web/mr.html?d=${d}&bk=${bk}"
} }
//其他的跳转百度的地址拼接
fun toBaduVR(lat:String?,lng:String?,bk:String?):String{ fun toBaduVR(lat:String?,lng:String?,bk:String?):String{
KLog.i("MintsWebViewActivity","file:///android_asset/web/m.html?lat=${lat}&lng=${lng}&bk=${bk}") KLog.i("MintsWebViewActivity","file:///android_asset/web/m.html?lat=${lat}&lng=${lng}&bk=${bk}")
return "file:///android_asset/web/m.html?lat=${lat}&lng=${lng}&bk=${bk}" return "file:///android_asset/web/m.html?lat=${lat}&lng=${lng}&bk=${bk}"
} }
......
...@@ -4,6 +4,7 @@ import android.graphics.Color ...@@ -4,6 +4,7 @@ import android.graphics.Color
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.widget.ImageView import android.widget.ImageView
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity import androidx.fragment.app.FragmentActivity
import androidx.recyclerview.widget.DividerItemDecoration import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
...@@ -16,12 +17,12 @@ import com.mints.street.main.home.HomeFragment ...@@ -16,12 +17,12 @@ 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,homeFragment: HomeFragment) { class HotViewDialog(context: FragmentActivity, viewModel: HomeViewModel, mCurrentLat:Double, mCurrentLon:Double,fragment: Fragment) {
private var mBottomSheetDialog: BottomSheetDialog? = null private var mBottomSheetDialog: BottomSheetDialog? = null
private var context: FragmentActivity private var context: FragmentActivity
private var viewModel: HomeViewModel? = null private var viewModel: HomeViewModel? = null
private var homeFragment: HomeFragment? = null private var fragment: Fragment? = null
private var mCurrentLat: Double? = null private var mCurrentLat: Double? = null
private var mCurrentLon: Double? = null private var mCurrentLon: Double? = null
...@@ -33,7 +34,7 @@ class HotViewDialog(context: FragmentActivity, viewModel: HomeViewModel, mCurren ...@@ -33,7 +34,7 @@ class HotViewDialog(context: FragmentActivity, viewModel: HomeViewModel, mCurren
init { init {
this.context = context this.context = context
this.viewModel = viewModel this.viewModel = viewModel
this.homeFragment = homeFragment this.fragment = fragment
this.mCurrentLat=mCurrentLat this.mCurrentLat=mCurrentLat
this.mCurrentLon=mCurrentLon this.mCurrentLon=mCurrentLon
} }
...@@ -53,15 +54,15 @@ class HotViewDialog(context: FragmentActivity, viewModel: HomeViewModel, mCurren ...@@ -53,15 +54,15 @@ class HotViewDialog(context: FragmentActivity, viewModel: HomeViewModel, mCurren
view1.findViewById<RecyclerView>(R.id.recycler_view) view1.findViewById<RecyclerView>(R.id.recycler_view)
.addItemDecoration(GridItemDecoration(context, DividerItemDecoration.VERTICAL)) .addItemDecoration(GridItemDecoration(context, DividerItemDecoration.VERTICAL))
vLayout = VirtualLayoutManager(context!!); vLayout = VirtualLayoutManager(context)
mAdapter = DelegateAdapter(vLayout, false) mAdapter = DelegateAdapter(vLayout, false)
recycler_view.layoutManager = vLayout recycler_view.layoutManager = vLayout
recycler_view.adapter = mAdapter recycler_view.adapter = mAdapter
viewModel?.getHotView() viewModel?.getHotView()
viewModel?.hotviewData?.observe(homeFragment!!, 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, it.list, viewModel!!,mCurrentLat!!,mCurrentLon!!)
mAdapter?.addAdapter(itemHotViewAdapter) mAdapter?.addAdapter(itemHotViewAdapter)
} }
mAdapter?.notifyDataSetChanged() mAdapter?.notifyDataSetChanged()
......
...@@ -41,6 +41,26 @@ ...@@ -41,6 +41,26 @@
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" /> app:layout_constraintEnd_toEndOf="parent" />
<ImageView
android:id="@+id/image_map_change_icon"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginBottom="220dp"
android:layout_marginTop="35dp"
android:src="@mipmap/map_change_icon"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
/>
<ImageView
android:id="@+id/ly_hotview"
android:layout_width="35dp"
android:layout_height="35dp"
android:padding="3dp"
android:layout_marginTop="10dp"
android:src="@mipmap/icon_hotview"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/image_map_change_icon" />
<LinearLayout <LinearLayout
android:id="@+id/map_a_d" android:id="@+id/map_a_d"
android:layout_width="31dp" android:layout_width="31dp"
......
...@@ -29,32 +29,22 @@ ...@@ -29,32 +29,22 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/bmapView" /> app:layout_constraintTop_toTopOf="@id/bmapView" />
<ImageView
android:id="@+id/image_map_change"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginTop="15dp"
android:src="@mipmap/map_change_icon"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView <ImageView
android:id="@+id/image_map_history" android:id="@+id/image_map_history"
android:layout_width="35dp" android:layout_width="35dp"
android:layout_height="35dp" android:layout_height="35dp"
android:layout_marginTop="15dp" android:layout_marginTop="25dp"
android:src="@mipmap/map_history_icon" android:src="@mipmap/map_history_icon"
android:visibility="gone" android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/image_map_change" /> app:layout_constraintTop_toBottomOf="@id/image_map_change_icon" />
<ImageView <ImageView
android:id="@+id/ly_hotview" android:id="@+id/ly_hotview"
android:layout_width="35dp" android:layout_width="35dp"
android:layout_height="35dp" android:layout_height="35dp"
android:padding="3dp" android:padding="3dp"
android:layout_marginTop="15dp" android:layout_marginTop="10dp"
android:src="@mipmap/icon_hotview" android:src="@mipmap/icon_hotview"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/image_map_change_icon" /> app:layout_constraintTop_toBottomOf="@id/image_map_change_icon" />
...@@ -73,7 +63,7 @@ ...@@ -73,7 +63,7 @@
android:layout_width="35dp" android:layout_width="35dp"
android:layout_height="35dp" android:layout_height="35dp"
android:layout_marginBottom="220dp" android:layout_marginBottom="220dp"
android:layout_marginTop="15dp" android:layout_marginTop="35dp"
android:src="@mipmap/map_change_icon" android:src="@mipmap/map_change_icon"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
......
...@@ -50,7 +50,9 @@ ...@@ -50,7 +50,9 @@
android:textColor="@color/black" android:textColor="@color/black"
android:textSize="18dp" android:textSize="18dp"
app:layout_constraintStart_toEndOf="@+id/image1" app:layout_constraintStart_toEndOf="@+id/image1"
app:layout_constraintTop_toTopOf="@+id/image1" /> app:layout_constraintTop_toTopOf="@+id/image1"
app:layout_constraintBottom_toTopOf="@id/line"
/>
<View <View
android:id="@+id/view" android:id="@+id/view"
...@@ -76,6 +78,7 @@ ...@@ -76,6 +78,7 @@
tools:text="距离" /> tools:text="距离" />
<androidx.appcompat.widget.LinearLayoutCompat <androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/line"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
...@@ -91,7 +94,7 @@ ...@@ -91,7 +94,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="5dp" android:layout_marginBottom="5dp"
android:text="景点介绍。。。" tools:text="景点介绍。。。"
android:textColor="#99000000" android:textColor="#99000000"
android:textSize="12sp" /> android:textSize="12sp" />
......
...@@ -13,7 +13,7 @@ ext { ...@@ -13,7 +13,7 @@ ext {
minSdkVersion : 21, minSdkVersion : 21,
targetSdkVersion : 30, targetSdkVersion : 30,
versionCode : 1, versionCode : 1,
versionName : "1.0.0", versionName : "1.0.1",
] ]
java_version = [ java_version = [
......
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