diff options
author | Anonymous <no-reply@google.com> | 2019-03-28 01:11:33 +0900 |
---|---|---|
committer | Jeff Davidson <jpd@google.com> | 2019-03-27 16:38:00 +0000 |
commit | e926546a739acd231feeb85d9bd7a9f2cec0fefb (patch) | |
tree | 64996a4d0fe89a8562b0b18c02b0b092c9f86f5b /src/main/java/com/android/volley/toolbox/NetworkImageView.java | |
parent | 356bcc337d8b543da5b1b580a65f97a1969c114c (diff) | |
download | volley-e926546a739acd231feeb85d9bd7a9f2cec0fefb.tar.gz |
Import of Volley from GitHub to AOSP.
Android.bp is updated to use androidx.annotation instead of
android.support.annotation to be consistent with the new
Gradle dependencies.
- ddbc32c04921df0973baadeee50f8d3099b12e14 Migrate to AndroidX (#251) by Jaewoong Eum <skydoves@naver.com>
- 95a6796c40f570a723a73d9360dddbd0994ed1d4 Pre-sized array is not recommended in HotSpot based JVMs ... by Jaewoong Eum <skydoves@naver.com>
- d8239ceeb22f4cfcc18f580ca2425cbfc3425548 Fix SNAPSHOT build deployment. (#250) by Jeff Davidson <jpd236@cornell.edu>
- bc81fa5e46588b0a22a0c1bb5e315bbf1555dbd0 Update build (#248) by Matthew Zavislak <elevenfive@users.noreply.github.com>
- 4c1a94566b6c4e6e8a2c6f0e31b2769a38467e0a Setting a default image, or an error image, will clear pr... by Ammar Aijazi <aaijazi@users.noreply.github.com>
GitOrigin-RevId: ddbc32c04921df0973baadeee50f8d3099b12e14
Change-Id: Ib4c2b69235fa0edb78252b771cc1b1cc7f416d16
Diffstat (limited to 'src/main/java/com/android/volley/toolbox/NetworkImageView.java')
-rw-r--r-- | src/main/java/com/android/volley/toolbox/NetworkImageView.java | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/src/main/java/com/android/volley/toolbox/NetworkImageView.java b/src/main/java/com/android/volley/toolbox/NetworkImageView.java index 6ad1e49..53affc3 100644 --- a/src/main/java/com/android/volley/toolbox/NetworkImageView.java +++ b/src/main/java/com/android/volley/toolbox/NetworkImageView.java @@ -15,12 +15,12 @@ package com.android.volley.toolbox; import android.content.Context; import android.graphics.Bitmap; -import android.support.annotation.MainThread; -import android.support.annotation.Nullable; import android.text.TextUtils; import android.util.AttributeSet; import android.view.ViewGroup.LayoutParams; import android.widget.ImageView; +import androidx.annotation.MainThread; +import androidx.annotation.Nullable; import com.android.volley.VolleyError; import com.android.volley.toolbox.ImageLoader.ImageContainer; import com.android.volley.toolbox.ImageLoader.ImageListener; @@ -100,12 +100,10 @@ public class NetworkImageView extends ImageView { * Sets the default image resource ID to be used for this view until the attempt to load it * completes. * - * <p>Cannot be called with {@link NetworkImageView#setDefaultImageBitmap}. + * <p>This will clear anything set by {@link NetworkImageView#setDefaultImageBitmap}. */ public void setDefaultImageResId(int defaultImage) { - if (mDefaultImageBitmap != null) { - throw new IllegalArgumentException("Can't have a default image resource ID and bitmap"); - } + mDefaultImageBitmap = null; mDefaultImageId = defaultImage; } @@ -113,12 +111,10 @@ public class NetworkImageView extends ImageView { * Sets the default image bitmap to be used for this view until the attempt to load it * completes. * - * <p>Cannot be called with {@link NetworkImageView#setDefaultImageResId}. + * <p>This will clear anything set by {@link NetworkImageView#setDefaultImageResId}. */ public void setDefaultImageBitmap(Bitmap defaultImage) { - if (mDefaultImageId != 0) { - throw new IllegalArgumentException("Can't have a default image resource ID and bitmap"); - } + mDefaultImageId = 0; mDefaultImageBitmap = defaultImage; } @@ -126,12 +122,10 @@ public class NetworkImageView extends ImageView { * Sets the error image resource ID to be used for this view in the event that the image * requested fails to load. * - * <p>Cannot be called with {@link NetworkImageView#setErrorImageBitmap}. + * <p>This will clear anything set by {@link NetworkImageView#setErrorImageBitmap}. */ public void setErrorImageResId(int errorImage) { - if (mErrorImageBitmap != null) { - throw new IllegalArgumentException("Can't have an error image resource ID and bitmap"); - } + mErrorImageBitmap = null; mErrorImageId = errorImage; } @@ -139,12 +133,10 @@ public class NetworkImageView extends ImageView { * Sets the error image bitmap to be used for this view in the event that the image requested * fails to load. * - * <p>Cannot be called with {@link NetworkImageView#setErrorImageResId}. + * <p>This will clear anything set by {@link NetworkImageView#setErrorImageResId}. */ public void setErrorImageBitmap(Bitmap errorImage) { - if (mErrorImageId != 0) { - throw new IllegalArgumentException("Can't have an error image resource ID and bitmap"); - } + mErrorImageId = 0; mErrorImageBitmap = errorImage; } |