diff options
author | Alan Viverette <alanv@google.com> | 2015-02-23 12:49:47 -0800 |
---|---|---|
committer | Alan Viverette <alanv@google.com> | 2015-02-23 12:49:47 -0800 |
commit | 6a8253fdc9f4574c28b4beeeed90580ffc93734a (patch) | |
tree | 6919966e21d2af7e3821632e147e8f243d484c9b /graphics | |
parent | b3f3762ee0f57c94ea25bc1cc9d4baf0ee2a2976 (diff) | |
download | frameworks_base-6a8253fdc9f4574c28b4beeeed90580ffc93734a.zip frameworks_base-6a8253fdc9f4574c28b4beeeed90580ffc93734a.tar.gz frameworks_base-6a8253fdc9f4574c28b4beeeed90580ffc93734a.tar.bz2 |
Update progress bar and seek bar backgrounds, fix seek bar thumb
Ensures LayerDrawable copies out the correct layer properties during
"tileification". This really needs to be deprecated or replaced in a
future CL, though, because it is potentially lossy (e.g. for
RippleDrawable, which is an instanceof LayerDrawable).
Bug: 19448441
Change-Id: I483e9c34fd781e280c13eb5951f96bc71a252819
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/java/android/graphics/drawable/LayerDrawable.java | 147 |
1 files changed, 142 insertions, 5 deletions
diff --git a/graphics/java/android/graphics/drawable/LayerDrawable.java b/graphics/java/android/graphics/drawable/LayerDrawable.java index 08849df..f5353d4 100644 --- a/graphics/java/android/graphics/drawable/LayerDrawable.java +++ b/graphics/java/android/graphics/drawable/LayerDrawable.java @@ -558,10 +558,9 @@ public class LayerDrawable extends Drawable implements Drawable.Callback { * default layer gravity behavior. See {@link #setLayerGravity(int, int)} * for more information. * - * @param index the index of the drawable to adjust + * @param index the index of the layer to adjust * @param w width in pixels, or -1 to use the intrinsic width * @param h height in pixels, or -1 to use the intrinsic height - * * @see #getLayerWidth(int) * @see #getLayerHeight(int) * @attr ref android.R.styleable#LayerDrawableItem_width @@ -574,9 +573,18 @@ public class LayerDrawable extends Drawable implements Drawable.Callback { } /** + * @param index the index of the layer to adjust + * @param w width in pixels, or -1 to use the intrinsic width + * @attr ref android.R.styleable#LayerDrawableItem_width + */ + public void setLayerWidth(int index, int w) { + final ChildDrawable childDrawable = mLayerState.mChildren[index]; + childDrawable.mWidth = w; + } + + /** * @param index the index of the drawable to adjust * @return the explicit width of the layer, or -1 if not specified - * * @see #setLayerSize(int, int, int) * @attr ref android.R.styleable#LayerDrawableItem_width */ @@ -586,9 +594,18 @@ public class LayerDrawable extends Drawable implements Drawable.Callback { } /** + * @param index the index of the layer to adjust + * @param h height in pixels, or -1 to use the intrinsic height + * @attr ref android.R.styleable#LayerDrawableItem_height + */ + public void setLayerHeight(int index, int h) { + final ChildDrawable childDrawable = mLayerState.mChildren[index]; + childDrawable.mHeight = h; + } + + /** * @param index the index of the drawable to adjust * @return the explicit height of the layer, or -1 if not specified - * * @see #setLayerSize(int, int, int) * @attr ref android.R.styleable#LayerDrawableItem_height */ @@ -656,7 +673,7 @@ public class LayerDrawable extends Drawable implements Drawable.Callback { * Specifies the relative insets in pixels for the drawable at the * specified index. * - * @param index the index of the drawable to adjust + * @param index the index of the layer to adjust * @param s number of pixels to inset from the start bound * @param t number of pixels to inset from the top bound * @param e number of pixels to inset from the end bound @@ -671,6 +688,126 @@ public class LayerDrawable extends Drawable implements Drawable.Callback { setLayerInsetInternal(index, 0, t, 0, b, s, e); } + /** + * @param index the index of the layer to adjust + * @param l number of pixels to inset from the left bound + * @attr ref android.R.styleable#LayerDrawableItem_left + */ + public void setLayerInsetLeft(int index, int l) { + final ChildDrawable childDrawable = mLayerState.mChildren[index]; + childDrawable.mInsetL = l; + } + + /** + * @param index the index of the layer + * @return number of pixels to inset from the left bound + * @attr ref android.R.styleable#LayerDrawableItem_left + */ + public int getLayerInsetLeft(int index) { + final ChildDrawable childDrawable = mLayerState.mChildren[index]; + return childDrawable.mInsetL; + } + + /** + * @param index the index of the layer to adjust + * @param r number of pixels to inset from the right bound + * @attr ref android.R.styleable#LayerDrawableItem_right + */ + public void setLayerInsetRight(int index, int r) { + final ChildDrawable childDrawable = mLayerState.mChildren[index]; + childDrawable.mInsetR = r; + } + + /** + * @param index the index of the layer + * @return number of pixels to inset from the right bound + * @attr ref android.R.styleable#LayerDrawableItem_right + */ + public int getLayerInsetRight(int index) { + final ChildDrawable childDrawable = mLayerState.mChildren[index]; + return childDrawable.mInsetR; + } + + /** + * @param index the index of the layer to adjust + * @param t number of pixels to inset from the top bound + * @attr ref android.R.styleable#LayerDrawableItem_top + */ + public void setLayerInsetTop(int index, int t) { + final ChildDrawable childDrawable = mLayerState.mChildren[index]; + childDrawable.mInsetT = t; + } + + /** + * @param index the index of the layer + * @return number of pixels to inset from the top bound + * @attr ref android.R.styleable#LayerDrawableItem_top + */ + public int getLayerInsetTop(int index) { + final ChildDrawable childDrawable = mLayerState.mChildren[index]; + return childDrawable.mInsetT; + } + + /** + * @param index the index of the layer to adjust + * @param b number of pixels to inset from the bottom bound + * @attr ref android.R.styleable#LayerDrawableItem_bottom + */ + public void setLayerInsetBottom(int index, int b) { + final ChildDrawable childDrawable = mLayerState.mChildren[index]; + childDrawable.mInsetB = b; + } + + /** + * @param index the index of the layer + * @return number of pixels to inset from the bottom bound + * @attr ref android.R.styleable#LayerDrawableItem_bottom + */ + public int getLayerInsetBottom(int index) { + final ChildDrawable childDrawable = mLayerState.mChildren[index]; + return childDrawable.mInsetB; + } + + /** + * @param index the index of the layer to adjust + * @param s number of pixels to inset from the start bound + * @attr ref android.R.styleable#LayerDrawableItem_start + */ + public void setLayerInsetStart(int index, int s) { + final ChildDrawable childDrawable = mLayerState.mChildren[index]; + childDrawable.mInsetS = s; + } + + /** + * @param index the index of the layer + * @return number of pixels to inset from the start bound + * @attr ref android.R.styleable#LayerDrawableItem_start + */ + public int getLayerInsetStart(int index) { + final ChildDrawable childDrawable = mLayerState.mChildren[index]; + return childDrawable.mInsetS; + } + + /** + * @param index the index of the layer to adjust + * @param e number of pixels to inset from the end bound + * @attr ref android.R.styleable#LayerDrawableItem_end + */ + public void setLayerInsetEnd(int index, int e) { + final ChildDrawable childDrawable = mLayerState.mChildren[index]; + childDrawable.mInsetE = e; + } + + /** + * @param index the index of the layer + * @return number of pixels to inset from the end bound + * @attr ref android.R.styleable#LayerDrawableItem_end + */ + public int getLayerInsetEnd(int index) { + final ChildDrawable childDrawable = mLayerState.mChildren[index]; + return childDrawable.mInsetE; + } + private void setLayerInsetInternal(int index, int l, int t, int r, int b, int s, int e) { final ChildDrawable childDrawable = mLayerState.mChildren[index]; childDrawable.mInsetL = l; |