do not use the GestureViews enableScrollInViewPager function, it is glitchy

This commit is contained in:
tibbi 2019-01-17 23:14:22 +01:00
parent 36f27fa5b2
commit 2aa6069351
3 changed files with 2 additions and 12 deletions

View file

@ -366,7 +366,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
} }
private fun updatePagerItems(media: MutableList<Medium>) { private fun updatePagerItems(media: MutableList<Medium>) {
val pagerAdapter = MyPagerAdapter(this, supportFragmentManager, media, view_pager) val pagerAdapter = MyPagerAdapter(this, supportFragmentManager, media)
if (!isDestroyed) { if (!isDestroyed) {
view_pager.apply { view_pager.apply {
adapter = pagerAdapter adapter = pagerAdapter

View file

@ -7,7 +7,6 @@ import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentStatePagerAdapter import androidx.fragment.app.FragmentStatePagerAdapter
import androidx.viewpager.widget.PagerAdapter import androidx.viewpager.widget.PagerAdapter
import com.simplemobiletools.commons.views.MyViewPager
import com.simplemobiletools.gallery.pro.activities.ViewPagerActivity import com.simplemobiletools.gallery.pro.activities.ViewPagerActivity
import com.simplemobiletools.gallery.pro.fragments.PhotoFragment import com.simplemobiletools.gallery.pro.fragments.PhotoFragment
import com.simplemobiletools.gallery.pro.fragments.VideoFragment import com.simplemobiletools.gallery.pro.fragments.VideoFragment
@ -15,7 +14,7 @@ import com.simplemobiletools.gallery.pro.fragments.ViewPagerFragment
import com.simplemobiletools.gallery.pro.helpers.MEDIUM import com.simplemobiletools.gallery.pro.helpers.MEDIUM
import com.simplemobiletools.gallery.pro.models.Medium import com.simplemobiletools.gallery.pro.models.Medium
class MyPagerAdapter(val activity: ViewPagerActivity, fm: FragmentManager, val media: MutableList<Medium>, val viewPager: MyViewPager) : FragmentStatePagerAdapter(fm) { class MyPagerAdapter(val activity: ViewPagerActivity, fm: FragmentManager, val media: MutableList<Medium>) : FragmentStatePagerAdapter(fm) {
private val fragments = HashMap<Int, ViewPagerFragment>() private val fragments = HashMap<Int, ViewPagerFragment>()
override fun getCount() = media.size override fun getCount() = media.size
@ -29,10 +28,6 @@ class MyPagerAdapter(val activity: ViewPagerActivity, fm: FragmentManager, val m
PhotoFragment() PhotoFragment()
} }
if (!medium.isVideo()) {
(fragment as? PhotoFragment)?.mViewPager = viewPager
}
fragment.arguments = bundle fragment.arguments = bundle
fragment.listener = activity fragment.listener = activity
return fragment return fragment

View file

@ -30,7 +30,6 @@ import com.davemorrissey.labs.subscaleview.decoder.ImageDecoder
import com.davemorrissey.labs.subscaleview.decoder.ImageRegionDecoder import com.davemorrissey.labs.subscaleview.decoder.ImageRegionDecoder
import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.OTG_PATH import com.simplemobiletools.commons.helpers.OTG_PATH
import com.simplemobiletools.commons.views.MyViewPager
import com.simplemobiletools.gallery.pro.R import com.simplemobiletools.gallery.pro.R
import com.simplemobiletools.gallery.pro.activities.PanoramaPhotoActivity import com.simplemobiletools.gallery.pro.activities.PanoramaPhotoActivity
import com.simplemobiletools.gallery.pro.activities.PhotoActivity import com.simplemobiletools.gallery.pro.activities.PhotoActivity
@ -80,7 +79,6 @@ class PhotoFragment : ViewPagerFragment() {
private var mStoredShowHighestQuality = false private var mStoredShowHighestQuality = false
private var mStoredAllowOneFingerZoom = false private var mStoredAllowOneFingerZoom = false
private var mStoredExtendedDetails = 0 private var mStoredExtendedDetails = 0
var mViewPager: MyViewPager? = null
private lateinit var mView: ViewGroup private lateinit var mView: ViewGroup
private lateinit var mMedium: Medium private lateinit var mMedium: Medium
@ -383,9 +381,6 @@ class PhotoFragment : ViewPagerFragment() {
mView.gestures_view.controller.apply { mView.gestures_view.controller.apply {
settings.maxZoom = 3f settings.maxZoom = 3f
settings.overzoomFactor = 1.2f settings.overzoomFactor = 1.2f
if (mViewPager != null) {
enableScrollInViewPager(mViewPager)
}
} }
} }