Demo app:
Features:
dependencies {
compile 'com.avast:android-styled-dialogs:2.3.3'
}
Hosted in jcenter:
It uses standard Material colors, for example like this:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/indigo</item>
<item name="colorPrimaryDark">@color/indigo_dark</item>
<item name="colorAccent">@color/pink</item>
</style>
For dark theme, inherit from Theme.AppCompat
. Or you can force dark theme per individual dialog using useDarkTheme()
builder method.
You can also force light theme per individual dialog using useLightTheme()
builder method.
Easy:
SimpleDialogFragment.createBuilder(this, getSupportFragmentManager()).setMessage(R.string.message).show();
SimpleDialogFragment.createBuilder(this, getSupportFragmentManager()).setTitle(R.string.title).setMessage(R.string.message).setPositiveButtonText(R.string.positive_button).setNegativeButtonText(R.string.negative_button).show();
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.
It's not possible to use normal Java callbacks, because they are lost after device rotation.
Implement interface ISimpleDialogCancelListener
in your Activity/Fragment.
Extend BaseDialogFragment
.
Have a look at JayneHatDialogFragment for a practical example.
Pull requests are welcomed!
Please set your Android Studio formatting to our code style.
Theodor Dialogs was a famous Czech painter, uncle of Jára 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 who help with #AndroidDev.