app: switch back to buttons for SSH config screen

This commit is contained in:
Harsh Shandilya 2021-11-01 20:04:57 +05:30
parent f8088f0f44
commit 4a50f3fb6d
No known key found for this signature in database
GPG key ID: 366D7BBAD1031E80
2 changed files with 15 additions and 8 deletions

View file

@ -65,7 +65,11 @@ class GitServerConfigActivity : BaseGitActivity() {
AuthMode.OpenKeychain -> check(binding.authModeOpenKeychain.id)
AuthMode.None -> check(View.NO_ID)
}
setOnCheckedChangeListener { _, checkedId ->
addOnButtonCheckedListener { _, checkedId, isChecked ->
if (!isChecked) {
newAuthMode = AuthMode.None
return@addOnButtonCheckedListener
}
when (checkedId) {
binding.authModeSshKey.id -> newAuthMode = AuthMode.SshKey
binding.authModeOpenKeychain.id -> newAuthMode = AuthMode.OpenKeychain
@ -213,12 +217,12 @@ class GitServerConfigActivity : BaseGitActivity() {
authModeSshKey.isVisible = false
authModeOpenKeychain.isVisible = false
authModePassword.isVisible = true
if (authModeGroup.checkedChipId != authModePassword.id) authModeGroup.check(View.NO_ID)
if (authModeGroup.checkedButtonId != authModePassword.id) authModeGroup.check(View.NO_ID)
} else {
authModeSshKey.isVisible = true
authModeOpenKeychain.isVisible = true
authModePassword.isVisible = true
if (authModeGroup.checkedChipId == View.NO_ID) authModeGroup.check(authModeSshKey.id)
if (authModeGroup.checkedButtonId == View.NO_ID) authModeGroup.check(authModeSshKey.id)
}
}

View file

@ -67,7 +67,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/label_server_branch" />
<com.google.android.material.chip.ChipGroup
<com.google.android.material.button.MaterialButtonToggleGroup
android:id="@+id/auth_mode_group"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -75,24 +75,27 @@
app:layout_constraintTop_toBottomOf="@id/label_auth_mode"
app:singleSelection="true">
<com.google.android.material.chip.Chip
<com.google.android.material.button.MaterialButton
android:id="@+id/auth_mode_ssh_key"
style="?attr/materialButtonOutlinedStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/connection_mode_ssh_key" />
<com.google.android.material.chip.Chip
<com.google.android.material.button.MaterialButton
android:id="@+id/auth_mode_password"
style="?attr/materialButtonOutlinedStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/connection_mode_basic_authentication" />
<com.google.android.material.chip.Chip
<com.google.android.material.button.MaterialButton
android:id="@+id/auth_mode_open_keychain"
style="?attr/materialButtonOutlinedStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/connection_mode_openkeychain" />
</com.google.android.material.chip.ChipGroup>
</com.google.android.material.button.MaterialButtonToggleGroup>
<com.google.android.material.button.MaterialButton
android:id="@+id/save_button"