diff options
author | Alex Ning <chineseperson5@gmail.com> | 2020-10-19 04:13:43 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2020-10-19 04:13:43 +0000 |
commit | 1283ad62bb01ecabf03862b0a757b9448ac8c20c (patch) | |
tree | f3bf18c47a6a67e0aaffb8beba37d34af9d5b1cc | |
parent | 658af22c0436c0bfcec962463582f345b1d96fab (diff) | |
download | infinity-for-reddit-1283ad62bb01ecabf03862b0a757b9448ac8c20c.tar infinity-for-reddit-1283ad62bb01ecabf03862b0a757b9448ac8c20c.tar.gz infinity-for-reddit-1283ad62bb01ecabf03862b0a757b9448ac8c20c.tar.bz2 infinity-for-reddit-1283ad62bb01ecabf03862b0a757b9448ac8c20c.tar.lz infinity-for-reddit-1283ad62bb01ecabf03862b0a757b9448ac8c20c.tar.xz infinity-for-reddit-1283ad62bb01ecabf03862b0a757b9448ac8c20c.tar.zst infinity-for-reddit-1283ad62bb01ecabf03862b0a757b9448ac8c20c.zip |
Fix DrawerLayout in MainActivity has extra background color in immersive interface on Android 11.
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java index 79481f1e..452016ee 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java @@ -5,6 +5,7 @@ import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.res.ColorStateList; +import android.graphics.Color; import android.os.Build; import android.os.Bundle; import android.view.Gravity; @@ -247,6 +248,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb } if (isImmersiveInterface()) { + drawer.setStatusBarBackgroundColor(Color.TRANSPARENT); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { drawer.setFitsSystemWindows(false); drawer.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | @@ -266,6 +268,8 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb linearLayoutBottomAppBar.getPaddingTop(), 0, navBarHeight); navDrawerRecyclerView.setPadding(0, 0, 0, navBarHeight); } + } else { + drawer.setStatusBarBackgroundColor(mCustomThemeWrapper.getColorPrimaryDark()); } } @@ -343,7 +347,6 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb protected void applyCustomTheme() { int backgroundColor = mCustomThemeWrapper.getBackgroundColor(); drawer.setBackgroundColor(backgroundColor); - drawer.setStatusBarBackgroundColor(mCustomThemeWrapper.getColorPrimaryDark()); int bottomAppBarIconColor = mCustomThemeWrapper.getBottomAppBarIconColor(); option1BottomAppBar.setColorFilter(bottomAppBarIconColor, android.graphics.PorterDuff.Mode.SRC_IN); option2BottomAppBar.setColorFilter(bottomAppBarIconColor, android.graphics.PorterDuff.Mode.SRC_IN); |