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

Change Android launcher App Icon and App Name programmatically.

A Twitter style post length counter which can be bound to an EditText and provide callbacks when hitting a max character count.

Once bound to an EditText the characters remaining will go down as the user types. If the user goes over the max limit you will get notified and the view will show how much they are over.

FlowR is a wrapper class around the Fragment Manager. It's mainly used to navigate between different fragments easily while providing a wide range of functionality. The following are the functionalities provided by the Flowr:

Easily navigate between different fragments. Ability to open fragments for result. Keeping the state of the activity correctly synced depending on the custom values specified by the fragment currently visible such as the screen orientation and navigation bar colour.

Sliding Tab Layout with color icons.

A handy set of utility for android.

SimplerRecyclerViewAdapter used to simplify the adapter structure for RecyclerView.

Features:

  • Easy to use
  • No need to create adapter (Separate java files)
  • Works with multiple view types.
  • View holders are inside Activity or Fragment, so easily call methods of activity on row click.

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