From bdda585dde76239ac578eefa442087e059f6d3ac Mon Sep 17 00:00:00 2001 From: Moez Bhatti Date: Mon, 26 Mar 2018 01:16:29 -0400 Subject: [PATCH] Fix accidental page swipe while moving color thumb, enable pager tabs --- .../src/main/java/feature/themepicker/HSVPickerView.kt | 10 ++++++++++ .../src/main/res/layout/theme_picker_activity.xml | 3 +-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/presentation/src/main/java/feature/themepicker/HSVPickerView.kt b/presentation/src/main/java/feature/themepicker/HSVPickerView.kt index 3eec611f..92e49e77 100644 --- a/presentation/src/main/java/feature/themepicker/HSVPickerView.kt +++ b/presentation/src/main/java/feature/themepicker/HSVPickerView.kt @@ -57,6 +57,7 @@ class HSVPickerView @JvmOverloads constructor(context: Context, attrs: Attribute MotionEvent.ACTION_DOWN -> { swatchX = event.x - event.rawX swatchY = event.y - event.rawY + parent.requestDisallowInterceptTouchEvent(true) } MotionEvent.ACTION_MOVE -> { @@ -69,6 +70,10 @@ class HSVPickerView @JvmOverloads constructor(context: Context, attrs: Attribute swatch.setTint(Color.HSVToColor(hsv)) } + MotionEvent.ACTION_UP -> { + parent.requestDisallowInterceptTouchEvent(false) + } + else -> return@setOnTouchListener false } true @@ -81,6 +86,7 @@ class HSVPickerView @JvmOverloads constructor(context: Context, attrs: Attribute when (event.action) { MotionEvent.ACTION_DOWN -> { hueThumbX = event.x - event.rawX + parent.requestDisallowInterceptTouchEvent(true) } MotionEvent.ACTION_MOVE -> { @@ -94,6 +100,10 @@ class HSVPickerView @JvmOverloads constructor(context: Context, attrs: Attribute swatch.setTint(Color.HSVToColor(hsv)) } + MotionEvent.ACTION_UP -> { + parent.requestDisallowInterceptTouchEvent(false) + } + else -> return@setOnTouchListener false } true diff --git a/presentation/src/main/res/layout/theme_picker_activity.xml b/presentation/src/main/res/layout/theme_picker_activity.xml index 6e9fadad..a211920f 100644 --- a/presentation/src/main/res/layout/theme_picker_activity.xml +++ b/presentation/src/main/res/layout/theme_picker_activity.xml @@ -30,8 +30,7 @@ android:layout_height="40dp" android:orientation="horizontal" android:paddingEnd="12dp" - android:paddingStart="12dp" - android:visibility="gone" /> + android:paddingStart="12dp" />