mirror of
https://github.com/android-password-store/Android-Password-Store
synced 2025-08-29 13:27:46 +00:00
Redo authentication modes UI with Chips (#1297)
This commit is contained in:
parent
4b892c328d
commit
ea24056554
@ -63,8 +63,8 @@ class GitServerConfigActivity : BaseGitActivity() {
|
|||||||
AuthMode.OpenKeychain -> check(binding.authModeOpenKeychain.id)
|
AuthMode.OpenKeychain -> check(binding.authModeOpenKeychain.id)
|
||||||
AuthMode.None -> check(View.NO_ID)
|
AuthMode.None -> check(View.NO_ID)
|
||||||
}
|
}
|
||||||
addOnButtonCheckedListener { _, _, _ ->
|
setOnCheckedChangeListener { _, checkedId ->
|
||||||
when (checkedButtonId) {
|
when (checkedId) {
|
||||||
binding.authModeSshKey.id -> newAuthMode = AuthMode.SshKey
|
binding.authModeSshKey.id -> newAuthMode = AuthMode.SshKey
|
||||||
binding.authModeOpenKeychain.id -> newAuthMode = AuthMode.OpenKeychain
|
binding.authModeOpenKeychain.id -> newAuthMode = AuthMode.OpenKeychain
|
||||||
binding.authModePassword.id -> newAuthMode = AuthMode.Password
|
binding.authModePassword.id -> newAuthMode = AuthMode.Password
|
||||||
@ -184,13 +184,13 @@ class GitServerConfigActivity : BaseGitActivity() {
|
|||||||
authModeSshKey.isVisible = false
|
authModeSshKey.isVisible = false
|
||||||
authModeOpenKeychain.isVisible = false
|
authModeOpenKeychain.isVisible = false
|
||||||
authModePassword.isVisible = true
|
authModePassword.isVisible = true
|
||||||
if (authModeGroup.checkedButtonId != authModePassword.id)
|
if (authModeGroup.checkedChipId != authModePassword.id)
|
||||||
authModeGroup.check(View.NO_ID)
|
authModeGroup.check(View.NO_ID)
|
||||||
} else {
|
} else {
|
||||||
authModeSshKey.isVisible = true
|
authModeSshKey.isVisible = true
|
||||||
authModeOpenKeychain.isVisible = true
|
authModeOpenKeychain.isVisible = true
|
||||||
authModePassword.isVisible = true
|
authModePassword.isVisible = true
|
||||||
if (authModeGroup.checkedButtonId == View.NO_ID)
|
if (authModeGroup.checkedChipId == View.NO_ID)
|
||||||
authModeGroup.check(authModeSshKey.id)
|
authModeGroup.check(authModeSshKey.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
9
app/src/main/res/color/chip_surface_color.xml
Normal file
9
app/src/main/res/color/chip_surface_color.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
|
~ Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved.
|
||||||
|
~ SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
-->
|
||||||
|
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:color="@color/secondary_light_color" android:state_checked="true"/>
|
||||||
|
<item android:color="?attr/colorSecondary"/>
|
||||||
|
</selector>
|
9
app/src/main/res/color/chip_text_color.xml
Normal file
9
app/src/main/res/color/chip_text_color.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
|
~ Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved.
|
||||||
|
~ SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
-->
|
||||||
|
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:color="?attr/colorSurface" android:state_checked="true"/>
|
||||||
|
<item android:color="?attr/colorOnSecondary"/>
|
||||||
|
</selector>
|
@ -33,8 +33,7 @@
|
|||||||
android:id="@+id/label_server_url"
|
android:id="@+id/label_server_url"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="8dp"
|
android:layout_margin="8dp"
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:hint="@string/server_url"
|
android:hint="@string/server_url"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
@ -54,8 +53,7 @@
|
|||||||
android:id="@+id/label_server_branch"
|
android:id="@+id/label_server_branch"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="8dp"
|
android:layout_margin="8dp"
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:hint="@string/server_branch"
|
android:hint="@string/server_branch"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
@ -82,51 +80,36 @@
|
|||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/label_server_branch" />
|
app:layout_constraintTop_toBottomOf="@id/label_server_branch" />
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButtonToggleGroup
|
<com.google.android.material.chip.ChipGroup
|
||||||
android:id="@+id/auth_mode_group"
|
android:id="@+id/auth_mode_group"
|
||||||
style="@style/TextAppearance.MaterialComponents.Headline1"
|
android:layout_width="wrap_content"
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="8dp"
|
android:layout_margin="8dp"
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/label_auth_mode"
|
app:layout_constraintTop_toBottomOf="@id/label_auth_mode"
|
||||||
app:singleSelection="true">
|
app:singleSelection="true">
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.chip.Chip
|
||||||
android:id="@+id/auth_mode_ssh_key"
|
android:id="@+id/auth_mode_ssh_key"
|
||||||
style="?attr/materialButtonOutlinedStyle"
|
style="@style/AppTheme.Chip.Choice"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:text="@string/connection_mode_ssh_key" />
|
||||||
android:minWidth="0dp"
|
|
||||||
android:padding="8dp"
|
|
||||||
android:text="@string/connection_mode_ssh_key"
|
|
||||||
android:textSize="@dimen/toggle_group_text_size" />
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.chip.Chip
|
||||||
android:id="@+id/auth_mode_password"
|
android:id="@+id/auth_mode_password"
|
||||||
style="?attr/materialButtonOutlinedStyle"
|
style="@style/AppTheme.Chip.Choice"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:text="@string/connection_mode_basic_authentication" />
|
||||||
android:minWidth="0dp"
|
|
||||||
android:padding="8dp"
|
|
||||||
android:text="@string/connection_mode_basic_authentication"
|
|
||||||
android:textSize="@dimen/toggle_group_text_size" />
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.chip.Chip
|
||||||
android:id="@+id/auth_mode_open_keychain"
|
android:id="@+id/auth_mode_open_keychain"
|
||||||
style="?attr/materialButtonOutlinedStyle"
|
style="@style/AppTheme.Chip.Choice"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:text="@string/connection_mode_openkeychain" />
|
||||||
android:minWidth="0dp"
|
</com.google.android.material.chip.ChipGroup>
|
||||||
android:padding="8dp"
|
|
||||||
android:text="@string/connection_mode_openkeychain"
|
|
||||||
android:textSize="@dimen/toggle_group_text_size" />
|
|
||||||
</com.google.android.material.button.MaterialButtonToggleGroup>
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
android:id="@+id/save_button"
|
android:id="@+id/save_button"
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
<color name="primary_color">#ff111111</color>
|
<color name="primary_color">#ff111111</color>
|
||||||
<color name="primary_light_color">#ff373737</color>
|
<color name="primary_light_color">#ff373737</color>
|
||||||
<color name="secondary_color">#ff3b6888</color>
|
<color name="secondary_color">#ff3b6888</color>
|
||||||
|
<color name="secondary_light_color">#ff6b96b8</color>
|
||||||
<color name="primary_text_color">#ffffffff</color>
|
<color name="primary_text_color">#ffffffff</color>
|
||||||
|
|
||||||
<!-- Theme variables -->
|
<!-- Theme variables -->
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
<color name="primary_light_color">@color/white</color>
|
<color name="primary_light_color">@color/white</color>
|
||||||
<color name="secondary_color">#003e5b</color>
|
<color name="secondary_color">#003e5b</color>
|
||||||
<color name="secondary_dark_color">#001831</color>
|
<color name="secondary_dark_color">#001831</color>
|
||||||
|
<color name="secondary_light_color">#3b6888</color>
|
||||||
<color name="primary_text_color">#212121</color>
|
<color name="primary_text_color">#212121</color>
|
||||||
<color name="white">#ffffffff</color>
|
<color name="white">#ffffffff</color>
|
||||||
|
|
||||||
|
@ -5,34 +5,6 @@
|
|||||||
|
|
||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<!-- Base application theme. -->
|
|
||||||
<style name="APSTheme" parent="Theme.MaterialComponents.DayNight">
|
|
||||||
<item name="colorPrimary">@color/primary_color</item>
|
|
||||||
<item name="colorOnPrimary">@color/color_control_normal</item>
|
|
||||||
<item name="colorPrimaryDark">@color/primary_color</item>
|
|
||||||
<item name="colorPrimaryVariant">@color/primary_light_color</item>
|
|
||||||
<item name="colorSecondary">@color/secondary_color</item>
|
|
||||||
<item name="colorSecondaryVariant">@color/secondary_dark_color</item>
|
|
||||||
<item name="colorOnSecondary">@color/white</item>
|
|
||||||
<item name="colorSurface">@color/primary_color</item>
|
|
||||||
<item name="colorOnSurface">@color/color_control_normal</item>
|
|
||||||
<item name="colorControlNormal">@color/color_control_normal</item>
|
|
||||||
<item name="android:textColor">@color/primary_text_color</item>
|
|
||||||
<item name="android:colorBackgroundFloating">@color/primary_color</item>
|
|
||||||
<item name="android:statusBarColor">@color/status_bar_color</item>
|
|
||||||
<item name="android:navigationBarColor">@color/navigation_bar_color</item>
|
|
||||||
<item name="android:windowLightStatusBar">@bool/light_status_bar</item>
|
|
||||||
<item name="actionModeStyle">@style/ActionMode</item>
|
|
||||||
<item name="alertDialogTheme">@style/AppTheme.Dialog</item>
|
|
||||||
<item name="materialAlertDialogTheme">@style/AppTheme.Dialog</item>
|
|
||||||
<item name="materialButtonStyle">@style/AppTheme.MaterialButton</item>
|
|
||||||
<item name="materialButtonOutlinedStyle">@style/AppTheme.OutlinedButton</item>
|
|
||||||
<item name="bottomSheetDialogTheme">@style/BottomSheetDialogTheme</item>
|
|
||||||
<item name="textInputStyle">@style/AppTheme.TextInputLayout</item>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<style name="AppTheme" parent="APSTheme" />
|
|
||||||
|
|
||||||
<style name="AppTheme.TextInputLayout" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
|
<style name="AppTheme.TextInputLayout" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
|
||||||
<item name="boxStrokeColor">@color/outlined_box_selector</item>
|
<item name="boxStrokeColor">@color/outlined_box_selector</item>
|
||||||
<item name="hintTextColor">?attr/colorSecondary</item>
|
<item name="hintTextColor">?attr/colorSecondary</item>
|
||||||
@ -63,6 +35,22 @@
|
|||||||
<item name="colorSecondary">@color/secondary_color</item>
|
<item name="colorSecondary">@color/secondary_color</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="AppTheme.Chip.Choice" parent="Widget.MaterialComponents.Chip.Choice">
|
||||||
|
<item name="chipSurfaceColor">@color/chip_surface_color</item>
|
||||||
|
<item name="android:textColor">@color/chip_text_color</item>
|
||||||
|
<item name="shapeAppearanceOverlay">@style/ShapeAppearance.AppTheme.SmallComponent</item>
|
||||||
|
<item name="textAppearanceBody2">@style/TextAppearance.AppTheme.Body2</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="TextAppearance.AppTheme.Body2" parent="TextAppearance.MaterialComponents.Body2">
|
||||||
|
<item name="android:textStyle">bold</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="ShapeAppearance.AppTheme.SmallComponent" parent="ShapeAppearance.MaterialComponents.SmallComponent">
|
||||||
|
<item name="cornerFamily">rounded</item>
|
||||||
|
<item name="cornerSize">8dp</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
<style name="ActionMode" parent="@style/Widget.AppCompat.ActionMode">
|
<style name="ActionMode" parent="@style/Widget.AppCompat.ActionMode">
|
||||||
<item name="background">@color/primary_color</item>
|
<item name="background">@color/primary_color</item>
|
||||||
</style>
|
</style>
|
||||||
|
34
app/src/main/res/values/themes.xml
Normal file
34
app/src/main/res/values/themes.xml
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
|
~ Copyright © 2014-2020 The Android Password Store Authors. All Rights Reserved.
|
||||||
|
~ SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
-->
|
||||||
|
|
||||||
|
<resources>
|
||||||
|
<!-- Base application theme. -->
|
||||||
|
<style name="APSTheme" parent="Theme.MaterialComponents.DayNight">
|
||||||
|
<item name="colorPrimary">@color/primary_color</item>
|
||||||
|
<item name="colorOnPrimary">@color/color_control_normal</item>
|
||||||
|
<item name="colorPrimaryDark">@color/primary_color</item>
|
||||||
|
<item name="colorPrimaryVariant">@color/primary_light_color</item>
|
||||||
|
<item name="colorSecondary">@color/secondary_color</item>
|
||||||
|
<item name="colorSecondaryVariant">@color/secondary_dark_color</item>
|
||||||
|
<item name="colorOnSecondary">@color/white</item>
|
||||||
|
<item name="colorSurface">@color/primary_color</item>
|
||||||
|
<item name="colorOnSurface">@color/color_control_normal</item>
|
||||||
|
<item name="colorControlNormal">@color/color_control_normal</item>
|
||||||
|
<item name="android:textColor">@color/primary_text_color</item>
|
||||||
|
<item name="android:colorBackgroundFloating">@color/primary_color</item>
|
||||||
|
<item name="android:statusBarColor">@color/status_bar_color</item>
|
||||||
|
<item name="android:navigationBarColor">@color/navigation_bar_color</item>
|
||||||
|
<item name="android:windowLightStatusBar">@bool/light_status_bar</item>
|
||||||
|
<item name="actionModeStyle">@style/ActionMode</item>
|
||||||
|
<item name="alertDialogTheme">@style/AppTheme.Dialog</item>
|
||||||
|
<item name="materialAlertDialogTheme">@style/AppTheme.Dialog</item>
|
||||||
|
<item name="materialButtonStyle">@style/AppTheme.MaterialButton</item>
|
||||||
|
<item name="materialButtonOutlinedStyle">@style/AppTheme.OutlinedButton</item>
|
||||||
|
<item name="bottomSheetDialogTheme">@style/BottomSheetDialogTheme</item>
|
||||||
|
<item name="textInputStyle">@style/AppTheme.TextInputLayout</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="AppTheme" parent="APSTheme" />
|
||||||
|
</resources>
|
Loading…
x
Reference in New Issue
Block a user