diff options
author | Michael Kolb <kolby@google.com> | 2011-03-20 10:17:40 -0700 |
---|---|---|
committer | Michael Kolb <kolby@google.com> | 2011-03-23 12:54:12 -0700 |
commit | 11d1978d8d16004598347abc93918b54a5ef760b (patch) | |
tree | b3941e98c31d7c9346d594f7a3f5591745e25778 /src/com/android/browser/view/StopProgressView.java | |
parent | 71791a09579b21ef61f00c38056497cd99667440 (diff) | |
download | packages_apps_Browser-11d1978d8d16004598347abc93918b54a5ef760b.zip packages_apps_Browser-11d1978d8d16004598347abc93918b54a5ef760b.tar.gz packages_apps_Browser-11d1978d8d16004598347abc93918b54a5ef760b.tar.bz2 |
fix title bar
Merge code from TitleBarXLarge down into base
to support omnibox in both tablet and phone
browser
Change-Id: If54f3b162725411236f0b0676887bbcbdabadd25
Diffstat (limited to 'src/com/android/browser/view/StopProgressView.java')
-rw-r--r-- | src/com/android/browser/view/StopProgressView.java | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/src/com/android/browser/view/StopProgressView.java b/src/com/android/browser/view/StopProgressView.java new file mode 100644 index 0000000..bdafdb0 --- /dev/null +++ b/src/com/android/browser/view/StopProgressView.java @@ -0,0 +1,95 @@ + +package com.android.browser.view; + +import com.android.browser.R; + +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.drawable.Drawable; +import android.util.AttributeSet; +import android.widget.ProgressBar; + + +public class StopProgressView extends ProgressBar { + + Drawable mOverlayDrawable; + Drawable mProgressDrawable; + int mWidth; + int mHeight; + + /** + * @param context + * @param attrs + * @param defStyle + * @param styleRes + */ + public StopProgressView(Context context, AttributeSet attrs, int defStyle, int styleRes) { + super(context, attrs, defStyle, styleRes); + init(attrs); + } + + /** + * @param context + * @param attrs + * @param defStyle + */ + public StopProgressView(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + init(attrs); + } + + /** + * @param context + * @param attrs + */ + public StopProgressView(Context context, AttributeSet attrs) { + super(context, attrs); + init(attrs); + } + + /** + * @param context + */ + public StopProgressView(Context context) { + super(context); + init(null); + } + + private void init(AttributeSet attrs) { + mProgressDrawable = getIndeterminateDrawable(); + setImageDrawable(mContext.getResources() + .getDrawable(R.drawable.ic_stop_holo_dark)); + } + + public void hideProgress() { + setIndeterminateDrawable(null); + } + + public void showProgress() { + setIndeterminateDrawable(mProgressDrawable); + } + + @Override + protected void onDraw(Canvas canvas) { + super.onDraw(canvas); + if (mOverlayDrawable != null) { + int l = (getWidth() - mWidth) / 2; + int t = (getHeight() - mHeight) / 2; + mOverlayDrawable.setBounds(l, t, l + mWidth, t + mHeight); + mOverlayDrawable.draw(canvas); + } + } + + public Drawable getDrawable() { + return mOverlayDrawable; + } + + public void setImageDrawable(Drawable d) { + mOverlayDrawable = d; + if (d != null) { + mWidth = d.getIntrinsicWidth(); + mHeight = d.getIntrinsicHeight(); + } + } + +} |