BusyIndicator


Source link: https://github.com/silverforge/BusyIndicator

README

Contents

What is this repository for?

The BusyIndicator is a progress indicator with determined and indeterminate state.

Current version is

How do I get set up?

dependencies {
  ...

compile 'com.silverforge.controls:busyindicator:1.2.0' 
}
 
Issues/contact

Please do not hesitate to raise any issue you find related to BusyIndicator here

License

Apache 2.0

Copyright 2015 Janos Murvai-Gaal  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. 

Configuration

You can control the busyindicator behavior or look & feel with the following attributes:

Indeterminate
v1.0
  • bigpoint_color - The foreground color of the points (circles) on outer radius. By default it is gray.
  • smallpoint_color - The foreground color of the point (circle) on the inner radius. By default it is black.
  • bigpoint_count - The count of points (circles) on outer radius. By default it is 4. (Range is integer between 4 and 20)
  • background_is_visible - true of false. If true you have a light gray rectangle background with rounded corner by default .
  • background_color - The background color if visible. By default it is light gray.
  • background_shape - The shape of background. (Values could be either rounded_rectangle or circle)
v1.1
  • angle_modifier - The speed multiplicator of the busy indicator. By default it is 1. (Range is integer between 1 and 3)
Determined

All of the attributes mentioned in previous section plus

v1.0
  • infinite - true of false. If true the busyindicator is active otherwise the load indicator is active.
  • percentage_is_visible - true of false. If true the percentage text appears.
  • percentage_decimal_places - Could be : [0, 1, 2]. The decimal places of the percentage text.
  • max_value - The max value of the progress.
v1.1
  • stroke_width_multiplier - The width multiplicator of the indicator. (Range is float between 0.2F and 14F)
  • load_points_are_visible - true or false. If true the outer points are visible otherwise they are hidden.
  • indicator_alpha - The indicator color alpha. By default it is 100. (Range is integer between 100 and 255).

Dark rectangle background

Busy indicator
<com.silverforge.controls.BusyIndicator
  app:angle_modifier="3"
  app:background_is_visible="true"
  app:background_color="@color/dark_background"
  app:bigpoint_color="@color/dark_bigpoint"
  app:smallpoint_color="@color/dark_smallpoint"

android:layout_width="300dp"
  android:layout_height="150dp"
  android:layout_margin="10dp"
  />
Progress indicator
<com.silverforge.controls.BusyIndicator
  android:id="@+id/finiteRectangleBusyIndicator"

app:background_is_visible="true"
  app:background_shape="rounded_rectangle"
  app:background_color="@color/dark_background"
  app:bigpoint_color="@color/dark_bigpoint"
  app:smallpoint_color="@color/dark_smallpoint"
  app:bigpoint_count="20"

app:infinite="false"
  app:max_value="100"
  app:percentage_is_visible="true"
  app:percentage_decimal_places="1"
  app:load_points_are_visible="false"

android:layout_width="300dp"
  android:layout_height="150dp"
  android:layout_margin="10dp"
  />

Light circle background

Busy indicator
<com.silverforge.controls.BusyIndicator
  android:id="@+id/infiniteCircleBusyIndicator"

app:background_is_visible="true"
  app:background_shape="circle"
  app:background_color="@color/light_background"
  app:bigpoint_color="@color/light_bigpoint"
  app:smallpoint_color="@color/light_smallpoint"

android:layout_width="150dp"
  android:layout_height="150dp"
  android:layout_margin="10dp"
  />
Progress indicator
<com.silverforge.controls.BusyIndicator
  android:id="@+id/finiteCircleBusyIndicator"

app:background_is_visible="true"
  app:background_shape="circle"
  app:background_color="@color/light_background"
  app:bigpoint_color="@color/light_bigpoint"
  app:smallpoint_color="@color/light_smallpoint"
  app:bigpoint_count="20"

app:infinite="false"
  app:max_value="100"
  app:percentage_is_visible="true"
  app:percentage_decimal_places="2"
  app:stroke_width_multiplier="14"

android:layout_width="150dp"
  android:layout_height="150dp"
  android:layout_margin="10dp"
  />

Transparent background

Busy indicator
<com.silverforge.controls.BusyIndicator
  app:bigpoint_color="@color/trans_bigpoint"
  app:smallpoint_color="@color/trans_smallpoint"

android:layout_width="300dp"
  android:layout_height="150dp"
  android:layout_margin="10dp"
  />
Progress indicator
<com.silverforge.controls.BusyIndicator
  android:id="@+id/finiteTransBusyIndicator"

app:bigpoint_color="@color/trans_bigpoint"
  app:smallpoint_color="@color/trans_smallpoint"
  app:bigpoint_count="20"

app:infinite="false"
  app:max_value="100"
  app:percentage_is_visible="true"
  app:percentage_decimal_places="0"
  app:stroke_width_multiplier="0.8"

android:layout_width="300dp"
  android:layout_height="150dp"
  android:layout_margin="10dp"
  />

Multi progress indicators

Progress indicator

Multi progress indicator

How to control progress indicator from code

Basically just set the maxValue() of busyIndicator and after that set the current value via setValue() frequently like the // NOTE indicates in the code below.

Note : You can set the maxValue with xml attribute as well like app:max_value="756"

For example if you have a progress from 0 to 756, you just set maxValue() to 756 and via setValue() inform the busyIndicator about the progress. BusyIndicator will do the percentage calculations.


  busyIndicator = (BusyIndicator) findViewById(R.id.finiteBusyIndicator);

 // NOTE : Set the maximum value

busyIndicator.setMaxValue(102);

 new BusyIndicatorAsyncTask().execute();
  ...

class BusyIndicatorAsyncTask extends AsyncTask {

@Override

protected Object doInBackground(Object[] params) {

  for (int i = 0; i <= 102; i += 3) {

  final int a = i;

  runOnUiThread(new Runnable() {

@Override

public void run() {

  // NOTE : You can set the current value of BusyIndicator

 busyIndicator.setValue(a);

}

  
}
);

try {

Thread.sleep(1000);

  
}
 catch (InterruptedException e) {

e.printStackTrace();

  
}

 
}

  return null;

}

  
}
v1.2

Set the color of the load indicator from code

 rectangleBusyIndicator = (BusyIndicator) view.findViewById(R.id.finiteRectangleBusyIndicator);

rectangleBusyIndicator.setSingleColor(Color.CYAN);

Add custom text below the percentage

 rectangleBusyIndicator = (BusyIndicator) view.findViewById(R.id.finiteRectangleBusyIndicator);

rectangleBusyIndicator.setCustomText("perec");

How to adjust indeterminate busy indicator speed

Actualy it's simple, you can set the angle modifier via setAngleModifier() method at any time. The busy indicator immediately changes the speed once you set it.

 class InfiniteBusyModifier extends AsyncTask {

@Override

protected Object doInBackground(Object[] params) {

 final Random rand = new Random();

  FragmentActivity activity = getActivity();

  while (true) {

  final int a = rand.nextInt(3) + 1;

activity.runOnUiThread(new Runnable() {

@Override

public void run() {

  // NOTE : You can set the speed

 infiniteCircleBusyIndicator.setAngleModifier(a);

}

  
}
);

try {

Thread.sleep(1000);

  
}
 catch (InterruptedException e) {

e.printStackTrace();

  
}

 
}

}

  
}

UI

Resources

Generic Recycler View Adapter that supports multiple layout implementations in a single Recycler View.

Yeoman Generator for Android Conductor based apps. It's simple much better than cloning and refactoring your project manually.

A library, based on Google's Volley library, that makes android HTTP requests easier and requires no boiler plate code that volley usually needs.

CustomVolleyRequester is used to make developer's lives easier. Making HTTP calls is a common requirement for most apps and we believe that using it does not require the developer to repeat the initialization process each time. With CustomVolleyRequester, all you need to do is specify the request fields needed for your request, give it the desired model class to be returned, and the library will deliver your model.

A tiny, fully extensible MVP implementation for Android in pure Java, which goal is to provide common interfaces for tests that need to easily mock Views and Presenters.

An android pagination library.

Excuser is a utility app to rescue yourself from an awkward situation, boring meetings, annoying conversation, meaningless interviews etc.

Just shake your wrist with Andorid Wear and the fake call will ring your phone instantly.

The app allows you to:

  • Specify the intensity of the shake which triggers the incoming call.
  • Specify custom contacts (which are chosen randomly) for the incoming call.

Escape boredom. No need to make boring excuses - Just get Excuser!

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes