Commit d1913046 authored by fengruiyu's avatar fengruiyu

地图样式弹出框已完成

parent f6e839cc
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, Any>(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
......@@ -28,6 +28,7 @@ import com.mints.street.databinding.FragmentHomeBinding
import com.mints.street.main.MainActivity
import com.mints.street.manager.UmengManager
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.showupgradevipDialog
import me.goldze.mvvmhabit.base.AppManager
......@@ -84,6 +85,9 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso
private var isFirstLoc = true
private var myLocationData: MyLocationData? = null
//弹出框
private var dialogMapStyle: DialogMapStyle?=null
override fun initContentView(
inflater: LayoutInflater?,
......@@ -100,9 +104,6 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso
uploadDeviceInfo()
}
private fun uploadDeviceInfo() {
UmengManager.initUm()
......@@ -117,7 +118,20 @@ class HomeFragment() : BaseFragment<FragmentHomeBinding, HomeViewModel>(), Senso
SearchMapActivity.startSearchMapActivity(this)
}
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")
}
}
}
viewModel.getMapBean()
}
......
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 @@
android:id="@+id/bmapView"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginBottom="40dp"
android:layout_marginBottom="90dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
......@@ -58,6 +58,16 @@
android:src="@mipmap/location_icon"
app:layout_constraintBottom_toBottomOf="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
android:id="@+id/map_a_d"
......
......@@ -67,4 +67,8 @@
<style name="CustomCheckboxTheme" parent="@android:style/Widget.CompoundButton.CheckBox">
<item name="android:button">@drawable/checkbox_style</item>
</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>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="250"
android:fromXDelta="100%p"
android:toXDelta="0.0%p" />
android:fromXDelta="-100%p"
android:toXDelta="0"
android:duration="300"/>
</set>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="250"
android:fromXDelta="0.0%p"
android:toXDelta="100%p" />
android:fromXDelta="0"
android:toXDelta="-100%p"
android:duration="300"
/>
</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