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

Add a splash screen when Amaze loads #3445

Closed
wants to merge 13 commits into from
Closed

Add a splash screen when Amaze loads #3445

wants to merge 13 commits into from

Conversation

dhruvpatidar359
Copy link

@dhruvpatidar359 dhruvpatidar359 commented Aug 27, 2022

Signed-off-by: dhruv [email protected]
closes #3139

flash screen added

Description

Issue tracker

Automatic tests

  • Added test cases

  • Done

Build tasks success

Successfully running following tasks on local:

  • ./gradlew assembledebug
  • ./gradlew spotlessCheck

@dhruvpatidar359
Copy link
Author

dhruvpatidar359 commented Aug 27, 2022

@EmmanuelMess : hello , spotless check is giving me error -
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
I think this is due to new version of gradle .

@dhruvpatidar359
Copy link
Author

Hey @EmmanuelMess may you please review this .

@EmmanuelMess EmmanuelMess self-requested a review August 28, 2022 13:59
@VishnuSanal
Copy link
Member

VishnuSanal commented Aug 29, 2022

@dhruvpatidar359 Press Ctrl twice & on that run anything prompt paste ./gradlew spotlessApply, then Enter key

Push the changes this creates to the same branch.

@dhruvpatidar359
Copy link
Author

@VishnuSanal thanks for the help 😀.

@dhruvpatidar359
Copy link
Author

Hello @EmmanuelMess may you please review this.

@VishnuSanal
Copy link
Member

@dhruvpatidar359 I'll look into your PR by the weekend :)

Timer().schedule(
object : TimerTask() {
override fun run() {
startActivity(Intent(this@FlashScreen, MainActivity::class.java))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The activity should be started before the timer starts, so that it is available as fast as possible.

Copy link
Author

@dhruvpatidar359 dhruvpatidar359 Sep 2, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually i am not able to figure out how can i do that , can you give me a hint for that

Copy link
Member

@EmmanuelMess EmmanuelMess Sep 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can just do startActivity() before the timer task, then bring to the front the view with the splash icon. That's how I did it for a game some time ago:

https://github.com/EmmanuelMess/Tactical-Defence/blob/0af05b4767e8f2ce1e9b326a709571fd4f09e9d1/TacticalDefence/app/src/main/java/com/emmanuelmess/tacticaldefence/activities/game/GameMenuActivity.java#L140-L143

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I have tried it and it doesn't work (anymore?) you'll probably need to do another thing.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll probably have to reverse engineer the API 16 activity to check how it does it, and make it backwards compatible. Using onWindowFocusChanged(hasFocus: Boolean) works for showing the splash but not for loading the new activity.

Remember a requirement is that the MainAcitivity starts loading immediately (within a few ms) after the splash activity starts.

text1.startAnimation(AnimationUtils.loadAnimation(this, android.R.anim.slide_in_left))

activityScope.launch {
delay(1000)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is going to add a delay everytime app launches through launcher. However as per guidelines splash screen shouldn't be shown on hot starts
https://developer.android.com/develop/ui/views/launch/splash-screen

@EmmanuelMess EmmanuelMess marked this pull request as draft September 11, 2022 01:30
New Method Added for showing flashScreen
@dhruvpatidar359 dhruvpatidar359 marked this pull request as ready for review September 13, 2022 17:00
@dhruvpatidar359 dhruvpatidar359 marked this pull request as draft September 13, 2022 17:12
@dhruvpatidar359 dhruvpatidar359 closed this by deleting the head repository Dec 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a splash screen when Amaze loads
4 participants