diff --git a/README.md b/README.md
index d54530d9..e93257e8 100644
--- a/README.md
+++ b/README.md
@@ -26,7 +26,7 @@ xUtils 包含了orm, http(s), image, view注解, 但依然很轻量级(251K),
#### 使用Gradle构建时添加以下依赖即可:
```javascript
-implementation 'org.xutils:xutils:3.8.4'
+implementation 'org.xutils:xutils:3.8.5'
```
#### 混淆配置参考示例项目sample的配置
diff --git a/sample/src/main/res/values/strings.xml b/sample/src/main/res/values/strings.xml
index 3ded1986..8330d6af 100644
--- a/sample/src/main/res/values/strings.xml
+++ b/sample/src/main/res/values/strings.xml
@@ -5,5 +5,5 @@
移除
停止
开始下载
- http://dl.bintray.com/wyouflf/maven/org/xutils/xutils/3.8.4/xutils-3.8.4.aar
+ http://dl.bintray.com/wyouflf/maven/org/xutils/xutils/3.8.5/xutils-3.8.5.aar
\ No newline at end of file
diff --git a/xutils/build.gradle b/xutils/build.gradle
index ab199191..09f5313f 100644
--- a/xutils/build.gradle
+++ b/xutils/build.gradle
@@ -5,7 +5,7 @@ apply plugin: 'com.jfrog.bintray'
def siteUrl = 'https://github.com/wyouflf/xUtils3'
def gitUrl = 'https://github.com/wyouflf/xUtils3.git'
group = "org.xutils"
-version = "3.8.4"
+version = "3.8.5"
android {
compileSdkVersion 28
diff --git a/xutils/src/main/java/org/xutils/image/ImageOptions.java b/xutils/src/main/java/org/xutils/image/ImageOptions.java
index 7e0151cf..3ad75ed9 100644
--- a/xutils/src/main/java/org/xutils/image/ImageOptions.java
+++ b/xutils/src/main/java/org/xutils/image/ImageOptions.java
@@ -2,6 +2,7 @@
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
+import android.os.Build;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.widget.ImageView;
@@ -10,8 +11,6 @@
import org.xutils.common.util.LogUtil;
import org.xutils.http.RequestParams;
-import java.lang.reflect.Field;
-
/**
* Created by wyouflf on 15/8/21.
* 图片加载参数
@@ -119,8 +118,10 @@ final void optimizeMaxSize(ImageView view) {
}
}
- if (tempWidth <= 0) tempWidth = getImageViewFieldValue(view, "mMaxWidth");
- if (tempHeight <= 0) tempHeight = getImageViewFieldValue(view, "mMaxHeight");
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
+ if (tempWidth <= 0) tempWidth = view.getMaxWidth();
+ if (tempHeight <= 0) tempHeight = view.getMaxHeight();
+ }
}
if (tempWidth <= 0) tempWidth = screenWidth;
@@ -280,21 +281,6 @@ public String toString() {
return sb.toString();
}
- private static int getImageViewFieldValue(ImageView view, String fieldName) {
- int value = 0;
- try {
- Field field = ImageView.class.getDeclaredField(fieldName);
- field.setAccessible(true);
- int fieldValue = (Integer) field.get(view);
- if (fieldValue > 0 && fieldValue < Integer.MAX_VALUE) {
- value = fieldValue;
- }
- } catch (Throwable ex) {
- LogUtil.w(ex.getMessage(), ex);
- }
- return value;
- }
-
public interface ParamsBuilder {
RequestParams buildParams(RequestParams params, ImageOptions options);
}