Dbrant has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/312119

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.

Bug: T145686
Bug: T146109
Change-Id: Ia952336b043aec0be39743cb10e2f0fb3a574b77
---
M app/src/main/java/org/wikipedia/MainActivity.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_dark.xml
M app/src/main/res/values/styles_light.xml
5 files changed, 5 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia 
refs/changes/19/312119/1

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/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_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: newchange
Gerrit-Change-Id: Ia952336b043aec0be39743cb10e2f0fb3a574b77
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Dbrant <dbr...@wikimedia.org>

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

Reply via email to