Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added java example for usage #6

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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(){
Expand All @@ -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

Expand All @@ -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
Expand Down