Skip to content

Commit

Permalink
readme.md update
Browse files Browse the repository at this point in the history
  • Loading branch information
kishandonga committed Feb 21, 2019
1 parent 64618e7 commit 854a8a7
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
45 changes: 44 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ Make background semi-transparent and add corner radius for the better look<br/>
<img width="441" height="150" src="images/img_2.png"/><br/><br/>
Custom view according to your requirements<br/>
<img width="441" height="105" src="images/img_3.png"/><br/><br/>
Apply gradient in the snackbar background<br/>
<img width="441" height="78" src="images/img_4.png"/><br/><br/>
</div>

## Examples
Expand Down Expand Up @@ -73,8 +75,21 @@ CustomSnackbar(this, root).show {
}
}
```

Java
```java
CustomSnackbar sb = new CustomSnackbar(MainActivity.this);
sb.message("Testing Message...");
sb.padding(15);
sb.cornerRadius(15);
sb.duration(Snackbar.LENGTH_LONG);
sb.withAction(android.R.string.ok, new Function1<Snackbar, Unit>() {
@Override
public Unit invoke(Snackbar snackbar) {
snackbar.dismiss();
return null;
}
});
sb.show();
```

#### Custom View
Expand All @@ -94,6 +109,34 @@ CustomSnackbar(this).show {
```

```java
final CustomSnackbar sb = new CustomSnackbar(MainActivity.this);
sb.customView(R.layout.snack_layout);
sb.duration(Snackbar.LENGTH_INDEFINITE);
sb.withCustomView(new Function1<View, Unit>() {
@Override
public Unit invoke(View view) {
view.findViewById(R.id.btnUndo).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
sb.dismiss();
}
});
return null;
}
});
sb.show();

// OR Use Like This Way

// View v = sb.getView();
// if(v != null){
// v.findViewById(R.id.btnUndo).setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View view) {
// sb.dismiss();
// }
// });
// }
```

#### With Drawable
Expand Down
Binary file added images/img_4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 854a8a7

Please sign in to comment.