jenkins-bot has submitted this change and it was merged.

Change subject: Allow Dark mode for MainActivity.
......................................................................


Allow Dark mode for MainActivity.

There was really only one color attribute that needed to be introduced to
support dark mode.

This also requires us to set the statusBarColor programmatically, since
the theme is now set dynamically (and it's shared with other activities
that might not want a custom statusBarColor). Might be the subject of a
future refactor.

Bug: T145686
Bug: T146109
Change-Id: Ia952336b043aec0be39743cb10e2f0fb3a574b77
---
M app/src/main/AndroidManifest.xml
M app/src/main/java/org/wikipedia/MainActivity.java
M 
app/src/main/java/org/wikipedia/activity/SingleFragmentActivityWithToolbar.java
M app/src/main/res/layout/fragment_main.xml
M app/src/main/res/values/attrs.xml
M app/src/main/res/values/styles.xml
M app/src/main/res/values/styles_dark.xml
M app/src/main/res/values/styles_light.xml
8 files changed, 7 insertions(+), 10 deletions(-)

Approvals:
  BearND: Looks good to me, but someone else must approve
  jenkins-bot: Verified
  Niedzielski: Looks good to me, approved



diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 4adce91..e1e9619 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -55,7 +55,7 @@
             android:value="@string/hockeyapp_app_id" />
 
         <activity android:name=".MainActivity"
-                  android:theme="@style/MainTheme"
+                  android:theme="@style/AppTheme"
                   android:windowSoftInputMode="stateAlwaysHidden|adjustPan"
                   android:configChanges="orientation|screenSize"
                   android:launchMode="singleTask">
diff --git a/app/src/main/java/org/wikipedia/MainActivity.java 
b/app/src/main/java/org/wikipedia/MainActivity.java
index 2e1e14e..9fea045 100644
--- a/app/src/main/java/org/wikipedia/MainActivity.java
+++ b/app/src/main/java/org/wikipedia/MainActivity.java
@@ -18,8 +18,6 @@
         return MainFragment.newInstance();
     }
 
-    @Override protected void setTheme() { }
-
     @Override
     public void onTabChanged(@NonNull NavTab tab) {
         if (tab.equals(NavTab.EXPLORE)) {
diff --git 
a/app/src/main/java/org/wikipedia/activity/SingleFragmentActivityWithToolbar.java
 
b/app/src/main/java/org/wikipedia/activity/SingleFragmentActivityWithToolbar.java
index f1eac4a..8b4cd5f 100644
--- 
a/app/src/main/java/org/wikipedia/activity/SingleFragmentActivityWithToolbar.java
+++ 
b/app/src/main/java/org/wikipedia/activity/SingleFragmentActivityWithToolbar.java
@@ -21,6 +21,7 @@
             getSupportActionBar().setTitle("");
             getSupportActionBar().setDisplayHomeAsUpEnabled(false);
         }
+        setStatusBarColor(R.color.dark_blue);
     }
 
     @LayoutRes
diff --git a/app/src/main/res/layout/fragment_main.xml 
b/app/src/main/res/layout/fragment_main.xml
index 33fb11e..0751230 100644
--- a/app/src/main/res/layout/fragment_main.xml
+++ b/app/src/main/res/layout/fragment_main.xml
@@ -13,7 +13,7 @@
         android:layout_alignParentBottom="true"
         app:tabGravity="fill"
         android:elevation="12dp"
-        android:background="@android:color/white"
+        android:background="?attr/nav_tab_background_color"
         app:tabIndicatorColor="@android:color/transparent" />
 
     <android.support.design.widget.CoordinatorLayout
diff --git a/app/src/main/res/values/attrs.xml 
b/app/src/main/res/values/attrs.xml
index 5aa2db7..9be1fac 100644
--- a/app/src/main/res/values/attrs.xml
+++ b/app/src/main/res/values/attrs.xml
@@ -34,6 +34,7 @@
     <attr name="feed_text_primary_color" format="reference" />
     <attr name="feed_text_secondary_color" format="reference" />
     <attr name="feed_text_tertiary_color" format="reference" />
+    <attr name="nav_tab_background_color" format="reference" />
 
     <declare-styleable name="CabSearchView">
         <attr name="cabEnabled" format="boolean" />
diff --git a/app/src/main/res/values/styles.xml 
b/app/src/main/res/values/styles.xml
index 60d1851..f108267 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -8,12 +8,7 @@
         <item name="longPreferenceStyle">@style/LongPreference</item>
         <item name="intPreferenceStyle">@style/IntPreference</item>
         <item name="android:windowBackground">@drawable/splash_bg</item>
-        <item name="android:statusBarColor" 
tools:targetApi="21">@color/status_bar_background</item>
         <item name="navTabViewStyle">@style/NavTabView</item>
-    </style>
-
-    <style name="MainTheme" parent="AppTheme">
-        <item name="android:statusBarColor" 
tools:targetApi="21">@color/dark_blue</item>
     </style>
 
     <style name="PageTheme" parent="AppTheme">
diff --git a/app/src/main/res/values/styles_dark.xml 
b/app/src/main/res/values/styles_dark.xml
index 640fef1..2343c1d 100644
--- a/app/src/main/res/values/styles_dark.xml
+++ b/app/src/main/res/values/styles_dark.xml
@@ -24,7 +24,7 @@
         <item 
name="android:panelBackground">@color/background_floating_material_dark</item>
         <item 
name="autoCompleteTextViewStyle">@style/AppTheme.SearchViewEditTextStyle</item>
         <item name="popupMenuStyle">@style/Theme.Dark.PopupMenuStyle</item>
-        <item name="alertDialogTheme">@style/Theme.Light.Dialog.Alert</item>
+        <item name="alertDialogTheme">@style/Theme.Dark.Dialog.Alert</item>
         <item name="colorAccent">@color/foundation_blue</item>
         <item 
name="android:windowBackground">@color/window_background_dark</item>
         <item 
name="window_background_color">@color/window_background_dark</item>
@@ -55,6 +55,7 @@
         <item name="nav_item_color">@android:color/white</item>
         <item 
name="list_item_text_primary_color">@color/list_item_text_primary_dark</item>
         <item 
name="list_item_text_secondary_color">@color/list_item_text_secondary_dark</item>
+        <item name="nav_tab_background_color">@color/darkest_gray</item>
 
         <!-- TODO: move to AppTheme when style hierarchy is corrected. -->
         <item name="android:listViewStyle">@style/ListView</item>
diff --git a/app/src/main/res/values/styles_light.xml 
b/app/src/main/res/values/styles_light.xml
index d7b352c..bad725a 100644
--- a/app/src/main/res/values/styles_light.xml
+++ b/app/src/main/res/values/styles_light.xml
@@ -56,6 +56,7 @@
         <item name="nav_item_color">@color/darkest_gray</item>
         <item 
name="list_item_text_primary_color">@color/list_item_text_primary_light</item>
         <item 
name="list_item_text_secondary_color">@color/list_item_text_secondary_light</item>
+        <item name="nav_tab_background_color">@android:color/white</item>
 
         <!-- TODO: move to AppTheme when style hierarchy is corrected. -->
         <item name="android:listViewStyle">@style/ListView</item>

-- 
To view, visit https://gerrit.wikimedia.org/r/312119
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia952336b043aec0be39743cb10e2f0fb3a574b77
Gerrit-PatchSet: 2
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Dbrant <dbr...@wikimedia.org>
Gerrit-Reviewer: BearND <bsitzm...@wikimedia.org>
Gerrit-Reviewer: Brion VIBBER <br...@wikimedia.org>
Gerrit-Reviewer: Dbrant <dbr...@wikimedia.org>
Gerrit-Reviewer: Mholloway <mhollo...@wikimedia.org>
Gerrit-Reviewer: Niedzielski <sniedziel...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to