Progress animation tweak
This commit is contained in:
parent
b94cdc40af
commit
dd8893c952
@ -94,7 +94,7 @@ public class BrowserActivity extends Activity implements BrowserController {
|
|||||||
|
|
||||||
private ClickHandler mClickHandler;
|
private ClickHandler mClickHandler;
|
||||||
|
|
||||||
private ProgressBar mProgress;
|
private ProgressBar mProgressBar;
|
||||||
|
|
||||||
private boolean mSystemBrowser = false;
|
private boolean mSystemBrowser = false;
|
||||||
|
|
||||||
@ -193,8 +193,8 @@ public class BrowserActivity extends Activity implements BrowserController {
|
|||||||
mActivity = this;
|
mActivity = this;
|
||||||
mClickHandler = new ClickHandler(this);
|
mClickHandler = new ClickHandler(this);
|
||||||
mBrowserFrame = (FrameLayout) findViewById(R.id.content_frame);
|
mBrowserFrame = (FrameLayout) findViewById(R.id.content_frame);
|
||||||
mProgress = (ProgressBar) findViewById(R.id.activity_bar);
|
mProgressBar = (ProgressBar) findViewById(R.id.activity_bar);
|
||||||
mProgress.setVisibility(View.GONE);
|
mProgressBar.setVisibility(View.GONE);
|
||||||
mNewTab = (RelativeLayout) findViewById(R.id.new_tab_button);
|
mNewTab = (RelativeLayout) findViewById(R.id.new_tab_button);
|
||||||
mDrawer = (RelativeLayout) findViewById(R.id.drawer);
|
mDrawer = (RelativeLayout) findViewById(R.id.drawer);
|
||||||
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
|
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||||
@ -1687,26 +1687,29 @@ public class BrowserActivity extends Activity implements BrowserController {
|
|||||||
@Override
|
@Override
|
||||||
public void updateProgress(int n) {
|
public void updateProgress(int n) {
|
||||||
|
|
||||||
if (n > mProgress.getProgress()) {
|
if (n > mProgressBar.getProgress()) {
|
||||||
ObjectAnimator animator = ObjectAnimator.ofInt(mProgress, "progress", n);
|
ObjectAnimator animator = ObjectAnimator.ofInt(mProgressBar, "progress", n);
|
||||||
animator.setDuration(200);
|
animator.setDuration(200);
|
||||||
animator.setInterpolator(new DecelerateInterpolator());
|
animator.setInterpolator(new DecelerateInterpolator());
|
||||||
animator.start();
|
animator.start();
|
||||||
} else {
|
} else {
|
||||||
mProgress.setProgress(n);
|
ObjectAnimator animator = ObjectAnimator.ofInt(mProgressBar, "progress", 0, n);
|
||||||
|
animator.setDuration(200);
|
||||||
|
animator.setInterpolator(new DecelerateInterpolator());
|
||||||
|
animator.start();
|
||||||
}
|
}
|
||||||
if (n >= 100) {
|
if (n >= 100) {
|
||||||
Handler handler = new Handler();
|
Handler handler = new Handler();
|
||||||
handler.postDelayed(new Runnable() {
|
handler.postDelayed(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
mProgress.setVisibility(View.INVISIBLE);
|
mProgressBar.setVisibility(View.INVISIBLE);
|
||||||
setIsFinishedLoading();
|
setIsFinishedLoading();
|
||||||
}
|
}
|
||||||
}, 200);
|
}, 200);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
mProgress.setVisibility(View.VISIBLE);
|
mProgressBar.setVisibility(View.VISIBLE);
|
||||||
setIsLoading();
|
setIsLoading();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user