Commit 004be3c4 authored by fengruiyu's avatar fengruiyu

支付成功之后刷新地图页面问题

parent 2dab4867
...@@ -37,6 +37,14 @@ class MainActivity : BaseActivity<ActivityMainBinding, MainViewModel>() { ...@@ -37,6 +37,14 @@ class MainActivity : BaseActivity<ActivityMainBinding, MainViewModel>() {
override fun getStatusBarHeightView(): View? { override fun getStatusBarHeightView(): View? {
return null return null
} }
public fun verifyMember(){
if (UserManager.INSTANCE.userIsLogin() && UserManager.INSTANCE.getVipFlag()) {
binding.mainViewpager.setCurrentItem(3, false)
} else {
binding.mainViewpager.setCurrentItem(0, false)
}
}
override fun initData() { override fun initData() {
super.initData() super.initData()
...@@ -112,7 +120,7 @@ private fun BottomNavigationViewEx.init(navigationItemSelectedAction: (Int) -> U ...@@ -112,7 +120,7 @@ private fun BottomNavigationViewEx.init(navigationItemSelectedAction: (Int) -> U
return this return this
} }
private fun ViewPager2.initMain(activity: FragmentActivity): ViewPager2 { private fun ViewPager2.initMain(activity: MainActivity): ViewPager2 {
//是否可滑动 //是否可滑动
this.isUserInputEnabled = false this.isUserInputEnabled = false
//预加载 //预加载
...@@ -124,7 +132,7 @@ private fun ViewPager2.initMain(activity: FragmentActivity): ViewPager2 { ...@@ -124,7 +132,7 @@ private fun ViewPager2.initMain(activity: FragmentActivity): ViewPager2 {
return when (position) { return when (position) {
0 -> { 0 -> {
//首页 //首页
HomeFragment() HomeFragment(activity)
} }
1 -> { 1 -> {
//广场 //广场
...@@ -140,7 +148,7 @@ private fun ViewPager2.initMain(activity: FragmentActivity): ViewPager2 { ...@@ -140,7 +148,7 @@ private fun ViewPager2.initMain(activity: FragmentActivity): ViewPager2 {
else -> { else -> {
//首页 //首页
HomeFragment() HomeFragment(activity)
} }
} }
......
...@@ -25,6 +25,7 @@ import com.mints.street.R ...@@ -25,6 +25,7 @@ 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.DialogUtils import com.mints.street.widget.dialog.DialogUtils
...@@ -39,7 +40,7 @@ import me.goldze.mvvmhabit.utils.ToastUtils ...@@ -39,7 +40,7 @@ import me.goldze.mvvmhabit.utils.ToastUtils
* Created by 冯瑞雨 on 2021/7/2. * Created by 冯瑞雨 on 2021/7/2.
* 首页页面 * 首页页面
*/ */
class HomeFragment : BaseFragment<FragmentHomeBinding, HomeViewModel>(), SensorEventListener { class HomeFragment(val mainActivity: MainActivity) : BaseFragment<FragmentHomeBinding, HomeViewModel>(), SensorEventListener {
companion object { companion object {
val IS_FIRST_OPEN: String = "isFirstOpen" val IS_FIRST_OPEN: String = "isFirstOpen"
} }
...@@ -99,6 +100,9 @@ class HomeFragment : BaseFragment<FragmentHomeBinding, HomeViewModel>(), SensorE ...@@ -99,6 +100,9 @@ class HomeFragment : BaseFragment<FragmentHomeBinding, HomeViewModel>(), SensorE
uploadDeviceInfo() uploadDeviceInfo()
} }
private fun uploadDeviceInfo() { private fun uploadDeviceInfo() {
UmengManager.initUm() UmengManager.initUm()
...@@ -299,6 +303,7 @@ class HomeFragment : BaseFragment<FragmentHomeBinding, HomeViewModel>(), SensorE ...@@ -299,6 +303,7 @@ class HomeFragment : BaseFragment<FragmentHomeBinding, HomeViewModel>(), SensorE
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
binding.bmapView.onResume() binding.bmapView.onResume()
mainActivity.verifyMember()
} }
override fun onDestroy() { override fun onDestroy() {
......
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