中奖 未中奖dialog 赋值
This commit is contained in:
parent
80812b5a2c
commit
2c791929ee
|
|
@ -18,7 +18,9 @@ import com.vididin.real.money.game.R
|
|||
import com.gamedog.vididin.beans.ZeroBuyItem
|
||||
import com.gamedog.vididin.beans.ZeroBuyResp
|
||||
import com.gamedog.vididin.core.login.login.AccountManager
|
||||
import com.gamedog.vididin.features.zero.dialogs.ZeroBuyNotWinDialog
|
||||
import com.gamedog.vididin.features.zero.dialogs.ZeroBuyRulesDialog
|
||||
import com.gamedog.vididin.features.zero.dialogs.ZeroBuyWinDialog
|
||||
import com.gamedog.vididin.router.Router
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import kotlinx.coroutines.launch
|
||||
|
|
@ -123,9 +125,14 @@ class ZeroBuyActivity : AppViewsEmptyViewModelActivity<ViewBinding>() {
|
|||
repeatOnLifecycle(Lifecycle.State.STARTED) {
|
||||
viewModel.ZeroBuyListData.collect { result ->
|
||||
when (result) {
|
||||
is Result.Loading -> { }
|
||||
is Result.Success -> updateUIs(result.data)
|
||||
is Result.Error -> { }
|
||||
is Result.Loading -> { showLoading(true) }
|
||||
is Result.Success -> {
|
||||
hideLoading()
|
||||
updateUIs(result.data)
|
||||
}
|
||||
is Result.Error -> {
|
||||
hideLoading()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -158,9 +165,33 @@ class ZeroBuyActivity : AppViewsEmptyViewModelActivity<ViewBinding>() {
|
|||
|
||||
|
||||
private fun updateUIs(data: ZeroBuyResp) {
|
||||
showCompletePurchasesInfo(data.mFinishedList)
|
||||
mAdapter.submitList(data.mCurrentList)
|
||||
}
|
||||
|
||||
private fun showCompletePurchasesInfo(finishedList: List<ZeroBuyItem>?) {
|
||||
finishedList?.let {
|
||||
val userId = AccountManager.getAccount()?.userId
|
||||
val joinedIdList = SpUtil.instance().getList<Int>(SpUtil.KEY_ZEROBUY_JOINED_ACTIVITY_IDS)
|
||||
val hasNotifiedIdList: MutableList<Int> = SpUtil.instance().getList<Int>(SpUtil.KEY_ZEROBUY_HAS_NOTIFY_IDS) as MutableList<Int>
|
||||
it.forEach { item->
|
||||
if (joinedIdList.contains(item.id) && !hasNotifiedIdList.contains(item.id)) {
|
||||
hasNotifiedIdList.add(item.id)
|
||||
|
||||
item.winners?.let {
|
||||
if (it.contains(userId)) {
|
||||
ZeroBuyWinDialog(this@ZeroBuyActivity, item).show()
|
||||
} else {
|
||||
ZeroBuyNotWinDialog(this@ZeroBuyActivity).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SpUtil.instance().putList(SpUtil.KEY_ZEROBUY_HAS_NOTIFY_IDS, hasNotifiedIdList)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateItemUI(joinedItem: ZeroBuyItem?) {
|
||||
val currentList = mAdapter.currentList.toMutableList()
|
||||
val indexToUpdate = currentList.indexOfFirst { it.id == joinedItem?.id }
|
||||
|
|
|
|||
|
|
@ -4,11 +4,12 @@ package com.gamedog.vididin.features.zero.dialogs
|
|||
import android.app.Activity
|
||||
import com.ama.core.architecture.util.setOnClickBatch
|
||||
import com.ama.core.architecture.widget.BindingDialog
|
||||
import com.gamedog.vididin.beans.ZeroBuyItem
|
||||
import com.vididin.real.money.game.databinding.DialogZeroBuyNotWinBinding as ViewBinding
|
||||
import com.gamedog.vididin.router.Router
|
||||
|
||||
|
||||
class ZeroBuyNotWinDialog(context: Activity) : BindingDialog<ViewBinding>(context, ViewBinding::inflate) {
|
||||
class ZeroBuyNotWinDialog(context: Activity, private val item: ZeroBuyItem) : BindingDialog<ViewBinding>(context, ViewBinding::inflate) {
|
||||
|
||||
init {
|
||||
build()
|
||||
|
|
@ -22,13 +23,15 @@ class ZeroBuyNotWinDialog(context: Activity) : BindingDialog<ViewBinding>(contex
|
|||
setCanCancel(false)
|
||||
|
||||
mBinding.run {
|
||||
setOnClickBatch(tvConfirm, ivClose) {
|
||||
setOnClickBatch(ivClose) {
|
||||
when (this) {
|
||||
tvConfirm, ivClose -> {
|
||||
ivClose -> {
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tvTitle.text = item.title
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,11 +4,12 @@ package com.gamedog.vididin.features.zero.dialogs
|
|||
import android.app.Activity
|
||||
import com.ama.core.architecture.util.setOnClickBatch
|
||||
import com.ama.core.architecture.widget.BindingDialog
|
||||
import com.gamedog.vididin.beans.ZeroBuyItem
|
||||
import com.vididin.real.money.game.databinding.DialogZeroBuyWinBinding as ViewBinding
|
||||
import com.gamedog.vididin.router.Router
|
||||
|
||||
|
||||
class ZeroBuyWinDialog(context: Activity) : BindingDialog<ViewBinding>(context, ViewBinding::inflate) {
|
||||
class ZeroBuyWinDialog(context: Activity, private val item: ZeroBuyItem) : BindingDialog<ViewBinding>(context, ViewBinding::inflate) {
|
||||
|
||||
init {
|
||||
build()
|
||||
|
|
@ -22,19 +23,20 @@ class ZeroBuyWinDialog(context: Activity) : BindingDialog<ViewBinding>(context,
|
|||
setCanCancel(false)
|
||||
|
||||
mBinding.run {
|
||||
setOnClickBatch(tvConfirm, ivClose) {
|
||||
setOnClickBatch(ivClose) {
|
||||
when (this) {
|
||||
tvConfirm, ivClose -> {
|
||||
ivClose -> {
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tvTitle.text = item.title
|
||||
tvPurchaseId.text = item.redeem_code
|
||||
}
|
||||
}
|
||||
|
||||
private fun gotoWatchVideo() {
|
||||
Router.Withdraw.startActivity(mActivity)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape android:shape="rectangle"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<gradient android:type="linear" android:useLevel="true" android:startColor="#ff4c94ff" android:endColor="#ff0066ff" android:angle="180" />
|
||||
<corners android:topLeftRadius="30dp" android:topRightRadius="30dp" android:bottomLeftRadius="30dp" android:bottomRightRadius="30dp" />
|
||||
</shape>
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape android:shape="rectangle"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#ff009b39" />
|
||||
<corners android:topLeftRadius="5dp" android:topRightRadius="5dp" android:bottomLeftRadius="5dp" android:bottomRightRadius="5dp" />
|
||||
</shape>
|
||||
|
|
@ -2,7 +2,8 @@
|
|||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="20dp">
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
|
|
@ -20,56 +21,84 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="15dp"
|
||||
android:paddingHorizontal="15dp"
|
||||
android:layout_marginTop="60dp"
|
||||
android:clipChildren="false"
|
||||
android:gravity="center_horizontal"
|
||||
android:background="@drawable/bg_benefit_top_white"
|
||||
android:background="@mipmap/zero_win_dialog_bg"
|
||||
>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@mipmap/temp"
|
||||
android:layout_marginTop="7dp"
|
||||
/>
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:textSize="18sp"
|
||||
android:textColor="@color/black_28"
|
||||
android:text="@string/zero_buy_rule_dialog_title"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/white"
|
||||
android:text="title"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@mipmap/record_lost"
|
||||
android:layout_marginTop="7dp"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:textSize="21sp"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/gray3"
|
||||
android:text="@string/zero_win_title_winnot_hint"
|
||||
/>
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_desc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/gray6"
|
||||
android:text="@string/zero_buy_rule_dialog_descript"
|
||||
android:textSize="12sp"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/gray9"
|
||||
android:text="@string/zero_buy_not_win_dialog_descript"
|
||||
/>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_marginTop="20dp"
|
||||
android:paddingVertical="8dp"
|
||||
android:background="@drawable/bg_round_blue_gradient_30">
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_rules_1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/gray9"
|
||||
android:text="@string/zero_buy_rule_dialog_rule"
|
||||
/>
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_confirm"
|
||||
android:layout_width="240dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:background="@drawable/bg_but_zero_buy_dialog"
|
||||
android:textSize="18sp"
|
||||
android:textColor="@color/white"
|
||||
android:text="@string/understood"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/white"
|
||||
android:text="@string/zero_win_action"
|
||||
android:layout_centerInParent="true"
|
||||
android:drawableStart="@mipmap/icon_discord_2"
|
||||
android:drawablePadding="10dp"
|
||||
/>
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@
|
|||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="20dp">
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
|
|
@ -20,56 +21,114 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="15dp"
|
||||
android:paddingHorizontal="15dp"
|
||||
android:layout_marginTop="60dp"
|
||||
android:clipChildren="false"
|
||||
android:gravity="center_horizontal"
|
||||
android:background="@drawable/bg_benefit_top_white"
|
||||
android:background="@mipmap/zero_win_dialog_bg"
|
||||
>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@mipmap/temp"
|
||||
android:layout_marginTop="7dp"
|
||||
/>
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:textSize="18sp"
|
||||
android:textColor="@color/black_28"
|
||||
android:text="@string/zero_buy_rule_dialog_title"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/white"
|
||||
android:text="title"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@mipmap/record_win"
|
||||
android:layout_marginTop="7dp"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:textSize="21sp"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/gray3"
|
||||
android:text="@string/zero_win_title_win_hint"
|
||||
/>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="8dp"
|
||||
android:gravity="center"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="@drawable/bg_round_green39_5">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_purchase_id"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:textSize="30sp"
|
||||
android:textColor="@color/yellow_00"
|
||||
android:textStyle="bold"
|
||||
android:text="ID"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:textSize="12sp"
|
||||
android:textColor="@color/white"
|
||||
android:text="@string/zero_win_title_hint"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_desc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/gray6"
|
||||
android:text="@string/zero_buy_rule_dialog_descript"
|
||||
android:textSize="12sp"
|
||||
android:textColor="@color/gray9"
|
||||
android:text="@string/zero_buy_win_dialog_descript"
|
||||
/>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_marginTop="20dp"
|
||||
android:paddingVertical="8dp"
|
||||
android:background="@drawable/bg_round_blue_gradient_30">
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_rules_1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/gray9"
|
||||
android:text="@string/zero_buy_rule_dialog_rule"
|
||||
/>
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_confirm"
|
||||
android:layout_width="240dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:background="@drawable/bg_but_zero_buy_dialog"
|
||||
android:textSize="18sp"
|
||||
android:textColor="@color/white"
|
||||
android:text="@string/understood"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/white"
|
||||
android:text="@string/zero_win_action"
|
||||
android:layout_centerInParent="true"
|
||||
android:drawableStart="@mipmap/icon_discord_2"
|
||||
android:drawablePadding="10dp"
|
||||
/>
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 4.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 181 KiB |
|
|
@ -123,5 +123,11 @@
|
|||
<string name="no_data_hint">There\'s no any record</string>
|
||||
<string name="get">Get</string>
|
||||
<string name="not_enough_cash">You don\'t have enough cash.</string>
|
||||
<string name="zero_win_title_hint">Código promocional</string>
|
||||
<string name="zero_win_title_win_hint">Parabéns\nvocê ganhou!</string>
|
||||
<string name="zero_buy_win_dialog_descript">· Salve um print desta tela para comprovação.\n· Entre na nossa comunidade pelo link abaixo e procure o administrador para resgatar seu prêmio.</string>
|
||||
<string name="zero_win_action">Junte-se a nós!</string>
|
||||
<string name="zero_win_title_winnot_hint">Que pena\nvocê não foi o ganhador</string>
|
||||
<string name="zero_buy_not_win_dialog_descript">" Clique no link abaixo para entrar na nossa comunidade e conferir os ganhadores desta rodada!"</string>
|
||||
|
||||
</resources>
|
||||
|
|
@ -32,6 +32,7 @@ class SpUtil private constructor(spFileName: String) {
|
|||
|
||||
|
||||
const val KEY_ZEROBUY_JOINED_ACTIVITY_IDS = "KEY_ZEROBUY_JOINED_ACTIVITY_IDS"
|
||||
const val KEY_ZEROBUY_HAS_NOTIFY_IDS = "KEY_ZEROBUY_HAS_NOTIFY_IDS"
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue