Android View Animation between activity transition - android

How can i keep an animation alive while the transitions between activities are occurring?
Suppose that i have two activities A and B. Activity B has a "slide in" transition over the activity A. I want to keep a button rotating in my activity A while the transition of B is occurring. My button stop the rotating animation when the Activity B starts the slide over the activity A. I guess it happens because the android switch the UI Thread process to the new activity that is coming and stop what the previous activity was doing, but in my case the user still can see the activity A being covered by the activity B.

Related

Start activity in background

I know you should use services, backgroundtasks and AsynTask for long running processes. I've also seen this and this.
is there any way to start a activity in background and when process finishes, change the activity to current activity?
Suppose I have two activity A and B.
When user clicks on a view(a item in bottom navbar for example) on activity A, the desired action is to animate that view then start activity B.
But the problem is that there is a lag between animation terminate and starting of Activity B.
What I'm thinking of is to setup activity B while the view in activity A is animating.
As soon as animation terminates the activities swipe smoothly.
Is there a possible solution for this?

Up navigation with fragments and activities

I'm trying to use the up navigation pattern and I'm having issues while using both fragments and activities. Let's say that I have activity A and that activity contains fragment a. Now I click something in fragment a and a fragmentTransaction happens with fragment b replacing a and a is put in the back stack. The "up" arrow now appears in my toolbar. This is all fine. Now I click something in fragment b and fire up activity B. A is B's parent. Now, B has an up arrow and I expect that when I touch it I would go to the top, i.e. finish activity B and the back stack of A would be popped so we end up with activity A containing fragment a and empty back stack.
My issue here is that when up is pressed in B, B is finished but A is still showing fragment b. Is there any way that I can make A not restore its' fragment back state onActivityResult or something like that so fragment b is never shown on up action from B?
What I have tried is using startActivityForResult when firing up B and popping A's fragment backstack onActivityResult but then b is briefly shown before the stack is popped. I just want A not to restore it's fragment state if up was pressed in B.
Edit:
The pattern I'm using right now for the up navigation is that in my manifest I define A as B's parent and in activity B I have a toolbar which I set as a supportActionBar with setDisplayHomeAsUpEnabled.
I had my activity defined as "singleTop" in my manifest. If you remove that the up button causes the task to be recreated which is exactly what I wanted.
Edit: The pattern I'm using right now for the up navigation is that in
my manifest I define A as B's parent and in activity B I have a
toolbar which I set as a supportActionBar with
setDisplayHomeAsUpEnabled.
said that my suggestion is popping A(b) when going to B.
When you call navigateUpFromSameTask it finishes the current activity and starts (or resumes) the appropriate parent activity. If the target parent activity is in the task's back stack, it is brought forward. That's why you are experiencing that behaviour.

startActivity() first remove the fragment and only then moves to another Activity

I have an Activity with a fragment in front. now when i use StartActivity() the fragment is first removed and you can see for a half a sec the Ui of the activity before it moves to the next Activity...
any idea how to keep the fragment in the front until the last moment before switching to the next Activity?
Thanks

Update parent activity view before transitioning back to it

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.)

Scroll Activity to top

I tried and searched a lot, but did not find an answer for this. I have an activity A, transparent over an Activity B. I am trying to make the activity A scroll up to the top, like the notification bar, so that activity B becomes active. And I should be able to scroll down back A when necessary. Moreover, I am trying to implement this scrolling over an imageview in A, not anywhere on the activity A. can onTouch and onTouchListener help me? Please help me here. I am searching an answer to achieve this functionality.
You can animate Activity A to the top, saving its state, and have it start Activity B and then stop. When the user swipes down in an attempt to get back Activity A, Activity B simply starts A, which starts by animating down from the top. It restores the data it has saved, so to the user it's the same as if it has been active all the time.
If you need Activity A to continue processing, you an either delegate processing to Activity B, or to a Service, or to a class that is under control of RoboGuice and is kept active because it's injected in both A and B.
The only way I can think to do this is with Activity.overridePendingTranistion. Using this, you will have to start and finish your activity each time for it to animate. Have you considered using a view that animates down, like a SlidingDrawer?

Categories

Resources