Skip to content

Commit

Permalink
fix: LiquidTabsUi didn't scroll to current selected tab on init
Browse files Browse the repository at this point in the history
  • Loading branch information
WhiredPlanck committed Mar 31, 2024
1 parent f3906e9 commit 317f13a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
3 changes: 3 additions & 0 deletions app/src/main/java/com/osfans/trime/ime/symbol/LiquidTabsUi.kt
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ class LiquidTabsUi(override val ctx: Context, val theme: Theme) : Ui {
gravity = gravityCenterVertical
},
)
post {
scrollX = tabs[selected].root.left
}
}

fun setTabs(tags: List<TabTag>) {
Expand Down
12 changes: 0 additions & 12 deletions app/src/main/java/com/osfans/trime/ime/text/ScrollView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -178,16 +178,4 @@ class ScrollView(context: Context?, attrs: AttributeSet?) : HorizontalScrollView
isMoving = true
}
}

fun move(
left: Int,
right: Int,
) {
Timber.d("move: ($left $right), scrollX=$scrollX")
if (right > scrollX + width) {
scrollTo(right - width, 0)
} else if (left < scrollX) {
scrollTo(left, 0)
}
}
}

0 comments on commit 317f13a

Please sign in to comment.