Activity B starts and pushes Activity A to the left. This transition takes 200ms and I implement this calling this method in onCreate() before setContentView()
overridePendingTransition(R.anim.slide_in_right_to_left, R.anim.slide_out_right_to_left);
What I want to achieve is to start animating UI elements in the contentView at 100ms...So that the whole animation has a continuous feel. I haven't found where in the code I should start animating the UI elements.
Related
http://1.bp.blogspot.com/-Vv4SxVSI2DY/VEqQxAf3PWI/AAAAAAAAA7c/mfq7XBrIGgo/s400/activity_transitions%2B%281%29.gif
This is a material animation I want to implement, but I can't achieve a similar effect. First of all, the shared element transition moves the image into the second activity. This is quite simple, but then the root layout of the activity starts expanding and during the animation the user can see the first activity until the second activity's view doesn't hide it totally.
When I make an Activity scene transition, my problem is that while the Shared Element Transition is running, the other elements fade out. I found out that they don't really fade out, but the background of the second activity fades in.
When I set the background fade duration of the second activity to a very long time, I don't see the elements being covered. But thats not a real solution but more of a hack. What can I do there?
Transition code is starting here and in the other activity is receiving here.
I have a main activity that launches another activity, let's call it A2. When A2 finishes loading, it triggers an event that updates the main activity's view. This works great.
The problem is that when I press back or finish() in A2 and it begins the transition animation back to the main activity, the main activity's view doesn't seem to have been redrawn prior to the animation commencing, so as it slides back in it still has the old layout. When the transition finishes, it updates to what it should be.
Is there a way to force the main activity to invalidate its view or otherwise force it to redraw its view prior to the transition, so that the animation looks nice and smooth? I have tried invalidate(), but that does not redraw until after the transition.
(To avoid the XY problem: as a part of a complex animation from the main activity to A2, I create and fade in a black overlay view on the main activity. When A2 onResume()'s, it sends a navigation finished event that causes the main activity to remove the overlay. When returning from A2, that overlay is still rendered, so it looks like it's transitioning into a black screen until the transition finishes and the view re-renders.)
I tried to implement doing some background calculation using an AsyncTaskLoader, just as I thought would be the right way to do it.
Calculation is done in a different thread, the UI can stay smooth and buttery.
But the opposite happend.
My UI has some sliding panels. The user swipes them open, selects something in there and while the sliding panel slides back into place, the background task is performing its calculations for the main display that is again revealed while the sliding panel moves back.
Now: when the background task is done and AsyncTaskLoader.loadInBackground() is finished, the onLoadFinished callback method of my fragment is triggered - it sets the adapter of the main contents to the new result and triggers notifyDataSetChanged of this adapter.
Whenever my background calculation is FAST, the sliding panel is not yet back in its retracted place and the update of the adapter's data makes the panel movement "hang"!
Thus: by using background tasks, I literally mess up my formerly smooth UI.
How do you guys deal with things like that??
Is there a way to get the TabHost Activity to animate every time the tab is tapped? Right now i have the animation applied to the Activity that appears under the tab, but it will only every animate once (the first time it is loaded). Its a simple animation of the View coming in from left to right.
You should add onResume() method and do the same thing as the onCreate() in the activity. Then the animation should appears every time you tap it.