Skip to content

Commit

Permalink
优化进度的显示
Browse files Browse the repository at this point in the history
  • Loading branch information
hss01248 committed Aug 18, 2021
1 parent 28c4cfb commit bece4e3
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 5 deletions.
2 changes: 1 addition & 1 deletion bigimageviewpager/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ dependencies {
api 'me.jessyan:progressmanager:1.5.0'
api 'com.github.bumptech.glide:okhttp3-integration:4.11.0' // 新增

implementation 'androidx.viewpager:viewpager:1.0.0'
api 'androidx.viewpager:viewpager:1.0.0'
api 'com.github.hss01248.metadata:metadata:1.1.2'
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,41 @@ public static void download(Context context, ImageView ivHelper,String url,LoadL
if(service == null){
service = Executors.newCachedThreadPool();
}
service.execute(new Runnable() {

ProgressManager.getInstance().addResponseListener(url, new ProgressListener() {
@Override
public void onProgress(ProgressInfo progressInfo) {
try {
listener.onProgress(progressInfo.getPercent());
//tvProgress.setText(progressInfo.getPercent()+"% , speed: "+(progressInfo.getSpeed()/1024/8)+"KB/s");
}catch (Throwable throwable){
throwable.printStackTrace();
}
}

@Override
public void onError(long id, Exception e) {
if(e != null){
e.printStackTrace();
}
}
});
loadGlideByView(context,url,listener,ivHelper);














/* service.execute(new Runnable() {
@Override
public void run() {
boolean cached = isCached(context, url);
Expand Down Expand Up @@ -97,7 +131,7 @@ public void run() {
});
}
}
});
});*/
}

/**
Expand Down
2 changes: 1 addition & 1 deletion glidev4/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ dependencies {
exclude group: "com.android.support"
}
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
implementation group: 'com.github.bumptech.glide', name: 'okhttp3-integration', version: '4.11.0'
api group: 'com.github.bumptech.glide', name: 'okhttp3-integration', version: '4.11.0'

implementation 'jp.wasabeef:glide-transformations:4.1.0'
// If you want to use the GPU Filters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ public void onClick(View v) {
LogUtils.w("child at is "+childAt+", "+position);
if(childAt instanceof MyLargeImageView){
MyLargeImageView largeImageView = (MyLargeImageView) childAt;
String text = largeImageView.getInfo();
String text = largeImageView.getInfoStr();

View view = View.inflate(context, R.layout.html, null);
TextView textView = view.findViewById(R.id.tv_html);
Expand Down

0 comments on commit bece4e3

Please sign in to comment.