summaryrefslogtreecommitdiffhomepage
path: root/ui/src
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2020-03-28 15:21:20 -0600
committerJason A. Donenfeld <Jason@zx2c4.com>2020-03-28 16:26:22 -0600
commitbee6ebe3b419c08661b1f0aa8e555ecb62d2798b (patch)
tree2a4e619ca0fb559e1a8303877dd8d438154c13db /ui/src
parent5989298d3fc3a0fda4d3f88d5a13b4506ccb0cae (diff)
TunnelEditor: move generate button to inside box
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'ui/src')
-rw-r--r--ui/src/main/java/com/wireguard/android/fragment/TunnelEditorFragment.kt2
-rw-r--r--ui/src/main/res/drawable/ic_action_generate.xml9
-rw-r--r--ui/src/main/res/layout/tunnel_editor_fragment.xml22
-rw-r--r--ui/src/main/res/values-hi/strings.xml1
-rw-r--r--ui/src/main/res/values-id/strings.xml1
-rw-r--r--ui/src/main/res/values-it/strings.xml1
-rw-r--r--ui/src/main/res/values-ja/strings.xml1
-rw-r--r--ui/src/main/res/values-ru/strings.xml1
-rw-r--r--ui/src/main/res/values-zh-rCN/strings.xml1
-rw-r--r--ui/src/main/res/values/strings.xml2
10 files changed, 16 insertions, 25 deletions
diff --git a/ui/src/main/java/com/wireguard/android/fragment/TunnelEditorFragment.kt b/ui/src/main/java/com/wireguard/android/fragment/TunnelEditorFragment.kt
index 99a77494..3139b29a 100644
--- a/ui/src/main/java/com/wireguard/android/fragment/TunnelEditorFragment.kt
+++ b/ui/src/main/java/com/wireguard/android/fragment/TunnelEditorFragment.kt
@@ -17,6 +17,7 @@ import android.view.WindowManager
import android.view.inputmethod.InputMethodManager
import android.widget.Toast
import com.google.android.material.snackbar.Snackbar
+import com.google.android.material.textfield.TextInputLayout
import com.wireguard.android.Application
import com.wireguard.android.R
import com.wireguard.android.backend.Tunnel
@@ -73,6 +74,7 @@ class TunnelEditorFragment : BaseFragment(), AppExclusionListener {
executePendingBindings()
setUpRoot(root as ViewGroup)
setUpScrollingContent(mainContainer, null)
+ privateKeyTextLayout.setEndIconOnClickListener { config?.`interface`?.generateKeyPair() }
}
requireActivity().window.addFlags(WindowManager.LayoutParams.FLAG_SECURE)
return binding?.root
diff --git a/ui/src/main/res/drawable/ic_action_generate.xml b/ui/src/main/res/drawable/ic_action_generate.xml
new file mode 100644
index 00000000..a7688c67
--- /dev/null
+++ b/ui/src/main/res/drawable/ic_action_generate.xml
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+ <path
+ android:fillColor="#000000"
+ android:pathData="M12,12c0,-3 2.5,-5.5 5.5,-5.5S23,9 23,12L12,12zM12,12c0,3 -2.5,5.5 -5.5,5.5S1,15 1,12h11zM12,12c-3,0 -5.5,-2.5 -5.5,-5.5S9,1 12,1v11zM12,12c3,0 5.5,2.5 5.5,5.5S15,23 12,23L12,12z" />
+</vector>
diff --git a/ui/src/main/res/layout/tunnel_editor_fragment.xml b/ui/src/main/res/layout/tunnel_editor_fragment.xml
index 7e568f5b..0eb5c249 100644
--- a/ui/src/main/res/layout/tunnel_editor_fragment.xml
+++ b/ui/src/main/res/layout/tunnel_editor_fragment.xml
@@ -93,9 +93,10 @@
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:hint="@string/private_key"
- app:layout_constraintEnd_toStartOf="@id/generate_private_key_button"
- app:layout_constraintHorizontal_chainStyle="spread"
- app:layout_constraintHorizontal_weight="0.7"
+ app:endIconMode="custom"
+ app:endIconDrawable="@drawable/ic_action_generate"
+ app:endIconContentDescription="@string/generate_new_private_key"
+ app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/interface_name_layout">
@@ -108,21 +109,6 @@
app:filter="@{KeyInputFilter.newInstance()}" />
</com.google.android.material.textfield.TextInputLayout>
- <com.google.android.material.button.MaterialButton
- android:id="@+id/generate_private_key_button"
- style="@style/Widget.MaterialComponents.Button.TextButton"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_margin="4dp"
- android:onClick="@{() -> config.interface.generateKeyPair()}"
- android:text="@string/generate"
- android:textColor="?attr/colorSecondary"
- 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"
diff --git a/ui/src/main/res/values-hi/strings.xml b/ui/src/main/res/values-hi/strings.xml
index a3264b15..69aff26b 100644
--- a/ui/src/main/res/values-hi/strings.xml
+++ b/ui/src/main/res/values-hi/strings.xml
@@ -73,7 +73,6 @@
<string name="error_up">टनल को लाने में त्रुटि: %s</string>
<string name="exclude_private_ips">निजी आईपी को छोड़ दें</string>
<string name="excluded_applications">निकाले गए ऐप्स</string>
- <string name="generate">उत्पन्न</string>
<string name="generic_error">अज्ञात “%s” त्रुटि</string>
<string name="hint_automatic">(ऑटो)</string>
<string name="hint_generated">(उत्पन्न)</string>
diff --git a/ui/src/main/res/values-id/strings.xml b/ui/src/main/res/values-id/strings.xml
index 3c097e6e..a9937c16 100644
--- a/ui/src/main/res/values-id/strings.xml
+++ b/ui/src/main/res/values-id/strings.xml
@@ -73,7 +73,6 @@
<string name="error_up">Kesalahan menambahkan tunel: %s</string>
<string name="exclude_private_ips">Kecualikan IP pribadi</string>
<string name="excluded_applications">Kecualikan aplikasi</string>
- <string name="generate">Generate</string>
<string name="generic_error">Eror “%s” Tidak diketahui</string>
<string name="hint_automatic">(otomatis)</string>
<string name="hint_generated">(generate)</string>
diff --git a/ui/src/main/res/values-it/strings.xml b/ui/src/main/res/values-it/strings.xml
index ba768a51..302e7139 100644
--- a/ui/src/main/res/values-it/strings.xml
+++ b/ui/src/main/res/values-it/strings.xml
@@ -73,7 +73,6 @@
<string name="error_up">Errore di attivazione del tunnel: %s</string>
<string name="exclude_private_ips">Escludi IP privati</string>
<string name="excluded_applications">Applicazioni escluse</string>
- <string name="generate">Genera</string>
<string name="generic_error">Errore “%s” sconosciuto</string>
<string name="hint_automatic">(auto)</string>
<string name="hint_generated">(generato)</string>
diff --git a/ui/src/main/res/values-ja/strings.xml b/ui/src/main/res/values-ja/strings.xml
index 1d483f9c..0f76f89c 100644
--- a/ui/src/main/res/values-ja/strings.xml
+++ b/ui/src/main/res/values-ja/strings.xml
@@ -71,7 +71,6 @@
<string name="error_up">トンネル起動時エラー: %s</string>
<string name="exclude_private_ips">プライベート IP アドレスを除外</string>
<string name="excluded_applications">対象外とするアプリケーション</string>
- <string name="generate">生成</string>
<string name="generic_error">未知の “%s” エラー</string>
<string name="hint_automatic">(自動)</string>
<string name="hint_generated">(生成済み)</string>
diff --git a/ui/src/main/res/values-ru/strings.xml b/ui/src/main/res/values-ru/strings.xml
index 967e5423..ff213abe 100644
--- a/ui/src/main/res/values-ru/strings.xml
+++ b/ui/src/main/res/values-ru/strings.xml
@@ -89,7 +89,6 @@
<string name="error_up">Ошибка при запуске туннеля: %s</string>
<string name="exclude_private_ips">Исключить частные IP-адреса</string>
<string name="excluded_applications">Исключенные приложения</string>
- <string name="generate">Создать</string>
<string name="generic_error">Неизвестная “%s” ошибка</string>
<string name="hint_automatic">(авто)</string>
<string name="hint_generated">(авто)</string>
diff --git a/ui/src/main/res/values-zh-rCN/strings.xml b/ui/src/main/res/values-zh-rCN/strings.xml
index d0ac6526..626478d3 100644
--- a/ui/src/main/res/values-zh-rCN/strings.xml
+++ b/ui/src/main/res/values-zh-rCN/strings.xml
@@ -71,7 +71,6 @@
<string name="error_up">建立连接时出错:%s</string>
<string name="exclude_private_ips">排除局域网</string>
<string name="excluded_applications">排除的应用</string>
- <string name="generate">生成密钥</string>
<string name="generic_error">未知的 “%s” 错误</string>
<string name="hint_automatic">(自动)</string>
<string name="hint_generated">(生成)</string>
diff --git a/ui/src/main/res/values/strings.xml b/ui/src/main/res/values/strings.xml
index 04582606..8e5c28d1 100644
--- a/ui/src/main/res/values/strings.xml
+++ b/ui/src/main/res/values/strings.xml
@@ -77,7 +77,7 @@
<string name="error_up">Error bringing up tunnel: %s</string>
<string name="exclude_private_ips">Exclude private IPs</string>
<string name="excluded_applications">Excluded Applications</string>
- <string name="generate">Generate</string>
+ <string name="generate_new_private_key">Generate new private key</string>
<string name="generic_error">Unknown “%s” error</string>
<string name="hint_automatic">(auto)</string>
<string name="hint_generated">(generated)</string>