Skip to content

Commit

Permalink
修复渐进式加载出现的闪屏问题
Browse files Browse the repository at this point in the history
  • Loading branch information
郭文明 committed Sep 6, 2016
1 parent 9dc93d7 commit ff4f1c1
Showing 1 changed file with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public void onLoadingStarted(String s, View view) {

@Override
public void onLoadingFailed(String s, View view, FailReason failReason) {
progressBar.setVisibility(View.GONE);
progressBar.setVisibility(View.INVISIBLE);
}

@Override
Expand All @@ -111,16 +111,16 @@ public void onLoadingComplete(String s, final View view, Bitmap bitmap) {

if (mDatas.get(position).endsWith(".gif")) {
gifImg.setVisibility(View.VISIBLE);
longImg.setVisibility(View.GONE);
norImgView.setVisibility(View.GONE);
longImg.setVisibility(View.INVISIBLE);
norImgView.setVisibility(View.INVISIBLE);
if (file == null) {
return;
}
displayGif(file, gifImg);
} else if (ImageUtil.isLongImg(file, bitmap)) {
longImg.setVisibility(View.VISIBLE);
gifImg.setVisibility(View.GONE);
norImgView.setVisibility(View.GONE);
gifImg.setVisibility(View.INVISIBLE);
norImgView.setVisibility(View.INVISIBLE);

if (file == null) {
return;
Expand All @@ -131,18 +131,18 @@ public void onLoadingComplete(String s, final View view, Bitmap bitmap) {
public void run() {
hidePreviewImg(preNorImg, preLongImg);
progressBar.setProgress(100);
progressBar.setVisibility(View.GONE);
progressBar.setVisibility(View.INVISIBLE);
}
}, 500);
} else {
norImgView.setVisibility(View.VISIBLE);
gifImg.setVisibility(View.GONE);
longImg.setVisibility(View.GONE);
gifImg.setVisibility(View.INVISIBLE);
longImg.setVisibility(View.INVISIBLE);
displayNormalImg(bitmap, norImgView);
}
hidePreviewImg(preNorImg, preLongImg);
progressBar.setProgress(100);
progressBar.setVisibility(View.GONE);
progressBar.setVisibility(View.INVISIBLE);
}
}, new ImageLoadingProgressListener() {
@Override
Expand Down Expand Up @@ -219,22 +219,22 @@ public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
//如果是长图,显示长图
if (ImageUtil.isLongImg(bimiddleImg, loadedImage)) {
//ToastUtil.showShort(mContext, "显示长图预览");
preNorImg.setVisibility(View.GONE);
preNorImg.setVisibility(View.INVISIBLE);
preLongImg.setVisibility(View.VISIBLE);
displayLongPic(bimiddleImg, preLongImg);
} else {
//ToastUtil.showShort(mContext, "显示普通图片预览");
preNorImg.setVisibility(View.VISIBLE);
preLongImg.setVisibility(View.GONE);
preLongImg.setVisibility(View.INVISIBLE);
displayNormalImg(loadedImage, preNorImg);
}
}
});
}

private void hidePreviewImg(PhotoView norImg, final SubsamplingScaleImageView longImg) {
norImg.setVisibility(View.GONE);
longImg.setVisibility(View.GONE);
norImg.setVisibility(View.INVISIBLE);
longImg.setVisibility(View.INVISIBLE);
}

private void setOnLongClickListener(PhotoView preNorImg, SubsamplingScaleImageView preLongImg, final FrameLayout bgLayout, SubsamplingScaleImageView longImg, GifImageView gifImageView, PhotoView photoView, final int position) {
Expand Down

0 comments on commit ff4f1c1

Please sign in to comment.