From e83777cbc3097063f797ed42393534bf580d2373 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 24 Mar 2020 15:01:43 +0100 Subject: [PATCH] avoid zooming right after scaling without lifting fingers --- .../calendar/pro/fragments/WeekFragment.kt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/WeekFragment.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/WeekFragment.kt index 2b717dd67..aa77d93b2 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/WeekFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/fragments/WeekFragment.kt @@ -1,5 +1,6 @@ package com.simplemobiletools.calendar.pro.fragments +import android.annotation.SuppressLint import android.content.Intent import android.content.res.Resources import android.graphics.drawable.ColorDrawable @@ -72,6 +73,7 @@ class WeekFragment : Fragment(), WeeklyCalendar { allDayRows.add(HashSet()) } + @SuppressLint("ClickableViewAccessibility") override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { this.inflater = inflater @@ -84,7 +86,12 @@ class WeekFragment : Fragment(), WeeklyCalendar { val scaleDetector = getViewScaleDetector() scrollView.setOnTouchListener { view, motionEvent -> scaleDetector.onTouchEvent(motionEvent) - false + if (motionEvent.action == MotionEvent.ACTION_UP) { + scrollView.isScrollable = true + true + } else { + false + } } } @@ -244,11 +251,6 @@ class WeekFragment : Fragment(), WeeklyCalendar { scaleAtStart = detector.scaleFactor return super.onScaleBegin(detector) } - - override fun onScaleEnd(detector: ScaleGestureDetector) { - scrollView.isScrollable = true - super.onScaleEnd(detector) - } }) }