mirror of
https://github.com/element-hq/element-android
synced 2024-11-27 11:59:12 +03:00
adding personalization complete screen
This commit is contained in:
parent
9f6d3ec380
commit
e3c3db2964
6 changed files with 217 additions and 3 deletions
|
@ -103,6 +103,7 @@ import im.vector.app.features.onboarding.ftueauth.FtueAuthChooseDisplayNameFragm
|
|||
import im.vector.app.features.onboarding.ftueauth.FtueAuthChooseProfilePictureFragment
|
||||
import im.vector.app.features.onboarding.ftueauth.FtueAuthGenericTextInputFormFragment
|
||||
import im.vector.app.features.onboarding.ftueauth.FtueAuthLoginFragment
|
||||
import im.vector.app.features.onboarding.ftueauth.FtueAuthPersonalizationCompleteFragment
|
||||
import im.vector.app.features.onboarding.ftueauth.FtueAuthResetPasswordFragment
|
||||
import im.vector.app.features.onboarding.ftueauth.FtueAuthResetPasswordMailConfirmationFragment
|
||||
import im.vector.app.features.onboarding.ftueauth.FtueAuthResetPasswordSuccessFragment
|
||||
|
@ -491,6 +492,11 @@ interface FragmentModule {
|
|||
@FragmentKey(FtueAuthChooseProfilePictureFragment::class)
|
||||
fun bindFtueAuthChooseProfilePictureFragment(fragment: FtueAuthChooseProfilePictureFragment): Fragment
|
||||
|
||||
@Binds
|
||||
@IntoMap
|
||||
@FragmentKey(FtueAuthPersonalizationCompleteFragment::class)
|
||||
fun bindFtueAuthPersonalizationCompleteFragment(fragment: FtueAuthPersonalizationCompleteFragment): Fragment
|
||||
|
||||
@Binds
|
||||
@IntoMap
|
||||
@FragmentKey(UserListFragment::class)
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* Copyright (c) 2021 New Vector Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package im.vector.app.features.onboarding.ftueauth
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.view.isVisible
|
||||
import im.vector.app.core.animations.play
|
||||
import im.vector.app.databinding.FragmentFtuePersonalizationCompleteBinding
|
||||
import im.vector.app.features.onboarding.OnboardingAction
|
||||
import im.vector.app.features.onboarding.OnboardingViewEvents
|
||||
import javax.inject.Inject
|
||||
|
||||
class FtueAuthPersonalizationCompleteFragment @Inject constructor() : AbstractFtueAuthFragment<FragmentFtuePersonalizationCompleteBinding>() {
|
||||
|
||||
private var hasPlayedConfetti = false
|
||||
|
||||
override fun getBinding(inflater: LayoutInflater, container: ViewGroup?): FragmentFtuePersonalizationCompleteBinding {
|
||||
return FragmentFtuePersonalizationCompleteBinding.inflate(inflater, container, false)
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
setupViews()
|
||||
}
|
||||
|
||||
private fun setupViews() {
|
||||
views.personalizationCompleteCta.debouncedClicks { viewModel.handle(OnboardingAction.PostViewEvent(OnboardingViewEvents.OnTakeMeHome)) }
|
||||
|
||||
if (!hasPlayedConfetti) {
|
||||
hasPlayedConfetti = true
|
||||
views.viewKonfetti.isVisible = true
|
||||
views.viewKonfetti.play()
|
||||
}
|
||||
}
|
||||
|
||||
override fun resetViewModel() {
|
||||
// Nothing to do
|
||||
}
|
||||
|
||||
override fun onBackPressed(toolbarButton: Boolean): Boolean {
|
||||
viewModel.handle(OnboardingAction.PostViewEvent(OnboardingViewEvents.OnTakeMeHome))
|
||||
return true
|
||||
}
|
||||
}
|
|
@ -227,7 +227,7 @@ class FtueAuthVariant(
|
|||
OnboardingViewEvents.OnChooseDisplayName -> onChooseDisplayName()
|
||||
OnboardingViewEvents.OnTakeMeHome -> navigateToHome(createdAccount = true)
|
||||
OnboardingViewEvents.OnChooseProfilePicture -> onChooseProfilePicture()
|
||||
OnboardingViewEvents.OnPersonalizationComplete -> navigateToHome(createdAccount = true)
|
||||
OnboardingViewEvents.OnPersonalizationComplete -> onPersonalizationComplete()
|
||||
OnboardingViewEvents.OnBack -> activity.popBackstack()
|
||||
}.exhaustive
|
||||
}
|
||||
|
@ -393,7 +393,8 @@ class FtueAuthVariant(
|
|||
activity.supportFragmentManager.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||
activity.replaceFragment(
|
||||
views.loginFragmentContainer,
|
||||
FtueAuthAccountCreatedFragment::class.java
|
||||
FtueAuthAccountCreatedFragment::class.java,
|
||||
useCustomAnimation = true
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -416,4 +417,13 @@ class FtueAuthVariant(
|
|||
option = commonOption
|
||||
)
|
||||
}
|
||||
|
||||
private fun onPersonalizationComplete() {
|
||||
activity.supportFragmentManager.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||
activity.replaceFragment(
|
||||
views.loginFragmentContainer,
|
||||
FtueAuthPersonalizationCompleteFragment::class.java,
|
||||
useCustomAnimation = true
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
22
vector/src/main/res/drawable/ic_celebration.xml
Normal file
22
vector/src/main/res/drawable/ic_celebration.xml
Normal file
|
@ -0,0 +1,22 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="70dp"
|
||||
android:height="70dp"
|
||||
android:viewportWidth="70"
|
||||
android:viewportHeight="70">
|
||||
<path
|
||||
android:pathData="M35,70C54.33,70 70,54.33 70,35C70,15.67 54.33,0 35,0C15.67,0 0,15.67 0,35C0,54.33 15.67,70 35,70Z"
|
||||
android:fillColor="#0DBD8B"
|
||||
android:fillType="evenOdd"/>
|
||||
<path
|
||||
android:pathData="M21,23L19,27L23,25L27,27L25,23L27,19L23,21L19,19L21,23Z"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="2"
|
||||
android:fillColor="#ffffff"
|
||||
android:strokeColor="#ffffff"/>
|
||||
<path
|
||||
android:pathData="M35.653,41.423L38.538,50.076L41.422,41.423L50.076,38.538L41.422,35.654L38.538,27L35.653,35.654L27,38.538L35.653,41.423Z"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="2"
|
||||
android:fillColor="#ffffff"
|
||||
android:strokeColor="#ffffff"/>
|
||||
</vector>
|
|
@ -0,0 +1,113 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<nl.dionsegijn.konfetti.KonfettiView
|
||||
android:id="@+id/viewKonfetti"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone" />
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/ftueAuthGutterStart"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="@dimen/ftue_auth_gutter_start_percent" />
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/ftueAuthGutterEnd"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="@dimen/ftue_auth_gutter_end_percent" />
|
||||
|
||||
<Space
|
||||
android:id="@+id/personalizationCompleteSpace1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toTopOf="@id/personalizationCompleteLogo"
|
||||
app:layout_constraintHeight_percent="0.10"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_chainStyle="spread_inside" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/personalizationCompleteLogo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:importantForAccessibility="no"
|
||||
android:src="@drawable/ic_celebration"
|
||||
app:layout_constraintBottom_toTopOf="@id/personalizationCompleteSpace2"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHeight_percent="0.15"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/personalizationCompleteSpace1" />
|
||||
|
||||
<Space
|
||||
android:id="@+id/personalizationCompleteSpace2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toTopOf="@id/personalizationCompleteTitle"
|
||||
app:layout_constraintHeight_percent="0.05"
|
||||
app:layout_constraintTop_toBottomOf="@id/personalizationCompleteLogo" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/personalizationCompleteTitle"
|
||||
style="@style/Widget.Vector.TextView.Title.Medium"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="@string/ftue_personalize_complete_title"
|
||||
android:textColor="?vctr_content_primary"
|
||||
android:transitionName="loginTitleTransition"
|
||||
app:layout_constraintBottom_toTopOf="@id/personalizationCompleteSubtitle"
|
||||
app:layout_constraintEnd_toEndOf="@id/ftueAuthGutterEnd"
|
||||
app:layout_constraintStart_toStartOf="@id/ftueAuthGutterStart"
|
||||
app:layout_constraintTop_toBottomOf="@id/personalizationCompleteSpace2" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/personalizationCompleteSubtitle"
|
||||
style="@style/Widget.Vector.TextView.Subtitle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/ftue_personalize_complete_subtitle"
|
||||
android:textColor="?vctr_content_secondary"
|
||||
app:layout_constraintBottom_toTopOf="@id/personalizationCompleteSpace4"
|
||||
app:layout_constraintEnd_toEndOf="@id/ftueAuthGutterEnd"
|
||||
app:layout_constraintStart_toStartOf="@id/ftueAuthGutterStart"
|
||||
app:layout_constraintTop_toBottomOf="@id/personalizationCompleteTitle" />
|
||||
|
||||
<Space
|
||||
android:id="@+id/personalizationCompleteSpace4"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toTopOf="@id/personalizationCompleteCta"
|
||||
app:layout_constraintTop_toBottomOf="@id/personalizationCompleteSubtitle" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/personalizationCompleteCta"
|
||||
style="@style/Widget.Vector.Button.Login"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?colorSecondary"
|
||||
android:text="@string/ftue_personalize_lets_go"
|
||||
android:textAllCaps="true"
|
||||
app:layout_constraintBottom_toTopOf="@id/personalizationCompleteSpace5"
|
||||
app:layout_constraintEnd_toEndOf="@id/ftueAuthGutterEnd"
|
||||
app:layout_constraintStart_toStartOf="@id/ftueAuthGutterStart"
|
||||
app:layout_constraintTop_toBottomOf="@id/personalizationCompleteSpace4" />
|
||||
|
||||
<Space
|
||||
android:id="@+id/personalizationCompleteSpace5"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintHeight_percent="0.05"
|
||||
app:layout_constraintTop_toBottomOf="@id/personalizationCompleteCta" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -22,7 +22,9 @@
|
|||
|
||||
<string name="ftue_profile_picture_title" translatable="false">Add a profile picture</string>
|
||||
<string name="ftue_profile_picture_subtitle" translatable="false">You can change this anytime.</string>
|
||||
|
||||
<string name="ftue_personalize_lets_go" translatable="false">Let\'s go</string>
|
||||
<string name="ftue_personalize_complete_title" translatable="false">You\'re all set!</string>
|
||||
<string name="ftue_personalize_complete_subtitle" translatable="false">Your preferences have been saved.</string>
|
||||
|
||||
<string name="ftue_personalize_submit" translatable="false">Save and continue</string>
|
||||
<string name="ftue_personalize_skip_this_step" translatable="false">Skip this step</string>
|
||||
|
|
Loading…
Reference in a new issue