ProgressDialog that waits a minimum time to be dismissed before showing. Once visible, the ProgressDialog will be visible for a minimum amount of time to avoid "flashes" in the UI.

Overview

DelayedProgress

Android Arsenal Build Status License

ProgressBar and ProgressDialog that waits a minimum time to be dismissed before showing. Once visible, the they will be visible for a minimum amount of time to avoid "flashes" in the UI.

They extend platform version of them so that you can just replace all of your ProgressBar and ProgressDialog implementations quickly.

How does it look like?

Here is a demonstration of the usage in GDG Android App. As you can see here, on orientation change, the data is loaded quickly and has no progress indicator.

Usage

DelayedProgressBar

DelayedProgressBar is an extension to ProgressBar that handles automatic delaying and prevents flashes in the UI.

You can create it programatically just like you do with ProgressBar or you can use it in your XMLs.

<com.tasomaniac.android.widget.DelayedProgressBar
    android:id="@android:id/progress"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    style="?android:progressBarStyleHorizontal"/>

And you have to use show() and hide() functions instead of setting its visibility manually to have awesome delaying functionality.

Additionally we have show(boolean animate) and hide(boolean animate) that fades in and out the ProgressBar.

progressbar.show(true);

Lastly, if you want to do something when the animation ends, you can use the below function with endAction.

progressbar.show(true, new Runnable() {
    @Override
    public void run() {
        //Do something
    }
});

progressbar.hide(true, new Runnable() {
    @Override
    public void run() {
        //Do something
    }
});

DelayedProgressDialog

DelayedProgressDialog is an extension to ProgressDialog that handles automatic delaying and prevents flashes in the UI. You can use it just like ProgressDialog. Just use show() and dismiss() appropriately and it will handle the rest.

To create a DelayedProgressDialog with default timing values

DelayedProgressDialog.showDelayed(context, title, message, indeterminate, cancelable);

You can use make() to just create (without calling show()) it manually. This way you can modify it easily before calling show()

DelayedProgressDialog.makeDelayed(context, title, message, indeterminate, cancelable);

And configure

DelayedProgressDialog dialog = DelayedProgressDialog.make(...);
dialog.setMinDelay(2000);
dialog.setMinShowTime(500);
dialog.show();

Download

compile 'com.tasomaniac:delayed-progress:0.4'

Snapshots of the development version are available in Sonatype's snapshots repository.

License

Copyright (C) 2015 Said Tahsin Dane

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.
You might also like...
A view pager indicator view to deal with a large amount of pages.
A view pager indicator view to deal with a large amount of pages.

Attention I'm not going to support this anymore. Just use a better solution, e.g. this one Indefinite-Pager-Indicator BubblePagerIndicator A view page

A transaction management android app which allows you to verify records from both parties before addition.
A transaction management android app which allows you to verify records from both parties before addition.

Transact - Transaction Management Application Description Whenever we lend money to some people, friends, colleagues, we need to keep track of it to r

an android app to browse urls before open

link eye - kuesji koesnu - 8/8/2021 an android app to browse urls before open try to open a link, select link eye and choose always to start using

A Telegram bot utilities that help to reduce the code amount

Flume Party A Telegram bot utilities that help to reduce code amount. Real project examples Pull Party Bot: 19% of code has been reduced. Resistance B

An application that calculates the amount of a potential tip to a service that we were satisfied with.

Project: Tip Time App The 4th project of Kotlin on Android Studio Basics course. Introduction In this project we will create an interactive applicatio

Deletes other specs before the compileGroovy gradle task

run-groovy-spec-faster Template ToDo list Create a new IntelliJ Platform Plugin Template project. Get familiar with the template documentation. Verify

This is a repository for implementing Brontodroid and test it easily before we finalize things into a library/module to be consumed separately.

Bronto Playground This is a repository for implementing Brontodroid and test it easily before we finalize things into a library/module to be consumed

Dynamic Badge with customizable features as max number before displaying with +, color, shadow, border, corner radius, font properties and more written with Jetpack Compose
Dynamic Badge with customizable features as max number before displaying with +, color, shadow, border, corner radius, font properties and more written with Jetpack Compose

✏️📌 Dynamic Badge with customizable features as max number before displaying with +, color, shadow, border, corner radius, font properties and more written with Jetpack Compose. Displays numbers either in circle or rounded rectangle shape based on badge count and selected threshold to transform from circle to rounded rectangle.

Vigour - An Android Fitness App that rewards users with Crypto for walking a certain amount of steps.

Vigour Group Project for 2022 Mobile Application Development. Our app rewards user with crypto after walking for a certain amount of steps. We will be

Android Application that let users select 2 currencies with the amount to convert
Android Application that let users select 2 currencies with the amount to convert

Currency Converter Android Application that let users select 2 currencies with the amount to convert and have Historical data for 2 currencies of thei

💸Simple Android application to calculate a tip amount
💸Simple Android application to calculate a tip amount

TipTime 💸 Simple Android application to calculate a tip amount What i've learned? How to work with layouts in XML files Classes and inheritance in Ko

🚀🌆🏙 Display differences or animate progress between 2 images or Composables with overlay and customization options, zoom, pan gestures, and progress to observe properties for animating before-after progress

Compose Before-After Composables to display Images, or Composables as before and after composables to display differences or animate progress between

Small library that wraps Google Play Service API in brilliant RxJava Observables reducing boilerplate to minimum.

ReactiveLocation library for Android Small library that wraps Google Play Services API in brilliant RxJava Observables reducing boilerplate to minimum

A lightweight monthly calendar view for Android, fully written in Kotlin. Designed to meet the minimum demands for typical calendars.
A lightweight monthly calendar view for Android, fully written in Kotlin. Designed to meet the minimum demands for typical calendars.

Light Calendar View A lightweight monthly calendar view for Android, fully written in Kotlin. Designed to meet the minimum demands for typical calenda

A bare minimum proof-of-concept for Log4j2 JNDI RCE vulnerability (CVE-2021-44228/Log4Shell)

Log4j2 RCE Vulnerability POC A bare minimum proof-of-concept for Log4j2 JNDI Remote-Code-Execution vulnerability (CVE-2021-44228). This is intended fo

Minimum-mvvm-room-database - MVVM With Simple Room Database
Minimum-mvvm-room-database - MVVM With Simple Room Database

Minimum MVVM Koin (Kotlin Dependency Injection) Coroutines View Model Lifecycle

Button which is visible while user holds it. Main use case is controlling audio recording state (like in Telegram, Viber, VK).
Button which is visible while user holds it. Main use case is controlling audio recording state (like in Telegram, Viber, VK).

HoldingButton Button which is visible while user holds it. Main use case is controlling audio recording state (like in Telegram, Viber, VK). Getting s

 AutoPlayer - A player based on ExoPlayer for play video automatically in RecyclerView, when an item is visible.
AutoPlayer - A player based on ExoPlayer for play video automatically in RecyclerView, when an item is visible.

A player based on ExoPlayer for play video automatically in RecyclerView, when an item is visible.

Comments
  • Race issue leading to dialog not dismissed

    Race issue leading to dialog not dismissed

    I found a race timing dependent issue where the dialog is not dismissed in some cases, when the dialog it dismissed shortly after it has been shown.

    • ContentLoadingProgressDialog.dismiss() is called
    • it fires mDelayedHide
    • onAttachedToWindow() is called before mDelayedHide executes, and remove the callback
    • as a consequence, the callback is not called and the dialog not dismissed

    Although I could reprod it easily, it might be difficult to reproduce on a particular phone / Android version as it is really timing dependent. Raising minShowTime to 1000 or higher seems to fix it. It can also possibly fixed by modifying onAttachedToWindow() to not remove the callback if the dislog is in the process of being dismissed (not sure this is the correct fix though)

    opened by bubbleguuum 3
  • Attribute to show the progressBar delayed initially

    Attribute to show the progressBar delayed initially

    RIght now, delaying of the ProgressBar is controlled programatically. And by default it is shown. 😞

    Instead, it should be delayed initially as well.

    This also can be controlled by an attribute

    opened by tasomaniac 0
Releases(0.4)
Owner
Said Tahsin Dane
Engineering Manager @deliveryhero
Said Tahsin Dane
Android library for showing progress in a highly customizable pie.

ProgressPieView Android library for showing progress in a highly customizable pie. Choose from the broad spectre of styleable elements: ppvStrokeWidth

Filip Puđak 399 Dec 29, 2022
Custom font library for android | Library to change/add font of Entire Android Application at once without wasting your time - TextViews, EditText, Buttons, Views etc.,

AppFontChanger In a Single shot change font of Entire Android Application - TextViews, EditText, Buttons, Views etc., Kindly use the following links t

Prabhakar Thota 48 Aug 10, 2022
Cross-platform framework for building truly native mobile apps with Java or Kotlin. Write Once Run Anywhere support for iOS, Android, Desktop & Web.

Codename One - Cross Platform Native Apps with Java or Kotlin Codename One is a mobile first cross platform environment for Java and Kotlin developers

Codename One 1.4k Dec 23, 2022
Cross-platform framework for building truly native mobile apps with Java or Kotlin. Write Once Run Anywhere support for iOS, Android, Desktop & Web.

Codename One - Cross Platform Native Apps with Java or Kotlin Codename One is a mobile first cross platform environment for Java and Kotlin developers

Codename One 1.4k Jan 9, 2023
Renderers is an Android library created to avoid all the boilerplate needed to use a RecyclerView/ListView with adapters.

Renderers Renderers is an Android library created to avoid all the RecyclerView/Adapter boilerplate needed to create a list/grid of data in your app a

Pedro Vicente Gómez Sánchez 1.2k Nov 19, 2022
Intellij Idea, Android Studio plugin for generating Kotlin data classes from JSON. Helps to avoid writing boilerplate code for model classes. Supports annotations for Gson, Moshi, Jackson.

JSONToKotlinClass Intellij Idea, Android Studio plugin. Plugin generates Kotlin data classes from JSON text. It can find inner classes in nested JSON.

Vasily 139 Dec 21, 2022
TSBattery a new way to save your battery avoid cancer apps hacker it.

TSBattery TSBattery a new way to save your battery avoid cancer apps hacker it. TSBattery 是一个旨在使 QQ、TIM 变得更省电的开源 Xposed 模块 Get startted 此模块支持原生 Xposed

Fankesyooni 375 Jan 2, 2023
A button to substitute the ProgressDialog.

Progress Button Android Android Button that morphs into a loading progress bar. Fully customizable in the XML Really simple to use. Makes your app loo

Farham Hosseini 9 Aug 17, 2022
Tidy up your Android status bar before taking screenshots for the Play Store

DEPRECATED This project no longer works on recent versions of Android. Use Android's build-in Demo mode instead. For the curious, more information abo

Emma Vanbrabant 891 Nov 10, 2022