-
Notifications
You must be signed in to change notification settings - Fork 741
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5389 from vector-im/feature/adm/personalisation-c…
…omplete FTUE - Personalisation complete
- Loading branch information
Showing
14 changed files
with
307 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Introduces FTUE personalisation complete screen along with confetti celebration |
51 changes: 51 additions & 0 deletions
51
vector/src/main/java/im/vector/app/core/animations/Konfetti.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Copyright (c) 2022 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.core.animations | ||
|
||
import android.content.Context | ||
import androidx.annotation.ColorInt | ||
import androidx.core.content.ContextCompat | ||
import im.vector.app.R | ||
import nl.dionsegijn.konfetti.KonfettiView | ||
import nl.dionsegijn.konfetti.models.Shape | ||
import nl.dionsegijn.konfetti.models.Size | ||
|
||
fun KonfettiView.play() { | ||
val confettiColors = listOf( | ||
R.color.palette_azure, | ||
R.color.palette_grape, | ||
R.color.palette_verde, | ||
R.color.palette_polly, | ||
R.color.palette_melon, | ||
R.color.palette_aqua, | ||
R.color.palette_prune, | ||
R.color.palette_kiwi | ||
) | ||
build() | ||
.addColors(confettiColors.toColorInt(context)) | ||
.setDirection(0.0, 359.0) | ||
.setSpeed(2f, 5f) | ||
.setFadeOutEnabled(true) | ||
.setTimeToLive(2000L) | ||
.addShapes(Shape.Square, Shape.Circle) | ||
.addSizes(Size(12)) | ||
.setPosition(-50f, width + 50f, -50f, -50f) | ||
.streamFor(150, 3000L) | ||
} | ||
|
||
@ColorInt | ||
private fun List<Int>.toColorInt(context: Context) = map { ContextCompat.getColor(context, it) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
...ava/im/vector/app/features/onboarding/ftueauth/FtueAuthPersonalizationCompleteFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<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="M21,23L19,27L23,25L27,27L25,23L27,19L23,21L19,19L21,23Z" | ||
android:strokeLineJoin="round" | ||
android:strokeWidth="2" | ||
android:fillColor="#FF0000" | ||
android:strokeColor="#FF0000"/> | ||
<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="#FF0000" | ||
android:strokeColor="#FF0000"/> | ||
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<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,36.742C40.771,36.742 45.45,31.673 45.45,25.421C45.45,19.169 40.771,14.1 35,14.1C29.229,14.1 24.55,19.169 24.55,25.421C24.55,31.673 29.229,36.742 35,36.742ZM35,62.867C42.531,62.867 49.364,59.879 54.379,55.025C51.278,47.368 43.77,41.967 35,41.967C26.23,41.967 18.722,47.368 15.621,55.025C20.636,59.879 27.469,62.867 35,62.867Z" | ||
android:fillColor="#FF0000" | ||
android:fillType="evenOdd"/> | ||
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.