use colors by reference (makes the theme-aware) and reduce redundant colors
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Sun, 17 Feb 2019 20:09:09 +0000 (22:09 +0200)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Sun, 17 Feb 2019 20:09:09 +0000 (22:09 +0200)
18 files changed:
app/src/main/res/drawable-anydpi-v21/dashed_border_1dp.xml
app/src/main/res/drawable-anydpi-v21/dashed_border_8dp.xml
app/src/main/res/drawable-anydpi-v21/ic_app_icon_dynamic.xml [new file with mode: 0644]
app/src/main/res/drawable-anydpi-v21/ic_assignment_black_24dp.xml
app/src/main/res/drawable-anydpi-v21/ic_event_note_black_24dp.xml
app/src/main/res/drawable-anydpi-v21/ic_home_black_24dp.xml
app/src/main/res/drawable-anydpi-v21/ic_settings_black_24dp.xml
app/src/main/res/drawable-anydpi-v21/ic_view_list_black_24dp.xml
app/src/main/res/drawable-anydpi-v21/list_divider.xml
app/src/main/res/drawable-anydpi-v21/side_nav_bar.xml
app/src/main/res/layout/activity_main.xml
app/src/main/res/layout/activity_new_transaction.xml
app/src/main/res/layout/activity_profile_detail.xml
app/src/main/res/layout/crash_dialog.xml
app/src/main/res/layout/nav_header_logo.xml
app/src/main/res/layout/no_profiles.xml
app/src/main/res/layout/transaction_list_row.xml
app/src/main/res/values/attr.xml [new file with mode: 0644]

index f90b321..c9e5e96 100644 (file)
 <shape xmlns:android="http://schemas.android.com/apk/res/android"
     android:shape="line"
     android:thickness="1dp"
-    android:tint="@color/header_border">
+    android:tint="?colorAccent">
     <stroke
         android:width="1dp"
-        android:color="@color/header_border"
+        android:color="?colorAccent"
         android:dashWidth="2dp"
         android:dashGap="6dp" />
 
index b66a7e5..884aed2 100644 (file)
 <shape xmlns:android="http://schemas.android.com/apk/res/android"
     android:shape="line"
     android:thickness="1dp"
-    android:tint="@color/header_border">
+    android:tint="?colorAccent">
     <stroke
         android:width="8dp"
-        android:color="@color/header_border"
+        android:color="?colorAccent"
         android:dashWidth="16dp"
         android:dashGap="8dp" />
 
diff --git a/app/src/main/res/drawable-anydpi-v21/ic_app_icon_dynamic.xml b/app/src/main/res/drawable-anydpi-v21/ic_app_icon_dynamic.xml
new file mode 100644 (file)
index 0000000..e99168b
--- /dev/null
@@ -0,0 +1,86 @@
+<!--
+  ~ Copyright © 2019 Damyan Ivanov.
+  ~ This file is part of MoLe.
+  ~ MoLe is free software: you can distribute it and/or modify it
+  ~ under the term of the GNU General Public License as published by
+  ~ the Free Software Foundation, either version 3 of the License, or
+  ~ (at your opinion), any later version.
+  ~
+  ~ MoLe is distributed in the hope that it will be useful,
+  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+  ~ GNU General Public License terms for details.
+  ~
+  ~ You should have received a copy of the GNU General Public License
+  ~ along with MoLe. If not, see <https://www.gnu.org/licenses/>.
+  -->
+
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="24dp"
+    android:height="24dp"
+    android:viewportWidth="100"
+    android:viewportHeight="100">
+    <!--path
+        android:fillAlpha="1"
+        android:fillColor="?colorPrimary"
+        android:pathData="m8,0h84c4.432,0 8,3.568 8,8v84c0,4.432 -3.568,8 -8,8H8C3.568,100 0,96.432 0,92V8C0,3.568 3.568,0 8,0Z"
+        android:strokeWidth="6.5"
+        android:strokeAlpha="1"
+        android:strokeColor="#00000000"
+        android:strokeLineCap="round"
+        android:strokeLineJoin="round" /-->
+    <path
+        android:fillAlpha="1"
+        android:fillColor="#ffffff"
+        android:pathData="m54,38.688a4,4 0,0 1,-4 4,4 4,0 0,1 -4,-4 4,4 0,0 1,4 -4,4 4,0 0,1 4,4z"
+        android:strokeWidth="6.5"
+        android:strokeAlpha="1"
+        android:strokeColor="#00000000"
+        android:strokeLineCap="round"
+        android:strokeLineJoin="round" />
+    <path
+        android:fillAlpha="1"
+        android:fillColor="#ffffff"
+        android:pathData="m27.27,35.693c-6.756,0.048 -19.33,1.81 -19.462,1.828 0.076,-0.004 0.152,-0.012 0.229,-0.012l-0.273,0.018c0,0 0.043,-0.006 0.044,-0.006 -2.084,0.122 -3.796,1.878 -3.796,3.996v50.443c0,2.195 1.838,4.01 4.026,4.01a2,2 0,0 0,0.283 -0.02c0,0 12.891,-1.813 18.977,-1.854 7.237,-0.049 22.447,1.887 22.447,1.887a2,2 0,0 0,0.507 0c0,0 15.753,-1.964 23.258,-1.887 5.808,0.06 18.148,1.852 18.148,1.852a2,2 0,0 0,0.291 0.022c2.187,0 4.025,-1.815 4.025,-4.01v-50.443c0,-2.201 -1.89,-3.816 -3.838,-4 -0.167,-0.024 -12.112,-1.755 -18.586,-1.824 -4.371,-0.046 -10.704,0.465 -15.724,0.956l0.393,3.992c4.948,-0.482 11.21,-0.992 15.29,-0.948 5.819,0.062 18.157,1.795 18.157,1.795a2,2 0,0 0,0.096 0.011c0.287,0.027 0.213,-0.008 0.213,0.018v50.44c-0.456,-0.068 -12.016,-1.793 -18.424,-1.859 -6.628,-0.069 -17.426,1.15 -21.551,1.646v-45.384h-4v45.378c-4.07,-0.499 -14.381,-1.683 -20.728,-1.64 -6.685,0.045 -18.819,1.797 -19.26,1.861v-50.441c0,-0.031 -0.032,-0.008 0.025,-0.008a2,2 0,0 0,0.273 -0.02c0,0 12.891,-1.753 18.988,-1.797 3.778,-0.027 9.522,0.442 14.207,0.903l0.521,-3.98c-4.773,-0.472 -10.66,-0.952 -14.757,-0.923z"
+        android:strokeWidth="6.5"
+        android:strokeAlpha="1"
+        android:strokeColor="#00000000"
+        android:strokeLineCap="round"
+        android:strokeLineJoin="round" />
+    <path
+        android:fillAlpha="1"
+        android:fillColor="#ffffff"
+        android:pathData="m50,19.713c-4.871,0 -9.742,1.848 -13.436,5.541a4,4 0,1 0,5.658 5.656c4.329,-4.329 11.225,-4.329 15.555,0a4,4 0,1 0,5.658 -5.656C59.742,21.561 54.871,19.713 50,19.713Z"
+        android:strokeWidth="6.5"
+        android:strokeAlpha="1"
+        android:strokeColor="#00000000"
+        android:strokeLineCap="round"
+        android:strokeLineJoin="round" />
+    <path
+        android:fillAlpha="1"
+        android:fillColor="#ffffff"
+        android:pathData="m50,4.713c-8.71,0 -17.419,3.311 -24.041,9.934a4,4 0,1 0,5.656 5.656c10.187,-10.187 26.582,-10.187 36.77,0a4,4 0,1 0,5.656 -5.656C67.419,8.024 58.71,4.713 50,4.713Z"
+        android:strokeWidth="6.5"
+        android:strokeAlpha="1"
+        android:strokeColor="#00000000"
+        android:strokeLineCap="round"
+        android:strokeLineJoin="round" />
+    <path
+        android:fillAlpha="1"
+        android:fillColor="#ffffff"
+        android:pathData="m56.574,62.805v8h30.852v-8z"
+        android:strokeWidth="6.5"
+        android:strokeAlpha="1"
+        android:strokeColor="#00000000"
+        android:strokeLineCap="round"
+        android:strokeLineJoin="round" />
+    <path
+        android:fillAlpha="1"
+        android:fillColor="#ffffff"
+        android:pathData="m23.985,51.5v11.321h-11.411v7.968h11.411v11.32h8.032v-11.32h11.411v-7.968L32.016,62.82L32.016,51.5Z"
+        android:strokeWidth="6.5"
+        android:strokeAlpha="1"
+        android:strokeColor="#00000000"
+        android:strokeLineCap="round"
+        android:strokeLineJoin="round" />
+</vector>
index abe90bc..9008622 100644 (file)
@@ -17,7 +17,7 @@
 <vector xmlns:android="http://schemas.android.com/apk/res/android"
     android:width="24dp"
     android:height="24dp"
-    android:tint="@color/colorAccent"
+    android:tint="?colorAccent"
     android:viewportWidth="24.0"
     android:viewportHeight="24.0">
     <path
index 6fc017f..7517083 100644 (file)
@@ -17,7 +17,7 @@
 <vector xmlns:android="http://schemas.android.com/apk/res/android"
     android:width="24dp"
     android:height="24dp"
-    android:tint="@color/colorAccent"
+    android:tint="?colorAccent"
     android:viewportWidth="24.0"
     android:viewportHeight="24.0">
     <path
index 1278e0a..715c0c8 100644 (file)
@@ -18,7 +18,7 @@
 <vector xmlns:android="http://schemas.android.com/apk/res/android"
     android:width="24dp"
     android:height="24dp"
-    android:tint="@color/colorAccent"
+    android:tint="?colorAccent"
     android:viewportWidth="24.0"
     android:viewportHeight="24.0">
     <path
index 442f244..41c7e68 100644 (file)
@@ -17,7 +17,7 @@
 <vector xmlns:android="http://schemas.android.com/apk/res/android"
     android:width="24dp"
     android:height="24dp"
-    android:tint="@color/colorAccent"
+    android:tint="?colorAccent"
     android:viewportWidth="24.0"
     android:viewportHeight="24.0">
     <path
index 54c8886..9695d3d 100644 (file)
@@ -17,7 +17,7 @@
 <vector xmlns:android="http://schemas.android.com/apk/res/android"
     android:width="24dp"
     android:height="24dp"
-    android:tint="@color/colorAccent"
+    android:tint="?colorAccent"
     android:viewportWidth="24.0"
     android:viewportHeight="24.0">
     <path
index 8dbd1ae..dafd9e1 100644 (file)
@@ -20,7 +20,7 @@
     <gradient
         android:type="linear"
         android:startColor="@android:color/transparent"
-        android:centerColor="@color/colorPrimary"
+        android:centerColor="?colorPrimary"
         android:endColor="@android:color/transparent"/>
     <size android:height="2dp" />
 </shape>
\ No newline at end of file
index 28959b9..c141e31 100644 (file)
 
 <shape xmlns:android="http://schemas.android.com/apk/res/android"
     android:shape="rectangle">
-    <gradient
-        android:angle="135"
-        android:centerColor="@color/colorPrimary"
-        android:endColor="@color/colorPrimaryDark"
-        android:startColor="#724db6"
-        android:type="linear" />
+    <solid
+        android:color="?colorAccent"
+        />
 </shape>
\ No newline at end of file
index a1782e1..9c0fb62 100644 (file)
@@ -27,7 +27,7 @@
         android:id="@+id/toolbar"
         android:layout_width="match_parent"
         android:layout_height="?attr/actionBarSize"
-        android:background="@color/colorPrimary"
+        android:background="?colorPrimary"
         app:popupTheme="@style/AppTheme.PopupOverlay" />
 
     <android.support.v4.widget.DrawerLayout
@@ -51,7 +51,7 @@
                     android:layout_height="wrap_content"
                     android:layout_gravity="bottom|end"
                     android:layout_margin="@dimen/fab_margin"
-                    app:backgroundTint="@color/colorAccent"
+                    app:backgroundTint="?colorAccent"
                     app:layout_constraintBottom_toBottomOf="parent"
                     app:layout_constraintEnd_toEndOf="parent"
                     app:srcCompat="@drawable/svg_thick_plus_white" />
                             android:layout_weight="1"
                             android:indeterminate="true"
                             android:padding="0dp"
-                            android:progressTint="@color/colorPrimary"
+                            android:progressTint="?colorPrimary"
                             app:layout_constraintEnd_toEndOf="parent"
                             app:layout_constraintStart_toStartOf="parent" />
 
index 0cea5a5..b17bc1f 100644 (file)
@@ -60,7 +60,7 @@
             android:padding="@dimen/fab_margin"
             android:tint="@android:color/white"
             android:visibility="gone"
-            app:backgroundTint="@color/colorPrimary"
+            app:backgroundTint="?colorPrimary"
             app:layout_constraintBottom_toBottomOf="@id/save_transaction_progress"
             app:layout_constraintEnd_toEndOf="@id/save_transaction_progress"
             app:layout_constraintStart_toStartOf="@id/save_transaction_progress"
index 71376b9..bc5bf97 100644 (file)
@@ -64,7 +64,7 @@
         android:layout_height="wrap_content"
         android:layout_gravity="center_vertical|start"
         android:layout_margin="@dimen/fab_margin"
-        app:backgroundTint="@color/colorAccent"
+        app:backgroundTint="?colorAccent"
         app:layout_anchor="@+id/profile_detail_container"
         app:layout_anchorGravity="top|end"
         app:srcCompat="@drawable/ic_save_white_24dp" />
index 61a0e70..2b1bcbf 100644 (file)
@@ -13,7 +13,7 @@
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_weight="9"
-        android:background="@color/table_row_light_bg"
+        android:background="?table_row_light_bg"
         android:scrollbars="horizontal|vertical"
         android:visibility="gone">
 
index 0e24314..32ddb62 100644 (file)
@@ -22,5 +22,6 @@
     android:layout_height="48dp"
     android:contentDescription="@string/nav_header_desc"
     android:visibility="visible"
-    app:srcCompat="@drawable/ic_app_icon"
+    android:id="@+id/app_icon"
+    app:srcCompat="@drawable/ic_app_icon_dynamic"
     tools:showIn="@layout/activity_main" />
\ No newline at end of file
index 7be2768..ddced2e 100644 (file)
@@ -21,8 +21,8 @@
     android:id="@+id/no_profiles_layout"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    android:background="@color/colorPrimaryDark"
-    tools:showIn="@layout/activity_main">
+    android:background="?table_row_dark_bg"
+    >
 
     <TextView
         android:id="@+id/textView"
@@ -31,6 +31,7 @@
         android:layout_marginTop="48dp"
         android:text="@string/text_welcome"
         android:textSize="52sp"
+        android:textColor="?textColor"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintTop_toTopOf="parent" />
@@ -44,6 +45,7 @@
         android:layout_marginEnd="8dp"
         android:text="@string/text_welcome_profile_needed"
         android:textSize="20sp"
+        android:textColor="?textColor"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintTop_toBottomOf="@+id/textView" />
@@ -56,7 +58,7 @@
         android:layout_marginTop="24dp"
         android:layout_marginEnd="8dp"
         android:layout_marginBottom="8dp"
-        android:backgroundTint="@color/colorPrimary"
+        android:backgroundTint="?colorAccent"
         android:drawablePadding="16dp"
         android:text="@string/create_profile_label"
         app:layout_constraintBottom_toBottomOf="parent"
index 16bab06..0512885 100644 (file)
@@ -71,6 +71,7 @@
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:background="@drawable/dashed_border_1dp"
+                android:alpha="0.3"
                 android:minHeight="2dp"
                 android:orientation="horizontal"
                 app:layout_constraintEnd_toEndOf="parent"
             android:id="@+id/transaction_delimiter_month"
             android:layout_width="wrap_content"
             android:layout_height="match_parent"
-            android:background="@color/colorPrimary"
+            android:background="?colorPrimary"
             android:paddingStart="4dp"
             android:paddingEnd="4dp"
             android:text="---------"
             android:id="@+id/transaction_delimiter_date"
             android:layout_width="wrap_content"
             android:layout_height="match_parent"
-            android:background="@color/colorPrimary"
+            android:background="?colorPrimary"
             android:paddingStart="4dp"
             android:paddingEnd="4dp"
             android:text="--.--.----"
             android:layout_marginStart="8dp"
             android:layout_marginEnd="8dp"
             android:background="@drawable/dashed_border_1dp"
+            android:alpha="0.3"
             app:layout_constraintBottom_toBottomOf="parent"
             app:layout_constraintEnd_toStartOf="@id/transaction_delimiter_date"
             app:layout_constraintStart_toEndOf="@id/transaction_delimiter_month"
             android:id="@+id/transaction_delimiter_thick"
             android:layout_width="0dp"
             android:layout_height="0dp"
-            android:background="@color/colorPrimary"
+            android:background="?colorPrimary"
             app:layout_constraintBottom_toBottomOf="parent"
             app:layout_constraintEnd_toStartOf="@id/transaction_delimiter_date"
             app:layout_constraintStart_toEndOf="@id/transaction_delimiter_month"
diff --git a/app/src/main/res/values/attr.xml b/app/src/main/res/values/attr.xml
new file mode 100644 (file)
index 0000000..f203241
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <attr name="drawer_background" format="reference|color"/>
+    <attr name="table_row_dark_bg" format="reference|color"/>
+    <attr name="table_row_light_bg" format="reference|color"/>
+    <attr name="textColor" format="reference|color"/>
+
+</resources>
\ No newline at end of file