Commit 71ab39c9 authored by 张释方's avatar 张释方

Merge branch 'dev_1.0.0' of http://gitlab.mints-id.com/android/android_street into branch_zsf_2

parents 133881c9 a59fc2ca
package com.mints.street.adapter
import android.content.Context
import com.alibaba.android.vlayout.LayoutHelper
import com.alibaba.android.vlayout.layout.GridLayoutHelper
import com.alibaba.android.vlayout.layout.LinearLayoutHelper
import com.fry.base.adapter.AbstractVLayoutBaseAdapter
import com.fry.base.adapter.BindingViewHolder
import com.mints.street.R
import com.mints.street.databinding.DialogMapContentItemBinding
import com.mints.street.databinding.DialogMapContentItemBindingImpl
import com.mints.street.databinding.ItemGridMapAdapterBinding
/**
* Created by 冯瑞雨 on 2021/8/9.
*/
class DialogMapContentAdapter(val context: Context, var list: List<String>?) :
AbstractVLayoutBaseAdapter<DialogMapContentItemBinding, List<String>>(context, list, 2) {
override fun onBindViewHolder(
holder: BindingViewHolder<DialogMapContentItemBinding>,
position: Int) {
// holder.binding.
}
override fun getItemCount() = list?.size?:0
override fun onCreateLayoutHelper(): LayoutHelper {
val helper = GridLayoutHelper(2)
helper.setAutoExpand(false)
return helper
}
override fun getLayoutId(viewType: Int) = R.layout.dialog_map_content_item
}
\ No newline at end of file
package com.mints.street.adapter
import android.content.Context
import com.alibaba.android.vlayout.layout.LinearLayoutHelper
import com.fry.base.adapter.AbstractVLayoutBaseAdapter
import com.fry.base.adapter.BindingViewHolder
import com.mints.street.R
import com.mints.street.databinding.DialogMapHearItemBinding
import com.mints.street.databinding.DialogMapHearItemBindingImpl
/**
* Created by 冯瑞雨 on 2021/8/9.
*/
class DialogMapHeadAdapter(val context: Context, var name: String?) :
AbstractVLayoutBaseAdapter<DialogMapHearItemBinding, String?>(context, name, 1) {
override fun onBindViewHolder(
holder: BindingViewHolder<DialogMapHearItemBinding>,
position: Int) {
holder.binding.title.text = name
}
override fun getItemCount() = 1
override fun onCreateLayoutHelper() = LinearLayoutHelper()
override fun getLayoutId(viewType: Int) = R.layout.dialog_map_hear_item
}
\ No newline at end of file
package com.mints.street.adapter
import android.content.Context
import com.alibaba.android.vlayout.LayoutHelper
import com.alibaba.android.vlayout.layout.LinearLayoutHelper
import com.fry.base.adapter.AbstractVLayoutBaseAdapter
import com.fry.base.adapter.BindingViewHolder
import com.mints.street.R
import com.mints.street.databinding.ItemGridMapAdapterBinding
/**
* Created by 冯瑞雨 on 2021/8/9.
*/
class DialogMapTailAdapter(val context: Context) :
AbstractVLayoutBaseAdapter<ItemGridMapAdapterBinding, List<String>>(context, null, 3) {
override fun onBindViewHolder(
holder: BindingViewHolder<ItemGridMapAdapterBinding>,
position: Int
) {
}
override fun getItemCount() = 1
override fun onCreateLayoutHelper(): LayoutHelper {
return LinearLayoutHelper()
}
override fun getLayoutId(viewType: Int) = R.layout.dialog_map_tail_item
}
\ No newline at end of file
package com.mints.street.adapter package com.mints.street.adapter
import android.app.ActionBar
import android.content.Context import android.content.Context
import android.icu.number.IntegerWidth
import android.view.WindowManager
import android.widget.ImageView
import com.alibaba.android.vlayout.LayoutHelper import com.alibaba.android.vlayout.LayoutHelper
import com.alibaba.android.vlayout.layout.GridLayoutHelper import com.alibaba.android.vlayout.layout.GridLayoutHelper
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
...@@ -14,10 +10,8 @@ import com.fry.base.binding.setMargin ...@@ -14,10 +10,8 @@ import com.fry.base.binding.setMargin
import com.mints.street.R import com.mints.street.R
import com.mints.street.bean.VrmapBean import com.mints.street.bean.VrmapBean
import com.mints.street.databinding.ItemGridMapAdapterBinding import com.mints.street.databinding.ItemGridMapAdapterBinding
import com.mints.street.main.vr.PanoramicActivity
import com.mints.street.webview.MintsWebViewActivity import com.mints.street.webview.MintsWebViewActivity
import me.goldze.mvvmhabit.utils.AppUtils import me.goldze.mvvmhabit.utils.AppUtils
import me.goldze.mvvmhabit.utils.KLog
import me.goldze.mvvmhabit.utils.RxUtils import me.goldze.mvvmhabit.utils.RxUtils
/** /**
......
...@@ -64,7 +64,7 @@ class HistoryRecordAdapter(val activity: SearchMapActivity,val viewModel: Search ...@@ -64,7 +64,7 @@ class HistoryRecordAdapter(val activity: SearchMapActivity,val viewModel: Search
} }
private fun getHistoryData(): MutableList<HistoryBean>? { private fun getHistoryData(): MutableList<HistoryBean>? {
val instance = SPUtils.getInstance(SearchMapActivity.HISTORY_NAME) val instance = SPUtils.getInstance( SearchMapActivity.HISTORY_NAME)
val string = instance.decodeString(if (type==0){"Territory"}else{"Abroad"}) val string = instance.decodeString(if (type==0){"Territory"}else{"Abroad"})
if (TextUtils.isEmpty(string)) { if (TextUtils.isEmpty(string)) {
return null return null
......
...@@ -4,10 +4,10 @@ import android.Manifest ...@@ -4,10 +4,10 @@ import android.Manifest
import android.os.Build import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.view.KeyEvent import android.view.KeyEvent
import android.view.MotionEvent
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.viewpager2.adapter.FragmentStateAdapter import androidx.viewpager2.adapter.FragmentStateAdapter
import androidx.viewpager2.widget.ViewPager2 import androidx.viewpager2.widget.ViewPager2
import com.fry.base.base.BaseActivity import com.fry.base.base.BaseActivity
...@@ -19,7 +19,6 @@ import com.mints.street.databinding.ActivityMainBinding ...@@ -19,7 +19,6 @@ import com.mints.street.databinding.ActivityMainBinding
import com.mints.street.main.googlemap.GoogleMapFragment import com.mints.street.main.googlemap.GoogleMapFragment
import com.mints.street.main.home.HomeFragment import com.mints.street.main.home.HomeFragment
import com.mints.street.main.my.MyFragment import com.mints.street.main.my.MyFragment
import com.mints.street.main.my.OpenvipActivity
import com.mints.street.main.vr.VRFragment import com.mints.street.main.vr.VRFragment
import com.mints.street.manager.UserManager import com.mints.street.manager.UserManager
import com.mints.street.manager.oaid.OaidManager import com.mints.street.manager.oaid.OaidManager
...@@ -38,13 +37,14 @@ class MainActivity : BaseActivity<ActivityMainBinding, MainViewModel>() { ...@@ -38,13 +37,14 @@ class MainActivity : BaseActivity<ActivityMainBinding, MainViewModel>() {
override fun getStatusBarHeightView(): View? { override fun getStatusBarHeightView(): View? {
return null return null
} }
private val homeFragment = HomeFragment()
override fun initData() { override fun initData() {
super.initData() super.initData()
OaidManager.init() OaidManager.init()
//初始化viewpager2 //初始化viewpager2
binding.mainViewpager.initMain(this) binding.mainViewpager.initMain(this,homeFragment)
//初始化 bottomBarF //初始化 bottomBarF
binding.mainBottom.init { binding.mainBottom.init {
when (it) { when (it) {
...@@ -108,6 +108,21 @@ class MainActivity : BaseActivity<ActivityMainBinding, MainViewModel>() { ...@@ -108,6 +108,21 @@ class MainActivity : BaseActivity<ActivityMainBinding, MainViewModel>() {
return true return true
} }
override fun dispatchTouchEvent(ev: MotionEvent): Boolean {
if (ev.action == MotionEvent.ACTION_MOVE){
//触点的个数,就是有几个手指同时接触屏幕
if (ev.pointerCount==1){
homeFragment.updateGesture(true)
}else{
homeFragment.updateGesture(false)
}
}
return super.dispatchTouchEvent(ev)
}
} }
...@@ -123,7 +138,7 @@ private fun BottomNavigationViewEx.init(navigationItemSelectedAction: (Int) -> U ...@@ -123,7 +138,7 @@ private fun BottomNavigationViewEx.init(navigationItemSelectedAction: (Int) -> U
return this return this
} }
private fun ViewPager2.initMain(activity: MainActivity): ViewPager2 { private fun ViewPager2.initMain(activity: MainActivity,homeFragment:HomeFragment): ViewPager2 {
//是否可滑动 //是否可滑动
this.isUserInputEnabled = false this.isUserInputEnabled = false
//预加载 //预加载
...@@ -135,7 +150,7 @@ private fun ViewPager2.initMain(activity: MainActivity): ViewPager2 { ...@@ -135,7 +150,7 @@ private fun ViewPager2.initMain(activity: MainActivity): ViewPager2 {
return when (position) { return when (position) {
0 -> { 0 -> {
//首页 //首页
HomeFragment() homeFragment
} }
1 -> { 1 -> {
//广场 //广场
......
...@@ -25,9 +25,9 @@ import com.mints.street.R ...@@ -25,9 +25,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.MainActivity
import com.mints.street.manager.UmengManager import com.mints.street.manager.UmengManager
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.DialogUtils import com.mints.street.widget.dialog.DialogUtils
import com.mints.street.widget.dialog.DialogUtils.showupgradevipDialog import com.mints.street.widget.dialog.DialogUtils.showupgradevipDialog
import com.mints.street.widget.dialog.HotViewDialog import com.mints.street.widget.dialog.HotViewDialog
...@@ -36,7 +36,6 @@ import me.goldze.mvvmhabit.base.AppManager ...@@ -36,7 +36,6 @@ import me.goldze.mvvmhabit.base.AppManager
import me.goldze.mvvmhabit.utils.KLog import me.goldze.mvvmhabit.utils.KLog
import me.goldze.mvvmhabit.utils.RxUtils import me.goldze.mvvmhabit.utils.RxUtils
import me.goldze.mvvmhabit.utils.SPUtils import me.goldze.mvvmhabit.utils.SPUtils
import me.goldze.mvvmhabit.utils.ToastUtils
/** /**
* Created by 冯瑞雨 on 2021/7/2. * Created by 冯瑞雨 on 2021/7/2.
...@@ -59,6 +58,8 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso ...@@ -59,6 +58,8 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso
// 定位图层显示方式 // 定位图层显示方式
private var mCurrentMode: MyLocationConfiguration.LocationMode? = null private var mCurrentMode: MyLocationConfiguration.LocationMode? = null
private var mSensorManager: SensorManager? = null private var mSensorManager: SensorManager? = null
private var mUiSettings: UiSettings? = null
private var lastX = 0.0 private var lastX = 0.0
//// 此处设置开发者获取到的方向信息,顺时针0-360 //// 此处设置开发者获取到的方向信息,顺时针0-360
...@@ -88,6 +89,9 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso ...@@ -88,6 +89,9 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso
private var isFirstLoc = true private var isFirstLoc = true
private var myLocationData: MyLocationData? = null private var myLocationData: MyLocationData? = null
//弹出框
private var dialogMapStyle: DialogMapStyle? = null
override fun initContentView( override fun initContentView(
inflater: LayoutInflater?, inflater: LayoutInflater?,
...@@ -104,9 +108,6 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso ...@@ -104,9 +108,6 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso
uploadDeviceInfo() uploadDeviceInfo()
} }
private fun uploadDeviceInfo() { private fun uploadDeviceInfo() {
UmengManager.initUm() UmengManager.initUm()
...@@ -121,7 +122,22 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso ...@@ -121,7 +122,22 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso
SearchMapActivity.startSearchMapActivity(this) SearchMapActivity.startSearchMapActivity(this)
} }
RxUtils.onMultiClick(binding.ivClick) { RxUtils.onMultiClick(binding.ivClick) {
viewModel.authorized("", currentLat.toString(), currentLon.toString(), false) viewModel.authorized(
"",
currentLat.toString(), currentLon.toString(),
false
)
}
RxUtils.onMultiClick(binding.imageMapChangeIcon) {
context?.apply {
if (dialogMapStyle == null) {
dialogMapStyle = DialogMapStyle(this)
}
if (this@HomeFragment.fragmentManager != null) {
dialogMapStyle?.show(this@HomeFragment.fragmentManager!!, "dialogMapStyle")
}
}
} }
//点击热门景点 //点击热门景点
RxUtils.onMultiClick(binding.lyHotview) { RxUtils.onMultiClick(binding.lyHotview) {
...@@ -146,6 +162,11 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso ...@@ -146,6 +162,11 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso
private fun initMap() { private fun initMap() {
mBaiduMap = binding.bmapView.map mBaiduMap = binding.bmapView.map
mUiSettings = mBaiduMap?.uiSettings
mUiSettings?.setAllGesturesEnabled(false)
mUiSettings?.isScrollGesturesEnabled = true
mBaiduMap?.mapType = BaiduMap.MAP_TYPE_SATELLITE mBaiduMap?.mapType = BaiduMap.MAP_TYPE_SATELLITE
//设置是否显示缩放控件 //设置是否显示缩放控件
...@@ -184,7 +205,7 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso ...@@ -184,7 +205,7 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso
KLog.a("百度map", "移动结束") KLog.a("百度map", "移动结束")
currentLat = status?.target?.latitude ?: 0.0 currentLat = status?.target?.latitude ?: 0.0
currentLon = status?.target?.longitude ?: 0.0 currentLon = status?.target?.longitude ?: 0.0
currentMapZoom = status?.zoom?:0f currentMapZoom = status?.zoom ?: 0f
// 发起反地理编码请求 // 发起反地理编码请求
mSearch.reverseGeoCode(ReverseGeoCodeOption().location(status?.target)) mSearch.reverseGeoCode(ReverseGeoCodeOption().location(status?.target))
...@@ -192,11 +213,11 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso ...@@ -192,11 +213,11 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso
}) })
//使地图缩放级别增大一级 //使地图缩放级别增大一级
binding.imageIn.setOnClickListener { binding.imageIn.setOnClickListener {
mBaiduMap?.animateMapStatus(MapStatusUpdateFactory.zoomIn(),300) mBaiduMap?.animateMapStatus(MapStatusUpdateFactory.zoomIn(), 300)
} }
//使地图缩放级别减小一级 //使地图缩放级别减小一级
binding.imageOut.setOnClickListener { binding.imageOut.setOnClickListener {
mBaiduMap?.animateMapStatus(MapStatusUpdateFactory.zoomOut(),300) mBaiduMap?.animateMapStatus(MapStatusUpdateFactory.zoomOut(), 300)
} }
//历史影像 //历史影像
binding.imageMapHistory.setOnClickListener { binding.imageMapHistory.setOnClickListener {
...@@ -212,7 +233,7 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso ...@@ -212,7 +233,7 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso
val mapStatusUpdate = MapStatusUpdateFactory.newMapStatus(builder.build()) val mapStatusUpdate = MapStatusUpdateFactory.newMapStatus(builder.build())
// 设置地图状态 // 设置地图状态
mBaiduMap?.animateMapStatus(mapStatusUpdate,300) mBaiduMap?.animateMapStatus(mapStatusUpdate, 300)
} }
//定位初始化 //定位初始化
initLocation() initLocation()
...@@ -251,46 +272,49 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso ...@@ -251,46 +272,49 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso
mLocClient?.locOption = option mLocClient?.locOption = option
mLocClient?.start() mLocClient?.start()
} }
/** /**
*逆地理编码 *逆地理编码
*/ */
val mSearch = GeoCoder.newInstance() val mSearch = GeoCoder.newInstance()
private fun geoCoder(){ private fun geoCoder() {
val listener: OnGetGeoCoderResultListener = object : OnGetGeoCoderResultListener{ val listener: OnGetGeoCoderResultListener = object : OnGetGeoCoderResultListener {
override fun onGetGeoCodeResult(p0: GeoCodeResult?) { override fun onGetGeoCodeResult(p0: GeoCodeResult?) {
} }
override fun onGetReverseGeoCodeResult(reverseGeoCodeResult : ReverseGeoCodeResult?) {
override fun onGetReverseGeoCodeResult(reverseGeoCodeResult: ReverseGeoCodeResult?) {
if (reverseGeoCodeResult == null || reverseGeoCodeResult.error !== SearchResult.ERRORNO.NO_ERROR) { if (reverseGeoCodeResult == null || reverseGeoCodeResult.error !== SearchResult.ERRORNO.NO_ERROR) {
//没有找到检索结果 //没有找到检索结果
return return
} else { } else {
if ("CN".equals(reverseGeoCodeResult.addressDetail.countryCodeIso2)){ if ("CN".equals(reverseGeoCodeResult.addressDetail.countryCodeIso2)) {
if(currentMapZoom >= 15){ if (currentMapZoom >= 15) {
var zoom = 13f var zoom = 13f
// 默认 天安门 // 默认 天安门
val center = LatLng(currentLat, currentLon) val center = LatLng(currentLat, currentLon)
// 默认 11级 // 默认 11级
val builder = MapStatus.Builder() val builder = MapStatus.Builder()
builder.target(center).zoom(zoom) builder.target(center).zoom(zoom)
val mapStatusUpdate = MapStatusUpdateFactory.newMapStatus(builder.build()) val mapStatusUpdate =
showupgradevipDialog(requireContext()) MapStatusUpdateFactory.newMapStatus(builder.build())
// 设置地图状态 showupgradevipDialog(requireContext())
mBaiduMap?.animateMapStatus(mapStatusUpdate,200) // 设置地图状态
} mBaiduMap?.animateMapStatus(mapStatusUpdate, 200)
}else{ }
var zoom = 13f } else {
// 默认 天安门 var zoom = 13f
val center = LatLng(mCurrentLat, mCurrentLon) // 默认 天安门
// 默认 11级 val center = LatLng(mCurrentLat, mCurrentLon)
val builder = MapStatus.Builder() // 默认 11级
builder.target(center).zoom(zoom) val builder = MapStatus.Builder()
val mapStatusUpdate = MapStatusUpdateFactory.newMapStatus(builder.build()) builder.target(center).zoom(zoom)
showupgradevipDialog(requireContext()) val mapStatusUpdate = MapStatusUpdateFactory.newMapStatus(builder.build())
// 设置地图状态 showupgradevipDialog(requireContext())
mBaiduMap?.animateMapStatus(mapStatusUpdate,500) // 设置地图状态
} mBaiduMap?.animateMapStatus(mapStatusUpdate, 500)
}
} }
} }
...@@ -325,6 +349,22 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso ...@@ -325,6 +349,22 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso
} }
/**
* 更新手势状态
*/
fun updateGesture(isMove: Boolean) {
if (isMove) {
mUiSettings?.isZoomGesturesEnabled = false
} else {
if (mUiSettings?.isZoomGesturesEnabled == false) {
mUiSettings?.isZoomGesturesEnabled = true
}
}
}
/** /**
* 定位SDK监听函数 * 定位SDK监听函数
...@@ -334,7 +374,7 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso ...@@ -334,7 +374,7 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso
inner class MyLocationListener : BDLocationListener { inner class MyLocationListener : BDLocationListener {
override fun onReceiveLocation(location: BDLocation?) { override fun onReceiveLocation(location: BDLocation?) {
if( location?.latitude == 4.9E-324 ||location?.longitude == 4.9E-324){ if (location?.latitude == 4.9E-324 || location?.longitude == 4.9E-324) {
return return
} }
if (sp == null) { if (sp == null) {
...@@ -357,19 +397,19 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso ...@@ -357,19 +397,19 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso
sp?.encode(SPUtils.POSITIONING_MAP, Gson().toJson(positioningBean).toString()) sp?.encode(SPUtils.POSITIONING_MAP, Gson().toJson(positioningBean).toString())
// MapView 销毁后不在处理新接收的位置 // MapView 销毁后不在处理新接收的位置
mBaiduMap?.apply { mBaiduMap?.apply {
mCurrentLat = location?.latitude?:0.0 mCurrentLat = location?.latitude ?: 0.0
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
val ll = LatLng(location?.latitude?:0.0, location?.longitude?:0.0) val ll = LatLng(location?.latitude ?: 0.0, location?.longitude ?: 0.0)
val builder = MapStatus.Builder() val builder = MapStatus.Builder()
builder.target(ll).zoom(14.0f) builder.target(ll).zoom(14.0f)
this.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build())) this.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()))
...@@ -408,7 +448,7 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso ...@@ -408,7 +448,7 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso
val builder = MapStatus.Builder() val builder = MapStatus.Builder()
builder.target(latLng).zoom(18.5f).overlook(-21f).rotate(0f) builder.target(latLng).zoom(18.5f).overlook(-21f).rotate(0f)
// 更新地图状态 // 更新地图状态
mBaiduMap!!.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()),300) mBaiduMap!!.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()), 300)
//mMarker.setPosition(latLng) //mMarker.setPosition(latLng)
} }
} }
\ No newline at end of file
package com.mints.street.widget.dialog
import android.content.Context
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.os.Bundle
import android.util.DisplayMetrics
import android.view.*
import androidx.recyclerview.widget.RecyclerView
import com.alibaba.android.vlayout.DelegateAdapter
import com.alibaba.android.vlayout.VirtualLayoutManager
import com.fry.base.base.BaseDialogFragment
import com.mints.street.R
import com.mints.street.adapter.DialogMapContentAdapter
import com.mints.street.adapter.DialogMapHeadAdapter
import com.mints.street.adapter.DialogMapTailAdapter
/**MutableList<?>
* @author 冯瑞雨
* @date 2020/6/18 14:27
* 弹出框
*/
class DialogMapStyle(var mContext: Context) : BaseDialogFragment() {
private var recycler: RecyclerView?=null
private var vLayout: VirtualLayoutManager? = null
private var mAdapter: DelegateAdapter? = null
override fun onStart() {
super.onStart()
val window = dialog?.window
window?.setBackgroundDrawable(ColorDrawable())
val dm = DisplayMetrics()
activity?.windowManager?.defaultDisplay?.getMetrics(dm)
window?.setLayout((dm.widthPixels * 0.7).toInt(), WindowManager.LayoutParams.MATCH_PARENT)
val params = window?.attributes
params?.gravity = Gravity.START
// params?.windowAnimations = R.style.EndDialogAnim
window?.attributes = params
window?.decorView?.systemUiVisibility = (View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
or View.SYSTEM_UI_FLAG_LAYOUT_STABLE)
window?.statusBarColor = Color.TRANSPARENT
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
val inflate: View = inflater.inflate(R.layout.dialog_map_style, container, false)
recycler = inflate.findViewById(R.id.list_view)
vLayout = VirtualLayoutManager(context!!)
mAdapter = DelegateAdapter(vLayout, false)
recycler?.layoutManager = vLayout
recycler?.adapter = mAdapter
return inflate
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
for (index in 1..3){
mAdapter?.addAdapter(DialogMapHeadAdapter(mContext, "google"))
mAdapter?.addAdapter(DialogMapContentAdapter(mContext, listOf("1","2","3")))
}
mAdapter?.addAdapter(DialogMapHeadAdapter(mContext, "google"))
mAdapter?.addAdapter(DialogMapTailAdapter(mContext))
}
}
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<data>
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/bg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<ImageView
android:layout_marginTop="15dp"
android:id="@+id/image"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@mipmap/vip_google_bg"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="@id/image"
app:layout_constraintBottom_toBottomOf="@id/image"
android:src="@mipmap/map_select_icon"
/>
<TextView
android:paddingTop="10dp"
app:layout_constraintTop_toBottomOf="@+id/image"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/color_121B32"
tools:text="天地图卫星"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/color_E6E6E6"
android:orientation="vertical">
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:textColor="@color/black"
android:textSize="14sp"
tools:text="常用" />
</LinearLayout>
</layout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/cl"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/list_view"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</FrameLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<data>
<variable
name="viewModel"
type="com.mints.street.adapter.DialogMapHeadAdapter" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/bg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<TextView
android:id="@+id/recommend"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/color_333"
android:text="景点推荐"
android:textSize="16sp"
android:padding="10dp"
/>
<TextView
android:id="@+id/street_view"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/recommend"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/color_333"
android:text="街景地图"
android:textSize="16sp"
android:padding="10dp"
/>
<com.github.iielse.switchbutton.SwitchView
android:id="@+id/sv_recommend"
app:primaryColor="#2196F3"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_alignParentEnd="true"
app:isOpened="true"
android:layout_marginRight="10dp"
app:layout_constraintTop_toTopOf="@id/recommend"
app:layout_constraintBottom_toBottomOf="@id/recommend"
app:layout_constraintEnd_toEndOf="parent"
/>
<com.github.iielse.switchbutton.SwitchView
android:id="@+id/sv_street_view"
app:primaryColor="#2196F3"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_alignParentEnd="true"
app:isOpened="true"
android:layout_marginRight="10dp"
app:layout_constraintTop_toTopOf="@id/street_view"
app:layout_constraintBottom_toBottomOf="@id/street_view"
app:layout_constraintEnd_toEndOf="parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
\ No newline at end of file
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
android:id="@+id/bmapView" android:id="@+id/bmapView"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_marginBottom="40dp" android:layout_marginBottom="90dp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
...@@ -67,6 +67,16 @@ ...@@ -67,6 +67,16 @@
android:src="@mipmap/location_icon" android:src="@mipmap/location_icon"
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="15dp"
android:src="@mipmap/map_change_icon"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
/>
<LinearLayout <LinearLayout
android:id="@+id/map_a_d" android:id="@+id/map_a_d"
......
...@@ -67,4 +67,8 @@ ...@@ -67,4 +67,8 @@
<style name="CustomCheckboxTheme" parent="@android:style/Widget.CompoundButton.CheckBox"> <style name="CustomCheckboxTheme" parent="@android:style/Widget.CompoundButton.CheckBox">
<item name="android:button">@drawable/checkbox_style</item> <item name="android:button">@drawable/checkbox_style</item>
</style> </style>
<style name="EndDialogAnim">
<item name="android:windowEnterAnimation">@anim/slide_in_from_right</item>
<item name="android:windowExitAnimation">@anim/slide_out_to_right</item>
</style>
</resources> </resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"> <set xmlns:android="http://schemas.android.com/apk/res/android">
<translate <translate
android:duration="250" android:fromXDelta="-100%p"
android:fromXDelta="100%p" android:toXDelta="0"
android:toXDelta="0.0%p" /> android:duration="300"/>
</set> </set>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"> <set xmlns:android="http://schemas.android.com/apk/res/android">
<translate <translate
android:duration="250" android:fromXDelta="0"
android:fromXDelta="0.0%p" android:toXDelta="-100%p"
android:toXDelta="100%p" /> android:duration="300"
/>
</set> </set>
\ No newline at end of file
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