Bottom Sheet Behaviour isn't hidden when I use below code - android

Initially the bottom sheet is remains hidden, when I click on some place then bottom sheet should appear and when I click clear icon then the bottom sheet should be hidden actual manner, which is should be on initial state.
Initial App launch code:
bottomSheetInfoBehavior.setHideable(true);
bottomSheetInfoBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
After clicking on some place then this is the code which pops up the bottom sheet:
bottomSheetInfoBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
Finally when the clear icon is clicked then this the code that is hiding the bottom sheet (NOT WORKING):
bottomSheetInfoBehavior.setHideable(true);
bottomSheetInfoBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
Expected Result is:
When the clear icon is clicked then the bottom sheet should not appear in the screen, that should be disabled..! and should not visible in screen..!

You should use Bottom sheet's dismiss method in clear button.
And
use show method to show the BottomSheet dialog.
Keep the reference of BottomSheetDialog and use is accordingly.
From the code you have shared u are setting the state/behaviour of the BottomSheet which will be taken care by these method's automatically.
Ref:
BottomSheetDialog

Related

ModalBottomSheetLayout reappearance on navigation Jetpack Compose

I have some items in a modal sheet layout and when I press an Item, I navigate to another screen. However, when I press back button in the detail screen, the modal sheet reappears with a flashing behavior. I think this is because of recomposition but is there a way to prevent the recomposition without using a box and hiding-revealing the other screen? Any help is appreciated.
Maybe you need to pop the bottom sheet from the backstack?
When navigating to your detail screen from the bottom sheet, get the instance of the BottomSheetNavigator you used to create the ModalBottomSheetLayout and do:
bottomSheetNavigator.popBackStack(backstackEntry, true)
You get the backstackEntry from the lambda when calling bottomSheet(route)

How to prevent removing accessibility focus from a bottom sheet?

I need to open a bottom sheet with some content, and I want the accessibility focus to stay in that bottom sheet. I've tried to open the sheet in a view, in a separate fragment, in a PopupWindow, but anyway it was possible to move the focus "bellow" my sheet. Is there any way to solve that?
Thank you.

Bottom Sheet custom behaviour on outside click

I use a Modal Bottom Sheet to allow the user to enter some text and create Decisions or Tasks.
Some users want to close the keyboard and they tap outside of the Bottom Sheet and close it. This is a big issue because all the text is lost.
The material design documentation states that it can be dismissed when the outside is touched but this doesn't work for me.
I want to intercept the onOutsideClick event and check the keyboard's state:
Keyboard shown: Close the soft keyboard
Keyboard hidden: Dismiss the Bottom Sheet
Should I use a custom BottomSheetBehavior or can I Override some dialog methods?

when we click on icon/image of any contact, one view slide up from bottom of screen in Lollipop Contact in call details screen?

when we click on icon/image of any contact, By default, this view shows full screen.
how will implement following case
1.View a separate activity with transparent half when swipe towards the top it is overlay up-to action bar.
2.swipe down the screen will gone look like lollipop 5.1.1 call details view
Case 1 : For transparent Activity try this link. You just need to add Theme.Transparent and color code #0000000 in your styles.xml
Case 2 : Bottom to Top Activity transition use this link for more detail. You can do Top to Bottom transition on back pressed button.

Need help to get Slider popup window

Friend's
I need to get slider pop up window,when i click a tab control available at bottom.when i click the tab,i need to show the slider pop up from bottom to top animated to show the login button,after login i have to move my actual tab Activity.How can i get the view for slider pop up.
lets refer the screenshots,i attached here what i need exactly..
.
From these when user to choose login at the time second screen appears looks like it.
How can i get the view like this above.
Thanks in advance..
Get the sliding drawer view by id, cast it to a SlidingDrawer and then there is a function the SlidingDrawer object to pop it up. You might have some weird issues though with screen state if users do stuff like hit back or close the slider.
To do what you need in the screenshot, do a sliding drawer with an empty handle and slide that up from the bottom as needed. The sliding drawer is just another layout that can contain buttons, etc.
Here is an example: http://www.androidpeople.com/android-sliding-drawer-example-tutorial/

Categories

Resources