Kennyc1012 / BottomSheetMenu

BottomSheetMenu style dialogs for Android
Apache License 2.0
887 stars 99 forks source link

Question: is it possible to disable dimming, make content above touchable, and scroll? #20

Closed AndroidDeveloperLB closed 8 years ago

AndroidDeveloperLB commented 8 years ago

I'm trying to do something like on Google Maps, where the content above the bottom sheet is touchable, there is no dimming, and I can scroll the bottom sheet till it shows its whole content , and even further if there is a lot of content.

Is it possible on this library to have this behavior ?

Kennyc1012 commented 8 years ago

The library functions primarily as a dialog, so the request behavior isn't supported easily. The view used in Google Maps is most likely not a dialog but apart of the layout. You can wrap your view in a CollapsingView and add it to your view and manipulate it yourself.

AndroidDeveloperLB commented 8 years ago

@Kennyc1012 Too bad. Can you help me with this though? I've tried doing it for a long time on other libraries, and still failed: http://stackoverflow.com/q/34160423/878126

Kennyc1012 commented 8 years ago

Heres the approach I would take if I were try to replicate the Google Maps app.

Activity A- The wrapping activity for the views. Would contain 2 fragments. The activity theme should extend from Theme.AppCompat.NoActionBar

Map Fragment- This is where the map view would be held and manipulated. There should NO actionbar/toolbar here

Bottomsheet Fragment- This is where the actionbar/toolbar will be. The fragment will be added with a transaction when wanting to me shown. Upon dismissing by either the back arrow or dragging, the fragment should be removed from the fragment manager.

If communication is needed between both fragments and/or with the parent activity, you can create an interface that the activity will implement and the fragments can make calls to the interface(Activity A) which can then communicate down to either or both of the fragments.

AndroidDeveloperLB commented 8 years ago

The activity and fragments part is ok and I can already customize it, but I don't get how to use the bottom sheet itself (which is why I try out multiple libraries that support bottom sheet), and work well with its listeners. in a POC, I've tried now using the CollapsingView inside the layout of the activity, as such:

<FrameLayout 
             android:layout_width="match_parent"
             android:layout_height="match_parent">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center"
        android:text="some normal content behind the bottom sheet, not a part of it"/>

    <com.kennyc.bottomsheet.CollapsingView
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <include layout="@layout/custom_view"/>

    </com.kennyc.bottomsheet.CollapsingView>
</FrameLayout>

The "custom_view" layout is a large one, which also includes CollapsingToolbarLayout.

Yet, the bottom sheet takes the whole screen from the beginning. Isn't there a function to tell it to take the space of a certain view within or something? Only when scrolling, it should take the whole screen...

Kennyc1012 commented 8 years ago

The CollapsingView will wrap to the whole views total height, not partially show it. I don't think this library is a good solution for what you need, sorry.

AndroidDeveloperLB commented 8 years ago

Too bad. Thank you for your help. If you do know how to handle it well, please let me know. Bottom sheet is supposed to initially show only a part of it. That's why it's also called "bottom"...

Kennyc1012 commented 8 years ago

This can be achieved using the BottomSheetBehavior in the V23.2.0 support library described here