From 4f97989154eaa1882cebb1ff9ae31595836808e1 Mon Sep 17 00:00:00 2001
From: Anton Chekulaev <metaphore@bk.ru>
Date: Thu, 27 Aug 2020 12:30:27 +1000
Subject: [PATCH] Fixed status bar styling for lollipop devices. Simplified
 ic_circle_plus drawable.

---
 res/drawable/ic_circle_plus.xml               | 53 +++++++------------
 res/layout/conversation_input_panel.xml       |  2 +
 .../colors.xml                                |  0
 .../styles.xml                                |  0
 .../themes.xml                                |  7 ++-
 res/values-notnight-v23/themes.xml            | 18 +++++++
 res/values/themes.xml                         |  2 +-
 .../loki/activities/SettingsActivity.kt       |  6 +--
 8 files changed, 46 insertions(+), 42 deletions(-)
 rename res/{values-notnight-v28 => values-notnight-v21}/colors.xml (100%)
 rename res/{values-notnight-v28 => values-notnight-v21}/styles.xml (100%)
 rename res/{values-notnight-v28 => values-notnight-v21}/themes.xml (98%)
 create mode 100644 res/values-notnight-v23/themes.xml

diff --git a/res/drawable/ic_circle_plus.xml b/res/drawable/ic_circle_plus.xml
index e9db1a80a8..5e243e5296 100644
--- a/res/drawable/ic_circle_plus.xml
+++ b/res/drawable/ic_circle_plus.xml
@@ -1,36 +1,21 @@
 <vector xmlns:android="http://schemas.android.com/apk/res/android"
-    android:width="27dp"
-    android:height="27dp"
-    android:viewportWidth="27"
-    android:viewportHeight="27"
-    android:tint="?attr/colorControlNormal">
-  <group>
-    <clip-path android:pathData="M-19,-756h375v812h-375z M 0,0"/>
-    <group>
-      <clip-path android:pathData="M-3,-3h33v33h-33z M 0,0"/>
-      <group>
-        <clip-path android:pathData="M13.51,8.82c-0.35,0 -0.63,0.28 -0.62,0.62v3.43H9.46c-0.35,0 -0.63,0.28 -0.62,0.62c0,0.35 0.28,0.63 0.62,0.62h3.43v3.43c-0.02,0.35 0.27,0.63 0.61,0.63c0.17,0 0.33,-0.07 0.44,-0.18c0.11,-0.11 0.18,-0.27 0.18,-0.44v-3.43h3.43c0.17,0 0.33,-0.07 0.44,-0.18c0.11,-0.11 0.18,-0.27 0.18,-0.44c0,-0.35 -0.28,-0.63 -0.62,-0.62h-3.43V9.44C14.13,9.09 13.85,8.81 13.51,8.82zM21.46,5.54c4.39,4.39 4.39,11.53 0,15.92c-4.39,4.39 -11.53,4.39 -15.92,0s-4.39,-11.53 0,-15.92C9.93,1.15 17.07,1.15 21.46,5.54zM22.34,22.34c4.88,-4.88 4.88,-12.81 0,-17.69s-12.81,-4.88 -17.69,0s-4.88,12.81 0,17.69S17.47,27.22 22.34,22.34z M 0,0"/>
-        <group>
-          <clip-path android:pathData="M0,0h27v27h-27z M 0,0"/>
-          <path
-              android:pathData="M-4,-4h35v35h-35z"
-              android:strokeAlpha="0.9"
-              android:fillColor="@android:color/white"
-              android:fillAlpha="0.9"/>
-        </group>
-      </group>
-    </group>
-    <group>
-      <clip-path android:pathData="M-3,-3h33v33h-33z M 0,0"/>
-      <group>
-        <clip-path android:pathData="M0,0h27v27h-27z M 0,0"/>
-        <path
-            android:pathData="M13.51,8.82c-0.35,0 -0.63,0.28 -0.62,0.62v3.43H9.46c-0.35,0 -0.63,0.28 -0.62,0.62c0,0.35 0.28,0.63 0.62,0.62h3.43v3.43c-0.02,0.35 0.27,0.63 0.61,0.63c0.17,0 0.33,-0.07 0.44,-0.18c0.11,-0.11 0.18,-0.27 0.18,-0.44v-3.43h3.43c0.17,0 0.33,-0.07 0.44,-0.18c0.11,-0.11 0.18,-0.27 0.18,-0.44c0,-0.35 -0.28,-0.63 -0.62,-0.62h-3.43V9.44C14.13,9.09 13.85,8.81 13.51,8.82zM21.46,5.54c4.39,4.39 4.39,11.53 0,15.92c-4.39,4.39 -11.53,4.39 -15.92,0c-4.39,-4.39 -4.39,-11.53 0,-15.92C9.93,1.15 17.07,1.15 21.46,5.54zM22.34,22.34c4.88,-4.88 4.88,-12.81 0,-17.69s-12.81,-4.88 -17.69,0s-4.88,12.81 0,17.69S17.47,27.22 22.34,22.34z"
-            android:strokeAlpha="0.9"
-            android:strokeWidth="0.5"
-            android:strokeColor="@android:color/white"
-            android:fillAlpha="0.9"/>
-      </group>
-    </group>
-  </group>
+    android:width="24dp"
+    android:height="24dp"
+    android:viewportWidth="24"
+    android:viewportHeight="24"
+    android:tint="?android:colorControlNormal">
+  <path
+      android:pathData="M12,12m-9.4734,0a9.4734,9.4734 0,1 1,18.9468 0a9.4734,9.4734 0,1 1,-18.9468 0"
+      android:strokeWidth="1.5"
+      android:strokeColor="@android:color/white"/>
+  <path
+      android:pathData="m11.9996,8.4641l0,7.0708"
+      android:strokeWidth="1.2991"
+      android:strokeColor="@android:color/white"
+      android:strokeLineCap="round"/>
+  <path
+      android:pathData="m15.535,11.9997l-7.0708,0"
+      android:strokeWidth="1.2991"
+      android:strokeColor="@android:color/white"
+      android:strokeLineCap="round"/>
 </vector>
diff --git a/res/layout/conversation_input_panel.xml b/res/layout/conversation_input_panel.xml
index 9f5048f4ad..b7be0a150a 100644
--- a/res/layout/conversation_input_panel.xml
+++ b/res/layout/conversation_input_panel.xml
@@ -192,6 +192,8 @@
             android:layout_gravity="center"
             android:background="@drawable/circle_touch_highlight_background"
             android:src="@drawable/ic_circle_plus"
+            android:scaleType="fitXY"
+            android:padding="4dp"
             android:contentDescription="@string/ConversationActivity_add_attachment"
             android:nextFocusLeft="@+id/embedded_text_editor" />
 
diff --git a/res/values-notnight-v28/colors.xml b/res/values-notnight-v21/colors.xml
similarity index 100%
rename from res/values-notnight-v28/colors.xml
rename to res/values-notnight-v21/colors.xml
diff --git a/res/values-notnight-v28/styles.xml b/res/values-notnight-v21/styles.xml
similarity index 100%
rename from res/values-notnight-v28/styles.xml
rename to res/values-notnight-v21/styles.xml
diff --git a/res/values-notnight-v28/themes.xml b/res/values-notnight-v21/themes.xml
similarity index 98%
rename from res/values-notnight-v28/themes.xml
rename to res/values-notnight-v21/themes.xml
index 3de02c6f6a..ea5dff2c87 100644
--- a/res/values-notnight-v28/themes.xml
+++ b/res/values-notnight-v21/themes.xml
@@ -1,11 +1,8 @@
 <?xml version="1.0" encoding="utf-8"?>
-<resources>
+<resources xmlns:tools="http://schemas.android.com/tools">
 
     <style name="Theme.Session.DayNight">
         <item name="android:navigationBarColor">?android:navigationBarColor</item>
-        <item name="android:statusBarColor">@color/transparent</item>
-<!--        <item name="android:statusBarColor">?colorAccent</item>-->
-        <item name="android:windowLightStatusBar">true</item>
         <item name="android:textColorHint">@color/gray50</item>
 
         <item name="home_gradient_start">#00FFFFFF</item>
@@ -13,6 +10,8 @@
 
         <item name="message_received_background_color">#F5F5F5</item>
         <item name="message_sent_background_color">?colorAccent</item>
+
+        <item name="android:statusBarColor">@android:color/black</item>
     </style>
 
     <style name="Theme.TextSecure.DayNight">
diff --git a/res/values-notnight-v23/themes.xml b/res/values-notnight-v23/themes.xml
new file mode 100644
index 0000000000..4e55488512
--- /dev/null
+++ b/res/values-notnight-v23/themes.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources xmlns:tools="http://schemas.android.com/tools">
+
+    <style name="Theme.Session.DayNight">
+        <item name="android:navigationBarColor">?android:navigationBarColor</item>
+        <item name="android:textColorHint">@color/gray50</item>
+
+        <item name="home_gradient_start">#00FFFFFF</item>
+        <item name="home_gradient_end">#FFFFFFFF</item>
+
+        <item name="message_received_background_color">#F5F5F5</item>
+        <item name="message_sent_background_color">?colorAccent</item>
+
+        <item name="android:statusBarColor">@color/transparent</item>
+        <item name="android:windowLightStatusBar">true</item>
+    </style>
+
+</resources>
\ No newline at end of file
diff --git a/res/values/themes.xml b/res/values/themes.xml
index 3f3078098c..2857ee3621 100644
--- a/res/values/themes.xml
+++ b/res/values/themes.xml
@@ -81,7 +81,7 @@
 <!--        <item name="actionBarStyle">@style/Session.DarkSubtitleActionBar</item>-->
 <!--    </style>-->
 
-    <!-- TODO Refactor this use color resources -->
+    <!-- TODO Refactor this to use color resources -->
     <style name="Theme.Session.ForceDark" parent="Theme.Session.DayNight">
         <!-- TODO Use a color resource -->
         <item name="colorPrimary">#171717</item>
diff --git a/src/org/thoughtcrime/securesms/loki/activities/SettingsActivity.kt b/src/org/thoughtcrime/securesms/loki/activities/SettingsActivity.kt
index 46ee59e691..c6ff62f814 100644
--- a/src/org/thoughtcrime/securesms/loki/activities/SettingsActivity.kt
+++ b/src/org/thoughtcrime/securesms/loki/activities/SettingsActivity.kt
@@ -101,9 +101,9 @@ class SettingsActivity : PassphraseRequiredActionBarActivity() {
     override fun onCreateOptionsMenu(menu: Menu): Boolean {
         menuInflater.inflate(R.menu.settings_general, menu)
 
-        // Day/night themes are only available since Android 10
-        menu.findItem(R.id.action_change_theme)
-                .setVisible(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
+//        // Day/night themes are only available since Android 10
+//        menu.findItem(R.id.action_change_theme)
+//                .setVisible(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
 
         return true
     }