From 8593cd7da71b7de0d6d1d58da79849a0ac3cd728 Mon Sep 17 00:00:00 2001 From: Conny Duck Date: Tue, 1 Oct 2019 18:49:34 +0200 Subject: [PATCH] fix AccountActivity scroll animation again --- .../com/keylesspalace/tusky/AccountActivity.kt | 14 +++++++------- app/src/main/res/layout/activity_account.xml | 4 +--- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/AccountActivity.kt b/app/src/main/java/com/keylesspalace/tusky/AccountActivity.kt index f207bb20..e1d2f3ba 100644 --- a/app/src/main/java/com/keylesspalace/tusky/AccountActivity.kt +++ b/app/src/main/java/com/keylesspalace/tusky/AccountActivity.kt @@ -227,26 +227,27 @@ class AccountActivity : BottomSheetActivity(), ActionButtonActivity, HasAndroidI // Setup the toolbar. setSupportActionBar(accountToolbar) - supportActionBar?.title = null - supportActionBar?.setDisplayHomeAsUpEnabled(true) - supportActionBar?.setDisplayShowHomeEnabled(true) + supportActionBar?.run { + setDisplayHomeAsUpEnabled(true) + setDisplayShowHomeEnabled(true) + setDisplayShowTitleEnabled(false) + } ThemeUtils.setDrawableTint(this, accountToolbar.navigationIcon, R.attr.account_toolbar_icon_tint_uncollapsed) ThemeUtils.setDrawableTint(this, accountToolbar.overflowIcon, R.attr.account_toolbar_icon_tint_uncollapsed) // Add a listener to change the toolbar icon color when it enters/exits its collapsed state. accountAppBarLayout.addOnOffsetChangedListener(object : AppBarLayout.OnOffsetChangedListener { - var priorOffset = 0 @AttrRes var priorAttribute = R.attr.account_toolbar_icon_tint_uncollapsed override fun onOffsetChanged(appBarLayout: AppBarLayout, verticalOffset: Int) { - if(verticalOffset == priorOffset) { + if(verticalOffset == oldOffset) { return } - priorOffset = verticalOffset + oldOffset = verticalOffset @AttrRes val attribute = if (titleVisibleHeight + verticalOffset < 0) { supportActionBar?.setDisplayShowTitleEnabled(true) @@ -272,7 +273,6 @@ class AccountActivity : BottomSheetActivity(), ActionButtonActivity, HasAndroidI accountFloatingActionButton.hide() } } - oldOffset = verticalOffset val scaledAvatarSize = (avatarSize + verticalOffset) / avatarSize diff --git a/app/src/main/res/layout/activity_account.xml b/app/src/main/res/layout/activity_account.xml index c0311c9b..e0ba686d 100644 --- a/app/src/main/res/layout/activity_account.xml +++ b/app/src/main/res/layout/activity_account.xml @@ -17,6 +17,7 @@ android:id="@+id/accountAppBarLayout" android:layout_width="match_parent" android:layout_height="wrap_content" + android:background="?android:colorBackground" android:elevation="@dimen/actionbar_elevation">