An open API service indexing awesome lists of open source software.

https://github.com/fernandospr/android-overlay-dialog

A customizable dialog shown on top of the window
https://github.com/fernandospr/android-overlay-dialog

Last synced: 8 months ago
JSON representation

A customizable dialog shown on top of the window

Awesome Lists containing this project

README

          

# android-overlay-dialog
A customizable dialog shown on top of the window. Useful for showing info/error messages.

## Sample app

## How to use
Please, add the following dependency to your gradle file:
```
compile 'com.github.fernandospr:overlaydialog:1.0.1'
```

`OverlayDialog` inherits from `android.app.Dialog`, so you can use the same methods from Dialog, for example:
```
OverlayDialog dialog = new OverlayDialog(this);
dialog.setCancelable(true);
...
dialog.show();
...
dialog.dismiss();
```

To customize the view for the dialog, you should use:
```
View customView = LayoutInflater.from(this).inflate(layoutResID, root, false);
...
dialog.setContentView(customView);
```

To customize the auto dismiss time, you should use:
```
dialog.setAutoDismissDelayMillis(5000);
```

To customize the enter/exit animations, you should create a theme and set it in the constructor, for example:
```
OverlayDialog dialog = new OverlayDialog(this, R.style.TopMessageDialog);
```

* res/values/styles.xml
```

<item name="android:windowAnimationStyle">@style/TopMessageDialogAnimation</item>

<item name="android:windowEnterAnimation">@anim/translate_from_top</item>
<item name="android:windowExitAnimation">@anim/translate_to_top</item>

```

* res/anim/translate_from_top.xml
```


```

* res/anim/translate_to_top.xml
```


```

See the sample app for more examples.