Android slide activity transition without fade - android

I want to create an activity transition like the one shown in the Full Screen section of this page of the Material Design spec. I'm hoping I can get a press of the FAB to spread with a circular reveal across the bottom of the view and then transition to the new activity with a slide up from the bottom.
As a first step towards this goal I've used a Slide transition with a Gravity.BOTTOM to animate in the new Activity. This is working, but as well as the slide the incoming activity is fading in. In the animation on the spec the sliding activity is solid as it slides up, and I'm not sure how to achieve this effect. I've looked in the code for Slide and its parent Visibility and there is a method called forceVisibility(int visibility, boolean isStartValue), but it's not part of the public API so I can't use it. The fact that it exists does suggest that what I want to do is possible (as does the animation on the Material Design guide), but I'm not sure what I need to do.
Can anyone point me in the right direction?

Related

Android swipe right to left to expand fragment

Hi guys I am an android beginner. I want to make an fragment at the right edge of the main layout and it could be expanded/collapsed by swiping from right to left/left to right (please watch sort video below).
https://youtube.com/shorts/HKOvfDVS03M?feature=share
My problem is I could not know how I can start implementing since I'm new to android. Please help to give a sample code. Thank you
You can achieve the same using navigation drawer. Navigation drawer is menu or layout which slides from edges of the screen. As you are a beginner you need to learn the concepts first. So, try to learn navigation drawer first. As per suggestion you can watch below video.
Navigation drawer
As you complete the video you will know what navigation drawer is and how to implement it. Now, as you mentioned in your video it's a calculator. So, drawer is given specific height and width as well as it is placed below the calculating screen. SO, I assume that you know basics.
Using relative layout and it's property You can use
...
android:layout_below = "calculating_screen"
...
This will place your drawer below the screen and you can specify `android:layout_height =match_parent" in your drawer file to cover the remaining screen. And then after specifying width you just need to adjust the gravity. you just need to change the gravity line.
...
GravityCompat.END
...
from
...
GravityCompat.START
...
GravityCompat.START allows drawer to expand from left-right. If you want right-left then use GravityCompat.END.

Strange behavior of a bottom navigation view when is set visible

I try to make an app using one activity multiple fragments pattern. I handle navigation with Navigation architecture component using a bottom navigation view. In one of the fragment I have a Recyclerview which displays a list of custom cards. On item click it navigates to another fragment where I need to hide the bottom navigation view.
The problem appears when I navigate back and set the bottom navigation view visible again. The bar seems to appear in two steps giving the feeling of lag. (first time appears just 60% of the bottom navigation view).
The behavior seems to be related with the status bar. When I change the theme to full screen or I set windowTranslucentStatus=true, everything behaves okay. In addition, first time the nav bar seems to be with exactly 24dp smaller, that is the dimension of status bar.
Have you any idea what can I do?
PS. I'm new on stackoverflow and this is my first question. I'm glad to join this wonderful community.
Delay is one way to go, but I wouldn't suggest that.
I am assuming that the your navigation view is rendered before the entire activity is rendered, which is causing it to be rendered again after the UI is rendered. Why don't you try setting the visibility after the UI is rendered, like here

How to design activities like the uber app

I am building an app like uber, I have problems with some concepts I don't know.
How to make the animation when a view is swiped from bottom to top, it will merge with the toolbar until then the view is in a activity.
How to maintain or load the same map in all activities of the app.
Note: I don't know if the Uber app uses activities, fragments or otherwise.
Image: Picture before you start sliding
Image: Activity merged with the toolbar
For swipe a view from bottom to top, you can use bottom sheet android component which presents a dismissible view from the bottom of the screen and for animation you can define translation or transition animation for the component. Here is one github repository.
With regards,
Better yet, try using bottomSheetDialogFragment. though what i cant say is if it will give you a fullscreen merge with the other activity but it has features like drag already implemented. Here is a link to a tutorial you can follow

Adding a custom image onto a Navigation Drawer's center

I'm experimenting for the first time with Android's Navigation Drawer. I think it is a very elegant way to provide an application menu. However, showing my prototype to some friends, it seems that it is not quit intuitive to search for a menu i) on the top left corner respectively ii) on the left side of the screen.
To provide a "user hint" for case i), I added a custom image by creating an ActionBarDrawerToggle. This results in following design of the title bar (the little arrow is the cutom image, while the red star is the application icon):
Now while developping, I thought this is quite obvious, but apparantly I'm wrong :). So as a second idea, to support a user to find option ii) described below, I tried to figure out how to add a further image at a specific place, which I want to explain with following image:
Don't look at the design itself in the first place, but following: the image must be placed outside of the "view bounds" (when the navigation menu is hidden), and also exceed the navigation panel itself on the right side (always). Is this in any way possible without customize the entire navigation panel? I really wonder why I can't find much about this idea, since I think it is a very nice option to provide for the user (as long as the arrow don't disturbs the application usage)
Although I haven't actually tested it with Android's Navigation Drawer,
did you try putting an imageview in your activity's layout? The image would be placed in the middle vertically and on parent left horizontally. I believe this would work (i.e. the image will get pushed when you open the drawer. As an improvement you could also change the image itself in the drawer's callbacks, so that you have an arrow pointing right when the drawer is closed and an arrow pointing left when the drawer is open.
Hope it helps.

Custom animate navigation drawer

I have implemented Google's navigation drawer and I would like to add a custom animation when I click a menu item.
Ideally the menu would slide back as if closing, leaving a small sliver of the menu open. A dialog would open with an animation, originating from the space beside the selected menu item.
Something like this..
I tried to animate the left_drawer element on the x axis using ObjectAnimator, but this displaces the whole screen.
Can anyone help?
If you want it so the drawer is only peaking, try using drawerLayout.closeDrawers(true).
According to the source though, this closes all drawers (if you have more then one).
DrawLayout source

Categories

Resources