handle showAll at viewpager properly

This commit is contained in:
tibbi 2016-12-06 17:29:12 +01:00
parent dd3709f7ff
commit 7ff2d43f64
2 changed files with 5 additions and 1 deletions

View File

@ -302,6 +302,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
} else { } else {
Intent(this, ViewPagerActivity::class.java).apply { Intent(this, ViewPagerActivity::class.java).apply {
putExtra(MEDIUM, path) putExtra(MEDIUM, path)
putExtra(SHOW_ALL, mShowAll)
startActivity(this) startActivity(this)
} }
} }

View File

@ -27,6 +27,7 @@ import com.simplemobiletools.gallery.fragments.ViewPagerFragment
import com.simplemobiletools.gallery.helpers.MEDIUM import com.simplemobiletools.gallery.helpers.MEDIUM
import com.simplemobiletools.gallery.helpers.REQUEST_EDIT_IMAGE import com.simplemobiletools.gallery.helpers.REQUEST_EDIT_IMAGE
import com.simplemobiletools.gallery.helpers.REQUEST_SET_WALLPAPER import com.simplemobiletools.gallery.helpers.REQUEST_SET_WALLPAPER
import com.simplemobiletools.gallery.helpers.SHOW_ALL
import com.simplemobiletools.gallery.models.Medium import com.simplemobiletools.gallery.models.Medium
import kotlinx.android.synthetic.main.activity_medium.* import kotlinx.android.synthetic.main.activity_medium.*
import java.io.File import java.io.File
@ -39,6 +40,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
private var mIsFullScreen = false private var mIsFullScreen = false
private var mPos = -1 private var mPos = -1
private var mShowAll = false
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
@ -65,6 +67,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
} }
} else { } else {
mPath = intent.getStringExtra(MEDIUM) mPath = intent.getStringExtra(MEDIUM)
mShowAll = intent.getBooleanExtra(SHOW_ALL, false)
} }
if (mPath.isEmpty()) { if (mPath.isEmpty()) {
@ -239,7 +242,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
} }
private fun reloadViewPager() { private fun reloadViewPager() {
GetMediaAsynctask(applicationContext, mDirectory, false, false, ArrayList<String>(), false) { GetMediaAsynctask(applicationContext, mDirectory, false, false, ArrayList<String>(), mShowAll) {
mMedia = it mMedia = it
if (isDirEmpty()) if (isDirEmpty())
return@GetMediaAsynctask return@GetMediaAsynctask