@@ -312,14 +312,6 @@ class ColorSwitcherView(context: Context, attributeSet: AttributeSet) : View(con
312312 }
313313 }
314314
315- private val longPressedRunnable = Runnable {
316- if (isPrimarySelected) {
317- onPrimaryColorLongTapped.invoke()
318- } else {
319- onSecondaryColorLongTapped.invoke()
320- }
321- }
322-
323315 @SuppressLint(" ClickableViewAccessibility" ) /* * I will un-suppress in future commits **/
324316 override fun onTouchEvent (event : MotionEvent ): Boolean {
325317
@@ -337,18 +329,12 @@ class ColorSwitcherView(context: Context, attributeSet: AttributeSet) : View(con
337329
338330 if ((xOrY in toDp(50 ).. toDp(100 ) - insetStroke)
339331 && inverse !in toDp(50 ).. toDp(70 )) {
340- // secondary color has been selected
341- handler.postDelayed(longPressedRunnable, ViewConfiguration .getLongPressTimeout().toLong())
342-
343332 if (isPrimarySelected) {
344333 isPrimarySelected = false
345334 invalidate()
346335 }
347336 } else if ((xOrY !in toDp(50 ).. toDp(100 ) - insetStroke)
348337 && inverse !in toDp(50 ).. toDp(70 )) {
349- // primary color has been selected
350- handler.postDelayed(longPressedRunnable, ViewConfiguration .getLongPressTimeout().toLong())
351-
352338 if (! isPrimarySelected) {
353339 isPrimarySelected = true
354340 invalidate()
@@ -359,10 +345,6 @@ class ColorSwitcherView(context: Context, attributeSet: AttributeSet) : View(con
359345 onColorPickerTapped.invoke()
360346 }
361347
362- if (event.action == MotionEvent .ACTION_UP || event.action == MotionEvent .ACTION_MOVE ) {
363- handler.removeCallbacks(longPressedRunnable)
364- }
365-
366348 return true
367349 }
368350}
0 commit comments