Updater: Support Dark mode and update colors
Change-Id: I3503311e9e94663c4b708fc744962ce97690d6e1
diff --git a/build.gradle b/build.gradle
index a9277d1..816c6ea 100644
--- a/build.gradle
+++ b/build.gradle
@@ -25,7 +25,7 @@
buildToolsVersion '27.0.3'
defaultConfig {
- minSdkVersion 26
+ minSdkVersion 27
targetSdkVersion 27
}
diff --git a/res/drawable/ic_menu_refresh.xml b/res/drawable/ic_menu_refresh.xml
index 2c8912b..05a578d 100644
--- a/res/drawable/ic_menu_refresh.xml
+++ b/res/drawable/ic_menu_refresh.xml
@@ -6,6 +6,6 @@
android:viewportHeight="24">
<path
- android:fillColor="@android:color/white"
+ android:fillColor="@color/inverted"
android:pathData="M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z" />
</vector>
diff --git a/res/drawable/ic_system_update.xml b/res/drawable/ic_system_update.xml
index 0da1d2a..ecaaabb 100644
--- a/res/drawable/ic_system_update.xml
+++ b/res/drawable/ic_system_update.xml
@@ -5,6 +5,6 @@
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
- android:fillColor="#FF000000"
+ android:fillColor="@color/inverted"
android:pathData="M17,1.01L7,1c-1.1,0 -2,0.9 -2,2v18c0,1.1 0.9,2 2,2h10c1.1,0 2,-0.9 2,-2L19,3c0,-1.1 -0.9,-1.99 -2,-1.99zM17,19L7,19L7,5h10v14zM16,13h-3L13,8h-2v5L8,13l4,4 4,-4z"/>
</vector>
diff --git a/res/layout/activity_updates.xml b/res/layout/activity_updates.xml
index 766d42b..8be4d6e 100644
--- a/res/layout/activity_updates.xml
+++ b/res/layout/activity_updates.xml
@@ -19,7 +19,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:theme="@style/AppTheme.AppBarOverlay"
- app:collapsedTitleTextAppearance="@style/TextAppearanceWhite"
+ app:collapsedTitleTextAppearance="@style/TextAppearanceInverted"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleTextAppearance="@style/TextAppearanceTransparent"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
@@ -39,7 +39,7 @@
android:layout_height="wrap_content"
android:fontFamily="sans-serif-light"
android:paddingBottom="16dp"
- android:textColor="@color/white"
+ android:textColor="?android:attr/textColorPrimary"
android:textSize="56sp" />
<TextView
@@ -47,7 +47,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/header_title"
- android:textColor="@color/white"
+ android:textColor="?android:attr/textColorPrimary"
android:textSize="12sp" />
<TextView
@@ -55,7 +55,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/header_build_date"
- android:textColor="@color/white"
+ android:textColor="?android:attr/textColorPrimary"
android:textSize="12sp" />
<TextView
@@ -63,7 +63,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/header_build_version"
- android:textColor="@color/white"
+ android:textColor="?android:attr/textColorPrimary"
android:textSize="12sp" />
</RelativeLayout>
@@ -71,7 +71,7 @@
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
- android:titleTextColor="@color/white"
+ android:textColor="?android:attr/textColorPrimary"
app:layout_collapseMode="pin" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
diff --git a/res/values-night/bools.xml b/res/values-night/bools.xml
new file mode 100644
index 0000000..87d364c
--- /dev/null
+++ b/res/values-night/bools.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <bool name="theme_is_light">false</bool>
+</resources>
diff --git a/res/values-night/colors.xml b/res/values-night/colors.xml
new file mode 100644
index 0000000..907f254
--- /dev/null
+++ b/res/values-night/colors.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <color name="theme_primary">#212121</color>
+ <color name="theme_primary_dark">#1c1c1c</color>
+
+ <color name="inverted">#f5f5f5</color>
+</resources>
diff --git a/res/values/bools.xml b/res/values/bools.xml
new file mode 100644
index 0000000..8851bf8
--- /dev/null
+++ b/res/values/bools.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <bool name="theme_is_light">true</bool>
+</resources>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index fd4ad0f..539b386 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
- <color name="theme_primary">#ff212121</color>
- <color name="theme_primary_dark">#ff000000</color>
- <color name="theme_accent">#ff009688</color>
+ <color name="theme_primary">#f5f5f5</color>
+ <color name="theme_primary_dark">#e0e0e0</color>
+ <color name="theme_accent">#167c80</color>
- <color name="white">#f5f5f5</color>
+ <color name="inverted">#212121</color>
<color name="ic_background">#333333</color>
</resources>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index fbf812b..e87f58c 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -1,10 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
- <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
+ <style name="AppTheme" parent="Theme.AppCompat.DayNight">
<item name="colorPrimary">@color/theme_primary</item>
<item name="colorPrimaryDark">@color/theme_primary_dark</item>
<item name="colorAccent">@color/theme_accent</item>
<item name="windowActionModeOverlay">true</item>
+ <item name="android:windowLightStatusBar">@bool/theme_is_light</item>
+ <item name="android:windowLightNavigationBar">@bool/theme_is_light</item>
</style>
<style name="AppTheme.NoActionBar">
@@ -12,12 +14,13 @@
<item name="windowNoTitle">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
+ <item name="android:navigationBarColor">@android:color/transparent</item>
</style>
- <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
+ <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.ActionBar" />
- <style name="TextAppearanceWhite" parent="TextAppearance.AppCompat.Widget.ActionBar.Title">
- <item name="android:textColor">@color/white</item>
+ <style name="TextAppearanceInverted" parent="TextAppearance.AppCompat.Widget.ActionBar.Title">
+ <item name="android:textColor">@color/inverted</item>
</style>
<style name="TextAppearanceTransparent" parent="TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">@android:color/transparent</item>