-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
[Feature] Add Splash screen #14837
base: main
Are you sure you want to change the base?
[Feature] Add Splash screen #14837
Conversation
Is this really needed that too using a dependency? we already have a splash screen ig |
Ops, this fallback method for android11 and below seems not to depend on androidx.core.core-splashscreen. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love this
Lint is failing, can't immediately see why, could you take a look?
From the video, the spinning animation seems much too fast, I'd see about reducing the speed to maybe 0.75x what's currently there.
I can't determine what is wrong because the lint error happens in the code whch has'nt been modified. |
Thanks for trying, I'll take a look |
Thank you for your advice. |
The following are unused:
We need to improve our lint error reporting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On my phone/emulator, the opposite problem occurs:
There's not enough time to show the 'star' before the splash screen disappears
When I add a sleep, the star spins too quickly
Don't worry about the lint errors for now, I've added this to make them easier to diagnose, should be in main
later:
<aapt:attr name="android:animation"> | ||
<set> | ||
<!-- Behavior between physical devices and Android Studio preview are different. --> | ||
<!-- <objectAnimator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this commented out code is not required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The animation is correct without The commented out code on physical device, but it is needed for Preview of Android Studio Preview.
Same here. In those cases, having no animation looks better IMHO |
…speed of star of rotation Star will rotate just once.
I fixed these problems, however, I realized a hack* to rotate star infinitely didn't work well on Android13 and avobe, so I made the star rotate jsut once. I thought It might be better not to rotate the star. * This hack is to set
to Splash screen is removed when On Android 12 the hack works well because Due to the bad performance of my smartphone, I couldn't realize that the hack doesn't work. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel this would be cleaner as:
/** @see executeFunctionAfterSplashScreen */
override fun onCreate(savedInstanceState: Bundle?) {
// Note: This is our entry point from the launcher with intent: android.intent.action.MAIN
executeFunctionAfterSplashScreen(minDurationMs = 1000L) {
Themes.setTheme(this)
disableXiaomiForceDarkMode(this)
val intent = intent
Timber.v(intent.toString())
val reloadIntent = Intent(this, DeckPicker::class.java)
reloadIntent.setDataAndType(getIntent().data, getIntent().type)
val action = intent.action
// #6157 - We want to block actions that need permissions we don't have, but not the default case
// as this requires nothing
val runIfStoragePermissions = Consumer { runnable: Runnable ->
performActionIfStorageAccessible(runnable, reloadIntent, action)
}
when (getLaunchType(intent)) {
LaunchType.FILE_IMPORT -> runIfStoragePermissions.accept(Runnable {
handleFileImport(
intent,
reloadIntent,
action
)
})
LaunchType.SYNC -> runIfStoragePermissions.accept(Runnable {
handleSyncIntent(
reloadIntent,
action
)
})
LaunchType.REVIEW -> runIfStoragePermissions.accept(Runnable { handleReviewIntent(intent) })
LaunchType.DEFAULT_START_APP_IF_NEW -> {
Timber.d("onCreate() performing default action")
launchDeckPickerIfNoOtherTasks(reloadIntent)
}
LaunchType.COPY_DEBUG_INFO -> {
copyDebugInfoToClipboard(intent)
finish()
}
}
}
super.onCreate(savedInstanceState)
}
private fun executeFunctionAfterSplashScreen(minDurationMs: Long, function: () -> Unit) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S) {
executeFunctionWithDelay(minDurationMs, function)
return
}
splashScreen.setOnExitAnimationListener { splashScreenView ->
val animationDuration = splashScreenView.iconAnimationDuration
val animationStart = splashScreenView.iconAnimationStart
Timber.v("duration :${animationDuration?.toMillis()} start $animationStart")
val remainingDuration = when {
animationDuration == null -> 0L
animationStart == null -> 0L
else -> (animationDuration - Duration.between(animationStart, Instant.ofEpochMilli(TimeManager.time.intTimeMS())))
.toMillis()
}.coerceAtLeast(0L)
Timber.v("remainDuration :$remainingDuration")
executeFunctionWithDelay(remainingDuration, function)
}
}
- simplifying
Duration.between(animationStart, Instant.ofEpochMilli(TimeManager.time.intTimeMS()))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Submitted the review too early (only tested on API 33):
The splash screen duration is too long
- The 'appear' animation needs to be faster
- the star shouldn't need to spin before it closes
🪲 API 33:
- reopening AnkiDroid leads to a grey screen
Hello 👋, this PR has had no activity for more than 2 weeks and needs a reply from the author. If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing! You have 7 days until this gets closed automatically |
Would like to take over it |
Sounds good |
Purpose / Description
Splash screen is one of new Android features and it makes user experiences richer.
This animation is Inspired by the navbar branding image of Anki Web
Fixes
Approach
create splash screen
screen-20231129-173232.-.Trim.mp4
How Has This Been Tested?
P.S the difference of color of star is already fixed.
Checklist
Please, go through these checks before submitting the PR.