Use isExternalIntent()
function
This commit is contained in:
parent
1122e36e99
commit
54dc6c41b5
1 changed files with 4 additions and 3 deletions
|
@ -58,6 +58,7 @@ import kotlinx.android.synthetic.main.activity_medium.*
|
||||||
import kotlinx.android.synthetic.main.bottom_actions.*
|
import kotlinx.android.synthetic.main.bottom_actions.*
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.OutputStream
|
import java.io.OutputStream
|
||||||
|
import kotlin.math.min
|
||||||
|
|
||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, ViewPagerFragment.FragmentListener {
|
class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, ViewPagerFragment.FragmentListener {
|
||||||
|
@ -157,7 +158,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
||||||
if (config.isThirdPartyIntent) {
|
if (config.isThirdPartyIntent) {
|
||||||
config.isThirdPartyIntent = false
|
config.isThirdPartyIntent = false
|
||||||
|
|
||||||
if (intent.extras == null || !intent.getBooleanExtra(IS_FROM_GALLERY, false)) {
|
if (intent.extras == null || isExternalIntent()) {
|
||||||
mMediaFiles.clear()
|
mMediaFiles.clear()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1260,7 +1261,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
||||||
if (refetchViewPagerPosition || mPos == -1) {
|
if (refetchViewPagerPosition || mPos == -1) {
|
||||||
mPos = getPositionInList(media)
|
mPos = getPositionInList(media)
|
||||||
if (mPos == -1) {
|
if (mPos == -1) {
|
||||||
Math.min(mPos, media.size - 1)
|
min(mPos, media.size - 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1414,7 +1415,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
||||||
return if (getCurrentMedia().isEmpty() || mPos == -1) {
|
return if (getCurrentMedia().isEmpty() || mPos == -1) {
|
||||||
null
|
null
|
||||||
} else {
|
} else {
|
||||||
getCurrentMedia()[Math.min(mPos, getCurrentMedia().size - 1)]
|
getCurrentMedia()[min(mPos, getCurrentMedia().size - 1)]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue