All Projects → PatilShreyas → Materialdialog Android

PatilShreyas / Materialdialog Android

Licence: apache-2.0
📱Android Library to implement animated, 😍beautiful, 🎨stylish Material Dialog in android apps easily.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Materialdialog Android

Sequent
A simple continuous animation library for Android UI.
Stars: ✭ 263 (-56.31%)
Mutual labels:  material-design, material-ui, animation-library, android-ui
Materialdrawer
The flexible, easy to use, all in one drawer library for your Android project. Now brand new with material 2 design.
Stars: ✭ 11,498 (+1809.97%)
Mutual labels:  hacktoberfest, material-design, material-ui, android-ui
Slidetoact
A simple 'Slide to Unlock' Material widget for Android, written in Kotlin 📱🎨🦄
Stars: ✭ 783 (+30.07%)
Mutual labels:  hacktoberfest, material-design, material-ui, android-ui
Aestheticdialogs
📱 An Android Library for 💫fluid, 😍beautiful, 🎨custom Dialogs.
Stars: ✭ 352 (-41.53%)
Mutual labels:  material-design, material-ui, android-ui, dialog
Bottomsheet
BottomSheet dialog library for Android
Stars: ✭ 219 (-63.62%)
Mutual labels:  material-design, material-ui, android-ui
Ibackdrop
A library to simply use Backdrop in your project (make it easy). Read more ->
Stars: ✭ 137 (-77.24%)
Mutual labels:  material-design, material-ui, android-ui
Materialpreferences
A highly flexible set of lovely looking views that provides functionality of preferences.
Stars: ✭ 495 (-17.77%)
Mutual labels:  material-design, material-ui, android-ui
Nytimes App
🗽 A Simple Demonstration of the New York Times App 📱 using Jsoup web crawler with MVVM Architecture 🔥
Stars: ✭ 246 (-59.14%)
Mutual labels:  hacktoberfest, material-design, material-ui
Lovelydialog
This library is a set of simple wrapper classes that are aimed to help you easily create fancy material dialogs.
Stars: ✭ 1,043 (+73.26%)
Mutual labels:  material-design, android-ui, dialog
Mahapps.metro.iconpacks
Awesome icon packs for WPF and UWP in one library
Stars: ✭ 1,157 (+92.19%)
Mutual labels:  hacktoberfest, material-design, material-ui
Materiallettericon
Material first letter icon like lollipop contacts icon. Letter(s) on a shape drawn on canvas.
Stars: ✭ 255 (-57.64%)
Mutual labels:  material-design, material-ui, android-ui
Fancyshowcaseview
An easy-to-use customisable show case view with circular reveal animation.
Stars: ✭ 1,662 (+176.08%)
Mutual labels:  material-design, material-ui, android-ui
Mediapicker
Easy customizable picker for all your needs in Android application
Stars: ✭ 105 (-82.56%)
Mutual labels:  material-design, material-ui, android-ui
Introviews Flutter
☀️ A Flutter package for some material design app intro screens with some cool animations.
Stars: ✭ 570 (-5.32%)
Mutual labels:  hacktoberfest, material-design, material-ui
Datingapp
Dating UI kit is used for online meet up with girls and boys . The screen contains more than 30 icons and most of all required elements required to design an application like this. The XML and JAVA files contains comments at each and every point for easy understanding. Everything was made with a detail oriented style and followed by today's web trends. Clean coded & Layers are well-organized, carefully named, and grouped.
Stars: ✭ 97 (-83.89%)
Mutual labels:  material-design, material-ui, android-ui
Carbon
Material Design implementation for Android 4.0+. Shadows, ripples, vectors, fonts, animations, widgets, rounded corners and more.
Stars: ✭ 2,942 (+388.7%)
Mutual labels:  material-design, material-ui, android-ui
Alerter
An Android Alerting Library
Stars: ✭ 5,213 (+765.95%)
Mutual labels:  material-design, material-ui, android-ui
Materialfavoritebutton
Animated favorite/star/like button
Stars: ✭ 586 (-2.66%)
Mutual labels:  material-design, material-ui, android-ui
Android Material Design For Pre Lollipop
Various UI implementations, animations & effects based on Material Design compatible with pre Lollipop devices as well. (Work in progess)
Stars: ✭ 585 (-2.82%)
Mutual labels:  material-design, material-ui, android-ui
Purpleadmin Free Admin Template
Purple Admin is one of the most stylish Bootstrap admin dashboard you can get hands on. With its beautifully crafted captivating design and well-structured code.
Stars: ✭ 473 (-21.43%)
Mutual labels:  material-design, material-ui

Maven Central API Android Weekly

Github Followers GitHub stars GitHub forks GitHub watchers Twitter Follow

Material Dialogs for Android 📱

📱Android Library to implement animated, 😍beautiful, 🎨stylish Material Dialog in android apps easily.

1. Material Dialog 2. Animated Material Dialog 3. Bottom Sheet Material Dialog 4. Animated Bottom Sheet Material Dialog

Table of Contents:

Introduction

MaterialDialog library is built upon Google's Material Design library. This API will be useful to create rich, animated, beautiful dialogs in Android app easily. This library implements Airbnb's Lottie library to render After Effects animation in app. Refer this for Lottie documentation.

Types of Dialog

MaterialDialog library provides two types of dialog i.e.

1. Material Dialog 2. Bottom Sheet Material Dialog
This is basic material dialog which has two material buttons (Same as Android's AlertDialog) as you can see below. This is Bottom Sheet material dialog which has two material buttons which is showed from bottom of device as you can see below.

Implementation

Implementation of Material Dialog library is so easy. You can check /app directory for demo. Let's have look on basic steps of implementation.

Prerequisite

i. Gradle

In Build.gradle of app module, include these dependencies. If you want to show animations, include Lottie animation library.

This library is available on MavenCentreal

repositories {
    mavenCentral()
}

dependencies {

    // Material Dialog Library
    implementation 'dev.shreyaspatil.MaterialDialog:MaterialDialog:2.1.1'

    // Material Design Library
    implementation 'com.google.android.material:material:1.0.0'

    // Lottie Animation Library
    implementation 'com.airbnb.android:lottie:3.3.6'
}

ii. Set up Material Theme

Setting Material Theme to app is necessary before implementing Material Dialog library. To set it up, update styles.xml of values directory in app.

<resources>
    <style name="AppTheme" parent="Theme.MaterialComponents.Light">
        <!-- Customize your theme here. -->
        ...
    </style>
</resources>

These are required prerequisites to implement Material Dialog library.

iii. Customize Dialog Theme (Optional)

If you want to customize dialog view, you can override style in styles.xml as below.

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.MaterialComponents.Light.DarkActionBar">
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="android:fontFamily">@font/montserrat</item>

        <!-- Customize your theme here. -->
        <item name="material_dialog_background">#FFFFFF</item>
        <item name="material_dialog_title_text_color">#000000</item>
        <item name="material_dialog_message_text_color">#5F5F5F</item>
        <item name="material_dialog_positive_button_color">@color/colorAccent</item>
        <item name="material_dialog_positive_button_text_color">#FFFFFF</item>
        <item name="material_dialog_negative_button_text_color">@color/colorAccent</item>
    </style>

Create Dialog Instance

As there are two types of dialogs in library. Material Dialogs are instantiated as follows.

i. Material Dialog

MaterialDialog class is used to create Material Dialog. Its static Builder class is used to instantiate it. After building, to show the dialog, show() method of MaterialDialog is used.

        MaterialDialog mDialog = new MaterialDialog.Builder(this)
                .setTitle("Delete?")
                .setMessage("Are you sure want to delete this file?")
                .setCancelable(false)
                .setPositiveButton("Delete", R.drawable.ic_delete, new MaterialDialog.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int which) {
                        // Delete Operation
                    }
                })
                .setNegativeButton("Cancel", R.drawable.ic_close, new MaterialDialog.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int which) {
                        dialogInterface.dismiss();
                    }
                })
                .build();

        // Show Dialog
        mDialog.show();

ii. Bottom Sheet Material Dialog

BottomSheetMaterialDialog class is used to create Bottom Sheet Material Dialog. Its static Builder class is used to instantiate it. After building, to show the dialog, show() method of BottomSheetMaterialDialog is used.

        BottomSheetMaterialDialog mBottomSheetDialog = new BottomSheetMaterialDialog.Builder(this)
                .setTitle("Delete?")
                .setMessage("Are you sure want to delete this file?")
                .setCancelable(false)
                .setPositiveButton("Delete", R.drawable.ic_delete, new BottomSheetMaterialDialog.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int which) {
                        Toast.makeText(getApplicationContext(), "Deleted!", Toast.LENGTH_SHORT).show();
                        dialogInterface.dismiss();
                    }
                })
                .setNegativeButton("Cancel", R.drawable.ic_close, new BottomSheetMaterialDialog.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int which) {
                        Toast.makeText(getApplicationContext(), "Cancelled!", Toast.LENGTH_SHORT).show();
                        dialogInterface.dismiss();
                    }
                })
                .build();

        // Show Dialog
        mBottomSheetDialog.show();

Show Animations

Material Dialog Bottom Sheet Material Dialog

Animations in this library are implemented using Lottie animation library. You can get free animations files here. You can find varieties of animation files on https://lottiefiles.com. *.json file downloaded from LottieFiles should be placed in android project. There are two ways to place animation file (*.json).

For example, here delete_anim.json animation file is used to show file delete animation.

i. Using Resource File

Downloaded json file should placed in raw directory of res.

In code, setAnimation() method of Builder is used to set Animation to the dialog.

Prototype :

setAnimation(int resourceId)

Resource file should be passed to method. e.g. R.raw.delete_anim.

        MaterialButton mDialog = new MaterialDialog.Builder(this)
                // Other Methods to create Dialog........               
                .setAnimation(R.raw.delete_anim)                
                //...

ii. Using Asset File

Downloaded json file should placed in asset directory.

In code, setAnimation() method of Builder is used to set Animation to the dialog.

Prototype:

setAnimation(String fileName)

Only file name with extensions should passed to method.

        MaterialButton mDialog = new MaterialDialog.Builder(this)
                // Other Methods to create Dialog........               
                .setAnimation("delete_anim.json")               
                //...

iii. Getting LottieAnimationView

To get View of Animation for any operations, there is a method in Material Dialogs which returns LottieAnimationView of dialog.

        // Get Animation View
        LottieAnimationView animationView = mDialog.getAnimationView();
        // Do operations on animationView

Dialog State Listeners

There are three callback events and listeners for Dialog.

Following are interfaces for implementations:

  • OnShowListener() - Listens for dialog Show event. Its onShow() is invoked when dialog is displayed.
  • OnCancelListener() - Listens for dialog Cancel event. Its onCancel() is invoked when dialog is cancelled.
  • OnDismissListener() - Listens for dialog Dismiss event. Its onDismiss() is dismiss when dialog is dismissed.
       ... 
       mDialog.setOnShowListener(this);
       mDialog.setOnCancelListener(this);
       mDialog.setOnDismissListener(this);
    }
    
    @Override
    public void onShow(DialogInterface dialogInterface) {
        // Dialog is Displayed
    }

    @Override
    public void onCancel(DialogInterface dialogInterface) {
        // Dialog is Cancelled
    }

    @Override
    public void onDismiss(DialogInterface dialogInterface) {
        // Dialog is Dismissed
    }
}

Contribute

Let's develop with collaborations. We would love to have contributions by raising issues and opening PRs. Filing an issue before PR is must. See Contributing Guidelines.

Credits

This library is built using following open-source libraries.

License

Project is published under the Apache 2.0 license. Feel free to clone and modify repo as you want, but don't forget to add reference to authors :)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].