Bläddra i källkod

feat: 钱包充值弹窗

DoggyZhang 4 månader sedan
förälder
incheckning
86d33f23f7

+ 0 - 5
app/src/main/java/com/adealink/weparty/Routers.kt

@@ -12,9 +12,4 @@ interface AppModule {
         }
     }
 
-    interface Category{
-        companion object{
-            const val PATH = "/category"
-        }
-    }
 }

+ 6 - 0
app/src/main/java/com/adealink/weparty/module/im/Router.kt

@@ -14,4 +14,10 @@ interface IM {
         }
     }
 
+
+    interface Session {
+        companion object {
+            const val PATH = "${Common.PATH}/session"
+        }
+    }
 }

+ 6 - 0
app/src/main/java/com/adealink/weparty/module/profile/Router.kt

@@ -35,4 +35,10 @@ interface Profile {
         }
     }
 
+    interface Search {
+        companion object {
+            const val PATH = "${Common.PATH}/search"
+        }
+    }
+
 }

+ 6 - 0
app/src/main/java/com/adealink/weparty/module/wallet/Router.kt

@@ -11,5 +11,11 @@ interface Wallet {
 
     }
 
+    interface TopUpDialog {
+        companion object {
+            const val PATH = "${Common.PATH}/top_up_dialog"
+        }
+    }
+
 
 }

+ 0 - 8
app/src/main/java/com/adealink/weparty/module/webview/Router.kt

@@ -20,14 +20,6 @@ interface Web {
 
     }
 
-    interface BSFullScreen {
-
-        companion object {
-            const val PATH = "/bs_web/full_screen"
-        }
-
-    }
-
     interface HalfScreen {
 
         companion object {

+ 4 - 3
app/src/main/java/com/adealink/weparty/ui/main/tab/MainTab.kt

@@ -1,13 +1,14 @@
 package com.adealink.weparty.ui.main.tab
 
+import androidx.fragment.app.Fragment
 import com.adealink.frame.aab.util.getCompatString
 import com.adealink.frame.router.Router
 import com.adealink.weparty.R
 import com.adealink.weparty.commonui.BaseFragment
 import com.adealink.weparty.commonui.widget.EmptyFragment
-import com.adealink.weparty.module.playmate.Playmate
 import com.adealink.weparty.module.profile.Profile
 import com.adealink.weparty.ui.home.HomeFragment
+import com.tencent.qcloud.tuikit.tuiconversation.minimalistui.page.TUIConversationMinimalistFragment
 
 enum class MainTab(val tab: String, val number: Int) {
     /**
@@ -36,7 +37,7 @@ enum class MainTab(val tab: String, val number: Int) {
 data class Tab(
     val type: MainTab,
     val name: (() -> String),
-    val fragmentBuilder: () -> BaseFragment
+    val fragmentBuilder: () -> Fragment
 )
 
 val HOME_TAB = Tab(
@@ -55,7 +56,7 @@ val MESSAGE_TAB = Tab(
         getCompatString(R.string.common_main_message_tab)
     },
     fragmentBuilder = {
-        Router.getRouterInstance<BaseFragment>(Playmate.HomeList.PATH) ?: EmptyFragment()
+        TUIConversationMinimalistFragment()
     }
 )
 

+ 6 - 0
app/src/main/res/drawable/common_f9fafb_radius_16_bg.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+    <solid android:color="@color/color_FFF9FAFB" />
+    <corners android:radius="16dp" />
+</shape>

+ 6 - 0
app/src/main/res/drawable/common_white_radius_16_bg.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+    <solid android:color="@color/white" />
+    <corners android:radius="16dp" />
+</shape>

+ 1 - 1
app/src/main/res/values/dimens.xml

@@ -1,5 +1,5 @@
 <resources>
-    <dimen name="common_top_bar_height">44dp</dimen>
+    <dimen name="common_top_bar_height">45dp</dimen>
     <dimen name="wheel_item_width">160dp</dimen>
     <dimen name="wheel_item_height">40dp</dimen>
     <dimen name="wheel_divider_height">1dp</dimen>

+ 3 - 2
module/im/src/main/java/com/adealink/weparty/im/manager/IMLoginManager.kt

@@ -9,9 +9,9 @@ import com.adealink.weparty.call.manager.ICallLoginManager
 import com.adealink.weparty.im.constant.TAG_IM_LOGIN
 import com.adealink.weparty.im.service.TIMAppService
 import com.adealink.weparty.im.util.TUIUtils
+import com.adealink.weparty.module.account.AccountLocalService
 import com.adealink.weparty.module.account.AccountModule
 import com.adealink.weparty.module.account.ILoginListener
-import com.adealink.weparty.module.account.util.isUidValid
 import com.adealink.weparty.module.im.IMConfig
 import com.tencent.qcloud.tuicore.TUILogin
 import com.tencent.qcloud.tuicore.interfaces.TUICallback
@@ -57,7 +57,8 @@ class IMLoginManager : BaseFrame<ICallLoginListener>(),
             Log.d(TAG_IM_LOGIN, "login return, TUILogin.isUserLogined")
             return
         }
-        val uid = AccountModule.uid
+        //val uid = AccountModule.uid
+        val uid = AccountLocalService.testAccount
         if (uid.isEmpty()) {
             Log.e(TAG_IM_LOGIN, "handleLogin fail, for $uid is invalid.")
             return

+ 54 - 0
module/wallet/src/main/java/com/adealink/weparty/wallet/data/WalletData.kt

@@ -0,0 +1,54 @@
+package com.adealink.weparty.wallet.data
+
+import android.os.Parcelable
+import com.google.gson.annotations.GsonNullable
+import com.google.gson.annotations.SerializedName
+import kotlinx.parcelize.Parcelize
+
+
+enum class PayChannel(val value: String) {
+    Google("default");
+
+    companion object {
+        fun map(channel: String): PayChannel? {
+            return PayChannel.entries.firstOrNull { it.value == channel }
+        }
+    }
+}
+
+
+@Parcelize
+data class RechargeProductData(
+    @SerializedName("innerProductId")
+    val productId: Int,
+    @SerializedName("skuId")
+    var skuId: String,
+    @SerializedName("coin")
+    var coin: Int = 0,
+    @SerializedName("productNum")
+    var productNum: String? = null,
+    @SerializedName("productType")
+    var productType: String? = null,
+    @SerializedName("priceAmountCents")
+    var priceAmountCents: Long = 0,
+    @GsonNullable
+    @SerializedName("priceCurrencyCode")
+    var priceCurrencyCode: String? = null,
+    var channel: String = "",
+    @SerializedName("attrs")
+    val attrs: Map<String, String> = hashMapOf(),
+    @SerializedName("extAddNum")
+    var extAddNum: Int = 0,   // 总数量中包含的赠送数量
+    @SerializedName("cornerMark")
+    val cornerMark: Int? = 0, //首充标记,0非首充,1首充
+    @SerializedName("icon")
+    var icon: String = "", //充值图示
+    @SerializedName("iconName")
+    val iconName: String? = "", //图标名
+    @SerializedName("iconUrl")
+    val iconUrl: String? = "", //图标url
+) : Parcelable
+
+class RechargeProductItemData(
+    val data: RechargeProductData
+)

+ 35 - 0
module/wallet/src/main/java/com/adealink/weparty/wallet/topup/TopUpDialog.kt

@@ -0,0 +1,35 @@
+package com.adealink.weparty.wallet.topup
+
+import com.adealink.frame.base.fastLazy
+import com.adealink.frame.mvvm.view.viewBinding
+import com.adealink.frame.router.annotation.RouterUri
+import com.adealink.weparty.commonui.recycleview.adapter.MultiTypeListAdapter
+import com.adealink.weparty.commonui.widget.BottomDialogFragment
+import com.adealink.weparty.databinding.DialogCommonActionBinding
+import com.adealink.weparty.databinding.DialogCommonActionBinding.bind
+import com.adealink.weparty.module.wallet.Wallet
+import com.adealink.weparty.wallet.R
+import com.adealink.weparty.wallet.data.RechargeProductItemData
+import com.adealink.weparty.wallet.databinding.DialogTopUpBinding
+import kotlin.getValue
+
+@RouterUri(path = [Wallet.TopUpDialog.PATH], desc = "充值弹窗")
+class TopUpDialog : BottomDialogFragment(R.layout.dialog_top_up) {
+
+    private val binding by viewBinding(DialogTopUpBinding::bind)
+
+    private val listAdapter by fastLazy { MultiTypeListAdapter<RechargeProductItemData>() }
+    override fun initViews() {
+        super.initViews()
+
+        binding.btnRecharge.setOnClickListener {
+            doRecharge()
+        }
+    }
+
+
+    private fun doRecharge() {
+
+    }
+
+}

+ 59 - 0
module/wallet/src/main/res/layout/dialog_top_up.xml

@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:background="@drawable/common_bottom_dialog_gray_bg"
+    android:paddingHorizontal="16dp"
+    android:paddingBottom="24dp">
+
+    <androidx.appcompat.widget.AppCompatTextView
+        android:id="@+id/tv_title"
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/common_top_bar_height"
+        android:fontFamily="@font/poppins_semibold"
+        android:gravity="center"
+        android:includeFontPadding="false"
+        android:text="@string/wallet_top_up_title"
+        android:textColor="@color/color_FF1D2129"
+        android:textSize="16sp"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
+
+    <include
+        android:id="@+id/v_product"
+        layout="@layout/layout_top_up_product"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@id/tv_title" />
+
+    <include
+        android:id="@+id/v_payment"
+        layout="@layout/layout_top_up_payment"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="10dp"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@id/v_product" />
+
+    <com.adealink.weparty.commonui.widget.CommonButton
+        android:id="@+id/btn_recharge"
+        android:layout_width="0dp"
+        android:layout_height="48dp"
+        android:layout_marginTop="16dp"
+        android:layout_marginBottom="24dp"
+        android:fontFamily="@font/poppins_semibold"
+        android:gravity="center"
+        android:includeFontPadding="false"
+        android:text="@string/wallet_top_up_button"
+        android:textColor="@color/white"
+        android:textSize="16sp"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@id/v_payment" />
+
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 45 - 0
module/wallet/src/main/res/layout/layout_top_up_payment.xml

@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:background="@drawable/common_white_radius_16_bg"
+    android:paddingHorizontal="12dp"
+    android:paddingVertical="10dp">
+
+    <androidx.appcompat.widget.AppCompatTextView
+        android:id="@+id/tv_balance_title"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:fontFamily="@font/poppins_semibold"
+        android:gravity="start"
+        android:includeFontPadding="false"
+        android:text="@string/wallet_payment_title"
+        android:textColor="@color/color_FF4E5969"
+        android:textSize="12sp"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
+
+    <View
+        android:layout_width="0dp"
+        android:layout_height="1dp"
+        android:layout_marginTop="8dp"
+        android:background="@color/color_FFF2F3F5"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@id/tv_balance_title" />
+
+    <androidx.recyclerview.widget.RecyclerView
+        android:id="@+id/rv_payment"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="16dp"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@id/tv_balance_title"
+        tools:itemCount="2"
+        tools:listitem="@layout/layout_top_up_payment_item" />
+
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 44 - 0
module/wallet/src/main/res/layout/layout_top_up_payment_item.xml

@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:background="@drawable/common_white_radius_16_bg"
+    android:paddingHorizontal="12dp"
+    android:paddingVertical="4dp">
+
+    <com.adealink.frame.image.view.NetworkImageView
+        android:id="@+id/iv_payment"
+        android:layout_width="38dp"
+        android:layout_height="38dp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent"
+        app:roundAsCircle="true" />
+
+    <androidx.appcompat.widget.AppCompatTextView
+        android:id="@+id/tv_balance_title"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="6dp"
+        android:fontFamily="@font/poppins_semibold"
+        android:gravity="start"
+        android:includeFontPadding="false"
+        android:textColor="@color/color_FF4E5969"
+        android:textSize="12sp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintHorizontal_bias="0"
+        app:layout_constraintStart_toEndOf="@id/iv_payment"
+        app:layout_constraintTop_toTopOf="parent"
+        tools:text="Google Pay" />
+
+    <androidx.appcompat.widget.AppCompatImageView
+        android:id="@+id/iv_selected"
+        android:layout_width="22dp"
+        android:layout_height="22dp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintTop_toTopOf="parent"
+        app:srcCompat="@drawable/common_check_selected_ic" />
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 65 - 0
module/wallet/src/main/res/layout/layout_top_up_product.xml

@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:background="@drawable/common_white_radius_16_bg"
+    android:paddingHorizontal="12dp"
+    android:paddingVertical="10dp">
+
+    <androidx.appcompat.widget.AppCompatTextView
+        android:id="@+id/tv_balance_title"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:gravity="center"
+        android:includeFontPadding="false"
+        android:text="@string/wallet_balance"
+        android:textColor="@color/color_FF4E5969"
+        android:textSize="14sp"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
+
+    <androidx.appcompat.widget.AppCompatImageView
+        android:id="@+id/iv_diamond"
+        android:layout_width="11dp"
+        android:layout_height="11dp"
+        android:layout_marginStart="4dp"
+        app:layout_constraintBottom_toBottomOf="@id/tv_balance_title"
+        app:layout_constraintStart_toEndOf="@id/tv_balance_title"
+        app:layout_constraintTop_toTopOf="@id/tv_balance_title"
+        app:srcCompat="@drawable/common_diamond_16_ic" />
+
+    <androidx.appcompat.widget.AppCompatTextView
+        android:id="@+id/tv_balance"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="3dp"
+        android:gravity="center"
+        android:includeFontPadding="false"
+        android:textColor="@color/color_FF4E5969"
+        android:textSize="14sp"
+        app:layout_constraintBottom_toBottomOf="@id/tv_balance_title"
+        app:layout_constraintStart_toEndOf="@id/iv_diamond"
+        app:layout_constraintTop_toTopOf="@id/tv_balance_title"
+        tools:text="100" />
+
+    <View
+        android:layout_width="0dp"
+        android:layout_height="1dp"
+        android:layout_marginTop="8dp"
+        android:background="@color/color_FFF2F3F5"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@id/tv_balance_title" />
+
+    <androidx.recyclerview.widget.RecyclerView
+        android:id="@+id/rv_product"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="16dp"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@id/tv_balance_title" />
+
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 52 - 0
module/wallet/src/main/res/layout/layout_top_up_product_item.xml

@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="60dp"
+    android:background="@drawable/common_f9fafb_radius_16_bg"
+    tools:layout_width="100dp">
+
+    <androidx.appcompat.widget.AppCompatImageView
+        android:id="@+id/iv_diamond"
+        android:layout_width="11dp"
+        android:layout_height="11dp"
+        android:layout_marginStart="4dp"
+        app:layout_constraintBottom_toBottomOf="@id/tv_diamond"
+        app:layout_constraintEnd_toStartOf="@id/tv_diamond"
+        app:layout_constraintHorizontal_chainStyle="packed"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="@id/tv_diamond"
+        app:srcCompat="@drawable/common_diamond_16_ic" />
+
+    <androidx.appcompat.widget.AppCompatTextView
+        android:id="@+id/tv_diamond"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="3dp"
+        android:fontFamily="@font/poppins_semibold"
+        android:gravity="center"
+        android:includeFontPadding="false"
+        android:textColor="@color/color_FF4E5969"
+        android:textSize="16sp"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toEndOf="@id/iv_diamond"
+        app:layout_constraintTop_toTopOf="parent"
+        tools:text="100" />
+
+    <androidx.appcompat.widget.AppCompatTextView
+        android:id="@+id/tv_price"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="3dp"
+        android:layout_marginTop="7dp"
+        android:gravity="center"
+        android:includeFontPadding="false"
+        android:textColor="@color/color_FF4E5969"
+        android:textSize="12sp"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@id/tv_diamond"
+        tools:text="100" />
+
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 4 - 0
module/wallet/src/main/res/values/strings.xml

@@ -1,3 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
+    <string name="wallet_top_up_title">Top up</string>
+    <string name="wallet_balance">Balance:</string>
+    <string name="wallet_payment_title">Please choose your payment method</string>
+    <string name="wallet_top_up_button">Recharge</string>
 </resources>