mirror of
https://github.com/SimpleMobileTools/Simple-Launcher.git
synced 2025-06-05 21:59:15 +02:00
fix a flinging glitch
This commit is contained in:
@ -244,7 +244,7 @@ class MainActivity : SimpleActivity(), FlingListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun isAllAppsFragmentExpanded() = all_apps_fragment.y != mScreenHeight.toFloat()
|
fun isAllAppsFragmentExpanded() = all_apps_fragment.y != mScreenHeight.toFloat()
|
||||||
|
|
||||||
private fun isWidgetsFragmentExpanded() = widgets_fragment.y != mScreenHeight.toFloat()
|
private fun isWidgetsFragmentExpanded() = widgets_fragment.y != mScreenHeight.toFloat()
|
||||||
|
|
||||||
@ -309,6 +309,10 @@ class MainActivity : SimpleActivity(), FlingListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun showHomeIconMenu(x: Float, y: Float, gridItem: HomeScreenGridItem, isOnAllAppsFragment: Boolean) {
|
fun showHomeIconMenu(x: Float, y: Float, gridItem: HomeScreenGridItem, isOnAllAppsFragment: Boolean) {
|
||||||
|
if (isAllAppsFragmentExpanded()) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
home_screen_grid.hideResizeLines()
|
home_screen_grid.hideResizeLines()
|
||||||
mLongPressedIcon = gridItem
|
mLongPressedIcon = gridItem
|
||||||
val anchorY = if (isOnAllAppsFragment || gridItem.type == ITEM_TYPE_WIDGET) {
|
val anchorY = if (isOnAllAppsFragment || gridItem.type == ITEM_TYPE_WIDGET) {
|
||||||
|
@ -399,7 +399,11 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Rel
|
|||||||
widgetView.tag = appWidgetId
|
widgetView.tag = appWidgetId
|
||||||
widgetView.setAppWidget(appWidgetId, appWidgetProviderInfo)
|
widgetView.setAppWidget(appWidgetId, appWidgetProviderInfo)
|
||||||
widgetView.longPressListener = { x, y ->
|
widgetView.longPressListener = { x, y ->
|
||||||
(context as? MainActivity)?.showHomeIconMenu(x, widgetView.y, item, false)
|
val activity = context as? MainActivity
|
||||||
|
if (activity?.isAllAppsFragmentExpanded() == false) {
|
||||||
|
activity.showHomeIconMenu(x, widgetView.y, item, false)
|
||||||
|
performHapticFeedback()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
widgetView.onIgnoreInterceptedListener = {
|
widgetView.onIgnoreInterceptedListener = {
|
||||||
|
@ -64,7 +64,6 @@ class MyAppWidgetHostView(context: Context) : AppWidgetHostView(context) {
|
|||||||
longPressHandler.removeCallbacksAndMessages(null)
|
longPressHandler.removeCallbacksAndMessages(null)
|
||||||
hasLongPressed = true
|
hasLongPressed = true
|
||||||
longPressListener?.invoke(actionDownCoords.x, actionDownCoords.y)
|
longPressListener?.invoke(actionDownCoords.x, actionDownCoords.y)
|
||||||
performHapticFeedback()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user