mirror of
				https://github.com/SimpleMobileTools/Simple-Launcher.git
				synced 2025-06-05 21:59:15 +02:00 
			
		
		
		
	hide the resizing frame at clicking on the widget
This commit is contained in:
		| @@ -178,6 +178,7 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Rel | ||||
|             val frameRect = Rect(viewX, viewY, viewX + widgetView.width, viewY + widgetView.height) | ||||
|             resize_frame.updateFrameCoords(frameRect) | ||||
|             resize_frame.beVisible() | ||||
|             widgetView.ignoreTouches = true | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @@ -186,8 +187,9 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Rel | ||||
|             return | ||||
|         } | ||||
|  | ||||
|         resizedWidget = null | ||||
|         resize_frame.beGone() | ||||
|         widgetViews.firstOrNull { it.tag == resizedWidget!!.widgetId }?.ignoreTouches = false | ||||
|         resizedWidget = null | ||||
|     } | ||||
|  | ||||
|     private fun addAppIcon() { | ||||
| @@ -387,6 +389,10 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Rel | ||||
|             (context as? MainActivity)?.showHomeIconMenu(x, widgetView.y, item, false) | ||||
|         } | ||||
|  | ||||
|         widgetView.onIgnoreInterceptedListener = { | ||||
|             hideResizeLines() | ||||
|         } | ||||
|  | ||||
|         widgetView.x = calculateWidgetX(item.left) | ||||
|         widgetView.y = calculateWidgetY(item.top) | ||||
|         val widgetWidth = item.widthCells * rowWidth | ||||
|   | ||||
| @@ -16,9 +16,11 @@ class MyAppWidgetHostView(context: Context) : AppWidgetHostView(context) { | ||||
|     var hasLongPressed = false | ||||
|     var ignoreTouches = false | ||||
|     var longPressListener: ((x: Float, y: Float) -> Unit)? = null | ||||
|     var onIgnoreInterceptedListener: (() -> Unit)? = null       // let the home grid react on swallowed clicks, for example by hiding the widget resize frame | ||||
|  | ||||
|     override fun onTouchEvent(event: MotionEvent?): Boolean { | ||||
|         return if (ignoreTouches) { | ||||
|             onIgnoreInterceptedListener?.invoke() | ||||
|             true | ||||
|         } else { | ||||
|             super.onTouchEvent(event) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user