Skip to content

Commit

Permalink
修复查看gif图片无法点击退出的Bug
Browse files Browse the repository at this point in the history
  • Loading branch information
郭文明 committed Sep 6, 2016
1 parent 9da0bbe commit 9dc93d7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class ViewPagerAdapter extends PagerAdapter {
public OnSingleTagListener onSingleTagListener;

public interface OnSingleTagListener {
public void onTag();
void onTag();
}

public void setOnSingleTagListener(OnSingleTagListener onSingleTagListener) {
Expand Down 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.INVISIBLE);
progressBar.setVisibility(View.GONE);
}

@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.INVISIBLE);
norImgView.setVisibility(View.INVISIBLE);
longImg.setVisibility(View.GONE);
norImgView.setVisibility(View.GONE);
if (file == null) {
return;
}
displayGif(file, gifImg);
} else if (ImageUtil.isLongImg(file, bitmap)) {
longImg.setVisibility(View.VISIBLE);
gifImg.setVisibility(View.INVISIBLE);
norImgView.setVisibility(View.INVISIBLE);
gifImg.setVisibility(View.GONE);
norImgView.setVisibility(View.GONE);

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.INVISIBLE);
progressBar.setVisibility(View.GONE);
}
},500);
}, 500);
} else {
norImgView.setVisibility(View.VISIBLE);
gifImg.setVisibility(View.GONE);
longImg.setVisibility(View.INVISIBLE);
longImg.setVisibility(View.GONE);
displayNormalImg(bitmap, norImgView);
hidePreviewImg(preNorImg, preLongImg);
}
hidePreviewImg(preNorImg, preLongImg);
progressBar.setProgress(100);
progressBar.setVisibility(View.INVISIBLE);
progressBar.setVisibility(View.GONE);
}
}, new ImageLoadingProgressListener() {
@Override
Expand Down Expand Up @@ -195,8 +195,8 @@ private void showPreviewImg(final String url, final PhotoView preNorImg, final S
}
//存在原图,直接显示原图
File orgFile = DiskCacheUtils.findInCache(url, ImageLoader.getInstance().getDiskCache());
if (orgFile != null){
hidePreviewImg(preNorImg,preLongImg);
if (orgFile != null) {
hidePreviewImg(preNorImg, preLongImg);
return;
}

Expand All @@ -219,13 +219,13 @@ public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
//如果是长图,显示长图
if (ImageUtil.isLongImg(bimiddleImg, loadedImage)) {
//ToastUtil.showShort(mContext, "显示长图预览");
preNorImg.setVisibility(View.INVISIBLE);
preNorImg.setVisibility(View.GONE);
preLongImg.setVisibility(View.VISIBLE);
displayLongPic(bimiddleImg, preLongImg);
} else {
//ToastUtil.showShort(mContext, "显示普通图片预览");
preNorImg.setVisibility(View.VISIBLE);
preLongImg.setVisibility(View.INVISIBLE);
preLongImg.setVisibility(View.GONE);
displayNormalImg(loadedImage, preNorImg);
}
}
Expand All @@ -237,16 +237,16 @@ private void hidePreviewImg(PhotoView norImg, final SubsamplingScaleImageView lo
longImg.setVisibility(View.GONE);
}

private void setOnLongClickListener(PhotoView preImageView, SubsamplingScaleImageView previewLongImg, final FrameLayout bgLayout, SubsamplingScaleImageView longImg, GifImageView gifImageView, PhotoView photoView, final int position) {
preImageView.setOnLongClickListener(new View.OnLongClickListener() {
private void setOnLongClickListener(PhotoView preNorImg, SubsamplingScaleImageView preLongImg, final FrameLayout bgLayout, SubsamplingScaleImageView longImg, GifImageView gifImageView, PhotoView photoView, final int position) {
preNorImg.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
showPopWindow(bgLayout, position);
return false;
}
});

previewLongImg.setOnLongClickListener(new View.OnLongClickListener() {
preLongImg.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
showPopWindow(bgLayout, position);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,10 @@ public void onCreate(Bundle savedInstanceState) {
mActivity = getActivity();
mContext = getContext();
mProfileFragmentPresent = new ProfileFragmentPresentImp(this);
mUser = getArguments().getParcelable("currentUser");
Bundle bundle = getArguments();
if (bundle != null){
mUser = bundle.getParcelable("currentUser");
}
options = new DisplayImageOptions.Builder()
.showImageOnLoading(R.drawable.avator_default)
.showImageForEmptyUri(R.drawable.avator_default)
Expand Down

0 comments on commit 9dc93d7

Please sign in to comment.