ConfigListFragment: Use a floating action menu
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
@@ -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>
|
||||
@@ -10,11 +10,45 @@
|
||||
type="com.wireguard.android.bindings.ObservableSortedMap<String, com.wireguard.config.Config>" />
|
||||
</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>
|
||||
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
Reference in New Issue
Block a user