From 9e17ab09d6d3e93e434499b9aa9149fd3e234ee9 Mon Sep 17 00:00:00 2001 From: Hafiz Date: Thu, 26 Jun 2025 15:19:20 -0500 Subject: [PATCH] Introduce generic ConfigurableFormScreen for all settings forms Add FieldConfig and FormScreenConfig data models Implement ConfigurableFormScreen and ComponentTextInput to render any settings screen with AndroidView inputs, styling, and validation Refactor ChangePasswordScreen to use the new generic form instead of its bespoke implementation Preserve existing theming, padding, and error behavior across all screens --- Habitica/res/values-night/colors.xml | 2 + Habitica/res/values/colors.xml | 3 +- Habitica/res/values/strings.xml | 8 + Habitica/res/values/styles.xml | 15 + .../preferences/AccountPreferenceFragment.kt | 10 +- .../preferences/ChangePasswordBottomSheet.kt | 13 +- .../habitica/ui/views/ChangePasswordScreen.kt | 270 -------- .../habitica/ui/views/SettingScreen.kt | 599 ++++++++++++++++++ .../main/res/layout/component_text_input.xml | 5 +- 9 files changed, 641 insertions(+), 284 deletions(-) delete mode 100644 Habitica/src/main/java/com/habitrpg/android/habitica/ui/views/ChangePasswordScreen.kt create mode 100644 Habitica/src/main/java/com/habitrpg/android/habitica/ui/views/SettingScreen.kt diff --git a/Habitica/res/values-night/colors.xml b/Habitica/res/values-night/colors.xml index 812638a21..19c719f21 100644 --- a/Habitica/res/values-night/colors.xml +++ b/Habitica/res/values-night/colors.xml @@ -63,6 +63,7 @@ @color/brand_500 @color/green_500 @color/gray_400 + @color/gray_500 @color/gray_400 @color/gray_10 @color/gray_50 @@ -70,4 +71,5 @@ @color/red_100 @color/brand_600 + diff --git a/Habitica/res/values/colors.xml b/Habitica/res/values/colors.xml index 33617e217..c0dc4a072 100644 --- a/Habitica/res/values/colors.xml +++ b/Habitica/res/values/colors.xml @@ -129,7 +129,8 @@ @color/brand_400 @color/green_10 - @color/gray_10 + @color/gray_100 + @color/gray_100 @color/gray_200 @color/gray_600 @color/gray_600 diff --git a/Habitica/res/values/strings.xml b/Habitica/res/values/strings.xml index cd99fd7b0..6dffe6972 100644 --- a/Habitica/res/values/strings.xml +++ b/Habitica/res/values/strings.xml @@ -628,6 +628,8 @@ Edit your public profile. Display Name Photo URL + You can display an image on your Habitica profile for others to see by adding a link to the image here. + Save Photo URL Login Name About App Settings @@ -635,7 +637,9 @@ Change your authentication options. Change Password Change Email Address + This is the email address that you use to log in to Habitica, as well as receive notifications. Change Username + Usernames must be 1 to 20 characters, containing only letters a to z, numbers 0 to 9, hyphens, or underscores. Change Character Level Auto Allocate Points @@ -763,6 +767,8 @@ Username copied to clipboard One of these Veteran Pets will be waiting for you after you’ve finished confirming! What should we call you? + Change Display Name + This is the name that will be displayed for your avatar in Habitica. Unlike username, it does not have to be a unique identifier. Display names must be between 1 and 30 characters Join Habitica (Check me off!) You can either complete this To Do, edit it, or remove it. @@ -1223,6 +1229,8 @@ My Account Public Profile About Me + Add a small blurb about yourself that will appear on your Habitica profile when others view it. + Save About Me API Account Info Login Methods diff --git a/Habitica/res/values/styles.xml b/Habitica/res/values/styles.xml index c0ba51079..b8d88a68a 100644 --- a/Habitica/res/values/styles.xml +++ b/Habitica/res/values/styles.xml @@ -952,6 +952,21 @@ @style/TaskFormHintTextAppearance + +