fixed user profile status bar color

This commit is contained in:
Mariotaku Lee 2015-06-22 22:57:12 +08:00
parent 6324796383
commit b699c2d22c
3 changed files with 27 additions and 12 deletions

View File

@ -360,21 +360,22 @@ public class LinkHandlerActivity extends BaseAppCompatActivity implements System
private void setStatusBarColor(int linkId, Uri uri) {
switch (linkId) {
case LINK_ID_USER: {
mMainContent.setDrawShadow(true);
mMainContent.setShadowColor(0xA0000000);
// Fall through
break;
}
default: {
mMainContent.setDrawShadow(false);
mMainContent.setDrawColor(true);
mMainContent.setFactor(1);
final int alpha = ThemeUtils.isTransparentBackground(getThemeBackgroundOption())
? ThemeUtils.getActionBarAlpha(getCurrentThemeBackgroundAlpha()) : 0xFF;
final int statusBarColor = ThemeUtils.getActionBarColor(this, getCurrentThemeColor(), getCurrentThemeResourceId(), getThemeBackgroundOption());
mMainContent.setColor(statusBarColor, alpha);
StatusBarProxy.setStatusBarDarkIcon(getWindow(), TwidereColorUtils.getYIQLuminance(statusBarColor) > ThemeUtils.ACCENT_COLOR_THRESHOLD);
break;
}
}
mMainContent.setDrawColor(true);
mMainContent.setFactor(1);
final int alpha = ThemeUtils.isTransparentBackground(getThemeBackgroundOption())
? ThemeUtils.getActionBarAlpha(getCurrentThemeBackgroundAlpha()) : 0xFF;
final int statusBarColor = ThemeUtils.getActionBarColor(this, getCurrentThemeColor(), getCurrentThemeResourceId(), getThemeBackgroundOption());
mMainContent.setColor(statusBarColor, alpha);
StatusBarProxy.setStatusBarDarkIcon(getWindow(), TwidereColorUtils.getYIQLuminance(statusBarColor) > ThemeUtils.ACCENT_COLOR_THRESHOLD);
}
private void setTaskInfo(int linkId, Uri uri) {

View File

@ -180,6 +180,7 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
private ShapedImageView mProfileImageView;
private ImageView mProfileTypeView;
private ProfileBannerImageView mProfileBannerView;
private View mProfileBirthdayBannerView;
private TextView mNameView, mScreenNameView, mDescriptionView, mLocationView, mURLView, mCreatedAtView,
mListedCount, mFollowersCount, mFriendsCount, mHeaderErrorTextView;
private View mDescriptionContainer, mLocationContainer, mURLContainer, mListedContainer, mFollowersContainer,
@ -1086,6 +1087,7 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
mHeaderErrorIcon = (ImageView) headerView.findViewById(R.id.error_icon);
mProgressContainer = headerView.findViewById(R.id.progress_container);
mProfileBannerView = (ProfileBannerImageView) view.findViewById(R.id.profile_banner);
mProfileBirthdayBannerView = view.findViewById(R.id.profile_birthday_banner);
mProfileBannerContainer = view.findViewById(R.id.profile_banner_container);
mNameView = (TextView) headerView.findViewById(R.id.name);
mScreenNameView = (TextView) headerView.findViewById(R.id.screen_name);
@ -1324,7 +1326,7 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
public void setListShown(boolean shown) {
final TintedStatusFrameLayout tintedStatus = mTintedStatusContent;
if (tintedStatus == null) return;
tintedStatus.setDrawShadow(shown);
// tintedStatus.setDrawShadow(shown);
}
private void getFriendship() {
@ -1473,6 +1475,7 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
private void updateScrollOffset(int offset) {
final View space = mProfileBannerSpace;
final ProfileBannerImageView profileBannerView = mProfileBannerView;
final View profileBirthdayBannerView = mProfileBirthdayBannerView;
final View profileBannerContainer = mProfileBannerContainer;
final int spaceHeight = space.getHeight();
final float factor = MathUtils.clamp(spaceHeight == 0 ? 0 : (offset / (float) spaceHeight), 0, 1);
@ -1480,6 +1483,7 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
// profileBannerView.setTranslationY(Math.min(offset, spaceHeight) / 2);
profileBannerContainer.setTranslationY(-offset);
profileBannerView.setTranslationY(offset / 2);
profileBirthdayBannerView.setTranslationY(offset / 2);
if (mActionBarBackground != null && mTintedStatusContent != null) {
mActionBarBackground.setFactor(factor);
@ -1506,7 +1510,8 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
activity.getThemeBackgroundOption());
if (ThemeUtils.isTransparentBackground(activity.getCurrentThemeBackgroundOption())) {
stackedTabColor = ColorUtils.setAlphaComponent(stackedTabColor, ThemeUtils.getActionBarAlpha(activity.getCurrentThemeBackgroundAlpha()));
stackedTabColor = ColorUtils.setAlphaComponent(stackedTabColor,
ThemeUtils.getActionBarAlpha(activity.getCurrentThemeBackgroundAlpha()));
}
final int tabColor = (Integer) sArgbEvaluator.evaluate(tabOutlineAlphaFactor, stackedTabColor, mCardBackgroundColor);
((ColorDrawable) tabBackground).setColor(tabColor);

View File

@ -29,7 +29,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
<RelativeLayout
android:id="@+id/profile_banner_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -40,7 +40,16 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="centerCrop"/>
</FrameLayout>
<FrameLayout
android:id="@+id/profile_birthday_banner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/profile_banner"
android:layout_alignTop="@+id/profile_banner">
</FrameLayout>
</RelativeLayout>
<org.mariotaku.twidere.view.HeaderDrawerLayout
android:id="@+id/user_profile_drawer"