优化返回值
This commit is contained in:
parent
04b35f09a0
commit
577527472a
|
|
@ -110,10 +110,11 @@ class ZeroManager private constructor() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getZeroWithdrawItem(zeroItem: ZeroBuyItem): WinZeroWithdrawInfoItem {
|
fun getZeroWithdrawItem(zeroItem: ZeroBuyItem): WinZeroWithdrawInfoItem? {
|
||||||
try {
|
try {
|
||||||
mRecordLocker.lock()
|
mRecordLocker.lock()
|
||||||
return mRecordList.filter { zeroItem.id == it.purchase_id }[0]
|
val matchedList = mRecordList.filter { zeroItem.id == it.purchase_id }
|
||||||
|
return if (matchedList.isNotEmpty()) matchedList[0] else null
|
||||||
} finally {
|
} finally {
|
||||||
mRecordLocker.unlock()
|
mRecordLocker.unlock()
|
||||||
}
|
}
|
||||||
|
|
@ -273,7 +274,7 @@ class ZeroManager private constructor() {
|
||||||
fun startWithdrawProcess(activity: Activity, item: ZeroBuyItem) {
|
fun startWithdrawProcess(activity: Activity, item: ZeroBuyItem) {
|
||||||
val zeroWithdrawInfoItem = getZeroWithdrawItem(item)
|
val zeroWithdrawInfoItem = getZeroWithdrawItem(item)
|
||||||
|
|
||||||
if (couldStartWithdraw(item)) {
|
if (zeroWithdrawInfoItem != null && couldStartWithdraw(item)) {
|
||||||
val onConfirmed: (cashNum: Double)->Unit = {
|
val onConfirmed: (cashNum: Double)->Unit = {
|
||||||
requestZeroWithdrawReward(zeroWithdrawInfoItem)
|
requestZeroWithdrawReward(zeroWithdrawInfoItem)
|
||||||
}
|
}
|
||||||
|
|
@ -284,7 +285,7 @@ class ZeroManager private constructor() {
|
||||||
WithdrawBindBankDialog(activity = activity, onConfirmed).setWithDrawCashNumStr(zeroWithdrawInfoItem.winCashNumStr!!).show()
|
WithdrawBindBankDialog(activity = activity, onConfirmed).setWithDrawCashNumStr(zeroWithdrawInfoItem.winCashNumStr!!).show()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
when (zeroWithdrawInfoItem.withdrawState) {
|
when (zeroWithdrawInfoItem?.withdrawState) {
|
||||||
TRANSACTION_STATE_ONGOING -> {
|
TRANSACTION_STATE_ONGOING -> {
|
||||||
AndroidUtil.showToast(R.string.claim_reward_onging)
|
AndroidUtil.showToast(R.string.claim_reward_onging)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,8 @@
|
||||||
<string name="zero_win_state_failed">Failed</string>
|
<string name="zero_win_state_failed">Failed</string>
|
||||||
<string name="zero_win_state_withdrarw_success">Paid</string>
|
<string name="zero_win_state_withdrarw_success">Paid</string>
|
||||||
<string name="no_data_hint">There\'s no any data</string>
|
<string name="no_data_hint">There\'s no any data</string>
|
||||||
|
<string name="claim_reward_onging">This purchase reward claim is ongoing.</string>
|
||||||
|
<string name="has_claimed_reward">You have claimed this reward.</string>
|
||||||
|
|
||||||
|
|
||||||
<string name="benefit_task_top_hint">Finish all tasks to earn!</string>
|
<string name="benefit_task_top_hint">Finish all tasks to earn!</string>
|
||||||
|
|
|
||||||
|
|
@ -218,8 +218,8 @@
|
||||||
<string name="recompensa">Recompensa!</string>
|
<string name="recompensa">Recompensa!</string>
|
||||||
|
|
||||||
<string name="net_error">Erro de rede</string>
|
<string name="net_error">Erro de rede</string>
|
||||||
<string name="claim_reward_onging">This purchase reward claim is ongoing.</string>
|
<string name="claim_reward_onging">Recompensa em recepção</string>
|
||||||
<string name="has_claimed_reward">You have claimed this reward.</string>
|
<string name="has_claimed_reward">Já receberam recompensas</string>
|
||||||
<string name="game_center">Game Center</string>
|
<string name="game_center">Game Center</string>
|
||||||
<string name="withdraw_fail_not_reach_condition">Not reach withdraw condition</string>
|
<string name="withdraw_fail_not_reach_condition">Not reach withdraw condition</string>
|
||||||
<string name="withdraw_fail_already_withdraw">You\'ve already withdrawed</string>
|
<string name="withdraw_fail_already_withdraw">You\'ve already withdrawed</string>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue