TunnelEditor: move generate button to inside box

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2020-03-28 15:21:20 -06:00
parent 5989298d3f
commit bee6ebe3b4
10 changed files with 16 additions and 25 deletions

View File

@ -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

View File

@ -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>

View File

@ -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"

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>