mirror of
https://github.com/element-hq/element-android
synced 2024-11-27 11:59:12 +03:00
Scroll breadcrumbs to top when opened
This commit is contained in:
parent
853518fbb2
commit
1108ad5705
3 changed files with 15 additions and 1 deletions
|
@ -11,7 +11,7 @@ Other changes:
|
|||
-
|
||||
|
||||
Bugfix 🐛:
|
||||
-
|
||||
- Scroll breadcrumbs to top when opened
|
||||
|
||||
Translations 🗣:
|
||||
-
|
||||
|
|
|
@ -65,4 +65,8 @@ class BreadcrumbsFragment @Inject constructor(
|
|||
override fun onBreadcrumbClicked(roomId: String) {
|
||||
sharedActionViewModel.post(RoomDetailSharedAction.SwitchToRoom(roomId))
|
||||
}
|
||||
|
||||
fun scrollToTop() {
|
||||
breadcrumbsRecyclerView.scrollToPosition(0)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -86,9 +86,19 @@ class RoomDetailActivity : VectorBaseActivity(), ToolbarConfigurable {
|
|||
private val drawerListener = object : DrawerLayout.SimpleDrawerListener() {
|
||||
override fun onDrawerStateChanged(newState: Int) {
|
||||
hideKeyboard()
|
||||
|
||||
if (!drawerLayout.isDrawerOpen(GravityCompat.START) && newState == DrawerLayout.STATE_DRAGGING) {
|
||||
// User is starting to open the drawer, scroll the list to op
|
||||
scrollBreadcrumbsToTop()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun scrollBreadcrumbsToTop() {
|
||||
supportFragmentManager.fragments.filterIsInstance<BreadcrumbsFragment>()
|
||||
.forEach { it.scrollToTop() }
|
||||
}
|
||||
|
||||
override fun onBackPressed() {
|
||||
if (drawerLayout.isDrawerOpen(GravityCompat.START)) {
|
||||
drawerLayout.closeDrawer(GravityCompat.START)
|
||||
|
|
Loading…
Reference in a new issue