From 94dc92f8d70870b57a7f8c4fe8adef152c1211ce Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Sun, 10 May 2020 14:25:59 +0530 Subject: Miscellaneous UI tweaking (#771) * Remove dangling UI element and relayout authentication modes * Drop unnecessary actionBarPopupTheme declaration * Improve ssh keygen UI * Commonize button styling * Tweak save button in server config * Tweak generate button in ssh keygen * Commonize OutlinedButton style Signed-off-by: Harsh Shandilya --- .../zeapo/pwdstore/sshkeygen/SshKeyGenFragment.kt | 17 +--------- app/src/main/res/layout/activity_git_clone.xml | 38 +++++++--------------- app/src/main/res/layout/activity_git_config.xml | 9 ----- app/src/main/res/layout/decrypt_layout.xml | 5 +-- app/src/main/res/layout/encrypt_layout.xml | 3 -- app/src/main/res/layout/fragment_autofill.xml | 3 -- app/src/main/res/layout/fragment_ssh_keygen.xml | 35 +++++--------------- .../main/res/layout/fragment_to_clone_or_not.xml | 12 +------ app/src/main/res/values/styles.xml | 16 ++++++++- 9 files changed, 38 insertions(+), 100 deletions(-) (limited to 'app/src') diff --git a/app/src/main/java/com/zeapo/pwdstore/sshkeygen/SshKeyGenFragment.kt b/app/src/main/java/com/zeapo/pwdstore/sshkeygen/SshKeyGenFragment.kt index da7099ad..e16af70a 100644 --- a/app/src/main/java/com/zeapo/pwdstore/sshkeygen/SshKeyGenFragment.kt +++ b/app/src/main/java/com/zeapo/pwdstore/sshkeygen/SshKeyGenFragment.kt @@ -5,7 +5,6 @@ package com.zeapo.pwdstore.sshkeygen import android.os.Bundle -import android.text.InputType import android.view.LayoutInflater import android.view.View import android.view.ViewGroup @@ -47,19 +46,6 @@ class SshKeyGenFragment : Fragment() { generate.setOnClickListener { lifecycleScope.launch { generate(passphrase.text.toString(), comment.text.toString()) } } - showPassphrase.setOnCheckedChangeListener { _, isChecked: Boolean -> - val selection = passphrase.selectionEnd - if (isChecked) { - passphrase.inputType = ( - InputType.TYPE_CLASS_TEXT - or InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD) - } else { - passphrase.inputType = ( - InputType.TYPE_CLASS_TEXT - or InputType.TYPE_TEXT_VARIATION_PASSWORD) - } - passphrase.setSelection(selection) - } keyLengthGroup.check(R.id.key_length_4096) keyLengthGroup.addOnButtonCheckedListener { _, checkedId, isChecked -> if (isChecked) { @@ -82,10 +68,9 @@ class SshKeyGenFragment : Fragment() { // ShowSshKeyFragment which displays the public key. private suspend fun generate(passphrase: String, comment: String) { binding.generate.text = getString(R.string.ssh_key_gen_generating_progress) - val jsch = JSch() val e = try { withContext(Dispatchers.IO) { - val kp = KeyPair.genKeyPair(jsch, KeyPair.RSA, keyLength) + val kp = KeyPair.genKeyPair(JSch(), KeyPair.RSA, keyLength) var file = File(requireActivity().filesDir, ".ssh_key") var out = FileOutputStream(file, false) if (passphrase.isNotEmpty()) { diff --git a/app/src/main/res/layout/activity_git_clone.xml b/app/src/main/res/layout/activity_git_clone.xml index e5d41059..d4113cd6 100644 --- a/app/src/main/res/layout/activity_git_clone.xml +++ b/app/src/main/res/layout/activity_git_clone.xml @@ -33,15 +33,6 @@ app:layout_constraintTop_toBottomOf="@id/server_label" app:layout_constraintStart_toStartOf="parent" /> - - + android:text="@string/clone_protocol_ssh" /> + android:text="@string/clone_protocol_https" /> @@ -168,38 +151,39 @@ android:id="@+id/connection_mode_ssh_key" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:padding="4dp" android:text="@string/connection_mode_ssh_key" /> + app:layout_constraintEnd_toEndOf="parent" /> diff --git a/app/src/main/res/layout/activity_git_config.xml b/app/src/main/res/layout/activity_git_config.xml index 0ea45c55..e9d769b8 100644 --- a/app/src/main/res/layout/activity_git_config.xml +++ b/app/src/main/res/layout/activity_git_config.xml @@ -45,14 +45,11 @@ @@ -88,25 +85,19 @@ tools:text="HASH"/> diff --git a/app/src/main/res/layout/decrypt_layout.xml b/app/src/main/res/layout/decrypt_layout.xml index 8f8198a4..71566178 100644 --- a/app/src/main/res/layout/decrypt_layout.xml +++ b/app/src/main/res/layout/decrypt_layout.xml @@ -95,15 +95,12 @@ android:typeface="monospace" /> + app:layout_constraintTop_toBottomOf="@id/crypto_password_show_label" /> diff --git a/app/src/main/res/layout/encrypt_layout.xml b/app/src/main/res/layout/encrypt_layout.xml index 54b1c7c9..3b0b8068 100644 --- a/app/src/main/res/layout/encrypt_layout.xml +++ b/app/src/main/res/layout/encrypt_layout.xml @@ -53,14 +53,11 @@ diff --git a/app/src/main/res/layout/fragment_autofill.xml b/app/src/main/res/layout/fragment_autofill.xml index 29d0f517..21a9d95a 100644 --- a/app/src/main/res/layout/fragment_autofill.xml +++ b/app/src/main/res/layout/fragment_autofill.xml @@ -59,14 +59,11 @@ android:layout_weight="1"/> + android:text="@string/key_length_2048" /> + android:text="@string/key_length_4096" /> + android:hint="@string/ssh_keygen_passphrase" + app:endIconMode="password_toggle"> - - - + android:text="@string/ssh_keygen_generate" /> diff --git a/app/src/main/res/layout/fragment_to_clone_or_not.xml b/app/src/main/res/layout/fragment_to_clone_or_not.xml index 045d8d1e..5aa94e8a 100644 --- a/app/src/main/res/layout/fragment_to_clone_or_not.xml +++ b/app/src/main/res/layout/fragment_to_clone_or_not.xml @@ -42,37 +42,27 @@ android:layout_alignParentTop="true" android:layout_alignParentEnd="true" android:layout_marginEnd="@dimen/activity_horizontal_margin" - android:textAllCaps="true" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintEnd_toEndOf="parent" /> diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 7058dcff..1f1bb005 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -19,11 +19,25 @@ @style/ActionMode @style/AppTheme.Dialog @style/AppTheme.Dialog - @style/ThemeOverlay.MaterialComponents.ActionBar + @style/AppTheme.MaterialButton + @style/AppTheme.OutlinedButton @style/TextInputLayoutBase @style/BottomSheetDialogTheme + + + +