summaryrefslogtreecommitdiffhomepage
path: root/app/src/main/res
diff options
context:
space:
mode:
authorSamuel Holland <samuel@sholland.org>2017-11-28 20:14:47 -0600
committerSamuel Holland <samuel@sholland.org>2017-11-28 20:14:47 -0600
commit4a672fc05d4b40b2e169bdf7b6212f86c3789de0 (patch)
tree132e6a235a61b8f816223eacc9983b5a0be947d6 /app/src/main/res
parent19f008955963015abbaf0c9fd88492d0eb0a6ace (diff)
ConfigListFragment: Use a floating action menu
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'app/src/main/res')
-rw-r--r--app/src/main/res/drawable/fab_label_background.xml10
-rw-r--r--app/src/main/res/layout/config_list_fragment.xml46
-rw-r--r--app/src/main/res/menu/config_list.xml15
-rw-r--r--app/src/main/res/values/strings.xml3
-rw-r--r--app/src/main/res/values/styles.xml8
5 files changed, 60 insertions, 22 deletions
diff --git a/app/src/main/res/drawable/fab_label_background.xml b/app/src/main/res/drawable/fab_label_background.xml
new file mode 100644
index 00000000..c0315fd6
--- /dev/null
+++ b/app/src/main/res/drawable/fab_label_background.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <corners android:radius="4dp" />
+ <padding
+ android:bottom="4dp"
+ android:left="8dp"
+ android:right="8dp"
+ android:top="4dp" />
+ <solid android:color="?android:attr/colorPrimary" />
+</shape>
diff --git a/app/src/main/res/layout/config_list_fragment.xml b/app/src/main/res/layout/config_list_fragment.xml
index 7e8304e6..b3c48175 100644
--- a/app/src/main/res/layout/config_list_fragment.xml
+++ b/app/src/main/res/layout/config_list_fragment.xml
@@ -10,11 +10,45 @@
type="com.wireguard.android.bindings.ObservableSortedMap&lt;String, com.wireguard.config.Config&gt;" />
</data>
- <ListView
- android:id="@+id/config_list"
+ <RelativeLayout
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:choiceMode="singleChoice"
- app:items="@{configs}"
- app:layout="@{@layout/config_list_item}" />
+ android:layout_height="match_parent">
+
+ <ListView
+ android:id="@+id/config_list"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:choiceMode="singleChoice"
+ app:items="@{configs}"
+ app:layout="@{@layout/config_list_item}" />
+
+ <com.getbase.floatingactionbutton.FloatingActionsMenu
+ android:id="@+id/add_menu"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentBottom="true"
+ android:layout_alignParentEnd="true"
+ android:layout_marginBottom="8dp"
+ android:layout_marginEnd="8dp"
+ app:fab_labelStyle="@style/fab_label"
+ app:fab_labelsPosition="left">
+
+ <com.getbase.floatingactionbutton.FloatingActionButton
+ android:id="@+id/add_from_file"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ app:fab_icon="@drawable/ic_action_save"
+ app:fab_size="mini"
+ app:fab_title="@string/add_from_file" />
+
+ <com.getbase.floatingactionbutton.FloatingActionButton
+ android:id="@+id/add_from_scratch"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ app:fab_icon="@drawable/ic_action_edit"
+ app:fab_size="mini"
+ app:fab_title="@string/add_from_scratch" />
+ </com.getbase.floatingactionbutton.FloatingActionsMenu>
+
+ </RelativeLayout>
</layout>
diff --git a/app/src/main/res/menu/config_list.xml b/app/src/main/res/menu/config_list.xml
deleted file mode 100644
index 0e94e7ff..00000000
--- a/app/src/main/res/menu/config_list.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<menu xmlns:android="http://schemas.android.com/apk/res/android">
- <item
- android:id="@+id/menu_action_add"
- android:alphabeticShortcut="n"
- android:icon="@drawable/ic_action_add"
- android:showAsAction="always"
- android:title="@string/add" />
- <item
- android:id="@+id/menu_action_import"
- android:alphabeticShortcut="o"
- android:icon="@drawable/ic_action_open"
- android:showAsAction="ifRoom"
- android:title="@string/import_config" />
-</menu>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 4f548672..4687ec49 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -4,8 +4,9 @@
<item quantity="one">%d configuration selected</item>
<item quantity="other">%d configurations selected</item>
</plurals>
- <string name="add">Add empty config</string>
<string name="add_activity_title">New WireGuard configuration</string>
+ <string name="add_from_file">Add from file</string>
+ <string name="add_from_scratch">Add from scratch</string>
<string name="add_peer">Add peer</string>
<string name="addresses">Addresses</string>
<string name="allowed_ips">Allowed IPs</string>
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
new file mode 100644
index 00000000..11f3e544
--- /dev/null
+++ b/app/src/main/res/values/styles.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <style name="fab_label" parent="android:TextAppearance.DeviceDefault.Inverse">
+ <item name="android:background">@drawable/fab_label_background</item>
+ </style>
+
+</resources>