Merge branch 'connyduck-fix-collapsing-toolbar-bug'

This commit is contained in:
Vavassor 2017-05-30 19:48:08 -04:00
commit f88b88c73a

View file

@ -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() {