Skip to content

Commit

Permalink
chore: add reminder for future improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Irineu333 committed Nov 29, 2023
1 parent 6fc6fee commit 45f8a63
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions app/src/main/java/com/neo/speaktouch/model/Type.kt
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ sealed class Type {
// View -> TextView -> EditText
if (className `is` EditText::class.java) return EditField

// TODO: consider checking node.isEditable

// View -> TextView -> CheckedTextView
if (className `is` CheckedTextView::class.java) return Checkable.TextView

Expand Down
4 changes: 3 additions & 1 deletion app/src/main/java/com/neo/speaktouch/utils/NodeValidator.kt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ object NodeValidator {
*/
private fun hasTextToRead(node: AccessibilityNodeInfoCompat): Boolean {

// TODO: Replace with node.getContent().isNotNullOrEmpty()
return listOf(
node.text,
node.hintText?.takeIf { node.isEditable },
Expand Down Expand Up @@ -106,7 +107,8 @@ object NodeValidator {

if (node.isCheckable) return true

if (node.isEditable) return true // TODO: Consider removing after issue #88
// TODO: Consider removing after issue #88
if (node.isEditable) return true

return hasTextToRead(node)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,5 +289,6 @@ fun AccessibilityNodeInfoCompat.getContent(
if (text.isNotNullOrEmpty()) {
return text
}

return null
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ inline fun <T : CharSequence> T?.ifEmptyOrNull(
}
}



// TODO: Consider use a cache to avoid multiple calls to Class.forName
infix fun CharSequence.`is`(childClass: Class<*>): Boolean {

if (equals(childClass.name)) return true
if (isEmpty()) return false

Expand Down

0 comments on commit 45f8a63

Please sign in to comment.