From bee6ebe3b419c08661b1f0aa8e555ecb62d2798b Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Sat, 28 Mar 2020 15:21:20 -0600 Subject: [PATCH] TunnelEditor: move generate button to inside box Signed-off-by: Jason A. Donenfeld --- .../android/fragment/TunnelEditorFragment.kt | 2 ++ .../main/res/drawable/ic_action_generate.xml | 9 ++++++++ .../res/layout/tunnel_editor_fragment.xml | 22 ++++--------------- ui/src/main/res/values-hi/strings.xml | 1 - ui/src/main/res/values-id/strings.xml | 1 - ui/src/main/res/values-it/strings.xml | 1 - ui/src/main/res/values-ja/strings.xml | 1 - ui/src/main/res/values-ru/strings.xml | 1 - ui/src/main/res/values-zh-rCN/strings.xml | 1 - ui/src/main/res/values/strings.xml | 2 +- 10 files changed, 16 insertions(+), 25 deletions(-) create mode 100644 ui/src/main/res/drawable/ic_action_generate.xml 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 @@ + + + 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()}" /> - - टनल को लाने में त्रुटि: %s निजी आईपी को छोड़ दें निकाले गए ऐप्स - उत्पन्न अज्ञात “%s” त्रुटि (ऑटो) (उत्पन्न) 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 @@ Kesalahan menambahkan tunel: %s Kecualikan IP pribadi Kecualikan aplikasi - Generate Eror “%s” Tidak diketahui (otomatis) (generate) 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 @@ Errore di attivazione del tunnel: %s Escludi IP privati Applicazioni escluse - Genera Errore “%s” sconosciuto (auto) (generato) 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 @@ トンネル起動時エラー: %s プライベート IP アドレスを除外 対象外とするアプリケーション - 生成 未知の “%s” エラー (自動) (生成済み) 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 @@ Ошибка при запуске туннеля: %s Исключить частные IP-адреса Исключенные приложения - Создать Неизвестная “%s” ошибка (авто) (авто) 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 @@ 建立连接时出错:%s 排除局域网 排除的应用 - 生成密钥 未知的 “%s” 错误 (自动) (生成) 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 @@ Error bringing up tunnel: %s Exclude private IPs Excluded Applications - Generate + Generate new private key Unknown “%s” error (auto) (generated)