@@ -222,12 +222,29 @@ public void onPopulateAccessibilityEvent(AccessibilityEvent event) {
222222 }
223223 }
224224
225+ /**
226+ * True when ImageView is adjusting its bounds
227+ * to preserve the aspect ratio of its drawable
228+ *
229+ * @return whether to adjust the bounds of this view
230+ * to presrve the original aspect ratio of the drawable
231+ *
232+ * @see #setAdjustViewBounds(boolean)
233+ *
234+ * @attr ref android.R.styleable#ImageView_adjustViewBounds
235+ */
236+ public boolean getAdjustViewBounds () {
237+ return mAdjustViewBounds ;
238+ }
239+
225240 /**
226241 * Set this to true if you want the ImageView to adjust its bounds
227242 * to preserve the aspect ratio of its drawable.
228243 * @param adjustViewBounds Whether to adjust the bounds of this view
229244 * to presrve the original aspect ratio of the drawable
230245 *
246+ * @see #getAdjustViewBounds()
247+ *
231248 * @attr ref android.R.styleable#ImageView_adjustViewBounds
232249 */
233250 @ android .view .RemotableViewMethod
@@ -237,7 +254,20 @@ public void setAdjustViewBounds(boolean adjustViewBounds) {
237254 setScaleType (ScaleType .FIT_CENTER );
238255 }
239256 }
240-
257+
258+ /**
259+ * The maximum width of this view.
260+ *
261+ * @return The maximum width of this view
262+ *
263+ * @see #setMaxWidth(int)
264+ *
265+ * @attr ref android.R.styleable#ImageView_maxWidth
266+ */
267+ public int getMaxWidth () {
268+ return mMaxWidth ;
269+ }
270+
241271 /**
242272 * An optional argument to supply a maximum width for this view. Only valid if
243273 * {@link #setAdjustViewBounds(boolean)} has been set to true. To set an image to be a maximum
@@ -253,14 +283,29 @@ public void setAdjustViewBounds(boolean adjustViewBounds) {
253283 * </p>
254284 *
255285 * @param maxWidth maximum width for this view
256- *
286+ *
287+ * @see #getMaxWidth()
288+ *
257289 * @attr ref android.R.styleable#ImageView_maxWidth
258290 */
259291 @ android .view .RemotableViewMethod
260292 public void setMaxWidth (int maxWidth ) {
261293 mMaxWidth = maxWidth ;
262294 }
263-
295+
296+ /**
297+ * The maximum height of this view.
298+ *
299+ * @return The maximum height of this view
300+ *
301+ * @see #setMaxHeight(int)
302+ *
303+ * @attr ref android.R.styleable#ImageView_maxHeight
304+ */
305+ public int getMaxHeight () {
306+ return mMaxHeight ;
307+ }
308+
264309 /**
265310 * An optional argument to supply a maximum height for this view. Only valid if
266311 * {@link #setAdjustViewBounds(boolean)} has been set to true. To set an image to be a
@@ -276,7 +321,9 @@ public void setMaxWidth(int maxWidth) {
276321 * </p>
277322 *
278323 * @param maxHeight maximum height for this view
279- *
324+ *
325+ * @see #getMaxHeight()
326+ *
280327 * @attr ref android.R.styleable#ImageView_maxHeight
281328 */
282329 @ android .view .RemotableViewMethod
@@ -522,7 +569,37 @@ public void setImageMatrix(Matrix matrix) {
522569 invalidate ();
523570 }
524571 }
525-
572+
573+ /**
574+ * Return whether this ImageView crops to padding.
575+ *
576+ * @return whether this ImageView crops to padding
577+ *
578+ * @see #setCropToPadding(boolean)
579+ *
580+ * @attr ref android.R.styleable#ImageView_cropToPadding
581+ */
582+ public boolean getCropToPadding () {
583+ return mCropToPadding ;
584+ }
585+
586+ /**
587+ * Sets whether this ImageView will crop to padding.
588+ *
589+ * @param cropToPadding whether this ImageView will crop to padding
590+ *
591+ * @see #getCropToPadding()
592+ *
593+ * @attr ref android.R.styleable#ImageView_cropToPadding
594+ */
595+ public void setCropToPadding (boolean cropToPadding ) {
596+ if (mCropToPadding != cropToPadding ) {
597+ mCropToPadding = cropToPadding ;
598+ requestLayout ();
599+ invalidate ();
600+ }
601+ }
602+
526603 private void resolveUri () {
527604 if (mDrawable != null ) {
528605 return ;
@@ -997,11 +1074,24 @@ public final void setColorFilter(int color) {
9971074 public final void clearColorFilter () {
9981075 setColorFilter (null );
9991076 }
1000-
1077+
1078+ /**
1079+ * Returns the active color filter for this ImageView.
1080+ *
1081+ * @return the active color filter for this ImageView
1082+ *
1083+ * @see #setColorFilter(android.graphics.ColorFilter)
1084+ */
1085+ public ColorFilter getColorFilter () {
1086+ return mColorFilter ;
1087+ }
1088+
10011089 /**
10021090 * Apply an arbitrary colorfilter to the image.
10031091 *
10041092 * @param cf the colorfilter to apply (may be null)
1093+ *
1094+ * @see #getColorFilter()
10051095 */
10061096 public void setColorFilter (ColorFilter cf ) {
10071097 if (mColorFilter != cf ) {
@@ -1012,6 +1102,37 @@ public void setColorFilter(ColorFilter cf) {
10121102 }
10131103 }
10141104
1105+ /**
1106+ * Returns the alpha that will be applied to the drawable of this ImageView.
1107+ *
1108+ * @return the alpha that will be applied to the drawable of this ImageView
1109+ *
1110+ * @see #setImageAlpha(int)
1111+ */
1112+ public int getImageAlpha () {
1113+ return mAlpha ;
1114+ }
1115+
1116+ /**
1117+ * Sets the alpha value that should be applied to the image.
1118+ *
1119+ * @param alpha the alpha value that should be applied to the image
1120+ *
1121+ * @see #getImageAlpha()
1122+ */
1123+ @ RemotableViewMethod
1124+ public void setImageAlpha (int alpha ) {
1125+ setAlpha (alpha );
1126+ }
1127+
1128+ /**
1129+ * Sets the alpha value that should be applied to the image.
1130+ *
1131+ * @param alpha the alpha value that should be applied to the image
1132+ *
1133+ * @deprecated use #setImageAlpha(int) instead
1134+ */
1135+ @ Deprecated
10151136 @ RemotableViewMethod
10161137 public void setAlpha (int alpha ) {
10171138 alpha &= 0xFF ; // keep it legal
0 commit comments