store the currently visible portrait path at the fragment
This commit is contained in:
parent
1dbe82e074
commit
04e49086f8
|
@ -76,6 +76,7 @@ class PhotoFragment : ViewPagerFragment() {
|
||||||
private var mWasInit = false
|
private var mWasInit = false
|
||||||
private var mIsPanorama = false
|
private var mIsPanorama = false
|
||||||
private var mIsSubsamplingVisible = false // checking view.visibility is unreliable, use an extra variable for it
|
private var mIsSubsamplingVisible = false // checking view.visibility is unreliable, use an extra variable for it
|
||||||
|
private var mCurrentPortraitPhotoPath = ""
|
||||||
private var mImageOrientation = -1
|
private var mImageOrientation = -1
|
||||||
private var mLoadZoomableViewHandler = Handler()
|
private var mLoadZoomableViewHandler = Handler()
|
||||||
private var mScreenWidth = 0
|
private var mScreenWidth = 0
|
||||||
|
@ -465,12 +466,16 @@ class PhotoFragment : ViewPagerFragment() {
|
||||||
val sideElementWidth = curWidth - screenWidth
|
val sideElementWidth = curWidth - screenWidth
|
||||||
val adapter = PortraitPhotosAdapter(context!!, paths, sideElementWidth) { position, x ->
|
val adapter = PortraitPhotosAdapter(context!!, paths, sideElementWidth) { position, x ->
|
||||||
mView.photo_portrait_stripe.smoothScrollBy((x + itemWidth / 2) - screenWidth / 2, 0)
|
mView.photo_portrait_stripe.smoothScrollBy((x + itemWidth / 2) - screenWidth / 2, 0)
|
||||||
|
if (paths[position] != mCurrentPortraitPhotoPath) {
|
||||||
|
mCurrentPortraitPhotoPath = paths[position]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mView.photo_portrait_stripe.adapter = adapter
|
mView.photo_portrait_stripe.adapter = adapter
|
||||||
setupStripeBottomMargin()
|
setupStripeBottomMargin()
|
||||||
|
|
||||||
val coverIndex = getCoverImageIndex(paths)
|
val coverIndex = getCoverImageIndex(paths)
|
||||||
|
mCurrentPortraitPhotoPath = paths[coverIndex]
|
||||||
setupStripeUpListener(adapter, screenWidth, itemWidth)
|
setupStripeUpListener(adapter, screenWidth, itemWidth)
|
||||||
|
|
||||||
mView.photo_portrait_stripe.onGlobalLayout {
|
mView.photo_portrait_stripe.onGlobalLayout {
|
||||||
|
|
Loading…
Reference in New Issue