summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/current.txt2
-rw-r--r--core/java/android/widget/ProgressBar.java52
2 files changed, 44 insertions, 10 deletions
diff --git a/api/current.txt b/api/current.txt
index 505f7bb..5614baa 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -31778,11 +31778,13 @@ package android.widget {
method public android.os.Parcelable onSaveInstanceState();
method public synchronized void setIndeterminate(boolean);
method public void setIndeterminateDrawable(android.graphics.drawable.Drawable);
+ method public void setIndeterminateDrawableTiled(android.graphics.drawable.Drawable);
method public void setInterpolator(android.content.Context, int);
method public void setInterpolator(android.view.animation.Interpolator);
method public synchronized void setMax(int);
method public synchronized void setProgress(int);
method public void setProgressDrawable(android.graphics.drawable.Drawable);
+ method public void setProgressDrawableTiled(android.graphics.drawable.Drawable);
method public synchronized void setSecondaryProgress(int);
}
diff --git a/core/java/android/widget/ProgressBar.java b/core/java/android/widget/ProgressBar.java
index b0c2d28..217d630 100644
--- a/core/java/android/widget/ProgressBar.java
+++ b/core/java/android/widget/ProgressBar.java
@@ -259,10 +259,9 @@ public class ProgressBar extends View {
Drawable drawable = a.getDrawable(R.styleable.ProgressBar_progressDrawable);
if (drawable != null) {
- drawable = tileify(drawable, false);
// Calling this method can set mMaxHeight, make sure the corresponding
// XML attribute for mMaxHeight is read after calling this method
- setProgressDrawable(drawable);
+ setProgressDrawableTiled(drawable);
}
@@ -291,8 +290,7 @@ public class ProgressBar extends View {
drawable = a.getDrawable(R.styleable.ProgressBar_indeterminateDrawable);
if (drawable != null) {
- drawable = tileifyIndeterminate(drawable);
- setIndeterminateDrawable(drawable);
+ setIndeterminateDrawableTiled(drawable);
}
mOnlyIndeterminate = a.getBoolean(
@@ -465,11 +463,9 @@ public class ProgressBar extends View {
}
/**
- * <p>Define the drawable used to draw the progress bar in
- * indeterminate mode.</p>
+ * Define the drawable used to draw the progress bar in indeterminate mode.
*
* @param d the new drawable
- *
* @see #getIndeterminateDrawable()
* @see #setIndeterminate(boolean)
*/
@@ -486,6 +482,25 @@ public class ProgressBar extends View {
postInvalidate();
}
}
+
+ /**
+ * Define the tileable drawable used to draw the progress bar in
+ * indeterminate mode.
+ * <p>
+ * If the drawable is a BitmapDrawable or contains BitmapDrawables, a
+ * tiled copy will be generated for display as a progress bar.
+ *
+ * @param d the new drawable
+ * @see #getIndeterminateDrawable()
+ * @see #setIndeterminate(boolean)
+ */
+ public void setIndeterminateDrawableTiled(Drawable d) {
+ if (d != null) {
+ d = tileifyIndeterminate(d);
+ }
+
+ setIndeterminateDrawable(d);
+ }
/**
* <p>Get the drawable used to draw the progress bar in
@@ -501,11 +516,9 @@ public class ProgressBar extends View {
}
/**
- * <p>Define the drawable used to draw the progress bar in
- * progress mode.</p>
+ * Define the drawable used to draw the progress bar in progress mode.
*
* @param d the new drawable
- *
* @see #getProgressDrawable()
* @see #setIndeterminate(boolean)
*/
@@ -544,6 +557,25 @@ public class ProgressBar extends View {
doRefreshProgress(R.id.secondaryProgress, mSecondaryProgress, false, false);
}
}
+
+ /**
+ * Define the tileable drawable used to draw the progress bar in
+ * progress mode.
+ * <p>
+ * If the drawable is a BitmapDrawable or contains BitmapDrawables, a
+ * tiled copy will be generated for display as a progress bar.
+ *
+ * @param d the new drawable
+ * @see #getProgressDrawable()
+ * @see #setIndeterminate(boolean)
+ */
+ public void setProgressDrawableTiled(Drawable d) {
+ if (d != null) {
+ d = tileify(d, false);
+ }
+
+ setProgressDrawable(d);
+ }
/**
* @return The drawable currently used to draw the progress bar