Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SplashScreen Animation: Add wink animation #5565

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ensure the animation plays out on warm launches
I observed that on warm starts the animation never gets to fully play out, it seems like it's dismissed before being able to finish which makes it look like something is broken.

Therefore we can register an exit animation listener and use the length of the animation to determine when we should actually move on which results in the animation being played to completion on warm starts.
  • Loading branch information
mikescamell committed Feb 7, 2025
commit b9e3f0c0401246e1dca7d384f0c8fd20020e9246
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ import com.duckduckgo.app.browser.R
import com.duckduckgo.app.onboarding.ui.OnboardingActivity
import com.duckduckgo.common.ui.DuckDuckGoActivity
import com.duckduckgo.di.scopes.ActivityScope
import java.time.Instant
import java.time.temporal.ChronoUnit
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch

@InjectWith(ActivityScope::class)
Expand All @@ -35,13 +38,24 @@ class LaunchBridgeActivity : DuckDuckGoActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
val splashScreen = installSplashScreen()
super.onCreate(savedInstanceState)
splashScreen.setKeepOnScreenCondition { true }

setContentView(R.layout.activity_launch)

configureObservers()

lifecycleScope.launch { viewModel.determineViewToShow() }
splashScreen.setOnExitAnimationListener { splashScreenView ->
val splashScreenAnimationEndTime =
Instant.ofEpochMilli(splashScreenView.iconAnimationStartMillis + splashScreenView.iconAnimationDurationMillis)
val delay = Instant.now().until(
splashScreenAnimationEndTime,
ChronoUnit.MILLIS,
)

lifecycleScope.launch {
delay(delay)
viewModel.determineViewToShow()
}
}
}

private fun configureObservers() {
Expand Down