mirror of
https://github.com/SimpleMobileTools/Simple-Gallery.git
synced 2025-01-03 11:59:32 +01:00
set adapter paths in the constructor
This commit is contained in:
parent
86a0495a2f
commit
de84071cc0
@ -66,8 +66,7 @@ public class ViewPagerActivity extends AppCompatActivity
|
|||||||
if (isDirEmpty())
|
if (isDirEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
final MyPagerAdapter adapter = new MyPagerAdapter(getSupportFragmentManager());
|
final MyPagerAdapter adapter = new MyPagerAdapter(getSupportFragmentManager(), photos);
|
||||||
adapter.setPaths(photos);
|
|
||||||
pager.setAdapter(adapter);
|
pager.setAdapter(adapter);
|
||||||
pager.setCurrentItem(pos);
|
pager.setCurrentItem(pos);
|
||||||
pager.addOnPageChangeListener(this);
|
pager.addOnPageChangeListener(this);
|
||||||
|
@ -11,11 +11,8 @@ import java.util.List;
|
|||||||
public class MyPagerAdapter extends FragmentStatePagerAdapter {
|
public class MyPagerAdapter extends FragmentStatePagerAdapter {
|
||||||
private List<String> paths;
|
private List<String> paths;
|
||||||
|
|
||||||
public MyPagerAdapter(FragmentManager fm) {
|
public MyPagerAdapter(FragmentManager fm, List<String> paths) {
|
||||||
super(fm);
|
super(fm);
|
||||||
}
|
|
||||||
|
|
||||||
public void setPaths(List<String> paths) {
|
|
||||||
this.paths = paths;
|
this.paths = paths;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user