AccessibilityNodeInfoExt.kt•750 B
package dev.mobile.maestro
import android.os.Build
import android.view.accessibility.AccessibilityNodeInfo
object AccessibilityNodeInfoExt {
/**
* Retrieves the hint text associated with this [android.view.accessibility.AccessibilityNodeInfo].
*
* If the device API level is below 26 (Oreo) or the hint text is null, this function provides a fallback
* by returning an empty CharSequence instead.
*
* @return [CharSequence] representing the hint text or its fallback.
*/
fun AccessibilityNodeInfo.getHintOrFallback(): CharSequence {
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && this.hintText != null) {
this.hintText
} else {
""
}
}
}