From 51acf5fe9ed785aff9391ae3d63329bd91760615 Mon Sep 17 00:00:00 2001 From: Emil Sjolander Date: Mon, 8 Jun 2015 12:10:32 -0700 Subject: [PATCH] Update readme --- README.md | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 7427b1f8da..4ec3b4d528 100644 --- a/README.md +++ b/README.md @@ -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 - @@ -61,12 +61,12 @@ You would have to update it to look like this: - + ``` 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: @@ -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. @@ -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 @@ -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.