Makes debug icon hide when collapsing toolbar

This commit is contained in:
ericdecanini 2022-08-18 10:09:32 +02:00
parent 0b8c68739e
commit 2e323e6f2e
2 changed files with 6 additions and 1 deletions

View File

@ -28,6 +28,7 @@ import androidx.lifecycle.lifecycleScope
import com.airbnb.mvrx.activityViewModel import com.airbnb.mvrx.activityViewModel
import com.airbnb.mvrx.fragmentViewModel import com.airbnb.mvrx.fragmentViewModel
import com.airbnb.mvrx.withState import com.airbnb.mvrx.withState
import com.google.android.material.appbar.AppBarLayout
import com.google.android.material.badge.BadgeDrawable import com.google.android.material.badge.BadgeDrawable
import im.vector.app.R import im.vector.app.R
import im.vector.app.SpaceStateHandler import im.vector.app.SpaceStateHandler
@ -377,6 +378,10 @@ class NewHomeDetailFragment @Inject constructor(
sharedActionViewModel.post(HomeActivitySharedAction.CloseDrawer) sharedActionViewModel.post(HomeActivitySharedAction.CloseDrawer)
navigator.openDebug(requireActivity()) navigator.openDebug(requireActivity())
} }
views.appBarLayout.addOnOffsetChangedListener(AppBarLayout.OnOffsetChangedListener { _, verticalOffset ->
views.debugButton.isVisible = verticalOffset == 0
})
} }
private fun refreshDebugButtonState() { private fun refreshDebugButtonState() {

View File

@ -68,8 +68,8 @@
android:id="@+id/avatar" android:id="@+id/avatar"
android:layout_width="36dp" android:layout_width="36dp"
android:layout_height="36dp" android:layout_height="36dp"
android:padding="6dp"
android:contentDescription="@string/a11y_open_settings" android:contentDescription="@string/a11y_open_settings"
android:padding="6dp"
tools:src="@sample/user_round_avatars" /> tools:src="@sample/user_round_avatars" />
</com.google.android.material.appbar.MaterialToolbar> </com.google.android.material.appbar.MaterialToolbar>