Giter Club home page Giter Club logo

bottomsheet's People

Contributors

chrislacy avatar davideas avatar dlackty avatar emilsjolander avatar evant avatar gitter-badger avatar ipaulpro avatar kyild avatar markrietveld avatar meierjan avatar petershu avatar servus7 avatar thefinestartist avatar vanniktech avatar xiphirx avatar zacsweers avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bottomsheet's Issues

Why the layout?

Why can't you use the BottomSheet as a dialog like class instead of embedding it as part of a layout? If I'm not seeing it. please let me know, but this is far more useful if can use it in that way instead of it having to be put as a wrapper in every layout.

Thanks, I like the features, but don't see why it needs to be done in this fashion.

Add customizability to commons components

Expressing brand is important for many apps, so we can help in this department.

  • Sheet itself
    • Background (color, drawable, etc)
  • Title text
    • Font
    • Color
    • Custom title view?
  • Lists
    • Item selector
    • Divider color
    • Category headers
      • Font
      • Text color
    • Content rows
      • Font
      • Text color
  • Grids
    • Item selector
      • Default to borderless ripple on 5.0+, allow option to force normal square selector for all
    • Content cells
      • Font
      • Text color
    • Number of columns

The following are possible others, but have explicit specs in the Material Design guidelines:

  • Sheet elevation
  • Text sizes
  • Icon sizes

Calling `BottomSheetView#showWithSheetView(...)` may result in a stuck undismissible sheet

Steps how to reproduce:

  1. Create a button and listen to clicks on it.
void onClick(View view) {
    if (sheetView.isSheetShowing()) {
        return;
    }
    sheetView.showWithSheetView(...);
}
  1. Click the button as fast as you can multiply times.
  2. Bottom sheet appears in expanded mode and may not be dismissed by calling #dismissSheet() nor by dragging it.

To finally dismiss it you have to do:

if (sheetView.isSheetShowing()) {
    sheetView.dismissSheet();
} else if (sheetView.getSheetView() != null) {
    // Here we go. This should never happen, right?
    try {
        Method method = BottomSheetLayout.class.getDeclaredMethod(
                "setState", BottomSheetLayout.State.class);
        method.setAccessible(true);
        method.invoke(sheetView, BottomSheetLayout.State.EXPANDED);
        sheetView.dismissSheet();
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}

ImagePickerSheet

A sheet that shows a grid of most recent images, and also has two containers for retrieving from the camera or system image picker call.

Default implementation of retrieving images from local (where the user provides some getImage(Uri uri) implementation) or otherwise implement a provideImage(int position) interface if they want to source their own content.

BottomSheet.showWithSheetView() doesn't dim content view

The material design spec for bottom sheets states:

When a bottom sheet is displayed, it animates upwards from the bottom edge of the screen. The rest of the screen dims, giving focus to the bottom sheet.

This looks like this:

components_bottomsheets3

Right now, this library only dims the content view when the sheet is translating between the "peek" mode and the "expanded" mode. When the sheet is sitting at the bottom of the screen after showWithSheetView() is called, there is no content view dimming, even with shouldDimContentView set to true.

screenshot_2015-06-05-10-49-24

I understand that this library was initially created for the Flipboard app, but it would be nice to have the option to have the content view dim according to the spec.

MenuSheetView is not working in GRID mode

Hello! MenuSheetView isn't showing the icons in grid mode. My code

MenuSheetView menuSheetView =
                new MenuSheetView(getActivity(), MenuSheetView.MenuType.LIST, "Create...", new MenuSheetView.OnMenuItemClickListener() {
                    @Override
                    public boolean onMenuItemClick(MenuItem item) {
                        Toast.makeText(getActivity(), item.getTitle(), Toast.LENGTH_SHORT).show();
                        if (bottomSheetLayout.isSheetShowing()) {
                            bottomSheetLayout.dismissSheet();
                        }
                        return true;
                    }
                });
        menuSheetView.inflateMenu(R.menu.menu_sheet_add_plan);
        bottomSheetLayout.showWithSheetView(menuSheetView);
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
    android:id="@+id/plan_type_payment"
    android:icon="@drawable/creditcard"
    android:title="Payment"/>

<item
    android:id="@+id/menu_subheader"
    android:title=""
    >
    <menu>
        <item
            android:id="@+id/plan_type_plane"
            android:icon="@drawable/plane"
            android:title="Plane"/>
        <item
            android:id="@+id/plan_type_train"
            android:icon="@drawable/train"
            android:title="Train"/>
        <item
            android:id="@+id/plan_type_car"
            android:icon="@drawable/car"
            android:title="Car"/>
        <item
            android:id="@+id/plan_type_bus"
            android:icon="@drawable/schooolbus"
            android:title="Bus"/>
        <item
            android:id="@+id/plan_type_taxi"
            android:icon="@drawable/taxi"
            android:title="Taxi"/>
        <item
            android:id="@+id/plan_type_cruise"
            android:icon="@drawable/cruise"
            android:title="Cruise"/>
        <item
            android:id="@+id/plan_type_sailboat"
            android:icon="@drawable/sailboat"
            android:title="Sailboat"/>
        <item
            android:id="@+id/plan_type_bike"
            android:icon="@drawable/bike"
            android:title="Bike"/>
    </menu>
</item>

</menu>

Rename BottomSheet to BottomSheetLayout

The distinction between a BottomSheet and a SheetView is pretty confusing. The way that I understand it is that BottomSheet is a custom ViewGroup that wraps an entire screen's layout -- not just the layout of the actual bottom sheet. And a SheetView is just the view that comes up from the bottom. This is confusing because the SheetView is the actually the bottom sheet here -- not the BottomSheet.

Why don't you adopt the convention used with DrawerLayout and the navigation drawer? Seems like a perfect analogy. The DrawerLayout wraps the entire screen's layout, while the navigation drawer is just the second child of the DrawerLayout.

I'm proposing that you rename BottomSheet to BottomSheetLayout, and rename the SheetView (I know this isn't actually a class in the library, but it is what you're calling the actual bottom sheet view) to BottomSheet.

Possible item id class in IntentPickerSheetView

The internal adapter uses the component labels for the id, as pasted below. This could cause a clash as two applications could give an Activity the same label. It would be safer to hash the componentName instead.

    @Override
    public long getItemId(int position) {
        return activityInfos.get(position).label.hashCode();
    }

Change content of bottom sheet?

I am using a layout XML file for my bottom sheet, with a single textview in it.

How do I go about changing the value of the textview?

I tried the following, but it didn't work:

TextView title = (TextView) bottomSheet.findViewById(R.id.sheetTitle);
title.setText(marker.getTitle());

When I run the demo, picker and menu can not be full screen,

When I run the demo, picker and menu can not be full screen,
s50918-114153

HiTestActivity:

protected BottomSheetLayout bottomSheetLayout;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_hi_test);
    bottomSheetLayout = (BottomSheetLayout) findViewById(R.id.bottomsheet);
    bottomSheetLayout.setPeekOnDismiss(true);
    findViewById(R.id.btn_hi_test).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            showView();
        }

    });
}

private void showView() {
    HiTestView mHiTestView = new HiTestView(this);
    bottomSheetLayout.showWithSheetView(mHiTestView);
}

HiTestView

public HiTestView(Context context) {
    super(context);
    inflate(getContext(), R.layout.hi_sheet_view, this);
}

hi_sheet_view

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/white">

    <TextView
        android:id="@+id/title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginEnd="24dp"
        android:layout_marginLeft="24dp"
        android:layout_marginRight="24dp"
        android:layout_marginStart="24dp"
        android:gravity="center_vertical"
        android:text="hi test"
        android:textColor="@color/text_gray"
        android:textSize="16sp" />
</LinearLayout>

Update to bring this project in line with new Material spec updates

Google updated the spec today, and there's a fair number of additions we can design against in our commons components and core library as well.

http://www.google.com/design/spec/components/bottom-sheets.html#bottom-sheets-specs

  • Menu list icons should be 24x24
  • Menu list icons should have 16x16 horizontal padding, and text should have 16dp start padding
  • Grid icons should be 48x48
  • Grid should have 24dp horizontal paddings, 16dp top padding, and 24dp bottom padding
    • Presumably only show bottom padding if there are no more items
  • Initial peek height should be along a 16:9 keyline ratio
  • Two-column lists on tablets
    • Presumably not applicable for lists with subsections
  • Possibly support summary/description items in menu list items
    • Needs investigation. Spec isn't clear on if this is normal behavior or custom
  • Inset left side of menu section dividers if there are no headers
    • Needs investigation. Spec isn't clear on if this is normal behavior or custom
    • Custom. Nice, but not for menus
  • More specific spec for widths on tablets
    • See bottom of the linked spec
    • This will need some work. The spec provides minimum and maximum bounds. Minimum is easy to support, but maximum depends on us being able to conveniently predict the size of the content within it. This might be manageable via overriding onMeasure and maintaining the limits ourselves, but hard to know if it's a can of worms without opening it first.

Is it possible to move the sheet so that it can cover maximum area

Hi , how can i increase the view which appears on clicking share so that it can cover maximum area till top . I want only 30-40 dp gap when it appears and when it is scrolled then it is fine.

So can i guide me how to achieve this?

Actually many of the apps have used this feature and this library is very close it. Like airbnb . This app has listview which comes from bottom and user has the ability to scroll it as much as he can. It just leaves a space from top(so that the view behind it can be seen). The rest of the featue i.e full view on scroll issame as you have done

Sheet intercepting touch events from RecyclerView.

I'm using a RecyclerView inside the bottom sheet in several places in my app. I've noticed that sometimes the sheet intercepts the touch event to scroll the RecyclerView back to the top and moves the sheet instead. If I start the scroll in the other direction first it works correctly.

How to use Peek?

I cannot find any documentation on how to use the peek feature?

I'd like my sheet to peek, then expand when tapped or dragged up.

Potential bug when creating custom functionality in PickerActivity

Hi all,

I've found the following potential bug when creating a custom Activity for the PickerActivity.class from bottomsheet-sample.

I have the following basic implementation for the custom functionality:

Drawable scheduledGreetingDrawable = ResourcesCompat.getDrawable(getResources(), R.mipmap.ic_launcher, null);
            IntentPickerSheetView.ActivityInfo scheduledGreetingInfo =
                    new IntentPickerSheetView.ActivityInfo(scheduledGreetingDrawable, getString(R.string.scheduled), CreateScheduledGreetingActivity.class);
intentPickerSheet.setMixins(Collections.singletonList(scheduledGreetingInfo));

Now CreateScheduledGreetingActivity is in the following package: com.deolabs.greetingsbook.activities

I inspect the concreteIntent from void onIntentPicked(IntentPickerSheetView.ActivityInfo activityInfo):

Intent concreteIntent = activityInfo.getConcreteIntent(shareIntent);

This issue is that the value from mComponent->mPackage is com.deolabs.greetingsbook.activities
A normal intent has the value of mPackage com.deolabs.greetingsbook and works fine.

Basically if I move my activity in the the `com.deolabs.greetings' root package it works fine. Should'nt I be able to invoke activities from any custom package from the root package ? The bug is fixed if the activity class is placed in the root package (com.deolabs.greetings). If I put it in (com.deolabs.greetings.activities) it crashes.

The Exception that is thrown is:

Unable to find explicit activity class     {com.deolabs.greetingsbook.activities/com.deolabs.greetingsbook.activities.CreateScheduledGreetingActivity}; have you declared this activity in your AndroidManifest.xml?

Thanks.

Center PeekSheet

Hello, How can I easily centre the peek sheet on button click.

Feature Request : Peek the BottomSheet without Blocking UI interactions

I am trying to implement bottomsheet over a mapView. I peek the bottomsheet when the user clicks on markers on the map. But the user should be able to:

  1. either expand the bottom sheet to view the details (now possible)
    OR
  2. continue interacting with the map (i.e. content view) without dismissing the bottomsheet

P.S I would gladly like to help if anyone can guide me a little.

Possible issue when showing sheet after a long press

Hello,

I'm using the bottom sheet to display secondary actions for the items of a list. The sheet is shown when an item is long pressed.

The problem is, after the long press has been registered on the child view, if I don't lift the finger and start move it around the sheet intercepts those movement events and starts moving down.

Could a possible solution be intercepting touch events from the sheet layout only starting from a DOWN event?

public boolean onInterceptTouchEvent(MotionEvent ev) {
    return ev.getActionMasked() == MotionEvent.ACTION_DOWN && isSheetShowing();
}  

Thanks for the great library!

BottomSheetLayout requires a child

If BottomSheetLayout doesn't have any children it will throw an exception when trying to show a sheet.
For now the work around is to throw in an empty view like below.

<com.flipboard.bottomsheet.BottomSheetLayout
    android:id="@+id/bottomsheet"
    android:fitsSystemWindows="true"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <View
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>
    </com.flipboard.bottomsheet.BottomSheetLayout>

BottomSheet appears to go behind the statusBar

Hello

I have the following code that I inflate for my bottom sheet:

<TextView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="Upload a picture"
    android:layout_margin="16dp"
    />
<TextView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="Option 1"
    android:layout_marginBottom="16dp"
    android:layout_marginLeft="16dp"
    />
<TextView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="Option 2"
    android:layout_marginBottom="16dp"
    android:layout_marginLeft="16dp"
    />

It inflates fine - but the problem is that if you drag the bottomsheet to the top of the screen, some of it hides behind the statusBar.

Before I drag it to the top (peekSheet):

borttomsheet

After dragging it to the top - you can see that the "Upload a picture" text is hidden somewhat :

bottomsheetexpanded

Sheet view locates in incorrect position

After rotate screen , sheet view locates in incorrect position.
Target Device : SamSung Tab N8000.
AndroidManifest.xml : <activity android:configChanges="keyboardHidden|orientation|screenSize"
The first 3 pictures are in normal state, and the last 3 pictures are what happens after rotate screen.

==============================Before rotate screen=================================

device-01-normal
device-01-normal

device-02-normal
device-02-normal

device-03-normal
device-03-normal

==============================After rotate screen =================================
device-01-after-rotate
device-01-after-rotate

device-02-after-rotate
device-02-after-rotate

device-03-after-rotate
device-03-after-rotate

Get this OOB exception

java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid view holder adapter positionViewHolder{35dc8731 position=1 id=-1, oldPos=-1, pLpos:-1 scrap tmpDetached no parent}
at android.support.v7.widget.RecyclerView$Recycler.validateViewHolderForOffsetPosition(SourceFile:4349)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(SourceFile:4480)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(SourceFile:4461)
at android.support.v7.widget.LinearLayoutManager$LayoutState.next(SourceFile:1962)
at android.support.v7.widget.LinearLayoutManager.layoutChunk(SourceFile:1371)
at android.support.v7.widget.LinearLayoutManager.fill(SourceFile:1334)
at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(SourceFile:563)
at android.support.v7.widget.RecyclerView.dispatchLayout(SourceFile:2847)
at android.support.v7.widget.RecyclerView.onLayout(SourceFile:3145)
at android.view.View.layout(View.java:15614)
at android.view.ViewGroup.layout(ViewGroup.java:4968)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1466)
at android.view.View.layout(View.java:15614)
at android.view.ViewGroup.layout(ViewGroup.java:4968)
at android.support.v4.view.ViewPager.onLayout(SourceFile:1627)
at android.view.View.layout(View.java:15614)
at android.view.ViewGroup.layout(ViewGroup.java:4968)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1466)
at android.view.View.layout(View.java:15614)
at android.view.ViewGroup.layout(ViewGroup.java:4968)
at android.support.design.widget.CoordinatorLayout.layoutChild(SourceFile:1034)
at android.support.design.widget.CoordinatorLayout.onLayoutChild(SourceFile:744)
at android.support.design.widget.CoordinatorLayout.onLayout(SourceFile:758)
at android.view.View.layout(View.java:15614)
at android.view.ViewGroup.layout(ViewGroup.java:4968)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
at android.widget.FrameLayout.onLayout(FrameLayout.java:508)
at com.flipboard.bottomsheet.BottomSheetLayout.onLayout(SourceFile:205)
at android.view.View.layout(View.java:15614)
at android.view.ViewGroup.layout(ViewGroup.java:4968)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
at android.widget.FrameLayout.onLayout(FrameLayout.java:508)
at android.view.View.layout(View.java:15614)
at android.view.ViewGroup.layout(ViewGroup.java:4968)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1466)
at android.view.View.layout(View.java:15614)
at android.view.ViewGroup.layout(ViewGroup.java:4968)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
at android.widget.FrameLayout.onLayout(FrameLayout.java:508)
at android.view.View.layout(View.java:15614)
at android.view.ViewGroup.layout(ViewGroup.java:4968)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1466)
at android.view.View.layout(View.java:15614)
at android.view.ViewGroup.layout(ViewGroup.java:4968)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
at android.widget.FrameLayout.onLayout(FrameLayout.java:508)
at android.view.View.layout(View.java:15614)
at android.view.ViewGroup.layout(ViewGroup.java:4968)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2102)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1859)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1077)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5884)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
at android.view.Choreographer.doCallbacks(Choreographer.java:580)
at android.view.Choreographer.doFrame(Choreographer.java:550)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5312)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:901)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:696)

onClickListener on BottomSheet is not working

Hey,
I attached a onClickListener on the BottomSheet to let it disappear, but nothing happens, when I click/tap on it.

As a comparison, the onTouchListener on it works great, but I can't drag the BottomSheet using it.

Also setting a onClickListener on the containing View is not a solution, because it's not filling the whole screen.

Here a code snippet:

    bottomSheet = (BottomSheetLayout) findViewById(R.id.bottomsheet);
    bottomSheet.setShouldDimContentView(false);
    gifView = LayoutInflater.from(this).inflate(R.layout.gif_animation_view, bottomSheet, false);

    bottomSheet.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            bottomSheet.dismissSheet();
            Log.i(INFO_LOG_99, "dismissing sheet");
        }
    });

I can put a invisible view filling the whole BottomSheet and adding a onClickListener on it as a workaround, but I'm just curios why it's not working directly on the BottomSheet.

FragmentSheet

This commons component should take a fragment and show it in the bottomsheet.

bottomSheet background color?

how to change background color of the sheet?
and... is there any way to change the menu items typeface (font) when inflating a menu?
thanks...

Change Peek height / Disable peek?

I'm using the MenuSheetView, however I only have about 5 items that I need to show. I don't like how the 3 items are visible when peaked, but you have to drag it up to see the other 2 options.

Is it / could it be possible to adjust the peek height, either so that a certain number of menu items are visible, or so that the peek state is disabled, and the menu goes from collapsed, straight to expanded.

Thanks.

Util visibility

Util in commons has some strange visibility. It is a public class but all of its methods are package private. Perhaps it should be package private as well or set the methods to to public if you intend other devs to use the methods to make sheets.

Also the Constructor should be made private and throw an AssertException.

Update the wiki resources for IntentPickerSheetView

In the wiki on the main page and in this blog post you have presented the following code regarding the use of IntentPickerSheetView:

IntentPickerSheetView intentPickerSheet = new IntentPickerSheetView(MainActivity.this, shareIntent, "Share with...", new IntentPickerSheetView.OnIntentPickedListener() {
    @Override
    public void onIntentPicked(Intent intent) {
        bottomSheet.dismissSheet();
        startActivity(intent);
    }
});

With the latest update the onIntentPicked doesn't have Intent as parameter, instead it has IntentPickerSheetView.ActivityInfo. With that being said, the example should be modified in order to work properly. I have managed to do that in the following manner:

IntentPickerSheetView intentPickerSheetView = new IntentPickerSheetView(MainActivity.this, shareIntent, "Share via...", new IntentPickerSheetView.OnIntentPickedListener() {
            @Override
            public void onIntentPicked(IntentPickerSheetView.ActivityInfo activityInfo) {
                bottomSheet.dismissSheet();
                startActivity(activityInfo.getConcreteIntent(shareIntent));
            }
        });

Swap Sheets

I realise this may be more of a design issue on my part, but would it be possible to add the ability to swap sheets without having to dismiss and re-open?

I have a menu sheet with a list of options, one option is to upload an image, which is picked via the new image sheet, therefore it would be nice to show (and optionally animate via a slide) the new sheet immediately.

Thanks.

PagerSheet

A sheet that maintains a ViewPager and TabLayout and accepts a PagerAdapter to show content.

Should have a divider/elevation of some sort on the tab bar to distringuish it from the content below.

Could also use a Toolbar or just simple icons (with circular ripples) approach instead of TabLayout

Proposal: Switch to RecyclerView for grid/list implementations in commons components.

So far, we've been using ListView and GridView for everything, which has come with its fair share of problems. They're less flexible, less performant, and have forced us to dance around some bugs as well. I propose we switch to RecyclerView instead.

Pros

  • Performant
  • Long term replacement for both of those views (it seems)
  • Flexibility and easier customizability
    • Specifically on this front, we've discussed adding material animations to item displays. This would make that substantially easier.
  • Easy drag and drop support (if we ever wanted it)
  • One standard component for both grids and lists
  • Doesn't have some of the API-specific bugs of GridView

Cons

  • Extra dependency (but lightweight)
  • Perhaps overkill in some places

Other things to consider

With its added flexibility, we should do due diligence to make sure the library can allow for users to hook into this fairly easily. I'm not familiar enough with RecyclerView to know if that would problematic, or if it's even a problem at all. Just something to keep in mind.


@markrietveld @st028 @emilsjolander thoughts?

More options

Such as
selector for grid/list item,
grid padding,
progress bar while loading packages,
image picker infinite loading,
dim,
grid/list hiding scrollbar...

Proposal: Different views for peek and expanded states.

Hello! We're enjoying a lot using the library. We're currently using it in a few parts of the app and we want to use it one more time. Just let me know if it's even possible to do what we want to do:

screen shot 2015-09-17 at 4 53 11 pm

In the image at the left we have already a view in the bottom, we want that when user tap in the FAB expand with a bottom sheet to get the information in the image at the right.

We've tried several things:

  • We made to fade out the existing view and show the bottom sheet. This is actually working, but it is not what we want to do.
  • We included the current bottom view in the bottom sheet layout and show it from the beginning (working) and then when click expand more (not working). But the map gets darker so we don't want that either
  • We tried to push up the existing view with the bottom sheet. No success so far. This would be an option.
  • We tried to expand the current bottom view with the bottom sheet.

How would you suggest to do this?

Thanks a million (for the library and reading this ;) )

Allow peek content to scroll

First, great lib. Thanks.

I think it would be great to allow peeked content to scroll. Similar to the behavior when expanded, when you hit the end of the scrollable, then it pulls open to an expanded view. Definately as a state switch, because it's more of an edge case.

Also, to add to this, I think it would be super cool to define a second sheet that hangs below the first (or just wherever you want) that animates in as you move from peeked to expanded. Could be cool.

Tests

Because good software engineers write tests.

Would be good to use Travis-CI as well

Null pointer exception with recyclerview

I'm wrapping BottomSheetLayout around a LinearLayout that contains a RecyclerView (which is populated with RelativeLayouts). To test it, I'm calling

BottomSheetLayout bottomSheet = (BottomSheetLayout) v.findViewById(R.id.bottomsheet);
    bottomSheet.showWithSheetView(inflater.inflate(R.layout.fragment_layout, bottomSheet, false));

at the end of the fragment's onCreateView(), after the recyclerview has already been set up.

However, this ends up breaking the RecyclerView, as any touch input causes this stack trace:

java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.support.v7.widget.RecyclerView$LayoutManager.canScrollVertically()' on a null object reference
        at android.support.v7.widget.RecyclerView.computeVerticalScrollOffset(RecyclerView.java:1540)
        at android.view.View.canScrollVertically(View.java:12835)
        at android.support.v4.view.ViewCompatICS.canScrollVertically(ViewCompatICS.java:35)
        at android.support.v4.view.ViewCompat$ICSViewCompatImpl.canScrollVertically(ViewCompat.java:1161)
        at android.support.v4.view.ViewCompat.canScrollVertically(ViewCompat.java:1575)
        at android.support.v4.widget.SwipeRefreshLayout.canChildScrollUp(SwipeRefreshLayout.java:643)
        at android.support.v4.widget.SwipeRefreshLayout.onInterceptTouchEvent(SwipeRefreshLayout.java:657)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1960)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2405)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2049)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2405)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2049)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2405)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2049)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2405)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2049)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2405)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2049)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2405)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2049)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2405)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2049)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2405)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2049)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2405)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2049)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2405)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2049)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2405)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2049)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2405)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2049)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2405)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2049)
        at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2405)
        at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2049)
        at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2369)
        at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1719)
        at android.app.Activity.dispatchTouchEvent(Activity.java:2742)
        at android.support.v7.internal.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:60)
        at android.support.v7.internal.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:60)
        at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2330)
        at android.view.View.dispatchPointerEvent(View.java:8666)
        at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4123)
        at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:3989)
        at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3544)
        at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3597)
        at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3563)
        at android.view.ViewRootImpl$AsyncInputStage.forward

Here's a screenshot of what happens:

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.