diff options
author | Samuel Holland <samuel@sholland.org> | 2017-08-08 05:51:38 -0500 |
---|---|---|
committer | Samuel Holland <samuel@sholland.org> | 2017-08-08 05:51:38 -0500 |
commit | 0685d4a1591cac4683e3c6e73024414fdb1739f0 (patch) | |
tree | 10946a6214e0641eb0581b77c9f2bfadc511029f /app/src/main/res/layout | |
parent | 3076fd8c4159aa1ecfcc4860b4bed9a60f4093e9 (diff) |
ProfileActivity: Refactor into clean layers of functionality
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'app/src/main/res/layout')
-rw-r--r-- | app/src/main/res/layout/placeholder_fragment.xml | 7 | ||||
-rw-r--r-- | app/src/main/res/layout/profile_activity.xml | 22 | ||||
-rw-r--r-- | app/src/main/res/layout/profile_detail_fragment.xml | 71 | ||||
-rw-r--r-- | app/src/main/res/layout/profile_list_fragment.xml | 1 |
4 files changed, 91 insertions, 10 deletions
diff --git a/app/src/main/res/layout/placeholder_fragment.xml b/app/src/main/res/layout/placeholder_fragment.xml deleted file mode 100644 index 8a321c6b..00000000 --- a/app/src/main/res/layout/placeholder_fragment.xml +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<TextView xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/text" - 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_activity.xml b/app/src/main/res/layout/profile_activity.xml index d9b6a1f6..2645552b 100644 --- a/app/src/main/res/layout/profile_activity.xml +++ b/app/src/main/res/layout/profile_activity.xml @@ -1,5 +1,21 @@ <?xml version="1.0" encoding="utf-8"?> -<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/list_fragment_container" +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" - android:layout_height="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> diff --git a/app/src/main/res/layout/profile_detail_fragment.xml b/app/src/main/res/layout/profile_detail_fragment.xml new file mode 100644 index 00000000..248f11a1 --- /dev/null +++ b/app/src/main/res/layout/profile_detail_fragment.xml @@ -0,0 +1,71 @@ +<?xml version="1.0" encoding="utf-8"?> +<layout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto"> + + <data> + + <import type="android.view.View" /> + + <variable + name="profile" + type="com.wireguard.config.Profile" /> + </data> + + <FrameLayout + 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 + android:layout_width="match_parent" + android:layout_height="match_parent" + android:visibility="@{profile == null ? View.GONE : View.VISIBLE}"> + + <RelativeLayout + 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" /> + + <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> +</layout> diff --git a/app/src/main/res/layout/profile_list_fragment.xml b/app/src/main/res/layout/profile_list_fragment.xml index c0edd444..f5954092 100644 --- a/app/src/main/res/layout/profile_list_fragment.xml +++ b/app/src/main/res/layout/profile_list_fragment.xml @@ -4,6 +4,7 @@ <data> + <!--suppress AndroidDomInspection --> <variable name="profiles" type="android.databinding.ObservableArrayMap<String, com.wireguard.config.Profile>" /> |