|
@@ -107,13 +107,13 @@ class CfBetFragment : BaseFragment(R.layout.fragment_cf_betting) {
|
|
}
|
|
}
|
|
})
|
|
})
|
|
// test user read only or not
|
|
// test user read only or not
|
|
- if (userShare.readOnly) {
|
|
|
|
- btnBetMeron.isEnabled = true
|
|
|
|
- btnBetWala.isEnabled = true
|
|
|
|
- } else {
|
|
|
|
- btnBetMeron.isEnabled = false
|
|
|
|
- btnBetWala.isEnabled = false
|
|
|
|
- }
|
|
|
|
|
|
+// if (userShare.readOnly) {
|
|
|
|
+// btnBetMeron.isEnabled = true
|
|
|
|
+// btnBetWala.isEnabled = true
|
|
|
|
+// } else {
|
|
|
|
+// btnBetMeron.isEnabled = false
|
|
|
|
+// btnBetWala.isEnabled = false
|
|
|
|
+// }
|
|
// Red side betting
|
|
// Red side betting
|
|
btnBetMeron.setOnClickListener {
|
|
btnBetMeron.setOnClickListener {
|
|
LogOutTimerUtil.resetLogoutTimer(null, null)
|
|
LogOutTimerUtil.resetLogoutTimer(null, null)
|
|
@@ -167,18 +167,18 @@ class CfBetFragment : BaseFragment(R.layout.fragment_cf_betting) {
|
|
edtBettingAmount.setText(string.substring(0, string.length - 1))
|
|
edtBettingAmount.setText(string.substring(0, string.length - 1))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- shareViewModel.getUpdatePayout.observe(viewLifecycleOwner, Observer {
|
|
|
|
- Log.d("getUpdatePayout", "onUpdatePlayerBetting" + it)
|
|
|
|
- if (!it.isNullOrEmpty()) {
|
|
|
|
- if (isStopBetting == "true") {
|
|
|
|
- val obj = JSONObject(it)
|
|
|
|
- if (obj.getInt("currency_type") == userShare.currencyType) {
|
|
|
|
- txtMeronPayout.text = obj.getString("payout_wala")
|
|
|
|
- txtWalaPayout.text = obj.getString("payout_meron")
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
|
|
+// shareViewModel.getUpdatePayout.observe(viewLifecycleOwner, Observer {
|
|
|
|
+// Log.d("getUpdatePayout", "onUpdatePlayerBetting" + it)
|
|
|
|
+// if (!it.isNullOrEmpty()) {
|
|
|
|
+// if (isStopBetting == "true") {
|
|
|
|
+// val obj = JSONObject(it)
|
|
|
|
+// if (obj.getInt("currency_type") == userShare.currencyType) {
|
|
|
|
+// txtMeronPayout.text = obj.getString("payout_wala")
|
|
|
|
+// txtWalaPayout.text = obj.getString("payout_meron")
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// })
|
|
shareViewModel.getResetAmount.observe(viewLifecycleOwner, Observer {
|
|
shareViewModel.getResetAmount.observe(viewLifecycleOwner, Observer {
|
|
Log.d("getResetAmount", "onUpdatePlayerBetting" + it)
|
|
Log.d("getResetAmount", "onUpdatePlayerBetting" + it)
|
|
txtMeronAmount.text = "0"
|
|
txtMeronAmount.text = "0"
|
|
@@ -196,57 +196,57 @@ class CfBetFragment : BaseFragment(R.layout.fragment_cf_betting) {
|
|
}
|
|
}
|
|
layMeronPayout.visibility = View.VISIBLE
|
|
layMeronPayout.visibility = View.VISIBLE
|
|
layWalaPayout.visibility = View.VISIBLE
|
|
layWalaPayout.visibility = View.VISIBLE
|
|
- if (userShare.readOnly) {
|
|
|
|
- when (isStopBetting) {
|
|
|
|
- "true" -> {
|
|
|
|
- btnBetMeron.isEnabled = true
|
|
|
|
- btnBetWala.isEnabled = true
|
|
|
|
- }
|
|
|
|
- "false" -> {
|
|
|
|
- btnBetMeron.isEnabled = false
|
|
|
|
- btnBetWala.isEnabled = false
|
|
|
|
- }
|
|
|
|
- else -> {
|
|
|
|
- btnBetMeron.isEnabled = false
|
|
|
|
- btnBetWala.isEnabled = false
|
|
|
|
- layMeronPayout.visibility = View.INVISIBLE
|
|
|
|
- layWalaPayout.visibility = View.INVISIBLE
|
|
|
|
-// txtMeronAmount.text = currencyFormat(it.amountRed)
|
|
|
|
-// txtWalaAmount.text = currencyFormat(it.amountBlue)
|
|
|
|
-// txtMeronPayout.text = it.payoutRed.toString()
|
|
|
|
-// txtWalaPayout.text = it.payoutBlue.toString()
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- btnBetMeron.isEnabled = false
|
|
|
|
- btnBetWala.isEnabled = false
|
|
|
|
- if (isStopBetting == "null") {
|
|
|
|
- layMeronPayout.visibility = View.INVISIBLE
|
|
|
|
- layWalaPayout.visibility = View.INVISIBLE
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- shareViewModel.getUpdatePayout.observe(viewLifecycleOwner, Observer {
|
|
|
|
- Log.d("getUpdatePayout", "onUpdatePlayerBetting" + it)
|
|
|
|
- if (!it.isNullOrEmpty()) {
|
|
|
|
- val obj = JSONObject(it)
|
|
|
|
- if (userShare.currencyType == obj.getInt("currency_type")) {
|
|
|
|
- txtMeronPayout.text = obj.getString("payout_meron")
|
|
|
|
- txtWalaPayout.text = obj.getString("payout_wala")
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- shareViewModel.onUpdateBettingAmount.observe(viewLifecycleOwner, Observer {
|
|
|
|
- Log.d("onUpdateBettingAmount", "onUpdatePlayerBetting" + it)
|
|
|
|
- if (!it.isNullOrEmpty()) {
|
|
|
|
- val arr = JSONArray(it)
|
|
|
|
- txtMeronAmount.text =
|
|
|
|
- arr.getJSONObject(userShare.currencyType - 1).getString("meron_amount")
|
|
|
|
- txtWalaAmount.text =
|
|
|
|
- arr.getJSONObject(userShare.currencyType - 1).getString("wala_amount")
|
|
|
|
|
|
+// if (userShare.readOnly) {
|
|
|
|
+// when (isStopBetting) {
|
|
|
|
+// "true" -> {
|
|
|
|
+// btnBetMeron.isEnabled = true
|
|
|
|
+// btnBetWala.isEnabled = true
|
|
|
|
+// }
|
|
|
|
+// "false" -> {
|
|
|
|
+// btnBetMeron.isEnabled = false
|
|
|
|
+// btnBetWala.isEnabled = false
|
|
|
|
+// }
|
|
|
|
+// else -> {
|
|
|
|
+// btnBetMeron.isEnabled = false
|
|
|
|
+// btnBetWala.isEnabled = false
|
|
|
|
+// layMeronPayout.visibility = View.INVISIBLE
|
|
|
|
+// layWalaPayout.visibility = View.INVISIBLE
|
|
|
|
+//// txtMeronAmount.text = currencyFormat(it.amountRed)
|
|
|
|
+//// txtWalaAmount.text = currencyFormat(it.amountBlue)
|
|
|
|
+//// txtMeronPayout.text = it.payoutRed.toString()
|
|
|
|
+//// txtWalaPayout.text = it.payoutBlue.toString()
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// } else {
|
|
|
|
+// btnBetMeron.isEnabled = false
|
|
|
|
+// btnBetWala.isEnabled = false
|
|
|
|
+// if (isStopBetting == "null") {
|
|
|
|
+// layMeronPayout.visibility = View.INVISIBLE
|
|
|
|
+// layWalaPayout.visibility = View.INVISIBLE
|
|
|
|
+// }
|
|
|
|
+// }
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
+// shareViewModel.getUpdatePayout.observe(viewLifecycleOwner, Observer {
|
|
|
|
+// Log.d("getUpdatePayout", "onUpdatePlayerBetting" + it)
|
|
|
|
+// if (!it.isNullOrEmpty()) {
|
|
|
|
+// val obj = JSONObject(it)
|
|
|
|
+// if (userShare.currencyType == obj.getInt("currency_type")) {
|
|
|
|
+// txtMeronPayout.text = obj.getString("payout_meron")
|
|
|
|
+// txtWalaPayout.text = obj.getString("payout_wala")
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// })
|
|
|
|
+// shareViewModel.onUpdateBettingAmount.observe(viewLifecycleOwner, Observer {
|
|
|
|
+// Log.d("onUpdateBettingAmount", "onUpdatePlayerBetting" + it)
|
|
|
|
+// if (!it.isNullOrEmpty()) {
|
|
|
|
+// val arr = JSONArray(it)
|
|
|
|
+// txtMeronAmount.text =
|
|
|
|
+// arr.getJSONObject(userShare.currencyType - 1).getString("meron_amount")
|
|
|
|
+// txtWalaAmount.text =
|
|
|
|
+// arr.getJSONObject(userShare.currencyType - 1).getString("wala_amount")
|
|
|
|
+// }
|
|
|
|
+// })
|
|
shareViewModel.onUpdateChanelDeveloper.observe(viewLifecycleOwner, Observer {
|
|
shareViewModel.onUpdateChanelDeveloper.observe(viewLifecycleOwner, Observer {
|
|
if (!it.isNullOrEmpty()) {
|
|
if (!it.isNullOrEmpty()) {
|
|
// Log.d("getUpdateData", "onUpdateChanelDeveloper" + it)
|
|
// Log.d("getUpdateData", "onUpdateChanelDeveloper" + it)
|
|
@@ -268,35 +268,35 @@ class CfBetFragment : BaseFragment(R.layout.fragment_cf_betting) {
|
|
txtWalaPayout.text = it.getString(K.PayoutBlue)
|
|
txtWalaPayout.text = it.getString(K.PayoutBlue)
|
|
layMeronPayout.visibility = View.VISIBLE
|
|
layMeronPayout.visibility = View.VISIBLE
|
|
layWalaPayout.visibility = View.VISIBLE
|
|
layWalaPayout.visibility = View.VISIBLE
|
|
- if (userShare.readOnly) {
|
|
|
|
- when {
|
|
|
|
- it.getString(K.TypeOfPlay) == K.Open -> {
|
|
|
|
- btnBetMeron.isEnabled = true
|
|
|
|
- btnBetWala.isEnabled = true
|
|
|
|
- }
|
|
|
|
- it.getString(K.TypeOfPlay) == K.Close -> {
|
|
|
|
- btnBetMeron.isEnabled = false
|
|
|
|
- btnBetWala.isEnabled = false
|
|
|
|
- }
|
|
|
|
- else -> {
|
|
|
|
- btnBetMeron.isEnabled = false
|
|
|
|
- btnBetWala.isEnabled = false
|
|
|
|
- layMeronPayout.visibility = View.INVISIBLE
|
|
|
|
- layWalaPayout.visibility = View.INVISIBLE
|
|
|
|
-// txtMeronAmount.text = amountRed
|
|
|
|
-// txtWalaAmount.text = amountBlue
|
|
|
|
-// txtMeronPayout.text = payoutRed
|
|
|
|
-// txtWalaPayout.text = payoutBlue
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- btnBetMeron.isEnabled = false
|
|
|
|
- btnBetWala.isEnabled = false
|
|
|
|
- if (it.getString(K.TypeOfPlay) == K.Live) {
|
|
|
|
- layMeronPayout.visibility = View.INVISIBLE
|
|
|
|
- layWalaPayout.visibility = View.INVISIBLE
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+// if (userShare.readOnly) {
|
|
|
|
+// when {
|
|
|
|
+// it.getString(K.TypeOfPlay) == K.Open -> {
|
|
|
|
+// btnBetMeron.isEnabled = true
|
|
|
|
+// btnBetWala.isEnabled = true
|
|
|
|
+// }
|
|
|
|
+// it.getString(K.TypeOfPlay) == K.Close -> {
|
|
|
|
+// btnBetMeron.isEnabled = false
|
|
|
|
+// btnBetWala.isEnabled = false
|
|
|
|
+// }
|
|
|
|
+// else -> {
|
|
|
|
+// btnBetMeron.isEnabled = false
|
|
|
|
+// btnBetWala.isEnabled = false
|
|
|
|
+// layMeronPayout.visibility = View.INVISIBLE
|
|
|
|
+// layWalaPayout.visibility = View.INVISIBLE
|
|
|
|
+//// txtMeronAmount.text = amountRed
|
|
|
|
+//// txtWalaAmount.text = amountBlue
|
|
|
|
+//// txtMeronPayout.text = payoutRed
|
|
|
|
+//// txtWalaPayout.text = payoutBlue
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// } else {
|
|
|
|
+// btnBetMeron.isEnabled = false
|
|
|
|
+// btnBetWala.isEnabled = false
|
|
|
|
+// if (it.getString(K.TypeOfPlay) == K.Live) {
|
|
|
|
+// layMeronPayout.visibility = View.INVISIBLE
|
|
|
|
+// layWalaPayout.visibility = View.INVISIBLE
|
|
|
|
+// }
|
|
|
|
+// }
|
|
betMin = it.getInt("amount_min")
|
|
betMin = it.getInt("amount_min")
|
|
betMax = it.getInt("amount_max")
|
|
betMax = it.getInt("amount_max")
|
|
txtMax.text = currencyFormat(betMax)
|
|
txtMax.text = currencyFormat(betMax)
|
|
@@ -305,30 +305,30 @@ class CfBetFragment : BaseFragment(R.layout.fragment_cf_betting) {
|
|
}
|
|
}
|
|
|
|
|
|
private fun confirmBet(betType: String, moneyBet: Int, chickenId: String) {
|
|
private fun confirmBet(betType: String, moneyBet: Int, chickenId: String) {
|
|
- val builder = context?.let { AlertDialog.Builder(it) }
|
|
|
|
- //set title for alert dialog
|
|
|
|
- builder?.setTitle("Confirm betting!")
|
|
|
|
- //set message for alert dialog
|
|
|
|
- builder?.setMessage("You are betting $moneyBet ${currencyType()} on $betType!")
|
|
|
|
-// builder?.setIcon(android.R.drawable.ic_dialog_alert)
|
|
|
|
-
|
|
|
|
- //performing positive action
|
|
|
|
- builder?.setPositiveButton("Yes") { dialogInterface, which ->
|
|
|
|
-
|
|
|
|
- cfBetViewModel.createBetting(CreateBetting(moneyBet, chickenId))
|
|
|
|
- dialogInterface.dismiss()
|
|
|
|
- }
|
|
|
|
- //performing negative action
|
|
|
|
- builder?.setNegativeButton("No") { dialogInterface, which ->
|
|
|
|
- btnBetMeron.isEnabled = true
|
|
|
|
- btnBetWala.isEnabled = true
|
|
|
|
- dialogInterface.dismiss()
|
|
|
|
- }
|
|
|
|
- // Create the AlertDialog
|
|
|
|
- val alertDialog: AlertDialog? = builder?.create()
|
|
|
|
- // Set other dialog properties
|
|
|
|
- alertDialog?.setCancelable(false)
|
|
|
|
- alertDialog?.show()
|
|
|
|
|
|
+// val builder = context?.let { AlertDialog.Builder(it) }
|
|
|
|
+// //set title for alert dialog
|
|
|
|
+// builder?.setTitle("Confirm betting!")
|
|
|
|
+// //set message for alert dialog
|
|
|
|
+// builder?.setMessage("You are betting $moneyBet ${currencyType()} on $betType!")
|
|
|
|
+//// builder?.setIcon(android.R.drawable.ic_dialog_alert)
|
|
|
|
+//
|
|
|
|
+// //performing positive action
|
|
|
|
+// builder?.setPositiveButton("Yes") { dialogInterface, which ->
|
|
|
|
+//
|
|
|
|
+// cfBetViewModel.createBetting(CreateBetting(moneyBet, chickenId))
|
|
|
|
+// dialogInterface.dismiss()
|
|
|
|
+// }
|
|
|
|
+// //performing negative action
|
|
|
|
+// builder?.setNegativeButton("No") { dialogInterface, which ->
|
|
|
|
+// btnBetMeron.isEnabled = true
|
|
|
|
+// btnBetWala.isEnabled = true
|
|
|
|
+// dialogInterface.dismiss()
|
|
|
|
+// }
|
|
|
|
+// // Create the AlertDialog
|
|
|
|
+// val alertDialog: AlertDialog? = builder?.create()
|
|
|
|
+// // Set other dialog properties
|
|
|
|
+// alertDialog?.setCancelable(false)
|
|
|
|
+// alertDialog?.show()
|
|
}
|
|
}
|
|
|
|
|
|
private fun btnMaster(it: BtnMasterState) {
|
|
private fun btnMaster(it: BtnMasterState) {
|