From b439322776516aa755526c8f9b8774d41d8a47f6 Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Wed, 16 Mar 2022 11:59:39 +0000 Subject: [PATCH 01/21] adding debug flag for enabling the new combined signup/choose server screen --- .../app/features/debug/features/DebugFeaturesStateFactory.kt | 5 +++++ .../app/features/debug/features/DebugVectorFeatures.kt | 4 ++++ .../src/main/java/im/vector/app/features/VectorFeatures.kt | 2 ++ 3 files changed, 11 insertions(+) diff --git a/vector/src/debug/java/im/vector/app/features/debug/features/DebugFeaturesStateFactory.kt b/vector/src/debug/java/im/vector/app/features/debug/features/DebugFeaturesStateFactory.kt index 60024d4c19..069b303b42 100644 --- a/vector/src/debug/java/im/vector/app/features/debug/features/DebugFeaturesStateFactory.kt +++ b/vector/src/debug/java/im/vector/app/features/debug/features/DebugFeaturesStateFactory.kt @@ -54,6 +54,11 @@ class DebugFeaturesStateFactory @Inject constructor( key = DebugFeatureKeys.onboardingPersonalize, factory = VectorFeatures::isOnboardingPersonalizeEnabled ), + createBooleanFeature( + label = "FTUE Personalize combined choose server", + key = DebugFeatureKeys.onboardingCombinedChooseServer, + factory = VectorFeatures::isOnboardingCombinedChooseServerEnabled + ), createBooleanFeature( label = "Live location sharing", key = DebugFeatureKeys.liveLocationSharing, diff --git a/vector/src/debug/java/im/vector/app/features/debug/features/DebugVectorFeatures.kt b/vector/src/debug/java/im/vector/app/features/debug/features/DebugVectorFeatures.kt index ec3de1408a..62997d907f 100644 --- a/vector/src/debug/java/im/vector/app/features/debug/features/DebugVectorFeatures.kt +++ b/vector/src/debug/java/im/vector/app/features/debug/features/DebugVectorFeatures.kt @@ -54,6 +54,9 @@ class DebugVectorFeatures( override fun isOnboardingPersonalizeEnabled(): Boolean = read(DebugFeatureKeys.onboardingPersonalize) ?: vectorFeatures.isOnboardingPersonalizeEnabled() + override fun isOnboardingCombinedChooseServerEnabled(): Boolean = read(DebugFeatureKeys.onboardingCombinedChooseServer) + ?: vectorFeatures.isOnboardingCombinedChooseServerEnabled() + override fun isLiveLocationEnabled(): Boolean = read(DebugFeatureKeys.liveLocationSharing) ?: vectorFeatures.isLiveLocationEnabled() @@ -109,5 +112,6 @@ object DebugFeatureKeys { val onboardingSplashCarousel = booleanPreferencesKey("onboarding-splash-carousel") val onboardingUseCase = booleanPreferencesKey("onbboarding-splash-carousel") val onboardingPersonalize = booleanPreferencesKey("onbboarding-personalize") + val onboardingCombinedChooseServer = booleanPreferencesKey("onbboarding-combined-choose-server") val liveLocationSharing = booleanPreferencesKey("live-location-sharing") } diff --git a/vector/src/main/java/im/vector/app/features/VectorFeatures.kt b/vector/src/main/java/im/vector/app/features/VectorFeatures.kt index 52ad9242f4..cdb82af827 100644 --- a/vector/src/main/java/im/vector/app/features/VectorFeatures.kt +++ b/vector/src/main/java/im/vector/app/features/VectorFeatures.kt @@ -25,6 +25,7 @@ interface VectorFeatures { fun isOnboardingSplashCarouselEnabled(): Boolean fun isOnboardingUseCaseEnabled(): Boolean fun isOnboardingPersonalizeEnabled(): Boolean + fun isOnboardingCombinedChooseServerEnabled(): Boolean fun isLiveLocationEnabled(): Boolean enum class OnboardingVariant { @@ -40,5 +41,6 @@ class DefaultVectorFeatures : VectorFeatures { override fun isOnboardingSplashCarouselEnabled() = true override fun isOnboardingUseCaseEnabled() = true override fun isOnboardingPersonalizeEnabled() = false + override fun isOnboardingCombinedChooseServerEnabled() = false override fun isLiveLocationEnabled(): Boolean = BuildConfig.ENABLE_LIVE_LOCATION_SHARING } From 2cbbfca73fdffba98d4acc771592f4f23d02b5c2 Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Wed, 23 Mar 2022 16:27:42 +0000 Subject: [PATCH 02/21] adding helper for recalculating percentage heights within a constraint layout - this allows percentages to be used which make of the screen viewport rather than the accumulated scroll height --- .../app/core/extensions/ConstraintLayout.kt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/vector/src/main/java/im/vector/app/core/extensions/ConstraintLayout.kt b/vector/src/main/java/im/vector/app/core/extensions/ConstraintLayout.kt index b1b30da156..46d173b848 100644 --- a/vector/src/main/java/im/vector/app/core/extensions/ConstraintLayout.kt +++ b/vector/src/main/java/im/vector/app/core/extensions/ConstraintLayout.kt @@ -16,8 +16,12 @@ package im.vector.app.core.extensions +import android.view.View import androidx.constraintlayout.widget.ConstraintLayout import androidx.constraintlayout.widget.ConstraintSet +import androidx.core.view.children +import androidx.core.view.doOnLayout +import kotlin.math.roundToInt fun ConstraintLayout.updateConstraintSet(block: (ConstraintSet) -> Unit) { ConstraintSet().let { @@ -26,3 +30,16 @@ fun ConstraintLayout.updateConstraintSet(block: (ConstraintSet) -> Unit) { it.applyTo(this) } } + +fun ConstraintLayout.realignPercentagesToParent() { + doOnLayout { + val rootHeight = (parent as View).height + children.forEach { child -> + val params = child.layoutParams as ConstraintLayout.LayoutParams + if (params.matchConstraintPercentHeight != 1.0f) { + params.height = (rootHeight * params.matchConstraintPercentHeight).roundToInt() + child.layoutParams = params + } + } + } +} From 7e5c3df7a7b685bca38c6f8315e3859a76efd611 Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Wed, 23 Mar 2022 16:46:14 +0000 Subject: [PATCH 03/21] adding combined server selection/sign up fragment --- .../res/values/styles_text_input_layout.xml | 5 + .../onboarding/OnboardingViewEvents.kt | 1 + .../onboarding/OnboardingViewModel.kt | 8 +- .../FtueAuthChooseDisplayNameFragment.kt | 1 + .../FtueAuthCombinedSignUpFragment.kt | 220 +++++++++++++ .../onboarding/ftueauth/FtueAuthVariant.kt | 21 +- .../res/layout/fragment_ftue_display_name.xml | 4 +- .../layout/fragment_ftue_profile_picture.xml | 6 +- .../layout/fragment_ftue_sign_up_combined.xml | 289 ++++++++++++++++++ vector/src/main/res/values/donottranslate.xml | 7 + 10 files changed, 552 insertions(+), 10 deletions(-) create mode 100644 vector/src/main/java/im/vector/app/features/onboarding/ftueauth/FtueAuthCombinedSignUpFragment.kt create mode 100644 vector/src/main/res/layout/fragment_ftue_sign_up_combined.xml diff --git a/library/ui-styles/src/main/res/values/styles_text_input_layout.xml b/library/ui-styles/src/main/res/values/styles_text_input_layout.xml index 95a406ea5c..d8e7d598d5 100644 --- a/library/ui-styles/src/main/res/values/styles_text_input_layout.xml +++ b/library/ui-styles/src/main/res/values/styles_text_input_layout.xml @@ -9,6 +9,11 @@ ?vctr_content_secondary + +