|
|
@ -997,11 +997,23 @@ public class GateABController { |
|
|
|
// 如果状态发生变化且有监听器,通知监听器 |
|
|
|
if (stateChanged && gateStateListener != null) { |
|
|
|
final boolean finalShouldShowDialog = shouldShowDialog; |
|
|
|
final boolean shouldHideDialog = oldShouldShow && !newShouldShow; |
|
|
|
|
|
|
|
syncHandler.post(() -> { |
|
|
|
gateStateListener.onGateStateChanged(currentGateState); |
|
|
|
// 如果需要显示弹窗,额外通知 |
|
|
|
if (finalShouldShowDialog && gateStateListener instanceof GateUnavailableListener) { |
|
|
|
((GateUnavailableListener) gateStateListener).onGateUnavailable(currentGateState.getUnavailableReason()); |
|
|
|
|
|
|
|
if (gateStateListener instanceof GateUnavailableListener) { |
|
|
|
GateUnavailableListener unavailableListener = (GateUnavailableListener) gateStateListener; |
|
|
|
|
|
|
|
// 如果需要显示弹窗,触发不可用回调 |
|
|
|
if (finalShouldShowDialog) { |
|
|
|
unavailableListener.onGateUnavailable(currentGateState.getUnavailableReason()); |
|
|
|
} |
|
|
|
// 如果需要隐藏弹窗(门状态恢复正常),触发可用回调 |
|
|
|
else if (shouldHideDialog) { |
|
|
|
LogManager.logInfo(TAG, "触发门禁恢复可用回调,隐藏弹窗并恢复摄像头"); |
|
|
|
unavailableListener.onGateAvailable(); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|