summaryrefslogtreecommitdiffhomepage
path: root/app/src/main/res
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-07-30 15:26:33 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-07-30 16:28:03 +0200
commit75dfa0643be6967b2c99f5a42f179003d41bde3f (patch)
tree7d3a759a2db83692906a230db6824a1babd8cd85 /app/src/main/res
parentd5cde431589ee4de8d3d1c019e65f4b9e609a301 (diff)
Show different color for multiselection
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'app/src/main/res')
-rw-r--r--app/src/main/res/drawable/list_item_background.xml11
-rw-r--r--app/src/main/res/layout/tunnel_list_item.xml4
-rw-r--r--app/src/main/res/values/attrs.xml6
3 files changed, 14 insertions, 7 deletions
diff --git a/app/src/main/res/drawable/list_item_background.xml b/app/src/main/res/drawable/list_item_background.xml
index f064676a..d62f3237 100644
--- a/app/src/main/res/drawable/list_item_background.xml
+++ b/app/src/main/res/drawable/list_item_background.xml
@@ -1,12 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
-<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto">
<item>
<selector>
- <item android:state_activated="true">
+ <item app:state_multiselected="true" android:state_activated="true">
+ <color android:color="?android:attr/colorControlActivated" />
+ </item>
+ <item app:state_multiselected="false" android:state_activated="true">
<color android:color="?android:attr/colorControlHighlight" />
- <!-- TODO(msf): depending on whether or not we are in multiselect mode, choose instead:
- <color android:color="?android:attr/colorControlActivated" />
- -->
</item>
</selector>
</item>
diff --git a/app/src/main/res/layout/tunnel_list_item.xml b/app/src/main/res/layout/tunnel_list_item.xml
index ba36fe65..cf25b83e 100644
--- a/app/src/main/res/layout/tunnel_list_item.xml
+++ b/app/src/main/res/layout/tunnel_list_item.xml
@@ -25,7 +25,7 @@
type="com.wireguard.android.fragment.TunnelListFragment" />
</data>
- <RelativeLayout
+ <com.wireguard.android.widget.MultiselectableRelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/list_item_background"
@@ -51,5 +51,5 @@
android:layout_alignParentEnd="true"
app:checked="@{item.state == State.UP}"
app:onBeforeCheckedChanged="@{fragment::setTunnelState}" />
- </RelativeLayout>
+ </com.wireguard.android.widget.MultiselectableRelativeLayout>
</layout>
diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml
new file mode 100644
index 00000000..85a987f9
--- /dev/null
+++ b/app/src/main/res/values/attrs.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <declare-styleable name="Multiselected">
+ <attr name="state_multiselected" format="boolean"/>
+ </declare-styleable>
+</resources> \ No newline at end of file