Commit afb2b236 authored by 张释方's avatar 张释方

提交无限放大开通vip弹窗

parent ece1c945
......@@ -24,9 +24,9 @@ import com.mints.street.bean.MapBean
import com.mints.street.bean.PositioningBean
import com.mints.street.databinding.FragmentHomeBinding
import com.mints.street.manager.UmengManager
import com.mints.street.utils.GPSConverterUtils
import com.mints.street.widget.ScrollLayout
import com.mints.street.widget.dialog.DialogUtils
import com.mints.street.widget.dialog.DialogUtils.showupgradevipDialog
import me.goldze.mvvmhabit.base.AppManager
import me.goldze.mvvmhabit.utils.KLog
import me.goldze.mvvmhabit.utils.RxUtils
......@@ -37,7 +37,6 @@ import me.goldze.mvvmhabit.utils.SPUtils
* 首页页面
*/
class HomeFragment : BaseFragment<FragmentHomeBinding, HomeViewModel>(), SensorEventListener {
companion object {
val IS_FIRST_OPEN: String = "isFirstOpen"
}
......@@ -110,6 +109,7 @@ class HomeFragment : BaseFragment<FragmentHomeBinding, HomeViewModel>(), SensorE
viewModel.authorized("", currentLat.toString(), currentLon.toString(), false)
}
viewModel.getMapBean()
DialogUtils.showupgradevipDialog(requireContext())
}
override fun initViewObservable() {
......
......@@ -22,6 +22,12 @@ object DialogUtils {
dialogListener.setDialog(bonusDialog)
}
fun showupgradevipDialog(ctx: Context){
val weakReference = WeakReference<Context>(ctx)
val bonusDialog = UpgradeVipDialog(weakReference.get()!!)
bonusDialog.show()
}
/**
* 权限设置弹框
......
package com.mints.street.widget.dialog
import android.app.Dialog
import android.content.Context
import android.content.Intent
import android.view.Gravity
import android.view.KeyEvent
import android.view.WindowManager
import android.widget.Button
import android.widget.ImageView
import androidx.fragment.app.FragmentActivity
import com.alibaba.android.vlayout.DelegateAdapter
import com.alibaba.android.vlayout.VirtualLayoutManager
import com.blankj.utilcode.util.ActivityUtils.startActivity
import com.mints.street.R
import com.mints.street.adapter.GridBenfitAdapter
import com.mints.street.main.my.OpenvipActivity
import me.goldze.mvvmhabit.utils.RxUtils
class UpgradeVipDialog(context: Context)
: Dialog(context, R.style.dialog) {
private val lp: WindowManager.LayoutParams
private val iv_close:ImageView
private val bt_upgrade:Button
init {
setContentView(R.layout.layout_upgradevip)
// 设置window属性
lp = window!!.attributes
lp.gravity = Gravity.CENTER
lp.width = WindowManager.LayoutParams.WRAP_CONTENT
lp.windowAnimations = R.style.DialogAnimBottom
window!!.attributes = lp
iv_close=findViewById(R.id.iv_close)
bt_upgrade=findViewById(R.id.bt_upgrade)
// 设置外部不可关闭
setCancelable(false)
setCanceledOnTouchOutside(false)
setOnKeyListener { _, i, _ ->
i == KeyEvent.KEYCODE_BACK
}
initView()
}
private fun initView() {
RxUtils.onMultiClick(iv_close){
dismiss()
}
RxUtils.onMultiClick(bt_upgrade){
startActivity(Intent(context,OpenvipActivity::class.java))
// dismiss()
}
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners
android:radius="20dp" />
<solid android:color="@color/white"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners
android:radius="50dp"/>
<gradient
android:startColor="#FFC107"
android:endColor="#FF5722"
android:angle="90"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/shape_upgrade_bg">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="30dp"
android:orientation="vertical">
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_gravity="center"
android:src="@mipmap/iv_upgrade" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="30dp"
android:text="想要继续无限方法又不模糊?"
android:textColor="@color/black"
android:textSize="14sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="30dp"
android:text="升级全球会员,连地面小车也能看清"
android:textColor="#B3000000"
android:textSize="12sp" />
<Button
android:id="@+id/bt_upgrade"
android:layout_width="200dp"
android:layout_height="40dp"
android:layout_gravity="center"
android:layout_marginTop="30dp"
android:background="@drawable/shape_upgrade_btn_bg"
android:text="继续升级"
android:textColor="@color/white"
android:textSize="16sp" />
</LinearLayout>
<ImageView
android:id="@+id/iv_close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|top"
android:src="@mipmap/icon_upgrade_close" />
</FrameLayout>
\ 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