TunnelEditor: clean up xml

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2020-03-28 14:39:05 -06:00
parent fe6b788f6b
commit 1da714852f
2 changed files with 53 additions and 52 deletions

View File

@ -25,26 +25,26 @@
</data>
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="@+id/main_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorBackground">
android:id="@+id/main_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorBackground">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:orientation="vertical">
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginBottom="16dp"
app:cardBackgroundColor="?attr/elevationOverlayColor"
app:cardCornerRadius="0dp"
@ -92,9 +92,9 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="4dp"
app:layout_constraintHorizontal_weight="0.7"
app:layout_constraintHorizontal_chainStyle="spread"
app:layout_constraintEnd_toStartOf="@id/generate_private_key_button"
app:layout_constraintHorizontal_chainStyle="spread"
app:layout_constraintHorizontal_weight="0.7"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/interface_name_layout">
@ -117,19 +117,19 @@
android:onClick="@{() -> config.interface.generateKeyPair()}"
android:text="@string/generate"
android:textColor="?attr/colorSecondary"
app:layout_constraintHorizontal_weight="0.3"
app:layout_constraintBaseline_toBaselineOf="@id/private_key_text_layout"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_weight="0.3"
app:layout_constraintStart_toEndOf="@id/private_key_text_layout"
app:rippleColor="?attr/colorSecondary" />
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/public_key_label_layout"
style="@style/TextInputLayoutBase"
android:hint="@string/public_key"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:hint="@string/public_key"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/private_key_text_layout">
@ -138,10 +138,10 @@
android:id="@+id/public_key_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/hint_generated"
android:editable="false"
android:ellipsize="end"
android:focusable="false"
android:hint="@string/hint_generated"
android:onClick="@{ClipboardUtils::copyTextView}"
android:singleLine="true"
android:text="@{config.interface.publicKey}" />
@ -153,9 +153,9 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="4dp"
app:layout_constraintEnd_toStartOf="@id/listen_port_label_layout"
app:layout_constraintHorizontal_chainStyle="spread"
app:layout_constraintHorizontal_weight="0.7"
app:layout_constraintEnd_toStartOf="@id/listen_port_label_layout"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/public_key_label_layout">
@ -171,14 +171,14 @@
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/listen_port_label_layout"
style="@style/TextInputLayoutBase"
android:hint="@string/listen_port"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="4dp"
app:layout_constraintHorizontal_weight="0.3"
app:layout_constraintTop_toBottomOf="@id/public_key_label_layout"
android:hint="@string/listen_port"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/addresses_label_layout">
app:layout_constraintHorizontal_weight="0.3"
app:layout_constraintStart_toEndOf="@id/addresses_label_layout"
app:layout_constraintTop_toBottomOf="@id/public_key_label_layout">
<com.wireguard.android.widget.MonkeyedTextInputEditText
android:layout_width="match_parent"
@ -196,9 +196,9 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="4dp"
app:layout_constraintEnd_toStartOf="@id/mtu_label_layout"
app:layout_constraintHorizontal_chainStyle="spread"
app:layout_constraintHorizontal_weight="0.7"
app:layout_constraintEnd_toStartOf="@id/mtu_label_layout"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/addresses_label_layout">
@ -218,17 +218,17 @@
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:hint="@string/mtu"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_weight="0.3"
app:layout_constraintStart_toEndOf="@id/dns_servers_label_layout"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/dns_servers_label_layout">
<com.wireguard.android.widget.MonkeyedTextInputEditText
android:id="@+id/mtu_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="number"
android:hint="@string/hint_automatic"
android:inputType="number"
android:text="@={config.interface.mtu}"
android:textAlignment="center" />
</com.google.android.material.textfield.TextInputLayout>
@ -253,14 +253,15 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="?attr/actionBarSize"
android:divider="@null"
android:orientation="vertical"
android:layout_marginBottom="?attr/actionBarSize"
app:items="@{config.peers}"
app:layout="@{@layout/tunnel_editor_peer}"
tools:ignore="UselessLeaf" />
</LinearLayout>
</ScrollView>
<TextView
style="@style/TextAppearance.MaterialComponents.Button"
android:layout_width="match_parent"
@ -271,5 +272,5 @@
android:onClick="@{() -> config.addPeer()}"
android:text="@string/add_peer"
app:layout_anchorGravity="bottom" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</layout>

View File

@ -20,10 +20,10 @@
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="4dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="4dp"
app:cardBackgroundColor="?attr/elevationOverlayColor"
app:cardCornerRadius="0dp"
app:cardElevation="2dp"
@ -38,23 +38,23 @@
style="@style/TextAppearance.MaterialComponents.Headline6"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/peer"
android:layout_margin="8dp"
app:layout_constraintStart_toStartOf="parent"
android:text="@string/peer"
app:layout_constraintBottom_toTopOf="@+id/public_key_label_layout"
app:layout_constraintTop_toTopOf="parent"/>
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/delete"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:onClick="@{() -> item.unbind()}"
android:src="@drawable/ic_action_delete"
android:padding="8dp"
android:background="@null"
android:onClick="@{() -> item.unbind()}"
android:padding="8dp"
android:src="@drawable/ic_action_delete"
app:layout_constraintBaseline_toBaselineOf="@id/peer_title"
app:layout_constraintTop_toTopOf="@id/peer_title"
app:layout_constraintEnd_toEndOf="parent" />
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/peer_title" />
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/public_key_label_layout"
@ -62,19 +62,19 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="4dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/peer_title"
app:layout_constraintBottom_toTopOf="@+id/pre_shared_key_label_layout"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toTopOf="@+id/pre_shared_key_label_layout">
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/peer_title">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/public_key_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/public_key"
android:inputType="textNoSuggestions|textVisiblePassword"
android:text="@={item.publicKey}"
android:hint="@string/public_key"
app:filter="@{KeyInputFilter.newInstance()}"/>
app:filter="@{KeyInputFilter.newInstance()}" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
@ -84,9 +84,9 @@
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:hint="@string/pre_shared_key"
app:layout_constraintTop_toBottomOf="@+id/public_key_label_layout"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/public_key_label_layout">
<com.wireguard.android.widget.MonkeyedTextInputEditText
android:id="@+id/pre_shared_key_text"
@ -94,7 +94,7 @@
android:layout_height="wrap_content"
android:hint="@string/hint_optional"
android:inputType="textNoSuggestions|textVisiblePassword"
android:text="@={item.preSharedKey}"/>
android:text="@={item.preSharedKey}" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
@ -104,9 +104,9 @@
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:hint="@string/persistent_keepalive"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/pre_shared_key_label_layout"
app:layout_constraintEnd_toEndOf="parent">
app:layout_constraintTop_toBottomOf="@id/pre_shared_key_label_layout">
<com.wireguard.android.widget.MonkeyedTextInputEditText
android:id="@+id/persistent_keepalive_text"
@ -131,9 +131,9 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:inputType="textNoSuggestions|textVisiblePassword"
android:hint="@string/endpoint"
android:text="@={item.endpoint}"/>
android:inputType="textNoSuggestions|textVisiblePassword"
android:text="@={item.endpoint}" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
@ -141,20 +141,20 @@
style="@style/TextInputLayoutBase"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:layout_marginStart="4dp"
android:layout_marginTop="4dp"
android:layout_marginEnd="4dp"
app:layout_constraintTop_toBottomOf="@id/endpoint_label_layout"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/endpoint_label_layout">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/allowed_ips_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textNoSuggestions|textVisiblePassword"
android:hint="@string/allowed_ips"
android:text="@={item.allowedIps}"/>
android:inputType="textNoSuggestions|textVisiblePassword"
android:text="@={item.allowedIps}" />
</com.google.android.material.textfield.TextInputLayout>
<CheckBox
@ -163,11 +163,11 @@
android:layout_height="match_parent"
android:layout_marginStart="4dp"
android:layout_marginTop="0dp"
android:checked="@={item.excludingPrivateIps}"
android:text="@string/exclude_private_ips"
android:visibility="@{item.ableToExcludePrivateIps ? View.VISIBLE : View.GONE}"
android:checked="@={item.excludingPrivateIps}"
app:layout_constraintTop_toBottomOf="@id/allowed_ips_label_layout"
app:layout_constraintEnd_toEndOf="parent" />
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/allowed_ips_label_layout" />
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>