ProfileActivity: Replace fragments instead of hiding

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Samuel Holland
2017-08-09 05:12:00 -05:00
parent 2e3daa8913
commit 52cdf3e7e5
11 changed files with 149 additions and 106 deletions
@@ -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" />
@@ -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" />
@@ -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
<RelativeLayout
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}" />
android:layout_height="wrap_content">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="@{profile == null ? View.GONE : View.VISIBLE}">
<RelativeLayout
<TextView
android:id="@+id/profile_name_label"
android:layout_width="match_parent"
android:layout_height="wrap_content">
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_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/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_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>
<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>
@@ -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" />