From df90a3cac4e0e088256cb99e337fc1e01080b8ad Mon Sep 17 00:00:00 2001 From: Mohammadreza Yektamaram Date: Sat, 4 Jan 2020 23:34:47 +0330 Subject: [PATCH 1/2] Added java example for usage --- README.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/README.md b/README.md index 352f977..98fd555 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,9 @@ Simply extend `RoundedBottomSheetDialogFragment`, inflate your layout and show i #### Example +**Kotlin Class:**: ```kotlin +// MyRoundedBottomSheet.kot import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment class MyRoundedBottomSheet: RoundedBottomSheetDialogFragment(){ @@ -40,12 +42,27 @@ class MyRoundedBottomSheet: RoundedBottomSheetDialogFragment(){ } ``` +**Java Class:** +```java +// MyRoundedBottomSheet.java +import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment; + +public class MyRoundedBottomSheet extends RoundedBottomSheetDialogFragment { + + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + return inflater.inflate(R.layout.dialog_2_my_rounded_bottom_sheet, container, false); + } +} +``` + ## Usage - Dialog Simply extend or create an instance of `RoundedBottomSheetDialog` , inflate your layout and show it #### Example +**Kotlin:** ```kotlin import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialog @@ -55,6 +72,16 @@ mBottomSheetDialog.setContentView(sheetView) mBottomSheetDialog.show() ``` +**Java:** +```java +RoundedBottomSheetDialog roundedBottomSheetDialog = new RoundedBottomSheetDialog( this ); + +LayoutInflater inflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE); +View sheetView = inflater.inflate(R.layout.dialog_2_my_rounded_bottom_sheet, null); +roundedBottomSheetDialog.setContentView(sheetView); +roundedBottomSheetDialog.show(); +``` + ## Customization We provide a few options to customize, to make sure your Bottom Sheet will feel native to your app From 7d138656deb80f16e442ee90f4257a61bd72b176 Mon Sep 17 00:00:00 2001 From: Mohammadreza Yektamaram Date: Sat, 4 Jan 2020 23:36:06 +0330 Subject: [PATCH 2/2] Added java example for usage --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 98fd555..656e4d0 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ Simply extend `RoundedBottomSheetDialogFragment`, inflate your layout and show i #### Example -**Kotlin Class:**: +**Kotlin Class:** ```kotlin // MyRoundedBottomSheet.kot import com.deishelon.roundedbottomsheet.RoundedBottomSheetDialogFragment