From f640b510aa695f825b879d0b887f0fb86fa0a6f6 Mon Sep 17 00:00:00 2001 From: Conny Duck Date: Thu, 25 May 2017 19:10:49 +0200 Subject: [PATCH] fix bug in CollapsingToolbarLayout --- .../keylesspalace/tusky/AccountActivity.java | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/AccountActivity.java b/app/src/main/java/com/keylesspalace/tusky/AccountActivity.java index ae6f99ac..361c7769 100644 --- a/app/src/main/java/com/keylesspalace/tusky/AccountActivity.java +++ b/app/src/main/java/com/keylesspalace/tusky/AccountActivity.java @@ -20,6 +20,7 @@ import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; +import android.graphics.Color; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Bundle; @@ -136,23 +137,17 @@ public class AccountActivity extends BaseActivity implements SFragment.OnUserRem @AttrRes int attribute; if (collapsingToolbar.getHeight() + verticalOffset < 2 * ViewCompat.getMinimumHeight(collapsingToolbar)) { - if (getSupportActionBar() != null && loadedAccount != null) { - getSupportActionBar().setTitle(loadedAccount.getDisplayName()); + toolbar.setTitleTextColor(ThemeUtils.getColor(AccountActivity.this, android.R.attr.textColorPrimary)); - - String subtitle = String.format(getString(R.string.status_username_format), - loadedAccount.username); - getSupportActionBar().setSubtitle(subtitle); toolbar.setSubtitleTextColor(ThemeUtils.getColor(AccountActivity.this, android.R.attr.textColorSecondary)); - } + attribute = R.attr.account_toolbar_icon_tint_collapsed; } else { - if (getSupportActionBar() != null) { - getSupportActionBar().setTitle(""); - getSupportActionBar().setSubtitle(""); - } + toolbar.setTitleTextColor(Color.TRANSPARENT); + toolbar.setSubtitleTextColor(Color.TRANSPARENT); + attribute = R.attr.account_toolbar_icon_tint_uncollapsed; } if (attribute != priorAttribute) { @@ -245,6 +240,15 @@ public class AccountActivity extends BaseActivity implements SFragment.OnUserRem displayName.setText(account.getDisplayName()); + if (getSupportActionBar() != null) { + getSupportActionBar().setTitle(account.getDisplayName()); + + String subtitle = String.format(getString(R.string.status_username_format), + account.username); + getSupportActionBar().setSubtitle(subtitle); + + } + boolean useCustomTabs = PreferenceManager.getDefaultSharedPreferences(this) .getBoolean("customTabs", true); LinkHelper.setClickableText(note, account.note, null, useCustomTabs, new LinkListener() {