Last Updated on : 2025-05-26 02:48:53download
This anti-misoperation feature prevents accidental triggering of reset buttons to avoid user experience issues.
Initialization
private var manager: PreventAccidentalTouchManager? = null
manager = PreventAccidentalTouchManager(deviceId)
API description
abstract fun isSupportPreventAccidentalTouch(callback: IThingResultCallback<Boolean>)
Parameters
Parameter | Description |
---|---|
callback | The callback function. |
Example
manager?.isSupportPreventAccidentalTouch(object : IThingResultCallback<Boolean>{
override fun onSuccess(result: Boolean?) {
}
override fun onError(errorCode: String?, errorMessage: String?) {
}
})
You need to add a listener to get the anti-misoperation status. The added listener will return the current status of the anti-misoperation switch in real time. The return value true
means the anti-misoperation mode is enabled, and false
means the anti-misoperation mode is disabled.
API description
abstract fun addStatusListener(listener: PreventAccidentalTouchStatusListener)
Parameters
Parameter | Description |
---|---|
listener | The listener for the anti-misoperation status. |
Example
private val mPreventAccidentalTouchStatusListener: PreventAccidentalTouchStatusListener =
object : PreventAccidentalTouchStatusListener {
override fun onStatusUpdate(status: Boolean) {
}
}
manager?.addStatusListener(mPreventAccidentalTouchStatusListener)
API description
abstract fun removeStatusListener(listener: PreventAccidentalTouchStatusListener)
Parameters
Parameter | Description |
---|---|
listener | The listener for the anti-misoperation status. |
Example
override fun onDestroy() {
manager?.removeStatusListener(mPreventAccidentalTouchStatusListener)
super.onDestroy()
}
API description
abstract fun getPreventAccidentalTouchStatus()
You need to add a listener to get the anti-misoperation status. The added listener will return the current status of the anti-misoperation switch in real time. The return value true
means the anti-misoperation mode is enabled, and false
means the anti-misoperation mode is disabled.
Example
manager?.let { preventAccidentalTouchManager ->
preventAccidentalTouchManager.getPreventAccidentalTouchStatus()
}
API description
abstract fun updatePreventAccidentalTouchStatus(status:Boolean)
You need to add a listener to get the anti-misoperation status. The added listener will return the current status of the anti-misoperation switch in real time. The return value true
means the anti-misoperation mode is enabled, and false
means the anti-misoperation mode is disabled.
Parameters
Parameter | Description |
---|---|
status | The status.
|
Example
manager?.updatePreventAccidentalTouchStatus(isChecked)
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback