Another way to show progress. A progress View over the system StatusBar. in addition to showing a toast message.
The first form is suitable for showing that the activity is being loaded like fetching data from server, meanwhile the second form is better for real process.
1.2.0: Toast, waiting balls and percentage text has been removed due to chaotic notches on phones which will cause them to be covered at least on some devices even if added a method to position them manually and caluclating notch coordinates is a lot of work results in ugly positioning for a simple idea
Another way to show progress. A progress View over the system StatusBar.
That was for android pre-oreo on oreo and above statusbar will remain visible for all options like this:
1- Add jitpack.io repositories to you project build.gradle
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
2- Add it as a dependency to your app build.gradle
dependencies {
compile 'com.github.BaselHorany:ProgressStatusBar:1.2.4'
}
1- In your Activity class
public class MainActivity extends AppCompatActivity {
ProgressStatusBar mProgressStatusBar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.acitivity_main);
//initialize
mProgressStatusBar = new ProgressStatusBar(this);
//show progress
mProgressStatusBar.startFakeProgress(3000); //make fake progress from 0 to 100 in 3 sec.
//or
mProgressStatusBar.setProgress(60); //set progress value manually
/*Addidional*/
//options, anytime before you start a new progress
mProgressStatusBar.setProgressColor(COLOR);//default #40212121
mProgressStatusBar.setProgressBackgroundColor(COLOR);//default transparent
//Listener
mProgressStatusBar.setProgressListener(new ProgressStatusBar.OnProgressListener() {
public void onStart() {
//ex: lock the UI or tent it
}
public void onUpdate(int progress) {
//ex: simulate with another progressView
}
public void onEnd() {
//ex: continue the job
}
});
}
}
Basel Horany http://baselhorany.com