fix up displaying fullscreen images at the viewpager
This commit is contained in:
parent
a32de3c5ca
commit
3983428d5f
2 changed files with 5 additions and 18 deletions
|
@ -2,27 +2,22 @@ package gallery.simplemobiletools.com.adapters;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.support.v4.view.PagerAdapter;
|
import android.support.v4.view.PagerAdapter;
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ImageView;
|
|
||||||
|
|
||||||
import com.bumptech.glide.Glide;
|
import com.bumptech.glide.Glide;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import gallery.simplemobiletools.com.R;
|
import uk.co.senab.photoview.PhotoView;
|
||||||
import uk.co.senab.photoview.PhotoViewAttacher;
|
|
||||||
|
|
||||||
public class MyPagerAdapter extends PagerAdapter {
|
public class MyPagerAdapter extends PagerAdapter {
|
||||||
private final Context context;
|
private final Context context;
|
||||||
private final List<String> paths;
|
private final List<String> paths;
|
||||||
private final LayoutInflater inflater;
|
|
||||||
|
|
||||||
public MyPagerAdapter(Context context, List<String> paths) {
|
public MyPagerAdapter(Context context, List<String> paths) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.paths = paths;
|
this.paths = paths;
|
||||||
this.inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -37,12 +32,10 @@ public class MyPagerAdapter extends PagerAdapter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object instantiateItem(ViewGroup container, int position) {
|
public Object instantiateItem(ViewGroup container, int position) {
|
||||||
final View view = inflater.inflate(R.layout.pager_item, container, false);
|
final PhotoView photoView = new PhotoView(context);
|
||||||
final ImageView imageView = (ImageView) view.findViewById(R.id.photo);
|
Glide.with(context).load(paths.get(position)).fitCenter().crossFade().into(photoView);
|
||||||
Glide.with(context).load(paths.get(position)).fitCenter().crossFade().into(imageView);
|
container.addView(photoView);
|
||||||
container.addView(view);
|
return photoView;
|
||||||
new PhotoViewAttacher(imageView);
|
|
||||||
return view;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -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"/>
|
|
Loading…
Reference in a new issue