1
0
mirror of https://github.com/TwidereProject/Twidere-Android synced 2025-02-03 01:57:40 +01:00

improved transparent theme

This commit is contained in:
Mariotaku Lee 2015-05-18 00:06:40 +08:00
parent a9a80e4de0
commit 0e4e7887fd
3 changed files with 27 additions and 2 deletions

View File

@ -135,6 +135,7 @@ public class AccountsDashboardFragment extends BaseSupportFragment implements Lo
private TextView mAccountProfileNameView, mAccountProfileScreenNameView;
private ActionMenuView mAccountsToggleMenu;
private View mAccountProfileContainer;
private View mNoAccountContainer;
private Context mThemedContext;
private MediaLoaderWrapper mImageLoader;
@ -244,6 +245,13 @@ public class AccountsDashboardFragment extends BaseSupportFragment implements Lo
final Menu menu = mAccountsToggleMenu.getMenu();
mAccountActionProvider = (AccountToggleProvider) MenuItemCompat.getActionProvider(menu.findItem(MENU_SELECT_ACCOUNT));
final ParcelableAccount[] accounts = ParcelableAccount.getAccounts(data);
if (accounts.length > 0) {
mNoAccountContainer.setVisibility(View.GONE);
mAccountProfileContainer.setVisibility(View.VISIBLE);
} else {
mNoAccountContainer.setVisibility(View.VISIBLE);
mAccountProfileContainer.setVisibility(View.INVISIBLE);
}
long defaultId = -1;
for (ParcelableAccount account : accounts) {
if (account.is_activated) {
@ -394,6 +402,7 @@ public class AccountsDashboardFragment extends BaseSupportFragment implements Lo
mAccountsSelector.setAdapter(mAccountsAdapter);
mAccountsSelector.setItemAnimator(null);
mAccountProfileContainer = mAccountSelectorView.findViewById(R.id.profile_container);
mNoAccountContainer = mAccountSelectorView.findViewById(R.id.no_account_container);
mAccountProfileImageView = (ShapedImageView) mAccountSelectorView.findViewById(R.id.profile_image);
mAccountProfileBannerView = (ImageView) mAccountSelectorView.findViewById(R.id.account_profile_banner);
mFloatingProfileImageSnapshotView = (ImageView) mAccountSelectorView.findViewById(R.id.floating_profile_image_snapshot);

View File

@ -642,8 +642,8 @@ public class ThemeUtils implements Constants {
}
public static int getActionBarAlpha(final int alpha) {
return MathUtils.clamp(alpha * 2, ThemeBackgroundPreference.MIN_ALPHA,
ThemeBackgroundPreference.MAX_ALPHA);
return MathUtils.clamp(ThemeBackgroundPreference.MIN_ALPHA + (ThemeBackgroundPreference.MAX_ALPHA - alpha) / 2,
ThemeBackgroundPreference.MIN_ALPHA, ThemeBackgroundPreference.MAX_ALPHA);
}
public static Typeface getUserTypeface(final Context context, final Typeface defTypeface) {

View File

@ -146,4 +146,20 @@
tools:ignore="ContentDescription" />
</FrameLayout>
<FrameLayout
android:id="@+id/no_account_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/profile_container"
android:layout_alignTop="@+id/profile_container"
android:clickable="true">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/no_account" />
</FrameLayout>
</RelativeLayout>