mirror of
https://github.com/SimpleMobileTools/Simple-Launcher.git
synced 2025-03-06 04:07:44 +01:00
fix a flinging glitch
This commit is contained in:
parent
b9f96e0703
commit
2d46888cb1
@ -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()
|
||||
|
||||
@ -309,6 +309,10 @@ class MainActivity : SimpleActivity(), FlingListener {
|
||||
}
|
||||
|
||||
fun showHomeIconMenu(x: Float, y: Float, gridItem: HomeScreenGridItem, isOnAllAppsFragment: Boolean) {
|
||||
if (isAllAppsFragmentExpanded()) {
|
||||
return
|
||||
}
|
||||
|
||||
home_screen_grid.hideResizeLines()
|
||||
mLongPressedIcon = gridItem
|
||||
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.setAppWidget(appWidgetId, appWidgetProviderInfo)
|
||||
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 = {
|
||||
|
@ -64,7 +64,6 @@ class MyAppWidgetHostView(context: Context) : AppWidgetHostView(context) {
|
||||
longPressHandler.removeCallbacksAndMessages(null)
|
||||
hasLongPressed = true
|
||||
longPressListener?.invoke(actionDownCoords.x, actionDownCoords.y)
|
||||
performHapticFeedback()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user