From de84071cc05d59f8df6a1ae83d3d5577f542112a Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 25 Apr 2016 21:08:13 +0200 Subject: [PATCH] set adapter paths in the constructor --- .../gallery/activities/ViewPagerActivity.java | 3 +-- .../simplemobiletools/gallery/adapters/MyPagerAdapter.java | 5 +---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/simplemobiletools/gallery/activities/ViewPagerActivity.java b/app/src/main/java/com/simplemobiletools/gallery/activities/ViewPagerActivity.java index f0b850697..27775722e 100644 --- a/app/src/main/java/com/simplemobiletools/gallery/activities/ViewPagerActivity.java +++ b/app/src/main/java/com/simplemobiletools/gallery/activities/ViewPagerActivity.java @@ -66,8 +66,7 @@ public class ViewPagerActivity extends AppCompatActivity if (isDirEmpty()) return; - final MyPagerAdapter adapter = new MyPagerAdapter(getSupportFragmentManager()); - adapter.setPaths(photos); + final MyPagerAdapter adapter = new MyPagerAdapter(getSupportFragmentManager(), photos); pager.setAdapter(adapter); pager.setCurrentItem(pos); pager.addOnPageChangeListener(this); diff --git a/app/src/main/java/com/simplemobiletools/gallery/adapters/MyPagerAdapter.java b/app/src/main/java/com/simplemobiletools/gallery/adapters/MyPagerAdapter.java index 03c6cdab8..c56fe564c 100644 --- a/app/src/main/java/com/simplemobiletools/gallery/adapters/MyPagerAdapter.java +++ b/app/src/main/java/com/simplemobiletools/gallery/adapters/MyPagerAdapter.java @@ -11,11 +11,8 @@ import java.util.List; public class MyPagerAdapter extends FragmentStatePagerAdapter { private List paths; - public MyPagerAdapter(FragmentManager fm) { + public MyPagerAdapter(FragmentManager fm, List paths) { super(fm); - } - - public void setPaths(List paths) { this.paths = paths; }