Skip to content

Commit

Permalink
Add instruction to use dialog box and update the library documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
shashank singhal committed May 8, 2019
1 parent d722b3e commit 47bbe50
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 25 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# FancyAlertDialog-Android
[![platform](https://img.shields.io/badge/platform-Android-yellow.svg)](https://www.android.com)
[![API](https://img.shields.io/badge/API-19%2B-brightgreen.svg?style=plastic)](https://android-arsenal.com/api?level=19)
[![API](https://img.shields.io/badge/API-15%2B-brightgreen.svg?style=plastic)](https://android-arsenal.com/api?level=15)
[![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg?style=flat-square)](https://www.apache.org/licenses/LICENSE-2.0.html)
[![](https://jitpack.io/v/Shashank02051997/FancyGifDialog-Android.svg)](https://jitpack.io/#Shashank02051997/FancyGifDialog-Android)
[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-FancyGifDialog-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/6652)
Expand Down Expand Up @@ -31,12 +31,14 @@ Add this to your module's `build.gradle` file (make sure the version matches the
```gradle
dependencies {
...
compile 'com.github.Shashank02051997:FancyGifDialog-Android:1.1'
implementation 'com.github.Shashank02051997:FancyGifDialog-Android:1.2'
}
```
<h2> Fancy Gif Dialog</h2>
## Fancy Gif Dialog

```diff
Dialog with two buttons:

``` java
new FancyGifDialog.Builder(this)
.setTitle("Granny eating chocolate dialog box")
.setMessage("This is a granny eating chocolate dialog box. This library is used to help you easily create fancy gify dialog.")
Expand All @@ -61,6 +63,25 @@ new FancyGifDialog.Builder(this)
.build();
```

Dialog with one button:

``` java
new FancyGifDialog.Builder(this)
.setTitle("Granny eating chocolate dialog box")
.setMessage("This is a granny eating chocolate dialog box. This library is used to help you easily create fancy gify dialog.")
.setPositiveBtnText("Ok")
.setPositiveBtnBackground("#FF4081")
.setGifResource(R.drawable.gif1) //Pass your Gif here
.isCancellable(true)
.OnPositiveClicked(new FancyGifDialogListener() {
@Override
public void OnClick() {
Toast.makeText(MainActivity.this,"Ok",Toast.LENGTH_SHORT).show();
}
})
.build();
```

## Screenshots

**Please click the image below to enlarge.**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,36 @@

public class MainActivity extends AppCompatActivity implements View.OnClickListener {
Button b1;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
b1=findViewById(R.id.button);
b1 = findViewById(R.id.button);
b1.setOnClickListener(this);
}

@Override
public void onClick(View view) {
new FancyGifDialog.Builder(this)
.setTitle("Granny eating chocolate dialog box")
.setMessage("This is a granny eating chocolate dialog box. This library is used to help you easily create fancy gify dialog.")
.setNegativeBtnText("Cancel")
.setPositiveBtnBackground("#FF4081")
.setPositiveBtnText("Ok")
.setNegativeBtnText("Cancel")
.setNegativeBtnBackground("#FFA9A7A8")
.setGifResource(R.drawable.gif1)
.isCancellable(true)
.OnPositiveClicked(new FancyGifDialogListener() {
@Override
public void OnClick() {
Toast.makeText(MainActivity.this,"Ok",Toast.LENGTH_SHORT).show();
Toast.makeText(MainActivity.this, "Ok", Toast.LENGTH_SHORT).show();
}
})
.OnNegativeClicked(new FancyGifDialogListener() {
@Override
public void OnClick() {
Toast.makeText(MainActivity.this,"Cancel",Toast.LENGTH_SHORT).show();
Toast.makeText(MainActivity.this, "Cancel", Toast.LENGTH_SHORT).show();
}
})
.build();
Expand Down

0 comments on commit 47bbe50

Please sign in to comment.