fix AccountActivity scroll animation again

main
Conny Duck 5 years ago
parent a387b9de20
commit 8593cd7da7
  1. 14
      app/src/main/java/com/keylesspalace/tusky/AccountActivity.kt
  2. 4
      app/src/main/res/layout/activity_account.xml

@ -227,26 +227,27 @@ class AccountActivity : BottomSheetActivity(), ActionButtonActivity, HasAndroidI
// Setup the toolbar. // Setup the toolbar.
setSupportActionBar(accountToolbar) setSupportActionBar(accountToolbar)
supportActionBar?.title = null supportActionBar?.run {
supportActionBar?.setDisplayHomeAsUpEnabled(true) setDisplayHomeAsUpEnabled(true)
supportActionBar?.setDisplayShowHomeEnabled(true) setDisplayShowHomeEnabled(true)
setDisplayShowTitleEnabled(false)
}
ThemeUtils.setDrawableTint(this, accountToolbar.navigationIcon, R.attr.account_toolbar_icon_tint_uncollapsed) ThemeUtils.setDrawableTint(this, accountToolbar.navigationIcon, R.attr.account_toolbar_icon_tint_uncollapsed)
ThemeUtils.setDrawableTint(this, accountToolbar.overflowIcon, 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. // Add a listener to change the toolbar icon color when it enters/exits its collapsed state.
accountAppBarLayout.addOnOffsetChangedListener(object : AppBarLayout.OnOffsetChangedListener { accountAppBarLayout.addOnOffsetChangedListener(object : AppBarLayout.OnOffsetChangedListener {
var priorOffset = 0
@AttrRes @AttrRes
var priorAttribute = R.attr.account_toolbar_icon_tint_uncollapsed var priorAttribute = R.attr.account_toolbar_icon_tint_uncollapsed
override fun onOffsetChanged(appBarLayout: AppBarLayout, verticalOffset: Int) { override fun onOffsetChanged(appBarLayout: AppBarLayout, verticalOffset: Int) {
if(verticalOffset == priorOffset) { if(verticalOffset == oldOffset) {
return return
} }
priorOffset = verticalOffset oldOffset = verticalOffset
@AttrRes val attribute = if (titleVisibleHeight + verticalOffset < 0) { @AttrRes val attribute = if (titleVisibleHeight + verticalOffset < 0) {
supportActionBar?.setDisplayShowTitleEnabled(true) supportActionBar?.setDisplayShowTitleEnabled(true)
@ -272,7 +273,6 @@ class AccountActivity : BottomSheetActivity(), ActionButtonActivity, HasAndroidI
accountFloatingActionButton.hide() accountFloatingActionButton.hide()
} }
} }
oldOffset = verticalOffset
val scaledAvatarSize = (avatarSize + verticalOffset) / avatarSize val scaledAvatarSize = (avatarSize + verticalOffset) / avatarSize

@ -17,6 +17,7 @@
android:id="@+id/accountAppBarLayout" android:id="@+id/accountAppBarLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?android:colorBackground"
android:elevation="@dimen/actionbar_elevation"> android:elevation="@dimen/actionbar_elevation">
<com.google.android.material.appbar.CollapsingToolbarLayout <com.google.android.material.appbar.CollapsingToolbarLayout
@ -232,7 +233,6 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:fontFamily="sans-serif-medium" android:fontFamily="sans-serif-medium"
android:textColor="@color/account_tab_font_color" android:textColor="@color/account_tab_font_color"
android:textSize="?attr/status_text_medium" android:textSize="?attr/status_text_medium"
@ -293,7 +293,6 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:background="@android:color/transparent"
android:fontFamily="sans-serif-medium" android:fontFamily="sans-serif-medium"
android:textColor="@color/account_tab_font_color" android:textColor="@color/account_tab_font_color"
android:textSize="?attr/status_text_medium" android:textSize="?attr/status_text_medium"
@ -327,7 +326,6 @@
style="@style/TuskyTabAppearance" style="@style/TuskyTabAppearance"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?android:colorBackground" android:background="?android:colorBackground"
app:tabGravity="center" app:tabGravity="center"
app:tabMode="scrollable" app:tabMode="scrollable"

Loading…
Cancel
Save