fix up displaying fullscreen images at the viewpager

This commit is contained in:
tibbi 2016-02-21 17:50:29 +01:00
parent a32de3c5ca
commit 3983428d5f
2 changed files with 5 additions and 18 deletions

View File

@ -2,27 +2,22 @@ package gallery.simplemobiletools.com.adapters;
import android.content.Context;
import android.support.v4.view.PagerAdapter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
import java.util.List;
import gallery.simplemobiletools.com.R;
import uk.co.senab.photoview.PhotoViewAttacher;
import uk.co.senab.photoview.PhotoView;
public class MyPagerAdapter extends PagerAdapter {
private final Context context;
private final List<String> paths;
private final LayoutInflater inflater;
public MyPagerAdapter(Context context, List<String> paths) {
this.context = context;
this.paths = paths;
this.inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
@Override
@ -37,12 +32,10 @@ public class MyPagerAdapter extends PagerAdapter {
@Override
public Object instantiateItem(ViewGroup container, int position) {
final View view = inflater.inflate(R.layout.pager_item, container, false);
final ImageView imageView = (ImageView) view.findViewById(R.id.photo);
Glide.with(context).load(paths.get(position)).fitCenter().crossFade().into(imageView);
container.addView(view);
new PhotoViewAttacher(imageView);
return view;
final PhotoView photoView = new PhotoView(context);
Glide.with(context).load(paths.get(position)).fitCenter().crossFade().into(photoView);
container.addView(photoView);
return photoView;
}
@Override

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<ImageView
android:id="@+id/photo"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"/>