| | |
| | | import androidx.appcompat.app.AppCompatActivity |
| | | import androidx.core.content.ContextCompat |
| | | import androidx.fragment.app.Fragment |
| | | import androidx.lifecycle.Observer |
| | | import androidx.lifecycle.lifecycleScope |
| | | import androidx.navigation.fragment.findNavController |
| | | import com.google.android.material.dialog.MaterialAlertDialogBuilder |
| | |
| | | import com.example.firstapp.activity.ContentDetailActivity |
| | | import com.example.firstapp.database.service.RetrofitClient |
| | | import com.example.firstapp.databinding.FragmentNotificationsBinding |
| | | import com.example.firstapp.pay.PayAbility |
| | | import com.example.firstapp.ui.reminderOther.ReminderOtherAddActivity2 |
| | | import com.example.firstapp.ui.reminderOther.ReminderSettingsFragmentOther |
| | | import com.example.firstapp.ui.profile.EditProfileActivity |
| | | import com.example.firstapp.utils.Log |
| | | import com.google.android.material.snackbar.Snackbar |
| | | import kotlinx.coroutines.launch |
| | | import com.bumptech.glide.Glide |
| | | import com.example.firstapp.MainActivity |
| | | import com.example.firstapp.database.response.UserInfo |
| | | import com.example.firstapp.ui.invitation.InvitationActivity |
| | | |
| | | class NotificationsFragment : Fragment() { |
| | | |
| | |
| | | } |
| | | |
| | | private fun setupClickListeners() { |
| | | |
| | | // 支付插件 |
| | | // binding.payPlugin.setOnClickListener { |
| | | // // 跳转到支付插件页面 |
| | | // lifecycleScope.launch { |
| | | // try { |
| | | // val response = RetrofitClient.apiService.getPayOrderInfo() |
| | | // var orderInfo=response.data |
| | | // Log.d("AliPayHelper","获取订单信息时: ${response}") |
| | | // // 这里调用支付宝 |
| | | // PayAbility.aliPay(requireActivity(), orderInfo, Observer { |
| | | // when (it.resultStatus) { |
| | | // "9000" -> { |
| | | //// Snackbar.make(binding.root, "支付成功", Snackbar.LENGTH_LONG).show() |
| | | // requireActivity().runOnUiThread { |
| | | // Toast.makeText(requireContext(), "支付成功", Toast.LENGTH_LONG).show() |
| | | // } |
| | | // } |
| | | // else -> { |
| | | //// Snackbar.make(binding.root, "支付失败", Snackbar.LENGTH_LONG).show() |
| | | // requireActivity().runOnUiThread { |
| | | // Toast.makeText(requireContext(), "支付失败", Toast.LENGTH_LONG).show() |
| | | // } |
| | | // |
| | | // } |
| | | // } |
| | | // }) |
| | | // |
| | | // } catch (e: Exception) { |
| | | // Log.d("AliPayHelper","获取订单信息时发生错误: ${e.message}") |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | |
| | | // 设置提醒 |
| | | binding.layoutReminder.setOnClickListener { |
| | | findNavController().navigate(R.id.action_navigation_notifications_to_reminderSettingsFragment) |
| | |
| | | |
| | | // 好友邀请 |
| | | binding.layoutInvite.setOnClickListener { |
| | | shareToWechat() |
| | | // 跳转到邀请活动页面 |
| | | val intent = Intent(requireActivity(), InvitationActivity::class.java) |
| | | startActivity(intent) |
| | | } |
| | | |
| | | // AI助手 |
| | |
| | | .load(userInfo.cover) |
| | | .placeholder(R.drawable.default_avatar) |
| | | .into(binding.ivAvatar) |
| | | |
| | | |
| | | // 设置昵称和账号 |
| | | binding.tvNickname.text = userInfo.name |
| | | binding.tvUserId.text = "个人账号:${userInfo.contactTel}" |
| | | |
| | | |
| | | // 设置VIP信息 |
| | | if (userInfo.showed) { |
| | | binding.ivVip.visibility = View.VISIBLE |
| | |
| | | |
| | | override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
| | | super.onViewCreated(view, savedInstanceState) |
| | | |
| | | |
| | | // 加载用户信息 |
| | | lifecycleScope.launch { |
| | | loadUserInfo() |