Giter Site home page Giter Site logo

spots-dialog's Introduction

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.

spots-dialog's People

Contributors

aistomin avatar ardacebi avatar bryant1410 avatar dybarsky avatar

Watchers

 avatar  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.