GithubHelp home page GithubHelp logo

basirsharif / delayedprogress Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tasomaniac/delayedprogress

0.0 1.0 0.0 265 KB

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.

License: Apache License 2.0

Shell 4.38% Java 95.62%

delayedprogress's Introduction

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.

delayedprogress's People

Contributors

tasomaniac avatar

Watchers

Basir sharif 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.