From 3466799c94227c5ebba9fb201621e745058867ee Mon Sep 17 00:00:00 2001
From: cloudroam <cloudroam>
Date: 星期二, 15 四月 2025 13:18:34 +0800
Subject: [PATCH] add: 消息提醒时间设定;会员到期时间调整;

---
 app/src/main/java/com/example/firstapp/ui/notifications/NotificationsFragment.kt |   38 ++++++++++++++++++++++++++++++--------
 1 files changed, 30 insertions(+), 8 deletions(-)

diff --git a/app/src/main/java/com/example/firstapp/ui/notifications/NotificationsFragment.kt b/app/src/main/java/com/example/firstapp/ui/notifications/NotificationsFragment.kt
index 5f1ffe1..b3fe265 100644
--- a/app/src/main/java/com/example/firstapp/ui/notifications/NotificationsFragment.kt
+++ b/app/src/main/java/com/example/firstapp/ui/notifications/NotificationsFragment.kt
@@ -31,8 +31,10 @@
 import com.google.android.material.snackbar.Snackbar
 import kotlinx.coroutines.launch
 import com.bumptech.glide.Glide
+import com.example.firstapp.activity.SettingActivity
 import com.example.firstapp.activity.VipActivity
 import com.example.firstapp.database.response.UserInfo
+import com.example.firstapp.ui.invitation.InvitationActivity
 import com.example.firstapp.utils.PreferencesManager
 
 class NotificationsFragment : Fragment() {
@@ -96,6 +98,14 @@
         return binding.root
     }
 
+    override fun onResume() {
+        super.onResume()
+        // 加载用户信息
+        lifecycleScope.launch {
+            loadUserInfo()
+        }
+    }
+
     private suspend fun loadConfigurations() {
         try {
             // 获取小红书链接
@@ -134,7 +144,7 @@
 
         // 设置提醒
         binding.layoutReminder.setOnClickListener {
-            findNavController().navigate(R.id.action_navigation_notifications_to_reminderSettingsFragment)
+            Toast.makeText(context, "设置功能开发中", Toast.LENGTH_SHORT).show()
         }
 
         // 待办
@@ -145,7 +155,9 @@
 
         // 好友邀请
         binding.layoutInvite.setOnClickListener {
-            shareToWechat()
+            // 跳转到邀请活动页面
+            val intent = Intent(requireActivity(), InvitationActivity::class.java)
+            startActivity(intent)
         }
 
         // AI助手
@@ -178,12 +190,12 @@
 
         // 隐私协议
         binding.layoutPrivacy.setOnClickListener {
-            startContentActivity("privacy_policy", "隐私协议")
+            startContentActivity("隐私协议", "隐私协议")
         }
 
         // 使用教程
         binding.layoutTutorial.setOnClickListener {
-            startContentActivity("user_guide", "使用教程")
+            startContentActivity("使用教程", "使用教程")
         }
 
         // 头像点击老的处理逻辑
@@ -211,6 +223,13 @@
 //            Toast.makeText(context, "VIP续费功能开发中", Toast.LENGTH_SHORT).show()
             // 跳转到vipActivity
             val intent = Intent(requireContext(), VipActivity::class.java)
+            startActivity(intent)
+        }
+
+        // 设置按钮点击
+        binding.ivSetting.setOnClickListener {
+            // 跳转到
+            val intent = Intent(requireContext(), SettingActivity::class.java)
             startActivity(intent)
         }
 
@@ -269,9 +288,9 @@
         }
     }
 
-    private fun startContentActivity(type: String, title: String) {
+    private fun startContentActivity(id: String, title: String) {
         val intent = Intent(requireContext(), ContentDetailActivity::class.java).apply {
-            putExtra(ContentDetailActivity.EXTRA_CONTENT_TYPE, type)
+            putExtra(ContentDetailActivity.ID, id)
             putExtra(ContentDetailActivity.EXTRA_TITLE, title)
         }
         startActivity(intent)
@@ -292,6 +311,8 @@
                 currentUserInfo = response.data
                 val userInfo = response.data
 
+                // 本地保存我的邀请码
+                //PreferencesManager.setInviteCode(userInfo.intervialcode);
                 // 设置头像
                 Glide.with(this)
                     .load(userInfo.cover)
@@ -306,12 +327,13 @@
                 if (userInfo.isMember) {
                     binding.ivVip.visibility = View.VISIBLE
                     binding.cardVip.visibility = View.VISIBLE
-                    binding.tvVipExpire.text = "${userInfo.memberOvertime} 到期"
+                    binding.tvVipExpire.text = "${userInfo.memberOverDate} 到期"
                 } else {
                     //非会员信息
+                    binding.ivVip.visibility = View.GONE
+                    binding.cardVip.visibility = View.VISIBLE
                     binding.btnRenew.text = "立即开通"
                     binding.linearVipContainer.setBackgroundColor(ContextCompat.getColor(requireContext(), R.color.gray))
-                    binding.cardVip.visibility = View.GONE
                 }
             }
         } catch (e: Exception) {

--
Gitblit v1.9.3