oppia-android icon indicating copy to clipboard operation
oppia-android copied to clipboard

Navigation Drawer screen transition animation fix

Open rt4914 opened this issue 4 years ago • 23 comments

As per this comment:

The selected page should change in the background first before the menu slides back.

So from the Home Page, if I as a user tap the hamburger menu and select "Options," the page that is a layer below the side menu should change/fade to the Options page, and then the side menu hides. (mock)

rt4914 avatar Feb 17 '21 05:02 rt4914

Can i work on this issue?

harsh-hash avatar Feb 17 '21 06:02 harsh-hash

I checked in a lot of apps (Gmail, Amazon, CamScanner and a few others) When user selects an item from navigation drawer, all these apps first close the drawer and then navigate to the selected destination. I too feel that the drawer should first close and then (or simultaneously) the screen should fade (not slide) to next one.

Now, just to confirm once, we want our app to behave as stated in the issue??

ArpitShukIa avatar Mar 11 '21 17:03 ArpitShukIa

Can I work on this issue? I can add animation to it.

vrajdesai78 avatar Jun 06 '21 15:06 vrajdesai78

@vrajdesai78 Sure. I am assigning it to you.

rt4914 avatar Jun 07 '21 08:06 rt4914

Hello, Can I take this issue? It will be my first contribution, please guide me what to do ?

AgPriyanshu18 avatar Dec 12 '22 11:12 AgPriyanshu18

@AgPriyanshu18 assigned go ahead. If you have any query feel free to ask me.

MohitGupta121 avatar Dec 15 '22 13:12 MohitGupta121

@BenHenning the behaviour describe in this issue can not be achieved by using activities. Since, new activities start on top of previous activities, so we can't keep navigation drawer open in between. Previous activity will fade before getting new activity and the drawer is attached to the activity. All the menu items in naviagtion drawer like options start a new activity. It is only possible by using Fragments , we can switch between fragments in back when navigation drawer is open. This is what I found, Please correct me if I am wrong.

AgPriyanshu18 avatar Dec 21 '22 03:12 AgPriyanshu18

I'm not sure I fully follow @AgPriyanshu18. For the case of this issue, activities have a navigation drawer managed as a separate fragment within the activity's hierarchy. Presumably we can layer that activity's view hierarchy such that the base fragment of the activity that the drawer goes above can be blurred or faded using some sort of blended filter. I'm not quite seeing why this wouldn't be possible with how things are currently set up. Am I missing something? If so, could you please clarify on more specifically why what I described above wouldn't work?

BenHenning avatar Dec 21 '22 04:12 BenHenning

@AgPriyanshu18 are you still woking on this issue? If you blocked somewhere please feel free to ask. or we unassign you this issue if you not working on this?

MohitGupta121 avatar Jan 08 '23 08:01 MohitGupta121

@MohitGupta121 I still can't figure out How to solve the issue, I need help about how could I seperate a fragment from activity, to change base activity with fragment as it is.

AgPriyanshu18 avatar Jan 08 '23 09:01 AgPriyanshu18

@MohitGupta121 I still can't figure out How to solve the issue, I need help about how could I seperate a fragment from activity, to change base activity with fragment as it is.

This will probably need to be solved within each activity. I suggest starting with one (such as home_activity) and getting it to work there, first, and then we can see if generalization is possible. Once you get it working, I suggest opening a draft PR so that one of us can take a look.

BenHenning avatar Jan 11 '23 00:01 BenHenning

@MohitGupta121 I can't figure out how to solve the issue, Please unassign me from this issue

AgPriyanshu18 avatar Jan 17 '23 06:01 AgPriyanshu18

Yes sure @AgPriyanshu18 no problem. If you wish PTAL on another issues if you want?

MohitGupta121 avatar Jan 17 '23 06:01 MohitGupta121

Can you assign this issue to me? @seanlip @BenHenning @rt4914

kunsistent avatar Jan 19 '23 10:01 kunsistent

@kunsistent Could you please explain, in some detail, what the current problem is and what changes you plan to make to solve this issue (with links to files in the codebase)? If your proposed solution looks good, we can assign you to it. Thanks!

seanlip avatar Jan 19 '23 10:01 seanlip

I'm not sure I fully follow @AgPriyanshu18. For the case of this issue, activities have a navigation drawer managed as a separate fragment within the activity's hierarchy. Presumably we can layer that activity's view hierarchy such that the base fragment of the activity that the drawer goes above can be blurred or faded using some sort of blended filter. I'm not quite seeing why this wouldn't be possible with how things are currently set up. Am I missing something? If so, could you please clarify on more specifically why what I described above wouldn't work?

It is not just fading out the base fragment, it is also fading in the new view with the options, all while handling two drawers. The fade-out view and the fade-in view are in different activities, and each activity has its own drawer. To use an activity transition over the views, one needs to create the new activity with the drawer already open, tell the animation to fade-out the old activity's content, fade-in the new activity's content and close the new activity drawer after the activity transition finishes. The translucent background over the content is a problem as well, as it is not implemented as a View.

Using the standard android transitions I can do the following:

  • Set the enter transition in OptionsActivity to Fade
  • Set the exit transition in HomeActitivity to Fade
  • Set the shared element animation for both activities above to null
  • In NavigationDrawerFragmentPresenter:
    • When entering the options activity from the drawer, open the drawer without animation
    • Set shared element for transition to be the drawer content -- close the auto-opened drawer after a few (200?) milliseconds, when the activity transition has finished

This does not do what is requested, as the whole activities are faded (except the drawer), not just the content, but it is all I can think of with the standard android Transitions.

I don't yet know how to isolate this change to only the home and options activity transition. I'm attaching a recording. MainToOptionsTransition.webm

masclot avatar Jan 19 '23 14:01 masclot

Apologies for the late reply. Thanks for the detailed write-up @masclot.

I better understand the issue now, thanks to your write-up. This may actually not be feasible with our multi-activity architecture (at least, not without significant difficulty since I think it would potentially require caching renders of the activity cross-activity). Given that the activity transitions happen at such a low level in Android and aren't very customizable, I'm also not certain this can be solved with transitions alone.

Do you have any additional thoughts @masclot, or anyone else?

BenHenning avatar Feb 07 '23 04:02 BenHenning

@adityabarodiya please go through this comment https://github.com/oppia/oppia-android/issues/2732#issuecomment-1396778319 Same applies for you also.

MohitGupta121 avatar Feb 10 '23 11:02 MohitGupta121

Can I work on this issue?

predator313 avatar Aug 01 '23 19:08 predator313

Could you please explain, in some detail, what the current problem is and what changes you plan to make to solve this issue (with links to files in the codebase)? If your proposed solution looks good, we can assign you to it. Thanks!

Sure. Could you please explain, in some detail, what the current problem is and what changes you plan to make to solve this issue? If your proposed solution looks good, we can assign you to it. Thanks!

adhiamboperes avatar Aug 01 '23 20:08 adhiamboperes

Can you assign me ?

MonuGit9 avatar Jan 14 '24 06:01 MonuGit9

@MonuGit9, could you please describe your proposed solution to the problem?

adhiamboperes avatar Jan 14 '24 07:01 adhiamboperes

@MonuGit9, could you please describe your proposed solution to the problem?

Could you please explain, in some detail, what the current problem is and what changes you plan to make to solve this issue? If your proposed solution looks good, we can assign you to it. Thanks!

adhiamboperes avatar Jan 30 '24 06:01 adhiamboperes