Tweak Material You light theme on Android 12.

This commit is contained in:
Alex Ning 2021-11-03 21:54:56 +08:00
parent ef870f93fc
commit 6df1b1f954
4 changed files with 27 additions and 29 deletions

View File

@ -519,8 +519,8 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
appBarLayout.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { appBarLayout.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override @Override
public void onGlobalLayout() { public void onGlobalLayout() {
collapsingToolbarLayout.setScrimVisibleHeightTrigger(toolbar.getHeight() + tabLayout.getHeight() + getStatusBarHeight() * 2);
appBarLayout.getViewTreeObserver().removeOnGlobalLayoutListener(this); appBarLayout.getViewTreeObserver().removeOnGlobalLayoutListener(this);
collapsingToolbarLayout.setScrimVisibleHeightTrigger(toolbar.getHeight() + tabLayout.getHeight() + getStatusBarHeight() * 2);
} }
}); });
applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, collapsingToolbarLayout, toolbar, false); applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, collapsingToolbarLayout, toolbar, false);

View File

@ -566,8 +566,8 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
appBarLayout.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { appBarLayout.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override @Override
public void onGlobalLayout() { public void onGlobalLayout() {
collapsingToolbarLayout.setScrimVisibleHeightTrigger(toolbar.getHeight() + tabLayout.getHeight() + getStatusBarHeight() * 2);
appBarLayout.getViewTreeObserver().removeOnGlobalLayoutListener(this); appBarLayout.getViewTreeObserver().removeOnGlobalLayoutListener(this);
collapsingToolbarLayout.setScrimVisibleHeightTrigger(toolbar.getHeight() + tabLayout.getHeight() + getStatusBarHeight() * 2);
} }
}); });
applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, collapsingToolbarLayout, toolbar, false); applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, collapsingToolbarLayout, toolbar, false);

View File

@ -39,7 +39,6 @@ import com.bumptech.glide.Glide;
import com.bumptech.glide.RequestBuilder; import com.bumptech.glide.RequestBuilder;
import com.bumptech.glide.RequestManager; import com.bumptech.glide.RequestManager;
import com.bumptech.glide.load.DataSource; import com.bumptech.glide.load.DataSource;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.load.engine.GlideException; import com.bumptech.glide.load.engine.GlideException;
import com.bumptech.glide.request.RequestListener; import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.RequestOptions; import com.bumptech.glide.request.RequestOptions;
@ -1495,7 +1494,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
imageRequestBuilder.apply(RequestOptions.bitmapTransform(new BlurTransformation(50, 10))) imageRequestBuilder.apply(RequestOptions.bitmapTransform(new BlurTransformation(50, 10)))
.into(((PostWithPreviewTypeViewHolder) holder).imageView); .into(((PostWithPreviewTypeViewHolder) holder).imageView);
} else { } else {
imageRequestBuilder.diskCacheStrategy(DiskCacheStrategy.NONE).override(preview.getPreviewWidth(), preview.getPreviewHeight()).into(((PostWithPreviewTypeViewHolder) holder).imageView); imageRequestBuilder.override(preview.getPreviewWidth(), preview.getPreviewHeight()).into(((PostWithPreviewTypeViewHolder) holder).imageView);
} }
} }
} else if (holder instanceof PostCompactBaseViewHolder) { } else if (holder instanceof PostCompactBaseViewHolder) {

View File

@ -53,32 +53,31 @@ public class MaterialYouUtils {
CustomTheme darkTheme = CustomThemeWrapper.getIndigoDark(context); CustomTheme darkTheme = CustomThemeWrapper.getIndigoDark(context);
CustomTheme amoledTheme = CustomThemeWrapper.getIndigoAmoled(context); CustomTheme amoledTheme = CustomThemeWrapper.getIndigoAmoled(context);
lightTheme.colorPrimary = context.getColor(android.R.color.system_accent1_100);
lightTheme.colorPrimary = context.getColor(android.R.color.system_accent1_300); lightTheme.colorPrimaryDark = context.getColor(android.R.color.system_accent1_200);
lightTheme.colorPrimaryDark = context.getColor(android.R.color.system_accent1_500);
lightTheme.colorAccent = context.getColor(android.R.color.system_accent3_300); lightTheme.colorAccent = context.getColor(android.R.color.system_accent3_300);
lightTheme.colorPrimaryLightTheme = context.getColor(android.R.color.system_accent1_200); lightTheme.colorPrimaryLightTheme = lightTheme.colorPrimary;
lightTheme.backgroundColor = context.getColor(android.R.color.system_neutral1_10); lightTheme.backgroundColor = context.getColor(android.R.color.system_neutral1_100);
lightTheme.cardViewBackgroundColor = context.getColor(android.R.color.system_neutral2_50); lightTheme.cardViewBackgroundColor = context.getColor(android.R.color.system_neutral2_50);
lightTheme.commentBackgroundColor = context.getColor(android.R.color.system_neutral2_50); lightTheme.commentBackgroundColor = context.getColor(android.R.color.system_neutral2_50);
lightTheme.awardedCommentBackgroundColor = context.getColor(android.R.color.system_neutral2_100); lightTheme.awardedCommentBackgroundColor = context.getColor(android.R.color.system_neutral2_50);
lightTheme.bottomAppBarBackgroundColor = context.getColor(android.R.color.system_accent2_100); lightTheme.bottomAppBarBackgroundColor = lightTheme.colorPrimary;
lightTheme.navBarColor = context.getColor(android.R.color.system_neutral2_100); lightTheme.navBarColor = lightTheme.colorPrimary;
lightTheme.primaryTextColor = context.getColor(android.R.color.system_neutral1_900); lightTheme.primaryTextColor = context.getColor(android.R.color.system_neutral1_900);
lightTheme.secondaryTextColor = context.getColor(android.R.color.system_neutral1_900); lightTheme.secondaryTextColor = context.getColor(android.R.color.system_neutral1_700);
lightTheme.bottomAppBarIconColor = context.getColor(android.R.color.system_accent1_400);; lightTheme.bottomAppBarIconColor = context.getColor(android.R.color.system_accent1_800);
lightTheme.primaryIconColor = context.getColor(android.R.color.system_accent1_400); lightTheme.primaryIconColor = context.getColor(android.R.color.system_accent1_400);
lightTheme.fabIconColor = context.getColor(android.R.color.system_neutral1_10); lightTheme.fabIconColor = lightTheme.bottomAppBarIconColor;
lightTheme.toolbarPrimaryTextAndIconColor = context.getColor(android.R.color.system_accent1_50); lightTheme.toolbarPrimaryTextAndIconColor = lightTheme.bottomAppBarIconColor;
lightTheme.toolbarSecondaryTextColor = context.getColor(android.R.color.system_accent3_50); lightTheme.toolbarSecondaryTextColor = lightTheme.bottomAppBarIconColor;
lightTheme.tabLayoutWithCollapsedCollapsingToolbarTabIndicator = context.getColor(android.R.color.system_accent1_50); lightTheme.tabLayoutWithCollapsedCollapsingToolbarTabIndicator = lightTheme.bottomAppBarIconColor;
lightTheme.tabLayoutWithCollapsedCollapsingToolbarTextColor = context.getColor(android.R.color.system_accent1_50); lightTheme.tabLayoutWithCollapsedCollapsingToolbarTextColor = lightTheme.bottomAppBarIconColor;
lightTheme.tabLayoutWithCollapsedCollapsingToolbarTabBackground = context.getColor(android.R.color.system_accent1_50); lightTheme.tabLayoutWithCollapsedCollapsingToolbarTabBackground = lightTheme.colorPrimary;
lightTheme.tabLayoutWithExpandedCollapsingToolbarTabBackground = context.getColor(android.R.color.system_accent1_50); lightTheme.tabLayoutWithExpandedCollapsingToolbarTabBackground = lightTheme.backgroundColor;
lightTheme.tabLayoutWithExpandedCollapsingToolbarTabIndicator = context.getColor(android.R.color.system_accent1_50); lightTheme.tabLayoutWithExpandedCollapsingToolbarTabIndicator = lightTheme.bottomAppBarIconColor;
lightTheme.tabLayoutWithExpandedCollapsingToolbarTextColor = context.getColor(android.R.color.system_accent1_50); lightTheme.tabLayoutWithExpandedCollapsingToolbarTextColor = lightTheme.bottomAppBarIconColor;
lightTheme.circularProgressBarBackground = context.getColor(android.R.color.system_accent1_10); lightTheme.circularProgressBarBackground = context.getColor(android.R.color.system_accent1_10);
lightTheme.dividerColor = context.getColor(android.R.color.system_neutral1_100); lightTheme.dividerColor = context.getColor(android.R.color.system_neutral1_400);
lightTheme.isLightStatusBar = false; lightTheme.isLightStatusBar = false;
lightTheme.isChangeStatusBarIconColorAfterToolbarCollapsedInImmersiveInterface = true; lightTheme.isChangeStatusBarIconColorAfterToolbarCollapsedInImmersiveInterface = true;
lightTheme.name = "Material You"; lightTheme.name = "Material You";
@ -86,7 +85,7 @@ public class MaterialYouUtils {
darkTheme.colorPrimary = context.getColor(android.R.color.system_accent1_100); darkTheme.colorPrimary = context.getColor(android.R.color.system_accent1_100);
darkTheme.colorPrimaryDark = context.getColor(android.R.color.system_accent1_300); darkTheme.colorPrimaryDark = context.getColor(android.R.color.system_accent1_300);
darkTheme.colorAccent = context.getColor(android.R.color.system_accent3_100); darkTheme.colorAccent = context.getColor(android.R.color.system_accent3_100);
darkTheme.colorPrimaryLightTheme = context.getColor(android.R.color.system_accent1_100); darkTheme.colorPrimaryLightTheme = context.getColor(android.R.color.system_accent1_300);
darkTheme.backgroundColor = context.getColor(android.R.color.system_neutral1_900); darkTheme.backgroundColor = context.getColor(android.R.color.system_neutral1_900);
darkTheme.cardViewBackgroundColor = context.getColor(android.R.color.system_neutral2_800); darkTheme.cardViewBackgroundColor = context.getColor(android.R.color.system_neutral2_800);
darkTheme.commentBackgroundColor = context.getColor(android.R.color.system_neutral2_800); darkTheme.commentBackgroundColor = context.getColor(android.R.color.system_neutral2_800);
@ -99,11 +98,11 @@ public class MaterialYouUtils {
darkTheme.primaryIconColor = context.getColor(android.R.color.system_accent1_100); darkTheme.primaryIconColor = context.getColor(android.R.color.system_accent1_100);
darkTheme.fabIconColor = context.getColor(android.R.color.system_neutral1_900); darkTheme.fabIconColor = context.getColor(android.R.color.system_neutral1_900);
darkTheme.toolbarPrimaryTextAndIconColor = context.getColor(android.R.color.system_accent1_900); darkTheme.toolbarPrimaryTextAndIconColor = context.getColor(android.R.color.system_accent1_900);
darkTheme.toolbarSecondaryTextColor = context.getColor(android.R.color.system_accent3_900); darkTheme.toolbarSecondaryTextColor = context.getColor(android.R.color.system_accent1_900);
darkTheme.tabLayoutWithCollapsedCollapsingToolbarTabIndicator = context.getColor(android.R.color.system_accent1_800); darkTheme.tabLayoutWithCollapsedCollapsingToolbarTabIndicator = context.getColor(android.R.color.system_accent1_800);
darkTheme.tabLayoutWithCollapsedCollapsingToolbarTextColor = context.getColor(android.R.color.system_accent1_800); darkTheme.tabLayoutWithCollapsedCollapsingToolbarTextColor = context.getColor(android.R.color.system_accent1_800);
darkTheme.tabLayoutWithCollapsedCollapsingToolbarTabBackground = context.getColor(android.R.color.system_accent1_800); darkTheme.tabLayoutWithCollapsedCollapsingToolbarTabBackground = context.getColor(android.R.color.system_accent1_100);
darkTheme.tabLayoutWithExpandedCollapsingToolbarTabBackground = context.getColor(android.R.color.system_accent1_800); darkTheme.tabLayoutWithExpandedCollapsingToolbarTabBackground = context.getColor(android.R.color.system_accent1_100);
darkTheme.tabLayoutWithExpandedCollapsingToolbarTabIndicator = context.getColor(android.R.color.system_accent1_800); darkTheme.tabLayoutWithExpandedCollapsingToolbarTabIndicator = context.getColor(android.R.color.system_accent1_800);
darkTheme.tabLayoutWithExpandedCollapsingToolbarTextColor = context.getColor(android.R.color.system_accent1_800); darkTheme.tabLayoutWithExpandedCollapsingToolbarTextColor = context.getColor(android.R.color.system_accent1_800);
darkTheme.circularProgressBarBackground = context.getColor(android.R.color.system_accent1_900); darkTheme.circularProgressBarBackground = context.getColor(android.R.color.system_accent1_900);
@ -173,7 +172,7 @@ public class MaterialYouUtils {
lightTheme.tabLayoutWithCollapsedCollapsingToolbarTabIndicator = colorPrimaryAppropriateTextColor; lightTheme.tabLayoutWithCollapsedCollapsingToolbarTabIndicator = colorPrimaryAppropriateTextColor;
lightTheme.tabLayoutWithCollapsedCollapsingToolbarTextColor = colorPrimaryAppropriateTextColor; lightTheme.tabLayoutWithCollapsedCollapsingToolbarTextColor = colorPrimaryAppropriateTextColor;
lightTheme.tabLayoutWithCollapsedCollapsingToolbarTabBackground = colorPrimaryInt; lightTheme.tabLayoutWithCollapsedCollapsingToolbarTabBackground = colorPrimaryInt;
lightTheme.tabLayoutWithExpandedCollapsingToolbarTabBackground = colorPrimaryInt; lightTheme.tabLayoutWithExpandedCollapsingToolbarTabBackground = backgroundColor;
lightTheme.tabLayoutWithExpandedCollapsingToolbarTabIndicator = colorPrimaryAppropriateTextColor; lightTheme.tabLayoutWithExpandedCollapsingToolbarTabIndicator = colorPrimaryAppropriateTextColor;
lightTheme.tabLayoutWithExpandedCollapsingToolbarTextColor = colorPrimaryAppropriateTextColor; lightTheme.tabLayoutWithExpandedCollapsingToolbarTextColor = colorPrimaryAppropriateTextColor;
lightTheme.circularProgressBarBackground = colorPrimaryInt; lightTheme.circularProgressBarBackground = colorPrimaryInt;