mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2025-03-11 14:10:06 +01:00
Initial Image Zoom and acceptable difference
This commit is contained in:
parent
a948355d2e
commit
e030f85d10
2 changed files with 8 additions and 1 deletions
|
@ -89,6 +89,8 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
private var mScreenWidth = 0
|
||||
private var mScreenHeight = 0
|
||||
private var mCurrentGestureViewZoom = 1f
|
||||
private var mIsTouched = false
|
||||
private var mInitialZoom = 1f
|
||||
|
||||
private var mStoredShowExtendedDetails = false
|
||||
private var mStoredHideExtendedDetails = false
|
||||
|
@ -145,12 +147,16 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
|
||||
gesturesView.controller.addOnStateChangeListener(object : GestureController.OnStateChangeListener {
|
||||
override fun onStateChanged(state: State) {
|
||||
if(!mIsTouched){
|
||||
mInitialZoom = state.zoom
|
||||
}
|
||||
mCurrentGestureViewZoom = state.zoom
|
||||
}
|
||||
})
|
||||
|
||||
gesturesView.setOnTouchListener { v, event ->
|
||||
if (mCurrentGestureViewZoom == 1f) {
|
||||
mIsTouched = true
|
||||
if (Math.abs(mCurrentGestureViewZoom -mInitialZoom)< MAX_ZOOM_DIFFERENCE) {
|
||||
handleEvent(event)
|
||||
}
|
||||
false
|
||||
|
|
|
@ -134,6 +134,7 @@ const val SHOW_TEMP_HIDDEN_DURATION = 300000L
|
|||
const val CLICK_MAX_DURATION = 150
|
||||
const val CLICK_MAX_DISTANCE = 100
|
||||
const val MAX_CLOSE_DOWN_GESTURE_DURATION = 300
|
||||
const val MAX_ZOOM_DIFFERENCE = 0.01
|
||||
const val DRAG_THRESHOLD = 8
|
||||
const val MONTH_MILLISECONDS = MONTH_SECONDS * 1000L
|
||||
const val MIN_SKIP_LENGTH = 2000
|
||||
|
|
Loading…
Add table
Reference in a new issue