Android AlertDialog with moving dots progress indicator

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
Android - An action bar item which acts both as a refresh button and as a progress indicator

RefreshActionItem An action bar item that implements this common pattern: Initially it shows a refresh button. If the button is clicked, a background

Manuel Peinado Gallego 655 Nov 10, 2022
Customizable bouncing dots for smooth loading effect. Mostly used in chat bubbles to indicate the other person is typing.

LoadingDots for Android Customizable bouncing dots view for smooth loading effect. Mostly used in chat bubbles to indicate the other person is typing.

Eyal Biran 162 Dec 2, 2022
A progress wheel for android, intended for use instead of the standard progress bar.

Deprecation warning This project is no-longer maintained, and has not been maintained for a few years now. If you're looking for an alternative librar

Todd Davies 2.7k Dec 29, 2022
Android loading or progress dialog widget library, provide efficient way to implement iOS like loading dialog and progress wheel

ACProgressLite English Version / 中文版本 An Android loading widget library. Lite and easy to use, strong customizability. Can be used to implement 'iOS'

Cloudist Technology Co., Ltd. 234 Nov 24, 2022
IOSProgressBar is a progress-bar lib for android. And the progress-bar looks like iOS system style

IOSProgressBar is a progress-bar lib for android. And the progress-bar looks like iOS system style

heyangyang 6 Aug 25, 2022
A 'Google Fit' like activity indicator for Android

WheelIndicatorView A 'Google Fit' like activity indicator for Android Screenshots Usage How to use: Add a "WheelIndicatorView" in the layout editor li

David Lázaro 396 Nov 25, 2022
A lightweight circular indicator view library for Android

A lightweight circular indicator view library for Android

İbrahim Süren 241 Dec 30, 2022
Indicator like tachometer View Library for Android

Tachometer Android Indicator like tachometer View Library for Android GIF Sample Preview Setup Step 1. Add Jitpack repository to your project build.gr

null 1 Jul 28, 2022
A rubber indicator

RubberIndicator A rubber indicator for ViewPager Designed by Valentyn Khenkin Here is the CSS version Usage The attributes for RubberIndicator are not

Fei Liang 1.6k Dec 16, 2022
MaterialLoadingProgressBar provide a styled ProgressBar which looks like SwipeRefreshLayout's loading indicator(support-v4 v21+)

MaterialLoadingProgressBar MaterialLoadingProgressBar provide a styled ProgressBar which looks like SwipeRefreshLayout's loading indicator(support-v4

lsjwzh 1.1k Nov 19, 2022
This lib can be used for viewpager infinite loop with indicator easily.

InfiniteIndicator This project is inspired by the android-auto-scroll-view-pager of Trinea. Use the salvage lib implement view recycle adapter.It cont

lightSky 489 Sep 8, 2022
A rubber indicator

RubberIndicator A rubber indicator for ViewPager Designed by Valentyn Khenkin Here is the CSS version Usage The attributes for RubberIndicator are not

Fei Liang 1.6k Dec 16, 2022
[Android] Round Corner Progress Bar Library for Android

RoundCornerProgressBar Round corner is cool. Let's make your progress bar to round corner Colorful progress bar with round corner on progress which yo

Akexorcist 2.3k Dec 31, 2022
[Android] Round Corner Progress Bar Library for Android

RoundCornerProgressBar Round corner is cool. Let's make your progress bar to round corner Colorful progress bar with round corner on progress which yo

Akexorcist 2.3k Jan 7, 2023
Android library to display progress like google does in some of his services.

GoogleProgressBar This library is not maintained anymore and there will be no further releases Android library to display different kind of google rel

JPARDOGO 1.3k Dec 27, 2022
Android fillable progress view working with SVG paths. This is a nice option too if you want to create an interesting branding logo for your app. Based on the iOS project: https://github.com/poolqf/FillableLoaders

Android FillableLoaders Android Open Source library providing an interesting fillable progress view working with SVG paths. This is a nice option too

Jorge Castillo 2k Jan 1, 2023
A customizable, animated progress bar that features rounded corners. This Android library is designed to look great and be simple to use 🎉

RoundedProgressBar Easy, Beautiful, Customizeable The RoundedProgressBar library gives you a wide range of customizable options for making progress ba

null 541 Jan 1, 2023
Some beautiful android loading drawable, can be combined with any view as the LoadingView or the ProgressBar. Besides, some Drawable can customize the loading progress too.

LoadingDrawable: Android cool animation collection 前言 CircleRotate源码解析 Fish源码解析 LoadingDrawable is some android animations implement of drawable: a li

dinus_developer 4.1k Dec 27, 2022
A wave view of android,can be used as progress bar.

WaveView ![Gitter](https://badges.gitter.im/Join Chat.svg) A wave view of android,can be used as progress bar. Screenshot APK demo.apk What can be use

Kai Wang 1.3k Dec 28, 2022