Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarLayout.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarLayout.java b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarLayout.java |
| index 034a55241c4ad22a2852bf9b332443c6c85fa48a..d4f8e8495316534c3de5fd3a18b9cd10c5e0ab51 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarLayout.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarLayout.java |
| @@ -9,7 +9,6 @@ import android.content.Context; |
| import android.graphics.Bitmap; |
| import android.graphics.Canvas; |
| import android.graphics.Rect; |
| -import android.graphics.drawable.Drawable; |
| import android.os.SystemClock; |
| import android.util.AttributeSet; |
| import android.view.Gravity; |
| @@ -27,8 +26,8 @@ import org.chromium.chrome.browser.compositor.Invalidator; |
| import org.chromium.chrome.browser.ntp.NewTabPage; |
| import org.chromium.chrome.browser.omnibox.LocationBar; |
| import org.chromium.chrome.browser.util.ViewUtils; |
| -import org.chromium.chrome.browser.widget.SmoothProgressBar; |
| import org.chromium.chrome.browser.widget.TintedImageButton; |
| +import org.chromium.chrome.browser.widget.ToolbarProgressBar; |
| import org.chromium.ui.UiUtils; |
| /** |
| @@ -51,7 +50,7 @@ abstract class ToolbarLayout extends FrameLayout implements Toolbar { |
| private ToolbarDataProvider mToolbarDataProvider; |
| private ToolbarTabController mToolbarTabController; |
| - private SmoothProgressBar mProgressBar; |
| + private ToolbarProgressBar mProgressBar; |
| private boolean mNativeLibraryReady; |
| private boolean mUrlHasFocus; |
| @@ -75,12 +74,11 @@ abstract class ToolbarLayout extends FrameLayout implements Toolbar { |
| protected void onFinishInflate() { |
| super.onFinishInflate(); |
| - mProgressBar = (SmoothProgressBar) findViewById(R.id.progress); |
| + mProgressBar = (ToolbarProgressBar) findViewById(R.id.progress); |
| if (mProgressBar != null) { |
| removeView(mProgressBar); |
| - Drawable progressDrawable = mProgressBar.getProgressDrawable(); |
| getFrameLayoutParams(mProgressBar).topMargin = mToolbarHeightWithoutShadow |
| - - progressDrawable.getIntrinsicHeight(); |
| + - getFrameLayoutParams(mProgressBar).height; |
| } |
| mMenuButton = (TintedImageButton) findViewById(R.id.menu_button); |
| @@ -112,11 +110,6 @@ abstract class ToolbarLayout extends FrameLayout implements Toolbar { |
| } |
| @Override |
| - public int getLoadProgress() { |
| - return 0; |
| - } |
| - |
| - @Override |
| public String getCorpusChipText() { |
| return null; |
| } |
| @@ -182,7 +175,7 @@ abstract class ToolbarLayout extends FrameLayout implements Toolbar { |
| /** |
| * @return The {@link ProgressBar} this layout uses. |
| */ |
| - SmoothProgressBar getProgressBar() { |
| + ToolbarProgressBar getProgressBar() { |
| return mProgressBar; |
| } |
| @@ -479,11 +472,31 @@ abstract class ToolbarLayout extends FrameLayout implements Toolbar { |
| } |
| /** |
| + * Starts load progress. |
| + */ |
| + protected void startLoadProgress() { |
| + if (mProgressBar != null) { |
| + mProgressBar.start(); |
| + } |
| + } |
| + |
| + /** |
| * Sets load progress. |
| - * @param progress The load progress between 0 and 100. |
| + * @param progress The load progress between 0 and 1. |
| */ |
| - protected void setLoadProgress(int progress) { |
| - if (mProgressBar != null) mProgressBar.setProgress(progress); |
| + protected void setLoadProgress(float progress) { |
| + if (mProgressBar != null) { |
| + mProgressBar.setProgress(progress); |
| + } |
| + } |
| + |
| + /** |
| + * Finishes load progress. |
| + */ |
| + protected void finishLoadProgress(boolean fadeOut) { |
|
Ted C
2015/07/17 23:42:44
should we use delayed here to be consistent with t
Kibeom Kim (inactive)
2015/07/19 08:48:55
Done.
|
| + if (mProgressBar != null) { |
| + mProgressBar.finish(fadeOut); |
| + } |
| } |
| @Override |