Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Emil Sjolander committed Jun 8, 2015
1 parent b71a338 commit 51acf5f
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Get started by wrapping your layout in a BottomSheet. So if you currently have t

You would have to update it to look like this:
```xml
<com.flipboard.bottomsheet.BottomSheet
<com.flipboard.bottomsheet.BottomSheetLayout
android:id="@+id/bottomsheet"
android:layout_width="match_parent"
android:layout_height="match_parent">
Expand All @@ -61,12 +61,12 @@ You would have to update it to look like this:

</LinearLayout>

</com.flipboard.bottomsheet.BottomSheet>
</com.flipboard.bottomsheet.BottomSheetLayout>
```

Back in your activity or fragment you would get a reference to the BottomSheet like any other view.
```java
BottomSheet bottomSheet = (BottomSheet) findViewById(R.id.bottomsheet);
BottomSheetLayout bottomSheet = (BottomSheetLayout) findViewById(R.id.bottomsheet);
```

Now all you need to do is show a view in the bottomSheet:
Expand All @@ -88,7 +88,7 @@ bottomSheet.showWithSheetView(new IntentPickerSheetView(this, shareIntent, "Shar
That's it for the simplest of use cases. Check out the API documentation below to find out how to customize BottomSheet to fit your use cases.
##API
###BottomSheet
###BottomSheetLayout
```java
/**
* Set the presented sheet to be in an expanded state.
Expand Down Expand Up @@ -212,7 +212,7 @@ public void setOnSheetStateChangeListener(OnSheetStateChangeListener onSheetStat
*
* @param bottomSheet The bottom sheet which contained the presented sheet.
*/
void onDismissed(BottomSheet bottomSheet);
void onDismissed(BottomSheetLayout bottomSheet);
```
###ViewTransformer
Expand All @@ -227,9 +227,25 @@ void onDismissed(BottomSheet bottomSheet);
* @param parent The BottomSheet presenting the sheet view.
* @param view The content view to transform.
*/
void transformView(float translation, float maxTranslation, float peekedTranslation, BottomSheet parent, View view);
void transformView(float translation, float maxTranslation, float peekedTranslation, BottomSheetLayout parent, View view);

/**
* Called on when the translation of the sheet view changes allowing you to customize the amount of dimming which
* is applied to the content view.
*
* @param translation The current translation of the presented sheet view.
* @param maxTranslation The max translation of the presented sheet view.
* @param peekedTranslation The peeked state translation of the presented sheet view.
* @param parent The BottomSheet presenting the sheet view.
* @param view The content view to transform.
*
* @return The alpha to apply to the dim overlay.
*/
float getDimAlpha(float translation, float maxTranslation, float peekedTranslation, BottomSheetLayout parent, View view);
```

`BaseViewTransformer` exists for you to extend if you would like the default dimming behaviour.

##Common Components
These are located in the optional `bottomsheet-commons` dependency and implement common use cases for bottom sheet.

Expand Down

0 comments on commit 51acf5f

Please sign in to comment.