aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2020-03-15 16:22:56 +0000
committerAlex Ning <chineseperson5@gmail.com>2020-03-15 16:22:56 +0000
commit751a515a7d37501c3fccd62a26cc3ff651ef26de (patch)
tree46a36ec43e5073104b1d77103dafb492154be1b5 /app
parentfe658dd9e267763084775a4c27cb2aab5523ea59 (diff)
downloadinfinity-for-reddit-751a515a7d37501c3fccd62a26cc3ff651ef26de.tar
infinity-for-reddit-751a515a7d37501c3fccd62a26cc3ff651ef26de.tar.gz
infinity-for-reddit-751a515a7d37501c3fccd62a26cc3ff651ef26de.tar.bz2
infinity-for-reddit-751a515a7d37501c3fccd62a26cc3ff651ef26de.tar.lz
infinity-for-reddit-751a515a7d37501c3fccd62a26cc3ff651ef26de.tar.xz
infinity-for-reddit-751a515a7d37501c3fccd62a26cc3ff651ef26de.tar.zst
infinity-for-reddit-751a515a7d37501c3fccd62a26cc3ff651ef26de.zip
Fix status bar color in MainActivity.
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/BaseActivity.java9
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java3
2 files changed, 11 insertions, 1 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/BaseActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/BaseActivity.java
index 7cdec427..61beaee0 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/BaseActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/BaseActivity.java
@@ -40,6 +40,7 @@ public abstract class BaseActivity extends AppCompatActivity {
private boolean immersiveInterface;
private boolean changeStatusBarIconColor = true;
private boolean transparentStatusBarAfterToolbarCollapsed;
+ private boolean hasDrawerLayout = false;
private int systemVisibilityToolbarExpanded = 0;
private int systemVisibilityToolbarCollapsed = 0;
private CustomThemeWrapper customThemeWrapper;
@@ -105,7 +106,9 @@ public abstract class BaseActivity extends AppCompatActivity {
Window window = getWindow();
View decorView = window.getDecorView();
- window.setStatusBarColor(customThemeWrapper.getColorPrimaryDark());
+ if (!hasDrawerLayout) {
+ window.setStatusBarColor(customThemeWrapper.getColorPrimaryDark());
+ }
boolean isLightStatusbar = customThemeWrapper.isLightStatusBar();
boolean isLightNavBar = customThemeWrapper.isLightNavBar();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
@@ -208,6 +211,10 @@ public abstract class BaseActivity extends AppCompatActivity {
this.transparentStatusBarAfterToolbarCollapsed = true;
}
+ protected void setHasDrawerLayout() {
+ hasDrawerLayout = true;
+ }
+
protected void applyToolbarTheme(Toolbar toolbar) {
toolbar.setTitleTextColor(customThemeWrapper.getToolbarPrimaryTextAndIconColor());
}
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 03a489d5..315b81ed 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java
@@ -193,6 +193,8 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
setTheme(R.style.AppTheme_NoActionBarWithTransparentStatusBar);
+ setHasDrawerLayout();
+
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
@@ -292,6 +294,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
protected void applyCustomTheme() {
int backgroundColor = mCustomThemeWrapper.getBackgroundColor();
drawer.setBackgroundColor(backgroundColor);
+ drawer.setStatusBarBackgroundColor(mCustomThemeWrapper.getColorPrimaryDark());
navigationView.setBackgroundColor(backgroundColor);
appBarLayout.setBackgroundColor(mCustomThemeWrapper.getToolbarAndTabBackgroundColor());
applyTabLayoutTheme(tabLayout);