Giter Club home page Giter Club logo

materialstyleddialogs's Introduction

MaterialStyledDialogs

Android Library

Android Library that shows a beautiful and customizable Material designed dialog with header. Based on material-dialogs and inspired by this dribbble.

MaterialStyledDialogs

Sample Project

You can download the latest sample APK from Google Play:

How to include

Add the repository to your project build.gradle:

repositories {
    jcenter()
    maven {
        url "https://jitpack.io"
    }
}

And add the library to your module build.gradle:

dependencies {
    compile 'com.github.javiersantos:MaterialStyledDialogs:1.5'
}

Usage

Basic Dialog

A basic dialog will show the provided title (optional) and description, using your primary color as the header background.

new MaterialStyledDialog(this)
        .setTitle("Awesome!")
        .setDescription("What can we improve? Your feedback is always welcome.")
        .show();

or using the builder...

MaterialStyledDialog dialog = new MaterialStyledDialog(this)
        .setTitle("Awesome!")
        .setDescription("What can we improve? Your feedback is always welcome.")
        .build();
...
dialog.show();

Style

Style 1 Style 2
Header with Icon (default): .setStyle(Style.HEADER_WITH_ICON) Header with Title: .setStyle(Style.HEADER_WITH_TITLE)

Customizations (Wiki)

// Set an icon for the dialog header.
.setIcon(R.drawable.ic_launcher)
// Set if the header icon will be displayed with an initial animation.
// Default: true
.withIconAnimation(false)
// Set if the dialog will be displayed with an open and close animation, with custom duration.
// Default: false
.withDialogAnimation(true)

// Default: false, Duration.NORMAL
.withDialogAnimation(true, Duration.SLOW)
// Set if the divider will be displayed before the buttons and after the dialog content.
// Default: false
.withDivider(true)
// Set a color for the dialog header.
// Default: Theme primary color.
.setHeaderColor(R.color.dialog_header)
// Set an image for the dialog header.
.setHeaderDrawable(R.drawable.header)
// Set if the dialog will be hidden when touching outside.
// Default: true
.setCancelable(false)
// Set if the description will be scrollable, with custom maximum lines.
// Default: false
.setScrollable(true)

// Default: false, 5
.setScrollable(true, 10)
// Set a positive, negative and/or neutral button for the dialog.
.setPositive(getResources().getString(R.string.button), new MaterialDialog.SingleButtonCallback() {
        @Override
        public void onClick(MaterialDialog dialog, DialogAction which) {
                Log.d("MaterialStyledDialogs", "Do something!");
        }
})
//.setNegative(...)
//.setNeutral(...)
// Set a custom view for the dialog.
// Old standard padding: .setCustomView(your_custom_view, 20, 20, 20, 0)
// Check out the wiki for more documentation: https://github.com/javiersantos/MaterialStyledDialogs/wiki/Adding-a-custom-view
.setCustomView(your_custom_view)

// Set a custom view for the dialog with optional padding in DP.
// Old standard padding: .setCustomView(your_custom_view, 20, 20, 20, 0)
// Check out the wiki for more documentation: https://github.com/javiersantos/MaterialStyledDialogs/wiki/Adding-a-custom-view
.setCustomView(your_custom_view, int left, int top, int right, int bottom)

Apps already using this library

Feel free to send me new projects by submitting an issue or a pull request.

Following: game for Twitter

License

Copyright 2016 Javier Santos

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

MaterialStyledDialogs includes code from material-dialogs, which is 
licensed under the MIT license. You may obtain a copy at

   https://github.com/afollestad/material-dialogs/blob/master/LICENSE.txt

materialstyleddialogs's People

Contributors

javiersantos avatar

Watchers

James Cloos avatar cva78 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.