|
@@ -27,6 +27,7 @@ import com.grkj.iscs.features.main.viewmodel.hardware_manage.SlotsManageViewMode
|
|
|
import com.grkj.ui_base.base.BaseFragment
|
|
import com.grkj.ui_base.base.BaseFragment
|
|
|
import com.grkj.ui_base.config.ISCSConfig
|
|
import com.grkj.ui_base.config.ISCSConfig
|
|
|
import com.grkj.ui_base.dialog.TipDialog
|
|
import com.grkj.ui_base.dialog.TipDialog
|
|
|
|
|
+import com.grkj.ui_base.utils.CommonUtils
|
|
|
import com.grkj.ui_base.utils.event.LoadingEvent
|
|
import com.grkj.ui_base.utils.event.LoadingEvent
|
|
|
import com.grkj.ui_base.utils.modbus.DeviceConst
|
|
import com.grkj.ui_base.utils.modbus.DeviceConst
|
|
|
import com.grkj.ui_base.utils.modbus.DockBean
|
|
import com.grkj.ui_base.utils.modbus.DockBean
|
|
@@ -98,7 +99,7 @@ class SlotsManageFragment : BaseFragment<FragmentSlotsManageBinding>() {
|
|
|
viewModel.tagSlotsException(deviceBean.row, modelPosition + 1, it)
|
|
viewModel.tagSlotsException(deviceBean.row, modelPosition + 1, it)
|
|
|
.observe(this) {
|
|
.observe(this) {
|
|
|
TipDialog.showSuccess(
|
|
TipDialog.showSuccess(
|
|
|
- msg = getString(R.string.exception_report_success),
|
|
|
|
|
|
|
+ msg = CommonUtils.getStr("exception_report_success"),
|
|
|
onConfirmClick = {
|
|
onConfirmClick = {
|
|
|
binding.dockRv.adapter?.notifyDataSetChanged()
|
|
binding.dockRv.adapter?.notifyDataSetChanged()
|
|
|
},
|
|
},
|
|
@@ -115,7 +116,7 @@ class SlotsManageFragment : BaseFragment<FragmentSlotsManageBinding>() {
|
|
|
private fun detectSlot(deviceBean: DockBean.DeviceBean) {
|
|
private fun detectSlot(deviceBean: DockBean.DeviceBean) {
|
|
|
when (deviceBean) {
|
|
when (deviceBean) {
|
|
|
is DockBean.KeyBean -> {
|
|
is DockBean.KeyBean -> {
|
|
|
- LoadingEvent.sendLoadingEvent(getString(R.string.start_detect_key_slot))
|
|
|
|
|
|
|
+ LoadingEvent.sendLoadingEvent(CommonUtils.getStr("start_detect_key_slot"))
|
|
|
ThreadUtils.runOnIO {
|
|
ThreadUtils.runOnIO {
|
|
|
ModBusController.readKeyRfidStr(
|
|
ModBusController.readKeyRfidStr(
|
|
|
deviceBean.addr,
|
|
deviceBean.addr,
|
|
@@ -125,13 +126,13 @@ class SlotsManageFragment : BaseFragment<FragmentSlotsManageBinding>() {
|
|
|
viewModel.checkKeyRfidIsNewDevice(keyRfid)
|
|
viewModel.checkKeyRfidIsNewDevice(keyRfid)
|
|
|
.observe(this@SlotsManageFragment) {
|
|
.observe(this@SlotsManageFragment) {
|
|
|
if (it) {
|
|
if (it) {
|
|
|
- LoadingEvent.sendLoadingEvent(getString(R.string.start_scan_key_mac))
|
|
|
|
|
|
|
+ LoadingEvent.sendLoadingEvent(CommonUtils.getStr("start_scan_key_mac"))
|
|
|
viewModel.detectKeyMac(deviceBean)
|
|
viewModel.detectKeyMac(deviceBean)
|
|
|
.observe(this@SlotsManageFragment) { keyMac ->
|
|
.observe(this@SlotsManageFragment) { keyMac ->
|
|
|
LoadingEvent.sendLoadingEvent()
|
|
LoadingEvent.sendLoadingEvent()
|
|
|
ThreadUtils.runOnMain {
|
|
ThreadUtils.runOnMain {
|
|
|
TipDialog.showInfo(
|
|
TipDialog.showInfo(
|
|
|
- msg = getString(R.string.check_new_key_need_register),
|
|
|
|
|
|
|
+ msg = CommonUtils.getStr("check_new_key_need_register"),
|
|
|
onConfirmClick = {
|
|
onConfirmClick = {
|
|
|
viewModel.registerKeyInfo(
|
|
viewModel.registerKeyInfo(
|
|
|
keyRfid,
|
|
keyRfid,
|
|
@@ -140,11 +141,11 @@ class SlotsManageFragment : BaseFragment<FragmentSlotsManageBinding>() {
|
|
|
.observe(this@SlotsManageFragment) {
|
|
.observe(this@SlotsManageFragment) {
|
|
|
if (it) {
|
|
if (it) {
|
|
|
TipDialog.showSuccess(
|
|
TipDialog.showSuccess(
|
|
|
- getString(R.string.register_success)
|
|
|
|
|
|
|
+ CommonUtils.getStr("register_success")
|
|
|
)
|
|
)
|
|
|
} else {
|
|
} else {
|
|
|
TipDialog.showError(
|
|
TipDialog.showError(
|
|
|
- getString(R.string.register_failed)
|
|
|
|
|
|
|
+ CommonUtils.getStr("register_failed")
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -153,7 +154,7 @@ class SlotsManageFragment : BaseFragment<FragmentSlotsManageBinding>() {
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
LoadingEvent.sendLoadingEvent()
|
|
LoadingEvent.sendLoadingEvent()
|
|
|
- showToast(getString(R.string.key_info_already_exists))
|
|
|
|
|
|
|
+ showToast(CommonUtils.getStr("key_info_already_exists"))
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -163,29 +164,33 @@ class SlotsManageFragment : BaseFragment<FragmentSlotsManageBinding>() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
is DockBean.LockBean -> {
|
|
is DockBean.LockBean -> {
|
|
|
- LoadingEvent.sendLoadingEvent(getString(R.string.start_detect_lock_slot))
|
|
|
|
|
|
|
+ LoadingEvent.sendLoadingEvent(CommonUtils.getStr("start_detect_lock_slot"))
|
|
|
ThreadUtils.runOnIO {
|
|
ThreadUtils.runOnIO {
|
|
|
ModBusController.readLockRfidStr(deviceBean.addr, deviceBean.idx) { lockRfid ->
|
|
ModBusController.readLockRfidStr(deviceBean.addr, deviceBean.idx) { lockRfid ->
|
|
|
ThreadUtils.runOnMain {
|
|
ThreadUtils.runOnMain {
|
|
|
- LoadingEvent.sendLoadingEvent(getString(R.string.check_lock_is_new_device))
|
|
|
|
|
|
|
+ LoadingEvent.sendLoadingEvent(CommonUtils.getStr("check_lock_is_new_device"))
|
|
|
viewModel.checkLockRfidIsNewDevice(lockRfid)
|
|
viewModel.checkLockRfidIsNewDevice(lockRfid)
|
|
|
.observe(this@SlotsManageFragment) {
|
|
.observe(this@SlotsManageFragment) {
|
|
|
LoadingEvent.sendLoadingEvent()
|
|
LoadingEvent.sendLoadingEvent()
|
|
|
if (it) {
|
|
if (it) {
|
|
|
TipDialog.showInfo(
|
|
TipDialog.showInfo(
|
|
|
- msg = getString(R.string.check_new_lock_need_register),
|
|
|
|
|
|
|
+ msg = CommonUtils.getStr("check_new_lock_need_register"),
|
|
|
onConfirmClick = {
|
|
onConfirmClick = {
|
|
|
viewModel.registerLockInfo(lockRfid)
|
|
viewModel.registerLockInfo(lockRfid)
|
|
|
.observe(this@SlotsManageFragment) {
|
|
.observe(this@SlotsManageFragment) {
|
|
|
if (it) {
|
|
if (it) {
|
|
|
- TipDialog.showSuccess(getString(R.string.register_success))
|
|
|
|
|
|
|
+ TipDialog.showSuccess(
|
|
|
|
|
+ CommonUtils.getStr(
|
|
|
|
|
+ "register_success"
|
|
|
|
|
+ )
|
|
|
|
|
+ )
|
|
|
} else {
|
|
} else {
|
|
|
- TipDialog.showError(getString(R.string.register_failed))
|
|
|
|
|
|
|
+ TipDialog.showError(CommonUtils.getStr("register_failed"))
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
} else {
|
|
} else {
|
|
|
- showToast(getString(R.string.lock_already_exists))
|
|
|
|
|
|
|
+ showToast(CommonUtils.getStr("lock_already_exists"))
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -256,7 +261,7 @@ class SlotsManageFragment : BaseFragment<FragmentSlotsManageBinding>() {
|
|
|
}
|
|
}
|
|
|
itemKeyBinding.detect.setDebouncedClickListener {
|
|
itemKeyBinding.detect.setDebouncedClickListener {
|
|
|
if (!itemKey.isExist) {
|
|
if (!itemKey.isExist) {
|
|
|
- showToast(getString(R.string.current_slot_has_no_key))
|
|
|
|
|
|
|
+ showToast(CommonUtils.getStr("current_slot_has_no_key"))
|
|
|
return@setDebouncedClickListener
|
|
return@setDebouncedClickListener
|
|
|
}
|
|
}
|
|
|
detectSlot(itemKey)
|
|
detectSlot(itemKey)
|
|
@@ -278,7 +283,7 @@ class SlotsManageFragment : BaseFragment<FragmentSlotsManageBinding>() {
|
|
|
MainDomainData.roleKeys?.contains(RoleEnum.SYSCONFIG.roleKey) == true
|
|
MainDomainData.roleKeys?.contains(RoleEnum.SYSCONFIG.roleKey) == true
|
|
|
) {
|
|
) {
|
|
|
TipDialog.showInfo(
|
|
TipDialog.showInfo(
|
|
|
- getString(R.string.do_you_want_to_remove_exception),
|
|
|
|
|
|
|
+ CommonUtils.getStr("do_you_want_to_remove_exception"),
|
|
|
onConfirmClick = {
|
|
onConfirmClick = {
|
|
|
if (viewModel.exceptionSlotsData.any {
|
|
if (viewModel.exceptionSlotsData.any {
|
|
|
it.row?.toInt() == itemKey.row && it.col?.toInt() == (modelPosition + 1)
|
|
it.row?.toInt() == itemKey.row && it.col?.toInt() == (modelPosition + 1)
|
|
@@ -336,7 +341,7 @@ class SlotsManageFragment : BaseFragment<FragmentSlotsManageBinding>() {
|
|
|
}
|
|
}
|
|
|
itemLockBinding.detect.setDebouncedClickListener {
|
|
itemLockBinding.detect.setDebouncedClickListener {
|
|
|
if (!itemLock.isExist) {
|
|
if (!itemLock.isExist) {
|
|
|
- showToast(getString(R.string.current_slot_has_no_lock))
|
|
|
|
|
|
|
+ showToast(CommonUtils.getStr("current_slot_has_no_lock"))
|
|
|
return@setDebouncedClickListener
|
|
return@setDebouncedClickListener
|
|
|
}
|
|
}
|
|
|
detectSlot(itemLock)
|
|
detectSlot(itemLock)
|
|
@@ -358,7 +363,7 @@ class SlotsManageFragment : BaseFragment<FragmentSlotsManageBinding>() {
|
|
|
MainDomainData.roleKeys?.contains(RoleEnum.SYSCONFIG.roleKey) == true
|
|
MainDomainData.roleKeys?.contains(RoleEnum.SYSCONFIG.roleKey) == true
|
|
|
) {
|
|
) {
|
|
|
TipDialog.showInfo(
|
|
TipDialog.showInfo(
|
|
|
- getString(R.string.do_you_want_to_remove_exception),
|
|
|
|
|
|
|
+ CommonUtils.getStr("do_you_want_to_remove_exception"),
|
|
|
onConfirmClick = {
|
|
onConfirmClick = {
|
|
|
if (viewModel.exceptionSlotsData.any {
|
|
if (viewModel.exceptionSlotsData.any {
|
|
|
it.row?.toInt() == itemLock.row && it.col?.toInt() == (modelPosition + 1)
|
|
it.row?.toInt() == itemLock.row && it.col?.toInt() == (modelPosition + 1)
|
|
@@ -417,7 +422,7 @@ class SlotsManageFragment : BaseFragment<FragmentSlotsManageBinding>() {
|
|
|
}
|
|
}
|
|
|
itemKeyBinding.detect.setDebouncedClickListener {
|
|
itemKeyBinding.detect.setDebouncedClickListener {
|
|
|
if (!itemPortable.isExist) {
|
|
if (!itemPortable.isExist) {
|
|
|
- showToast(getString(R.string.current_slot_has_no_key))
|
|
|
|
|
|
|
+ showToast(CommonUtils.getStr("current_slot_has_no_key"))
|
|
|
return@setDebouncedClickListener
|
|
return@setDebouncedClickListener
|
|
|
}
|
|
}
|
|
|
detectSlot(itemPortable)
|
|
detectSlot(itemPortable)
|
|
@@ -439,7 +444,7 @@ class SlotsManageFragment : BaseFragment<FragmentSlotsManageBinding>() {
|
|
|
MainDomainData.roleKeys?.contains(RoleEnum.SYSCONFIG.roleKey) == true
|
|
MainDomainData.roleKeys?.contains(RoleEnum.SYSCONFIG.roleKey) == true
|
|
|
) {
|
|
) {
|
|
|
TipDialog.showInfo(
|
|
TipDialog.showInfo(
|
|
|
- getString(R.string.do_you_want_to_remove_exception),
|
|
|
|
|
|
|
+ CommonUtils.getStr("do_you_want_to_remove_exception"),
|
|
|
onConfirmClick = {
|
|
onConfirmClick = {
|
|
|
if (viewModel.exceptionSlotsData.any {
|
|
if (viewModel.exceptionSlotsData.any {
|
|
|
it.row?.toInt() == itemPortable.row && it.col?.toInt() == (modelPosition + 1)
|
|
it.row?.toInt() == itemPortable.row && it.col?.toInt() == (modelPosition + 1)
|
|
@@ -486,7 +491,7 @@ class SlotsManageFragment : BaseFragment<FragmentSlotsManageBinding>() {
|
|
|
}
|
|
}
|
|
|
itemLockBinding.detect.setDebouncedClickListener {
|
|
itemLockBinding.detect.setDebouncedClickListener {
|
|
|
if (!itemPortable.isExist) {
|
|
if (!itemPortable.isExist) {
|
|
|
- showToast(getString(R.string.current_slot_has_no_lock))
|
|
|
|
|
|
|
+ showToast(CommonUtils.getStr("current_slot_has_no_lock"))
|
|
|
return@setDebouncedClickListener
|
|
return@setDebouncedClickListener
|
|
|
}
|
|
}
|
|
|
detectSlot(itemPortable)
|
|
detectSlot(itemPortable)
|
|
@@ -508,7 +513,7 @@ class SlotsManageFragment : BaseFragment<FragmentSlotsManageBinding>() {
|
|
|
MainDomainData.roleKeys?.contains(RoleEnum.SYSCONFIG.roleKey) == true
|
|
MainDomainData.roleKeys?.contains(RoleEnum.SYSCONFIG.roleKey) == true
|
|
|
) {
|
|
) {
|
|
|
TipDialog.showInfo(
|
|
TipDialog.showInfo(
|
|
|
- getString(R.string.do_you_want_to_remove_exception),
|
|
|
|
|
|
|
+ CommonUtils.getStr("do_you_want_to_remove_exception"),
|
|
|
onConfirmClick = {
|
|
onConfirmClick = {
|
|
|
if (viewModel.exceptionSlotsData.any {
|
|
if (viewModel.exceptionSlotsData.any {
|
|
|
it.row?.toInt() == itemPortable.row && it.col?.toInt() == (modelPosition + 1)
|
|
it.row?.toInt() == itemPortable.row && it.col?.toInt() == (modelPosition + 1)
|