fix bug in CollapsingToolbarLayout
This commit is contained in:
parent
52aa32061a
commit
a2c019e8f1
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue