Skip to content

Commit

Permalink
Merge pull request #677 from GeorgCantor/patch-3
Browse files Browse the repository at this point in the history
Update ActivityMetadata.kt
  • Loading branch information
CherchesovAzamat authored Oct 27, 2024
2 parents e1b4e4d + c3de450 commit 98bc157
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 98bc157

Please sign in to comment.