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

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

View File

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