summaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
authorHarsh Shandilya <msfjarvis@gmail.com>2020-09-21 22:56:34 +0530
committerGitHub <noreply@github.com>2020-09-21 19:26:34 +0200
commit12db2d00df73b150054ddead1b0ee2af0370ddff (patch)
treee2322dc70f7a4bfefb36f4975821c3fef4185a91 /app/src/main
parent37ea5d4a494808ef2a4e45f7458a2948fe76ff53 (diff)
Refactor auth mode check/uncheck (#1115)
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/git/GitServerConfigActivity.kt18
1 files changed, 11 insertions, 7 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/git/GitServerConfigActivity.kt b/app/src/main/java/com/zeapo/pwdstore/git/GitServerConfigActivity.kt
index 0d4246b0..4b220be5 100644
--- a/app/src/main/java/com/zeapo/pwdstore/git/GitServerConfigActivity.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/git/GitServerConfigActivity.kt
@@ -56,16 +56,16 @@ class GitServerConfigActivity : BaseGitActivity() {
binding.authModeGroup.apply {
when (newAuthMode) {
- AuthMode.SshKey -> check(R.id.auth_mode_ssh_key)
- AuthMode.Password -> check(R.id.auth_mode_password)
- AuthMode.OpenKeychain -> check(R.id.auth_mode_open_keychain)
- AuthMode.None -> uncheck(checkedButtonId)
+ AuthMode.SshKey -> check(binding.authModeSshKey.id)
+ AuthMode.Password -> check(binding.authModePassword.id)
+ AuthMode.OpenKeychain -> check(binding.authModeOpenKeychain.id)
+ AuthMode.None -> check(View.NO_ID)
}
addOnButtonCheckedListener { _, _, _ ->
when (checkedButtonId) {
- R.id.auth_mode_ssh_key -> newAuthMode = AuthMode.SshKey
- R.id.auth_mode_open_keychain -> newAuthMode = AuthMode.OpenKeychain
- R.id.auth_mode_password -> newAuthMode = AuthMode.Password
+ binding.authModeSshKey.id -> newAuthMode = AuthMode.SshKey
+ binding.authModeOpenKeychain.id -> newAuthMode = AuthMode.OpenKeychain
+ binding.authModePassword.id -> newAuthMode = AuthMode.Password
View.NO_ID -> newAuthMode = AuthMode.None
}
}
@@ -80,10 +80,14 @@ class GitServerConfigActivity : BaseGitActivity() {
binding.authModeSshKey.isVisible = false
binding.authModeOpenKeychain.isVisible = false
binding.authModePassword.isVisible = true
+ if (binding.authModeGroup.checkedButtonId != binding.authModePassword.id)
+ binding.authModeGroup.check(View.NO_ID)
} else {
binding.authModeSshKey.isVisible = true
binding.authModeOpenKeychain.isVisible = true
binding.authModePassword.isVisible = true
+ if (binding.authModeGroup.checkedButtonId == View.NO_ID)
+ binding.authModeGroup.check(binding.authModeSshKey.id)
}
}