Smoothed ProgressBar animation
This commit is contained in:
parent
9bb947e249
commit
62430ce72e
@ -1689,17 +1689,27 @@ public class BrowserActivity extends Activity implements BrowserController {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateProgress(int n) {
|
public void updateProgress(int n) {
|
||||||
if (!mProgress.isShown()) {
|
|
||||||
mProgress.setVisibility(View.VISIBLE);
|
if (n > mProgress.getProgress()) {
|
||||||
}
|
ObjectAnimator animator = ObjectAnimator.ofInt(mProgress, "progress", n);
|
||||||
ObjectAnimator animator = ObjectAnimator.ofInt(mProgress, "progress", n);
|
animator.setDuration(200);
|
||||||
animator.setDuration(200);
|
animator.setInterpolator(new DecelerateInterpolator());
|
||||||
animator.setInterpolator(new DecelerateInterpolator());
|
animator.start();
|
||||||
animator.start();
|
|
||||||
if (n == 100) {
|
|
||||||
mProgress.setVisibility(View.INVISIBLE);
|
|
||||||
setIsFinishedLoading();
|
|
||||||
} else {
|
} else {
|
||||||
|
mProgress.setProgress(n);
|
||||||
|
}
|
||||||
|
if (n >= 100) {
|
||||||
|
Handler handler = new Handler();
|
||||||
|
handler.postDelayed(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
mProgress.setVisibility(View.INVISIBLE);
|
||||||
|
setIsFinishedLoading();
|
||||||
|
}
|
||||||
|
}, 200);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
mProgress.setVisibility(View.VISIBLE);
|
||||||
setIsLoading();
|
setIsLoading();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user