From b94b52a42ddc2325b539d0956fd0adcf35308b52 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Fri, 17 Apr 2020 18:36:07 +0530 Subject: Refactor Git related activities (#685) * Refactor git logic into separate parts * Extract hardcoded strings * Add KDoc to updateHostname, remove unused field * Cleanups * Fix dialog message * Wire in repository clone flow * spotless * Remove unused method * Cleanup GitActivity - Rename to GitOperationActivity. - Ensure identityBuilder is always closed regardless of what fragment uses it. - Remove hardcoded "Operation" strings and replace with REQUEST_ARG_OP. - Apply a transparent theme to GitOperationActivity make the UI less jarring. * Tweak some stupidly worded dialog messages As pointed out in #629, these strings are shoddily worded and do not express any clear intent to the user, leaving them confused and angry. * GitOperationActivity: wrap Context to ensure right theme is used * spotless * undo build.gradle change * Use correct parent theme, remove now useless wrapping * GitServerConfigActivity: fix repository clone flow * temp: disable leakcanary framework leaks on Samsung are pissing me off * Make system bars transparent in git activity * Tweak HTTPS password layout * Unhardcode wrong passphrase string * Store SSH passphrase in EncryptedSharedPreferences Also revamp the dialog to look a bit better * Implement support for remembering HTTPS password Fixes #521 * Try to patch HTTPS remote creation logic * Update security-crypto * Clear saved passphrase/password on auth failure * Revert "Update security-crypto" Broken on R DP2.1 This reverts commit 4b20371dd42c512a3dd3b759859abb6c1ffd2961. * Revert "temp: disable leakcanary" This reverts commit 2db7d41bd67b79c6dc8c5b359a7b27100379f45f. * Update CHANGELOG * Remove spacer * Remove useless override * Wrap git server activity in a ScrollView * GitOperation: always finish calling activity when dialogs are dismissed * Wipe saved password/passphrase when hostname changes * Don't commit prefs updates * Don't call listFiles excessively * Finish activity after saving configuration * Make ConnectionMode and Protocol enum classes * Change SSH key passphrase key, don't wipe on host change * Reimplement BaseGitActivity.updateUrl (was updateHostname) * Use SharedPreferences.edit KTX extension * Disable inapplicable connection modes depending on scheme * BaseGitActivity: annotate onDestroy with CallSuper We'll leak the identityBuilder connection otherwise * Move input hack for AlertDialog into an extension function We re-use this in many places * Fix protocol/mode toggle issue and consistenly name options * Fix a crash when opening GitServerConfigActivity without a repo * Fix OpenKeychain callbacks by moving onActivityResult to BaseGitActivity * Run spotlessApply Signed-off-by: Harsh Shandilya Co-authored-by: Fabian Henneke --- app/src/main/res/layout/activity_git_clone.xml | 362 ++++++++++++--------- app/src/main/res/layout/activity_git_config.xml | 5 +- app/src/main/res/layout/autofill_instructions.xml | 1 - app/src/main/res/layout/git_passphrase_layout.xml | 36 +- app/src/main/res/layout/password_recycler_view.xml | 1 - 5 files changed, 219 insertions(+), 186 deletions(-) (limited to 'app/src/main/res/layout') diff --git a/app/src/main/res/layout/activity_git_clone.xml b/app/src/main/res/layout/activity_git_clone.xml index 05d9a557..de9a240e 100644 --- a/app/src/main/res/layout/activity_git_clone.xml +++ b/app/src/main/res/layout/activity_git_clone.xml @@ -1,178 +1,216 @@ - - - - - - - - - + + - - - - - + + + + + + - - - - - - + + + + + + + - - - - - - + + + + + + + + + + + + + + + + - - - - - - + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - + android:textColor="?android:attr/windowBackground" + android:layout_marginTop="8dp" + app:backgroundTint="?attr/colorSecondary" + app:layout_constraintTop_toBottomOf="@id/connection_mode_group" + app:layout_constraintStart_toStartOf="parent" /> + + diff --git a/app/src/main/res/layout/activity_git_config.xml b/app/src/main/res/layout/activity_git_config.xml index a576ec46..94c09e27 100644 --- a/app/src/main/res/layout/activity_git_config.xml +++ b/app/src/main/res/layout/activity_git_config.xml @@ -5,7 +5,7 @@ android:layout_height="match_parent" android:padding="@dimen/activity_horizontal_margin" android:background="?android:attr/windowBackground" - tools:context="com.zeapo.pwdstore.git.GitActivity" + tools:context="com.zeapo.pwdstore.git.GitConfigActivity" tools:layout_editor_absoluteX="0dp" tools:layout_editor_absoluteY="81dp"> @@ -51,7 +51,6 @@ android:layout_height="wrap_content" android:layout_margin="8dp" android:text="@string/crypto_save" - android:onClick="applyGitConfigs" android:textColor="?android:attr/windowBackground" app:backgroundTint="?attr/colorSecondary" app:layout_constraintTop_toBottomOf="@id/email_input_layout" @@ -95,7 +94,6 @@ android:layout_height="wrap_content" android:layout_margin="8dp" android:text="@string/abort_rebase" - android:onClick="abortRebase" android:textColor="?android:attr/windowBackground" app:backgroundTint="?attr/colorSecondary" app:layout_constraintTop_toBottomOf="@id/commit_hash_label" /> @@ -107,7 +105,6 @@ android:layout_height="wrap_content" android:layout_margin="8dp" android:text="@string/reset_to_remote" - android:onClick="resetToRemote" android:textColor="?android:attr/windowBackground" app:backgroundTint="?attr/colorSecondary" app:layout_constraintTop_toBottomOf="@id/git_abort_rebase" /> diff --git a/app/src/main/res/layout/autofill_instructions.xml b/app/src/main/res/layout/autofill_instructions.xml index 8ce0a793..e7cf3dd1 100644 --- a/app/src/main/res/layout/autofill_instructions.xml +++ b/app/src/main/res/layout/autofill_instructions.xml @@ -19,7 +19,6 @@ android:textSize="16sp" /> + android:layout_height="match_parent" + android:padding="16dp"> - + app:layout_constraintTop_toTopOf="parent"> + + - + app:layout_constraintTop_toBottomOf="@+id/git_auth_passphrase_layout" /> diff --git a/app/src/main/res/layout/password_recycler_view.xml b/app/src/main/res/layout/password_recycler_view.xml index dd6b00c1..5368d593 100644 --- a/app/src/main/res/layout/password_recycler_view.xml +++ b/app/src/main/res/layout/password_recycler_view.xml @@ -25,7 +25,6 @@