diff options
author | Samuel Holland <samuel@sholland.org> | 2017-08-09 05:12:00 -0500 |
---|---|---|
committer | Samuel Holland <samuel@sholland.org> | 2017-08-09 05:12:00 -0500 |
commit | 52cdf3e7e5fb4292d1dfa99ba123701ca7959092 (patch) | |
tree | 9ce3ef9fc6d6865429789423deb1079f739461f2 /app/src/main/res | |
parent | 2e3daa89139652e0af1ec011ac1da6105a1d871e (diff) |
ProfileActivity: Replace fragments instead of hiding
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'app/src/main/res')
-rw-r--r-- | app/src/main/res/layout-land/profile_list_activity.xml | 20 | ||||
-rw-r--r-- | app/src/main/res/layout/placeholder_fragment.xml | 6 | ||||
-rw-r--r-- | app/src/main/res/layout/profile_detail_activity.xml | 6 | ||||
-rw-r--r-- | app/src/main/res/layout/profile_detail_fragment.xml | 87 | ||||
-rw-r--r-- | app/src/main/res/layout/profile_list_activity.xml | 21 | ||||
-rw-r--r-- | app/src/main/res/values/strings.xml | 1 |
6 files changed, 72 insertions, 69 deletions
diff --git a/app/src/main/res/layout-land/profile_list_activity.xml b/app/src/main/res/layout-land/profile_list_activity.xml new file mode 100644 index 00000000..dc7b5c3b --- /dev/null +++ b/app/src/main/res/layout-land/profile_list_activity.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:baselineAligned="false" + android:orientation="horizontal"> + + <fragment + android:name="com.wireguard.android.ProfileListFragment" + android:layout_width="0dp" + android:layout_height="match_parent" + android:layout_weight="1" + android:tag="list" /> + + <FrameLayout + android:id="@+id/fragment_container" + android:layout_width="0dp" + android:layout_height="match_parent" + android:layout_weight="2" /> +</LinearLayout> diff --git a/app/src/main/res/layout/placeholder_fragment.xml b/app/src/main/res/layout/placeholder_fragment.xml new file mode 100644 index 00000000..bb89ef1a --- /dev/null +++ b/app/src/main/res/layout/placeholder_fragment.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<TextView xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:gravity="center" + android:text="@string/placeholder_text" /> diff --git a/app/src/main/res/layout/profile_detail_activity.xml b/app/src/main/res/layout/profile_detail_activity.xml new file mode 100644 index 00000000..0be8d4bd --- /dev/null +++ b/app/src/main/res/layout/profile_detail_activity.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<fragment xmlns:android="http://schemas.android.com/apk/res/android" + android:name="com.wireguard.android.ProfileDetailFragment" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:tag="detail" /> diff --git a/app/src/main/res/layout/profile_detail_fragment.xml b/app/src/main/res/layout/profile_detail_fragment.xml index 248f11a1..c08236ce 100644 --- a/app/src/main/res/layout/profile_detail_fragment.xml +++ b/app/src/main/res/layout/profile_detail_fragment.xml @@ -4,68 +4,53 @@ <data> - <import type="android.view.View" /> - <variable name="profile" type="com.wireguard.config.Profile" /> </data> - <FrameLayout + <ScrollView android:layout_width="match_parent" android:layout_height="match_parent" android:padding="16dp"> - <TextView - android:layout_width="match_parent" - android:layout_height="match_parent" - android:gravity="center" - android:text="@string/placeholder_text" - android:visibility="@{profile == null ? View.VISIBLE : View.GONE}" /> - - <ScrollView + <RelativeLayout android:layout_width="match_parent" - android:layout_height="match_parent" - android:visibility="@{profile == null ? View.GONE : View.VISIBLE}"> + android:layout_height="wrap_content"> - <RelativeLayout + <TextView + android:id="@+id/profile_name_label" android:layout_width="match_parent" - android:layout_height="wrap_content"> - - <TextView - android:id="@+id/profile_name_label" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_alignParentTop="true" - android:labelFor="@+id/profile_name_text" - android:text="@string/profile_name" /> - - <TextView - android:id="@+id/profile_name_text" - style="?android:attr/textAppearanceMedium" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_below="@+id/profile_name_label" - android:text="@{profile.name}" /> - - <TextView - android:id="@+id/public_key_label" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_below="@+id/profile_name_text" - android:labelFor="@+id/public_key_text" - android:text="@string/public_key" /> + android:layout_height="wrap_content" + android:layout_alignParentTop="true" + android:labelFor="@+id/profile_name_text" + android:text="@string/profile_name" /> + + <TextView + android:id="@+id/profile_name_text" + style="?android:attr/textAppearanceMedium" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_below="@+id/profile_name_label" + android:text="@{profile.name}" /> - <TextView - android:id="@+id/public_key_text" - style="?android:attr/textAppearanceMedium" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_below="@+id/public_key_label" - android:ellipsize="end" - android:maxLines="1" - android:text="@{profile.interface.publicKey}" /> - </RelativeLayout> - </ScrollView> - </FrameLayout> + <TextView + android:id="@+id/public_key_label" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_below="@+id/profile_name_text" + android:labelFor="@+id/public_key_text" + android:text="@string/public_key" /> + + <TextView + android:id="@+id/public_key_text" + style="?android:attr/textAppearanceMedium" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_below="@+id/public_key_label" + android:ellipsize="end" + android:maxLines="1" + android:text="@{profile.interface.publicKey}" /> + </RelativeLayout> + </ScrollView> </layout> diff --git a/app/src/main/res/layout/profile_list_activity.xml b/app/src/main/res/layout/profile_list_activity.xml index 2645552b..f66a0cb3 100644 --- a/app/src/main/res/layout/profile_list_activity.xml +++ b/app/src/main/res/layout/profile_list_activity.xml @@ -1,21 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" +<fragment xmlns:android="http://schemas.android.com/apk/res/android" + android:name="com.wireguard.android.ProfileListFragment" android:layout_width="match_parent" android:layout_height="match_parent" - android:baselineAligned="false" - android:orientation="horizontal"> - - <fragment - android:name="com.wireguard.android.ProfileListFragment" - android:layout_width="0dp" - android:layout_height="match_parent" - android:layout_weight="1" - android:tag="list" /> - - <fragment - android:name="com.wireguard.android.ProfileDetailFragment" - android:layout_width="0dp" - android:layout_height="match_parent" - android:layout_weight="2" - android:tag="detail" /> -</LinearLayout> + android:tag="list" /> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 4010e776..872f9761 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -3,6 +3,7 @@ <string name="app_name">WireGuard</string> <string name="connected">Connected</string> <string name="disconnected">Disconnected</string> + <string name="edit">Edit</string> <string name="placeholder_text">No profile selected</string> <string name="profile_name">Profile name</string> <string name="public_key">Public key</string> |