From ea24056554f307f4f8f84b0ab6a808730d6acfa4 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Sun, 7 Feb 2021 12:49:00 +0530 Subject: Redo authentication modes UI with Chips (#1297) --- .../aps/ui/git/config/GitServerConfigActivity.kt | 8 ++-- app/src/main/res/color/chip_surface_color.xml | 9 +++++ app/src/main/res/color/chip_text_color.xml | 9 +++++ app/src/main/res/layout/activity_git_clone.xml | 47 +++++++--------------- app/src/main/res/values-night/colors.xml | 1 + app/src/main/res/values-v27/styles.xml | 11 ----- app/src/main/res/values-v27/themes.xml | 11 +++++ app/src/main/res/values/colors.xml | 1 + app/src/main/res/values/styles.xml | 44 ++++++++------------ app/src/main/res/values/themes.xml | 34 ++++++++++++++++ 10 files changed, 100 insertions(+), 75 deletions(-) create mode 100644 app/src/main/res/color/chip_surface_color.xml create mode 100644 app/src/main/res/color/chip_text_color.xml delete mode 100644 app/src/main/res/values-v27/styles.xml create mode 100644 app/src/main/res/values-v27/themes.xml create mode 100644 app/src/main/res/values/themes.xml (limited to 'app') diff --git a/app/src/main/java/dev/msfjarvis/aps/ui/git/config/GitServerConfigActivity.kt b/app/src/main/java/dev/msfjarvis/aps/ui/git/config/GitServerConfigActivity.kt index a964e150..0c250d87 100644 --- a/app/src/main/java/dev/msfjarvis/aps/ui/git/config/GitServerConfigActivity.kt +++ b/app/src/main/java/dev/msfjarvis/aps/ui/git/config/GitServerConfigActivity.kt @@ -63,8 +63,8 @@ class GitServerConfigActivity : BaseGitActivity() { AuthMode.OpenKeychain -> check(binding.authModeOpenKeychain.id) AuthMode.None -> check(View.NO_ID) } - addOnButtonCheckedListener { _, _, _ -> - when (checkedButtonId) { + setOnCheckedChangeListener { _, checkedId -> + when (checkedId) { binding.authModeSshKey.id -> newAuthMode = AuthMode.SshKey binding.authModeOpenKeychain.id -> newAuthMode = AuthMode.OpenKeychain binding.authModePassword.id -> newAuthMode = AuthMode.Password @@ -184,13 +184,13 @@ class GitServerConfigActivity : BaseGitActivity() { authModeSshKey.isVisible = false authModeOpenKeychain.isVisible = false authModePassword.isVisible = true - if (authModeGroup.checkedButtonId != authModePassword.id) + if (authModeGroup.checkedChipId != authModePassword.id) authModeGroup.check(View.NO_ID) } else { authModeSshKey.isVisible = true authModeOpenKeychain.isVisible = true authModePassword.isVisible = true - if (authModeGroup.checkedButtonId == View.NO_ID) + if (authModeGroup.checkedChipId == View.NO_ID) authModeGroup.check(authModeSshKey.id) } } diff --git a/app/src/main/res/color/chip_surface_color.xml b/app/src/main/res/color/chip_surface_color.xml new file mode 100644 index 00000000..e436e156 --- /dev/null +++ b/app/src/main/res/color/chip_surface_color.xml @@ -0,0 +1,9 @@ + + + + + + diff --git a/app/src/main/res/color/chip_text_color.xml b/app/src/main/res/color/chip_text_color.xml new file mode 100644 index 00000000..53c118a3 --- /dev/null +++ b/app/src/main/res/color/chip_text_color.xml @@ -0,0 +1,9 @@ + + + + + + diff --git a/app/src/main/res/layout/activity_git_clone.xml b/app/src/main/res/layout/activity_git_clone.xml index 890cc19b..5e29e06f 100644 --- a/app/src/main/res/layout/activity_git_clone.xml +++ b/app/src/main/res/layout/activity_git_clone.xml @@ -33,8 +33,7 @@ android:id="@+id/label_server_url" android:layout_width="0dp" android:layout_height="wrap_content" - android:layout_marginStart="8dp" - android:layout_marginTop="8dp" + android:layout_margin="8dp" android:hint="@string/server_url" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" @@ -54,8 +53,7 @@ android:id="@+id/label_server_branch" android:layout_width="0dp" android:layout_height="wrap_content" - android:layout_marginStart="8dp" - android:layout_marginTop="8dp" + android:layout_margin="8dp" android:hint="@string/server_branch" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" @@ -82,51 +80,36 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/label_server_branch" /> - - + android:text="@string/connection_mode_ssh_key" /> - + android:text="@string/connection_mode_basic_authentication" /> - - + android:text="@string/connection_mode_openkeychain" /> + #ff111111 #ff373737 #ff3b6888 + #ff6b96b8 #ffffffff diff --git a/app/src/main/res/values-v27/styles.xml b/app/src/main/res/values-v27/styles.xml deleted file mode 100644 index eeb92876..00000000 --- a/app/src/main/res/values-v27/styles.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - diff --git a/app/src/main/res/values-v27/themes.xml b/app/src/main/res/values-v27/themes.xml new file mode 100644 index 00000000..eeb92876 --- /dev/null +++ b/app/src/main/res/values-v27/themes.xml @@ -0,0 +1,11 @@ + + + + + + diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index b090c761..5d2f769f 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -9,6 +9,7 @@ @color/white #003e5b #001831 + #3b6888 #212121 #ffffffff diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 8b42d91e..293bdb9b 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -5,34 +5,6 @@ - - - - + + + + + + diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml new file mode 100644 index 00000000..bf32180c --- /dev/null +++ b/app/src/main/res/values/themes.xml @@ -0,0 +1,34 @@ + + + + + + +