Skip to content

Commit

Permalink
Update ActivityMetadata.kt
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgCantor authored Oct 5, 2024
1 parent e1b4e4d commit c3de450
Showing 1 changed file with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,28 +51,27 @@ internal class ActivityMetadata(
private fun getLocalizedStrings(decorView: View): List<LocalizedString> {
return TreeIterables.depthFirstViewTraversal(decorView)
.filter { it.visibility == View.VISIBLE }
.filter { it is TextView || it is CollapsingToolbarLayout }
.map { v ->
if (v is TextView) {
LocalizedString(
.mapNotNull { v ->
when (v) {
is TextView -> LocalizedString(
v.text.toString(),
getEntryName(decorView.resources, v),
v.left,
v.top,
v.width,
v.height
)
} else {
LocalizedString(
(v as CollapsingToolbarLayout).title.toString(),
is CollapsingToolbarLayout -> LocalizedString(
v.title.toString(),
getEntryNameFromLayout(decorView.resources, v),
v.left,
v.top,
v.width,
v.height
)
else -> null
}
}.toMutableList()
}
}

private fun getEntryName(resources: Resources, v: TextView): String {
Expand Down

0 comments on commit c3de450

Please sign in to comment.