|
|
@@ -139,29 +139,30 @@ class SimpleProcessActivity : BaseActivity<ActivitySimpleProcessBinding>() {
|
|
|
|
|
|
private fun updateSharedStatus() {
|
|
|
val doneCount = PresentationManager.mSimpleTicket?.lockerTogetherList?.filter { it.status == 2 }?.size ?: 0
|
|
|
+ val sharedCount = PresentationManager.mSimpleTicket?.lockerTogetherList?.filter { it.status == 1 }?.size ?: 0
|
|
|
println("updateSharedStatus : $doneCount")
|
|
|
- mBinding?.tvShared1?.text = "${getString(R.string.simple_shared)} $doneCount/2"
|
|
|
+ mBinding?.tvShared1?.text = "${getString(R.string.simple_shared)} $sharedCount/2"
|
|
|
mBinding?.tvShared2?.text = "${getString(R.string.simple_shared)} $doneCount/2"
|
|
|
if (doneCount == 2) {
|
|
|
PresentationManager.mSimpleTicket?.status = 3
|
|
|
PresentationManager.mStep = 5
|
|
|
changeStep(5)
|
|
|
- mBinding?.tvShared1?.setBackgroundColor(ContextCompat.getColor(this, R.color.simple_shared_done))
|
|
|
- mBinding?.tvShared2?.setBackgroundColor(ContextCompat.getColor(this, R.color.simple_shared_done))
|
|
|
- mBinding?.ivShared1?.background = ContextCompat.getDrawable(this, R.mipmap.unlock)
|
|
|
- mBinding?.ivShared2?.background = ContextCompat.getDrawable(this, R.mipmap.unlock)
|
|
|
} else {
|
|
|
- mBinding?.tvShared1?.setBackgroundColor(ContextCompat.getColor(this, R.color.simple_shared_processing))
|
|
|
- mBinding?.tvShared2?.setBackgroundColor(ContextCompat.getColor(this, R.color.simple_shared_processing))
|
|
|
- mBinding?.ivShared1?.background = ContextCompat.getDrawable(this, R.mipmap.lock)
|
|
|
- mBinding?.ivShared2?.background = ContextCompat.getDrawable(this, R.mipmap.lock)
|
|
|
+ if (sharedCount == 2) {
|
|
|
+ PresentationManager.mSimpleTicket?.status = 3
|
|
|
+ PresentationManager.mStep = 4
|
|
|
+ changeStep(4)
|
|
|
+ }
|
|
|
}
|
|
|
updateSharedName()
|
|
|
}
|
|
|
|
|
|
private fun updateSharedName() {
|
|
|
val samName = getString(R.string.simple_colocker_sam)
|
|
|
- val samStatus = PresentationManager.mLockerTogetherList.find { it.name == samName }?.status
|
|
|
+ var samStatus = PresentationManager.mLockerTogetherList.find { it.name == samName }?.status
|
|
|
+ if (PresentationManager.mStep == 4 && samStatus == 1) {
|
|
|
+ samStatus = 0
|
|
|
+ }
|
|
|
val samText = when (samStatus) {
|
|
|
1 -> getString(R.string.simple_colocker_sam, getString(R.string.simple_lock_shared))
|
|
|
2 -> getString(R.string.simple_colocker_sam, getString(R.string.simple_lock_unlocked))
|
|
|
@@ -169,7 +170,10 @@ class SimpleProcessActivity : BaseActivity<ActivitySimpleProcessBinding>() {
|
|
|
}
|
|
|
|
|
|
val robinName = getString(R.string.simple_colocker_robin)
|
|
|
- val robinStatus = PresentationManager.mLockerTogetherList.find { it.name == robinName }?.status
|
|
|
+ var robinStatus = PresentationManager.mLockerTogetherList.find { it.name == robinName }?.status
|
|
|
+ if (PresentationManager.mStep == 4 && robinStatus == 1) {
|
|
|
+ robinStatus = 0
|
|
|
+ }
|
|
|
val robinText = when (robinStatus) {
|
|
|
1 -> getString(R.string.simple_colocker_robin, getString(R.string.simple_lock_shared))
|
|
|
2 -> getString(R.string.simple_colocker_robin, getString(R.string.simple_lock_unlocked))
|
|
|
@@ -194,9 +198,9 @@ class SimpleProcessActivity : BaseActivity<ActivitySimpleProcessBinding>() {
|
|
|
PresentationManager.mSimpleTicket?.lockerTogetherList?.forEach { colocker ->
|
|
|
println("dispatchKeyEvent : ${colocker.status} - ${PresentationManager.mSimpleTicket?.lockerTogetherList}")
|
|
|
if (colocker.rfid == formattedCard) {
|
|
|
- if (colocker.status == 0) {
|
|
|
+ if (colocker.status == 0 && PresentationManager.mStep == 3) {
|
|
|
colocker.status = 1
|
|
|
- } else if (colocker.status == 1) {
|
|
|
+ } else if (colocker.status == 1 && PresentationManager.mStep == 4) {
|
|
|
colocker.status = 2
|
|
|
}
|
|
|
updateSharedStatus()
|