I am using a shared element transition between two activities. I am using this link for animation. Integrated this.
https://github.com/codepath/android_guides/wiki/Shared-Element-Activity-Transition
I am getting something like this. Can anyone tell me why I am getting this kind of screen for a second. Animation in not smooth, but when we press back button back animation as expected smooth.
enter image description here
Related
The main activity is a login page. I have included a splash screen as well. What I want is to apply animation to the splash screen. For that, I am trying to put it in a separate fragment. How can I do this?
I have created a theme and everything that is needed to implement a basic splash screen.
Most of the apps(youtube, facebook etc) don't have an animated splash screen because, all the code initialization drops a lot of frames in your app. These frame drops will be clearly visible if you try to animate the screen.
For your animations to be smooth, a frame has to be drawn every 16ms. Even if one frame is not drawn, users can see the change... what this means is, if you are jumping a ball on ur splash screens.. the easing function you apply to the animation will not work as expected.
Solution:
In your launcher activity, just have a simple ui. As minimal as possible. This will give the user a feeling that app launched quickly. Once your initializations are over, you can attach your fragment which can have the same UI as activity and then make any transition.
In practice:
Launch activity A(launcher) -> UI can be a simple white screen with your logo in the center of the screen.
Once your initialization(all the libraries that load in your Application class like firebase, ORM, analytics tools ect) is over, attach your fragment with a screen containing the same white screen and logo.
This way the user will not know transition from activity to ur fragment as the UI is same. Now you can do any kind of animation in your screen. The initialization time varies from application to application and phone to phone.
In my app, there are 2 activities. To make the transition seem smooth I animated elements of the first and second activity and disabled transition between the 2 activities. An example of what happens is in the video below:
https://youtu.be/L85HfIUPQuk
The problem as you might see is that, once the animations in the first activity end, there is a period, less than a second but still noticeable, where the screen hangs on the empty white background. Only after that does the second activity and animations start.
The animations are simple alpha and translate effects, nothing fancy.
Any suggestions how to get rid of the hanging period?
You should use Activity Transition.
I think what you need is Shared Elements Transition, since the list from first screen is also on the second screen. Checkout the documentation:
http://developer.android.com/training/material/animations.html
I have a FragmentDialog containing an animation composed by two ImageView that I animate indefinitely when App is doing some background work, in other words I use it as a loading dialog. ( I know that loading dialogs that block UI are bad practice in Android but I was forced to do it because I have to do an IOS porting).
This animation is always smooth except during transitions between two activities.
Example : I have to do a login screen and the loading dialog animation must run continuously till the login activity is no more visible and the next activity takes its place.
When the login is at the end , and transition between the two activity starts, the animation slow down and it's very jerky.
I begin the animations with startAnimation(AnimationUtils.loadAnimation(context, R.anim.rotate)); on 2 ImageView.
How can I solve this problem? Thanks in advance
What I want to achieve is a flip animation when going from activity to activity.
I've seen a recommendation somewhere on SO, that I should use appropriate layout animation in one activity, switch to next one without any animation whatsoever and then execute the second half of the animation in the second activity.
I guess it could work, not tried it yet. But what bothers me is more general aspect - I believe it should be possible to achieve the same effect with activity transition animation, but...
Somewhere (I guess it was SO, but I can't find it now) I've read that during the activity transition animation the background should always be fully covered by the animated activities. I'm not sure why - I can see the background is always black on all my devices, and making it visible during the animation appears to be harmless.
But perhaps it is not guaranteed? Can someone confirm that requirement? Is it officially stated anywhere?
I want to override the default animations (actually transitions) in Android, when an Activity comes on screen or goes off as the user presses the Home or Back button. I've tried the ViewFlipper, but that works only on single Activity with multiple views. I'm developing for Android 1.6. Any hint, how to do this?
So perhaps you should take a look at: Android transitions Slide in and Slide Out
It sounds very much like what you want.