Skip to content

Commit

Permalink
release: androidx-7.0.5 fix 重定向地址加载进度卡在1%问题
Browse files Browse the repository at this point in the history
  • Loading branch information
SherlockGougou committed Dec 8, 2022
1 parent fcb5092 commit 1a82e34
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 17 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ allprojects {
##### 此处显示的是本框架的最新版本号:
##### ⚠️注意:glide v3版本不再维护,最终版本为v3_4.0.2。建议使用androidx版本。
```
androidx用户 : 使用 androidx-7.0.4
androidx用户 : 使用 androidx-7.0.5
对于glide4.x : 使用 v4_6.1.3
```

Expand All @@ -54,7 +54,7 @@ dependencies {
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
implementation 'com.github.bumptech.glide:okhttp3-integration:4.11.0'
// BigImageViewPager https://github.com/SherlockGougou/BigImageViewPager
implementation 'com.github.SherlockGougou:BigImageViewPager:androidx-7.0.4'
implementation 'com.github.SherlockGougou:BigImageViewPager:androidx-7.0.5'
================================分割线==================================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ object ProgressManager {
val onProgressListener = getProgressListener(url)
val percentage = (bytesRead * 1f / totalBytes * 100f).toInt()
val isComplete = percentage >= 100
onProgressListener?.onProgress(url, isComplete, percentage, bytesRead, totalBytes)
listenersMap.let {
for (listener in it.values) {
listener.onProgress(url, isComplete, percentage, bytesRead, totalBytes)
}
}
if (isComplete) {
removeListener(url)
}
Expand Down
6 changes: 3 additions & 3 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId "cc.shinichi.bigimageviewpager"
minSdkVersion 14
targetSdkVersion 32
versionCode 704
versionName "androidx-7.0.4"
versionCode 705
versionName "androidx-7.0.5"
}
buildTypes {
release {
Expand Down Expand Up @@ -57,6 +57,6 @@ dependencies {
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
implementation 'com.github.bumptech.glide:okhttp3-integration:4.11.0'
// library
// implementation 'com.github.SherlockGougou:BigImageViewPager:androidx-7.0.4'
// implementation 'com.github.SherlockGougou:BigImageViewPager:androidx-7.0.5'
implementation project(':library')
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,7 @@ public class MainActivity extends AppCompatActivity {
private ImagePreview.LoadStrategy loadStrategy = ImagePreview.LoadStrategy.Default;

private final String[] images = {
// 小尺寸图片
"https://s1.ax1x.com/2020/10/16/0HXKv4.jpg",
// 普通jpg图片
"http://img6.16fan.com/201510/11/005258wdngg6rv0tpn8z9z.jpg",
"http://img6.16fan.com/201510/11/013553aj3kp9u6iuz6k9uj.jpg",
"http://img6.16fan.com/201510/11/011753fnanichdca0wbhxc.jpg",
"http://img6.16fan.com/201510/11/011819zbzbciir9ctn295o.jpg",
"http://img6.16fan.com/201510/11/004847l7w568jc5n5wn385.jpg",
"http://img6.16fan.com/201510/11/004906z0a0a0e0hs56ce0t.jpg",
Expand All @@ -77,6 +72,11 @@ public class MainActivity extends AppCompatActivity {
"http://img6.16fan.com/201510/11/004955d8ftz3t1sttt7ft7.jpg",
"http://img6.16fan.com/201510/11/005027qy2g55yyglb59zdu.jpg",
"http://img6.16fan.com/201510/11/005229bbtxkczcl0btmw8e.jpg",
"http://img6.16fan.com/201510/11/005258wdngg6rv0tpn8z9z.jpg",
"http://img6.16fan.com/201510/11/013553aj3kp9u6iuz6k9uj.jpg",
"http://img6.16fan.com/201510/11/011753fnanichdca0wbhxc.jpg",
// 小尺寸图片
"https://s1.ax1x.com/2020/10/16/0HXKv4.jpg",
// 大图:5760 * 3840
"http://img6.16fan.com/attachments/wenzhang/201805/18/152660818127263ge.jpeg",
// 长图:2280 * 22116
Expand Down Expand Up @@ -243,6 +243,14 @@ private void initData() {
i.setOriginUrl("https://test-houbo-homework.oss-cn-shanghai.aliyuncs.com/第2课测试-画鸡蛋测试-111-1553831-1662516935.jpg");
imageInfoList.add(i);

// todo 测试带重定向的地址
i = new ImageInfo();
i.setThumbnailUrl("https://im.api.ovivas.cn/rest/v1/im/file/download?fileId=2022%2F12%2F05%2Fb22d9ae0-32a6-4420-b0ca-b1f79cac7aca%2Fthumbnail%2Fwx_camera_1670145692581%282%29.jpg");
i.setOriginUrl("https://im.api.ovivas.cn/rest/v1/im/file/download?fileId=2022%2F12%2F05%2Fb22d9ae0-32a6-4420-b0ca-b1f79cac7aca%2Fwx_camera_1670145692581%282%29.jpg");
imageInfoList.add(i);



// 一、最简单的调用:
findViewById(R.id.buttonEasyUse).setOnClickListener(new View.OnClickListener() {
@Override
Expand All @@ -260,13 +268,13 @@ public void onClick(View v) {
ImageView image3 = findViewById(R.id.image3);

List<String> list2 = new ArrayList<>();
list2.add("http://img6.16fan.com/201510/11/005258wdngg6rv0tpn8z9z.jpg");
list2.add("http://img6.16fan.com/201510/11/013553aj3kp9u6iuz6k9uj.jpg");
list2.add("http://img6.16fan.com/201510/11/011753fnanichdca0wbhxc.jpg");
list2.add("http://img6.16fan.com/201510/11/005258wdngg6rv0tpn8z9z.jpg-400");
list2.add("http://img6.16fan.com/201510/11/013553aj3kp9u6iuz6k9uj.jpg-400");
list2.add("http://img6.16fan.com/201510/11/011753fnanichdca0wbhxc.jpg-400");

Glide.with(this).load("http://img6.16fan.com/201510/11/005258wdngg6rv0tpn8z9z.jpg").into(image1);
Glide.with(this).load("http://img6.16fan.com/201510/11/013553aj3kp9u6iuz6k9uj.jpg").into(image2);
Glide.with(this).load("http://img6.16fan.com/201510/11/011753fnanichdca0wbhxc.jpg").into(image3);
Glide.with(this).load("http://img6.16fan.com/201510/11/005258wdngg6rv0tpn8z9z.jpg-400").into(image1);
Glide.with(this).load("http://img6.16fan.com/201510/11/013553aj3kp9u6iuz6k9uj.jpg-400").into(image2);
Glide.with(this).load("http://img6.16fan.com/201510/11/011753fnanichdca0wbhxc.jpg-400").into(image3);

image1.setOnClickListener(new View.OnClickListener() {
@Override
Expand Down

0 comments on commit 1a82e34

Please sign in to comment.