GithubHelp home page GithubHelp logo

classicvalues / android-styled-dialogs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from avast/android-styled-dialogs

0.0 0.0 0.0 1.89 MB

Backport of Material dialogs with easy-to-use API based on DialogFragment

License: Apache License 2.0

Java 100.00%

android-styled-dialogs's Introduction

StyledDialogs for Android

Build Status License Android Arsenal

Screenshot of the dialogs

Demo app:

Get it on Google Play

Features:

  • Compatible with Material Design Guidelines
  • Same look for Android 2.2+
  • Built on top of standard DialogFragment
  • Supports stacked buttons, neutral button, callbacks even after rotation
  • Light and dark theme
  • Contains even more specialized dialogs: List, Progress, Time&Date Picker, Custom, ...

How to include it in your project:

dependencies {
	compile 'com.avast:android-styled-dialogs:2.3.3'
}

Hosted in jcenter: Download

Looking for Holo dialogs?

How to style all dialogs:

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.

How to create simple dialogs:

Easy:

Dialog with a simple message only:

SimpleDialogFragment.createBuilder(this, getSupportFragmentManager()).setMessage(R.string.message).show();

Dialog with a title, message and two buttons:

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.

It's not possible to use normal Java callbacks, because they are lost after device rotation.

How to react on cancelling the dialog:

Implement interface ISimpleDialogCancelListener in your Activity/Fragment.

How to create custom DialogFragments:

Extend BaseDialogFragment.

Have a look at JayneHatDialogFragment for a practical example.

Contributing

Pull requests are welcomed!

Please set your Android Studio formatting to our code style.

Why 'Dialogs'?

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.

android-styled-dialogs's People

Contributors

arriolac avatar cermakcz avatar davidvavra avatar evant avatar franklinharper avatar jfragosoperez avatar kd7uiy avatar marianeum avatar martarodriguezm avatar monikajethani avatar mr-const avatar mrgoltstein avatar petrsimek avatar samerzmd avatar tomas-vondracek avatar tomaskypta avatar tprochazka avatar veinhorn avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.