# android-styled-dialogs
**Repository Path**: androidfuntor/android-styled-dialogs
## Basic Information
- **Project Name**: android-styled-dialogs
- **Description**: android-styled-dialogs
- **Primary Language**: Unknown
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 2
- **Created**: 2014-10-09
- **Last Updated**: 2020-12-19
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# StyledDialogs for Android
This library makes styling and using dialogs _a piece of cake_.

Features:
- Compatible with Holo style and **Android Design Guidelines**
- Change style for all dialogs only by changing a **few color resources**
- Same look for **Android 2.2+**
- **Same API** as native Android DialogFragments
- `SimpleDialogFragment` class, which makes displaying simple dialogs a **one line of code**
## How to include it in your project:
With Gradle:
```groovy
compile 'eu.inmite.android.lib:android-styled-dialogs:1.1.2@aar'
```
With Maven:
```xml
eu.inmite.android.lib
android-styled-dialogs
1.1.2
apklib
```
Manually:
- clone the project
- add it as library project in your IDE
- include latest support library
## How to style all dialogs:
Add following into your application theme:
```xml
- @style/DialogStyleLight.Custom
```
or
```xml
- @style/DialogStyleDark.Custom
```
Define your dialog style, example for light theme:
```xml
```
## How to create simple dialogs:
Easy:
### Dialog with a simple message and Close button:
```java
SimpleDialogFragment.createBuilder(this, getSupportFragmentManager()).setMessage(R.string.message).show();
```
### Dialog with a title, message and Close button:
```java
SimpleDialogFragment.createBuilder(this, getSupportFragmentManager()).setTitle(R.string.title).setMessage(R.string.message).show();
```
### Dialog with a title, message and two buttons:
```java
SimpleDialogFragment.createBuilder(this, getSupportFragmentManager()).setTitle(R.string.title).setMessage(R.string.message).setPositiveButtonText(R.string.positive_button).setNegativeButtonText(R.string.negative_button).show();
```
### How to react on button press in your Activity/Fragment:
Simply implement interface `ISimpleDialogListener` in your Activity/Fragment. Listener's callbacks have `requestCode` parameter - you can use it if you have more dialogs in one Activity/Fragment.
For Fragments use setTargetFragment() method in the builder.
### How to react on cancelling the dialog:
Implement interface `ISimpleDialogCancelListener` in your Activity/Fragment.
## How to create all other DialogFragments:
Extend `BaseDialogFragment` and look at demo app implementation. It shows two types of those implementations:
- `FavoriteCharacterDialogFragment` shows a list in the dialog using extending `BaseDialogFragment`
- `JayneHatDialogFragment` shows a custom view in the dialog using extending `SimpleDialogFragment`
## Wishlist
The library could be improved with more common dialogs. Pull requests are encouraged!
### Possible candidates:
- date picker (spinners or calendar)
- time picker
- edittext dialog
- password dialog
- ...
## Why 'Dialogs'?
Theodor Dialogs was a famous Czech painter, uncle of [Jára Cimrman](http://en.wikipedia.org/wiki/J%C3%A1ra_Cimrman). Jára Cimrman was a playwright, philosopher, inventor, teacher, poet, mathematician and more but he lacked painting skills. That's why Theodor was helping him with many projects. Just like Android and this library do.
See [**our other Czech personalities**](http://inmite.github.io) who help with [#AndroidDev](https://plus.google.com/s/%23AndroidDev).