I am using LinearProgressIndicator with WebView to show web page rendering progress. I am using onProgressChanged (WebView view,int newProgress) of WebChromeClient for that purpose like below:
@Override
public void onProgressChanged(WebView view, final int newProgress) {
super.onProgressChanged(view, newProgress);
if (newProgress == 100) {
indicator.setProgressCompat(100,true);
//todo implement listener to hide progress indicator
} else {
indicator.setProgressCompat(newProgress,true);
}
}
Now consider this scenario: Progress indicator has current progress = 70 and newProgress which we have to set is 100. So, I want to hide progress indicator after its animation is finished. If I hide it using progressBar.hide(); after indicator.setProgressCompat(100,true); then it becomes hidden, but there is one issue, it quickly becomes hidden even if its animation which is changing its progress from 70 to 100 is currently running. I don't want this to happen, I want to hide progress indicator when its animation which is animating its progress from 70 to 100 is ended. Is there any listener to achieve this?
The simple way is just to delay your hide action after a specific time.
Test with your finest delayTime value.