Skip to content

Commit

Permalink
release 3.8.5
Browse files Browse the repository at this point in the history
  • Loading branch information
wyouflf committed Mar 4, 2020
1 parent 323bbb0 commit 5cc3dc4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 22 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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的配置
Expand Down
2 changes: 1 addition & 1 deletion sample/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
<string name="remove">移除</string>
<string name="stop">停止</string>
<string name="start">开始下载</string>
<string name="test_download_url">http://dl.bintray.com/wyouflf/maven/org/xutils/xutils/3.8.4/xutils-3.8.4.aar</string>
<string name="test_download_url">http://dl.bintray.com/wyouflf/maven/org/xutils/xutils/3.8.5/xutils-3.8.5.aar</string>
</resources>
2 changes: 1 addition & 1 deletion xutils/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 5 additions & 19 deletions xutils/src/main/java/org/xutils/image/ImageOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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.
* 图片加载参数
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 5cc3dc4

Please sign in to comment.