From ab2842d427504c531c79ddb9c5a9ef1df7833014 Mon Sep 17 00:00:00 2001
From: lmw <125975490@qq.com>
Date: 星期四, 06 二月 2025 10:11:44 +0800
Subject: [PATCH] save

---
 app/src/main/java/com/sinata/xqmuse/ui/home/HomeFragment.kt |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/app/src/main/java/com/sinata/xqmuse/ui/home/HomeFragment.kt b/app/src/main/java/com/sinata/xqmuse/ui/home/HomeFragment.kt
index 2b09161..ac82404 100644
--- a/app/src/main/java/com/sinata/xqmuse/ui/home/HomeFragment.kt
+++ b/app/src/main/java/com/sinata/xqmuse/ui/home/HomeFragment.kt
@@ -19,11 +19,13 @@
 import com.sinata.xqmuse.ui.home.adapter.HomeBannerAdapter
 import com.sinata.xqmuse.ui.home.adapter.TopMenuAdapter
 import com.sinata.xqmuse.ui.login.LoginActivity
+import com.sinata.xqmuse.ui.mine.VipActivity
 import com.sinata.xqmuse.utils.Const
 import com.sinata.xqmuse.utils.event.EmptyEvent
 import com.sinata.xqmuse.utils.interfaces.StringCallback
 import kotlinx.android.synthetic.main.fragment_home.*
 import org.greenrobot.eventbus.EventBus
+import org.jetbrains.anko.startActivity
 import org.jetbrains.anko.support.v4.startActivity
 import org.jetbrains.anko.support.v4.toast
 
@@ -62,7 +64,6 @@
         getList()
         getBottomMenu()
         initClick()
-        changeBg()
     }
 
     fun refreshData(){
@@ -106,10 +107,16 @@
                     showDialog()
                     HttpManager.getMeditationDetails(today!!.meditationId).requestByF(this,success = {_,data->
                         dismissDialog()
-                        if (MainActivity.playing)
-                            EventBus.getDefault().post(EmptyEvent(Const.EventCode.FINISH_THINK))
-                        MainActivity.voice = data
-                        EventBus.getDefault().post(EmptyEvent(Const.EventCode.START_THINK))
+                        if (data?.chargeType == 2&&data.isVip != 1){ //会员免费
+                            startActivity<VipActivity>()
+                        }else if (data?.chargeType == 3&&data.isBuy != 1){ //单独收费且未购买
+                            startActivity<BuyVoiceActivity>("id" to data.id)
+                        }else{
+                            if (MainActivity.playing)
+                                EventBus.getDefault().post(EmptyEvent(Const.EventCode.FINISH_THINK))
+                            MainActivity.voice = data
+                            EventBus.getDefault().post(EmptyEvent(Const.EventCode.START_THINK))
+                        }
                     }){_,_->
                         dismissDialog()
                     }
@@ -128,8 +135,7 @@
         iv_pri_empty.setOnClickListener { startActivity<LoginActivity>() }
     }
 
-    fun changeBg(){
-        val bg = SPUtils.instance().getString(Const.User.BG)
+    fun changeBg(bg:String){
         if (!bg.isNullOrEmpty())
             iv_home.setImageURI(bg)
     }

--
Gitblit v1.7.1