Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webp closes on dropdown Gesture #409

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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_EQUALITY_TOLERANCE) {
handleEvent(event)
}
false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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_EQUALITY_TOLERANCE = 0.01
const val DRAG_THRESHOLD = 8
const val MONTH_MILLISECONDS = MONTH_SECONDS * 1000L
const val MIN_SKIP_LENGTH = 2000
Expand Down
Loading