Android AlertDialog with moving dots progress indicator

Related tags

Dialog spots-dialog
Overview

Spots progress dialog

Maven    Blog Post    PlayStore    Android Arsenal

Android AlertDialog with moving spots progress indicator packed as android library.

Example Image1

===========

Usage

The library available in maven jcenter repository. You can get it using:

repositories {
    jcenter()
}
dependencies {
    implementation 'com.github.d-max:spots-dialog:1.1@aar'
}

Javadoc and sources package classifiers available too.

Note: The library requires minimum API level 15.

SpotsDialog class is an inheritor of a AlertDialog class. You can use it just like simple AlertDialog. For example:

val dialog: AlertDialog = SpotsDialog.Builder().setContext(context).build()
...
dialog.show()
...
dialog.dismiss()

Customization

For dialog customization of dialog, like message and cancel listener, use SpotsDialog.Builder methods.

val dialog: AlertDialog = SpotsDialog.Builder()
    .setContext(this)
    .setMessage(R.string.custom_title)
    .setCancelable(false)
    ...
    .build()
    .apply { 
        show() 
    }
...
dialog.dismiss()

For changing dialogs look and feel, create style and pass it ot dialog builder:

val dialog: AlertDialog = SpotsDialog.Builder()
    .Builder()
    .setContext(context)
    .setTheme(R.style.Cusom)
    .build()
    .apply {
        show()
    }

For styling the next custom attributes provided:

  • DialogTitleAppearance : style reference
  • DialogTitleText : string
  • DialogSpotColor : color
  • DialogSpotCount : integer

For example:

Provide you own style resource:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="Custom" parent="android:Theme.DeviceDefault.Dialog">
        <item name="DialogTitleAppearance">@android:style/TextAppearance.Medium</item>
        <item name="DialogTitleText">Updating…</item>
        <item name="DialogSpotColor">@android:color/holo_orange_dark</item>
        <item name="DialogSpotCount">4</item>
    </style>
</resources>

Result:

Example Image1

Note: On the pre-lollipop devices DialogSpotColor item won't work. As workaround just override color in your resources.

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="spots_dialog_color">@color/your_color_value</color>
</resources>

Proguard

If you're using proguard, add this code to your rules file:

-keep class dmax.dialog.** {
    *;
}

===========

Release notes

v1.1, June 5th 2018

  • Builder provided
  • Small fixes

v0.7, November 23th 2015

  • Override message setter

v0.4, July 23th 2015

  • Add custom message constructor

v0.3, May 5th 2015

  • Stop animation when dismiss dialog

v0.2, Feb 10th 2015

  • Fix issue on pre-lollipop

v0.1, Jan 15th 2015

  • Style customization

===========

Developed By

Maksym Dybarskyi - http://d-max.info

===========

License

The MIT License (MIT)
Copyright © 2015 Maxim Dybarsky

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Comments
  • java.lang.NoSuchFieldError: dmax.dialog.R$id.progress

    java.lang.NoSuchFieldError: dmax.dialog.R$id.progress

    Hello. Your library causes error:

        java.lang.NoSuchFieldError: dmax.dialog.R$id.progress
                at dmax.dialog.SpotsDialog.initProgress(SpotsDialog.java:76)
                at dmax.dialog.SpotsDialog.onCreate(SpotsDialog.java:49)
                at android.app.Dialog.dispatchOnCreate(Dialog.java:353)
                at android.app.Dialog.show(Dialog.java:257)
    
    opened by ftp27 19
  • Dialog animation for pre-Lollipop (Android 4.3)

    Dialog animation for pre-Lollipop (Android 4.3)

    Hi,

    I am using your library in Android app which is compiled to Android SDK version 23. I am running this app on Android 4.3. As far I can see the title of dialog, but I cannot see the animation composed from dots. My style.xml configuration looks like this one :

    <style name="LoadingDialog" parent="android:Theme.DeviceDefault.Dialog">
        <item name="DialogTitleAppearance">@android:style/TextAppearance.Medium</item>
        <item name="DialogTitleText">Loading</item>
        <item name="DialogSpotCount">4</item>
    </style>
    <color name="spots_dialog_color">@color/nliveo_orange_colorPrimary</color>
    

    Could you give me some additional guidance how fix this issue ? Thanks in advance!

    opened by GarciaPL 15
  • setMessage not working

    setMessage not working

    hi, I'm using your spots-dialog for my project...but setMessage() is not working... this is my code:

    SpotsDialog dialog = new SpotsDialog(this, R.style.Custom);
            dialog.setTitle("testing...");
            dialog.show();
    

    instead of "testing..." I got "?2130772112", or I just being don't understand with constructor,

    and I've tried you second solution:

    SpotsDialog dialog = new SpotsDialog(this);
            dialog.show();
            dialog.setMessage("testing...");
    

    but, instead of custom message that I've set, I got "Loading..." message. Please your guidance...

    opened by meeftah 6
  • NullPointerException

    NullPointerException

    at dmax.dialog.SpotsDialog.setMessage(SpotsDialog.java:74)

    @Override
    public void setMessage(CharSequence message) {
            ((TextView) findViewById(R.id.dmax_spots_title)).setText(message);
    }
    

    if you set custom message after create dialog but not show dialog yet, it throws NullPointerException. Because it isn't inflated yet. This method should be like that

    @Override
    public void setMessage(CharSequence message) {
           this.message = message; // this is necessary if textView null
           TextView textView = (TextView) findViewById(R.id.dmax_spots_title);
           if (textView != null) {
                textView.setText(message);
           }
    }
    
    opened by alirizagoksu 5
  • is there an easy way to change the color for the title ?

    is there an easy way to change the color for the title ?

    is there an easy way to change the color for the title ?

    Currently it is by default using the colorPrimary , can i change it to another color like white for example . you provided the following for customizing DialogTitleAppearance DialogTitleText DialogSpotColor DialogSpotCount

    non of them can be used for this .

    opened by justaaq 5
  • private access in dmx.dialog.SpotsDialog

    private access in dmx.dialog.SpotsDialog

    SpotsDialog dialog; dialog = new SpotsDialog(this);

    0.7 works great. I tried upgrading to 1.1 and keep getting a "private" access error. Can you provide a Java example? error

    opened by Ponkabonk 4
  • ้hey guy i error codeing spotsDialog java.lang.NullPointerException:

    ้hey guy i error codeing spotsDialog java.lang.NullPointerException:

    I catch error progressbar

    if (spotsDialog != null) {

                    spotsDialog.dismiss();
                    spotsDialog = null;
                } else {
                    spotsDialog.dismiss();
                    spotsDialog = null;
                }
    

    and show logcaat

    Process: th.co.siamkubota.kubota, PID: 24287 java.lang.NullPointerException: Attempt to invoke virtual method 'void dmax.dialog.SpotsDialog.dismiss()' on a null object reference at th.co.siamkubota.kubota.fragment.UnfinishTaskFragment$1.onPostExecute(UnfinishTaskFragment.java:308) at th.co.siamkubota.kubota.fragment.UnfinishTaskFragment$1.onPostExecute(UnfinishTaskFragment.java:221) at android.os.AsyncTask.finish(AsyncTask.java:636) at android.os.AsyncTask.access$500(AsyncTask.java:177) at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:653) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:145) at android.app.ActivityThread.main(ActivityThread.java:6856) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)

    opened by PongPloy2016 3
  • Ability to define style and title both from constructor

    Ability to define style and title both from constructor

    Hello and thanks for the great lib!

    I think the dialog message should not be in the styles, as it doesn't have to do anything with the looks. When you have 5 different dialogs with the same style but different text, they all should use the same style.

    I saw you closed a similar issue earlier and added a new constructor with context and message. The problem is that with this constructor you can't use a custom theme, so now you can set either the style OR the message.

    The solution would be a constructor that allows setting both the style and the message message. If you agree, I'd happily contribute.

    opened by zsoltk 3
  • SpotsDialog(....) has private access in 'dmax.dialog.SpotsDialog'

    SpotsDialog(....) has private access in 'dmax.dialog.SpotsDialog'

    Hi,

    tried the following

    AlertDialog waitingDialog = new SpotsDialog(LogIn.this);

    but SpotsDialog can't be read. Any idea what am i missing?

    The android prompt put this as the error SpotsDialog(....) has private access in 'dmax.dialog.SpotsDialog'

    opened by d3smondwong 2
  • I removed this and still gives error in cache files

    I removed this and still gives error in cache files

    I removed this from my gradle in android studio3.0.1 but still project is not syncing by giving me the error in cache files C:\Users\Moderni.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.0.1.aar\e8ddbb4d66d9a9dbbaff29cb1e3cc03d\res\values\values.xml

    Error:(1423, 5) error: style attribute 'attr/DialogTitleAppearance (aka com.kiran.example.ebitcoin:attr/DialogTitleAppearance)' not found.

    opened by developer20atmoderni 2
  • Minor issue with long texts

    Minor issue with long texts

    I think your library is awesome :D! However, there is one minor improvement point:

    <TextView
            android:id="@+id/dmax_spots_title"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/title_margin"
            android:layout_gravity="center"
            android:textAppearance="?attr/DialogTitleAppearance"
            android:text="?attr/DialogTitleText"/>
    

    The layout_width should be match_parent, if it's wrap_content and the text is too long for X or Y reason, it stops working as expected and it goes to the left. Maybe you could update it in your free time! Thanks for so awesome library.

    opened by FANMixco 2
  • Simplify build so that it can build with jitpack instead of deprecated jcenter

    Simplify build so that it can build with jitpack instead of deprecated jcenter

    Jcenter is deprecated so it's time to move to another distribution system. Jitpack works great and has been around for a long time. Let's use it instead!

    opened by johnnylambada 0
  • Crash to open the app

    Crash to open the app

    I have done every thing and I have installed the app without any error on the android virtualization mobile. I have checked the process and I did every thing like video. But, when I click on the app icon to open the app it does not work. what should I do now?

    opened by ahmad71177 1
  • Can't cancel dialog.

    Can't cancel dialog.

    Hey, I am using this code:

    mDialog = new SpotsDialog.Builder()
                    .setContext(this.getContext())
                    .setTheme(R.style.CustomDialog)
                    .setCancelable(true)
                    .setCancelListener(this)
                    .build();
            mDialog.show();
    

    but everywhere i touch on the screen nothing happens. It has also no effect if I setCacelable(false). No events will be send to the CacelListener. Would be nice if you have some instructions on how to solve this. ;-) cheers ;-)

    opened by HasBert 1
Owner
Maksym Dybarskyi
Maksym Dybarskyi
AlertDialog for Android, a beautiful and material alert dialog to use in your android app.

AlertDialog for Android, a beautiful and material alert dialog to use in your android app. Older verion of this library has been removed

Akshay Masram 124 Dec 28, 2022
GenericDialog 1.3 0.0 Java A new AlertDialog for Android is here...!!

GenericDialog A new AlertDialog for Android is here...!! Getting Started Installation Add this into your root build.gradle file: allprojects { reposi

Jaidev Naik 22 Sep 6, 2022
AlertDialog - Explain about Alert Dialog in Android

AndroidTemplate I got a problem to create Android project with Java 11 and anoth

Monthira Chayabanjonglerd 1 Feb 13, 2022
Make your native android Dialog Fancy and Gify. A library that takes the standard Android Dialog to the next level with a variety of styling options and Gif's. Style your dialog from code.

FancyGifDialog-Android Prerequisites Add this in your root build.gradle file (not your module build.gradle file): allprojects { repositories { ...

Shashank Singhal 522 Jan 2, 2023
Android has a built in microphone through which you can capture audio and store it , or play it in your phone. There are many ways to do that but with this dialog you can do all thats with only one dialog.

# Media Recorder Dialog ![](https://img.shields.io/badge/Platform-Android-brightgreen.svg) ![](https://img.shields.io/badge/Android-CustomView-blue.sv

Abdullah Alhazmy 73 Nov 29, 2022
A simple library for creating animated warnings/dialogs/alerts for Android.

Noty A simple library for creating animated warnings/notifications for Android. Examples Show me code Show me code Show me code Show me code Show me c

Emre 144 Nov 29, 2022
Advanced dialog solution for android

DialogPlus Simple and advanced dialog solution. Uses normal view as dialog Provides expandable option Multiple positioning Built-in options for easy i

Orhan Obut 5k Dec 29, 2022
SweetAlert for Android, a beautiful and clever alert dialog

Sweet Alert Dialog SweetAlert for Android, a beautiful and clever alert dialog 中文版 Inspired by JavaScript SweetAlert Demo Download ScreenShot Setup Th

书呆子 7.3k Dec 30, 2022
An Android Dialog Lib simplify customization.

FlycoDialog-Master 中文版 An Android Dialog Lib simplify customization. Supprot 2.2+. Features [Built-in Dialog, convenient to use](#Built-in Dialog) [Ab

Flyco 2.3k Dec 8, 2022
😍 A beautiful, fluid, and extensible dialogs API for Kotlin & Android.

Material Dialogs View Releases and Changelogs Modules The core module is the fundamental module that you need in order to use this library. The others

Aidan Follestad 19.5k Dec 29, 2022
[Deprecated] This project can make it easy to theme and custom Android's dialog. Also provides Holo and Material themes for old devices.

Deprecated Please use android.support.v7.app.AlertDialog of support-v7. AlertDialogPro Why AlertDialogPro? Theming Android's AlertDialog is not an eas

Feng Dai 468 Nov 10, 2022
LicensesDialog is an open source library to display licenses of third-party libraries in an Android app.

LicensesDialog LicensesDialog is an open source library to display licenses of third-party libraries in an Android app. Download Download the latest R

PSDev 817 Dec 30, 2022
Android library to show "Rate this app" dialog

Android-RateThisApp Android-RateThisApp is an library to show "Rate this app" dialog. The library monitors the following status How many times is the

Keisuke Kobayashi 553 Nov 23, 2022
A small library replicating the new dialogs in android L.

L-Dialogs A small library replicating the new dialogs in android L. Set Up (Android Studio): Download the aar here: https://www.dropbox.com/s/276bhapr

Lewis Deane 572 Nov 11, 2022
A simple file/ directory picker dialog for android

FileListerDialog FileListerDialog helps you to list and pick file/directory. Library is built for Android Getting Started Installing To use this libra

Yogesh S 446 Jan 7, 2023
📱 An Android Library for 💫fluid, 😍beautiful, 🎨custom Dialogs.

Aesthetic Dialogs for Android ?? ?? Android Library for ?? fluid, ?? beautiful, ?? custom Dialogs. Table of Contents: Introduction Types of Dialog Dar

Gabriel TEKOMBO 538 Dec 14, 2022
a quick custom android dialog project

QustomDialog Qustom helps you make quick custom dialogs for Android. All this is, for the time being, is a way to make it easy to achieve the Holo loo

Daniel Smith 183 Nov 20, 2022
Android library that allows applications to add dialog-based slider widgets to their settings

Android Slider Preference Library Overview Slider represents a float between 0.0 and 1.0 Access with SliderPreference.getValue() or SharedPreferences.

Jay Petacat 135 Nov 29, 2022
An Android library that provides a simple implementation of a DialogFragment

SimpleDialogFragment An Android library that provides a simple implementation of a DialogFragment. Are you tired of creating a new DialogFragment for

Julien Arzul 32 Oct 2, 2020