android: Fix color of lists and buttons on older platforms
authorTobias Brunner <tobias@strongswan.org>
Tue, 26 Apr 2016 14:29:35 +0000 (16:29 +0200)
committerTobias Brunner <tobias@strongswan.org>
Wed, 27 Apr 2016 12:24:27 +0000 (14:24 +0200)
This adds a workaround for an issue on older platforms where the list is
not properly styled with colorAccent.  Similarly applies to borderless buttons.

src/frontends/android/app/src/main/res/drawable/activated_background.xml [new file with mode: 0644]
src/frontends/android/app/src/main/res/values-v15/styles.xml
src/frontends/android/app/src/main/res/values/colors.xml

diff --git a/src/frontends/android/app/src/main/res/drawable/activated_background.xml b/src/frontends/android/app/src/main/res/drawable/activated_background.xml
new file mode 100644 (file)
index 0000000..04cf6ef
--- /dev/null
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Copyright (C) 2016 Tobias Brunner
+    HSR Hochschule fuer Technik Rapperswil
+
+    This program is free software; you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by the
+    Free Software Foundation; either version 2 of the License, or (at your
+    option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
+
+    This program 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
+    for more details.
+-->
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <item
+        android:state_pressed="true"
+        android:drawable="@color/pressed" />
+
+    <item
+        android:state_activated="true"
+        android:drawable="@color/accent" />
+
+    <item
+        android:drawable="@android:color/transparent" />
+
+</selector>
index 90c58a7..bf40c3f 100644 (file)
@@ -16,6 +16,8 @@
 <resources>
 
     <style name="ApplicationTheme" parent="ApplicationTheme.Base">
+        <item name="android:activatedBackgroundIndicator">@drawable/activated_background</item>
+        <item name="android:selectableItemBackground">@drawable/activated_background</item>
     </style>
 
     <style name="AlertDialogTheme" parent="AlertDialogTheme.Base">
index 6377d8f..f29ae19 100644 (file)
@@ -39,4 +39,7 @@
     <color
         name="panel_separator">#5a5a5a</color>
 
+    <color
+        name="pressed">#5a5a5a</color>
+
 </resources>