From 3983428d5fd4810e28fadd915a59ca08558ba4ae Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 21 Feb 2016 17:50:29 +0100 Subject: [PATCH] fix up displaying fullscreen images at the viewpager --- .../com/adapters/MyPagerAdapter.java | 17 +++++------------ app/src/main/res/layout/pager_item.xml | 6 ------ 2 files changed, 5 insertions(+), 18 deletions(-) delete mode 100644 app/src/main/res/layout/pager_item.xml diff --git a/app/src/main/java/gallery/simplemobiletools/com/adapters/MyPagerAdapter.java b/app/src/main/java/gallery/simplemobiletools/com/adapters/MyPagerAdapter.java index a2916f131..491d72dbd 100644 --- a/app/src/main/java/gallery/simplemobiletools/com/adapters/MyPagerAdapter.java +++ b/app/src/main/java/gallery/simplemobiletools/com/adapters/MyPagerAdapter.java @@ -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 paths; - private final LayoutInflater inflater; public MyPagerAdapter(Context context, List 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 diff --git a/app/src/main/res/layout/pager_item.xml b/app/src/main/res/layout/pager_item.xml deleted file mode 100644 index 399c2e089..000000000 --- a/app/src/main/res/layout/pager_item.xml +++ /dev/null @@ -1,6 +0,0 @@ - -