Fix anchor positioning on all apps fragment and home screen

This commit is contained in:
Ensar Sarajčić 2023-07-28 13:40:21 +02:00
parent 73b7638a93
commit 7f787cef08
3 changed files with 9 additions and 6 deletions

View File

@ -523,11 +523,11 @@ class MainActivity : SimpleActivity(), FlingListener {
home_screen_grid.hideResizeLines()
mLongPressedIcon = gridItem
val anchorY = if (isOnAllAppsFragment || gridItem.type == ITEM_TYPE_WIDGET) {
y
} else if (gridItem.top == config.homeRowCount - 1) {
home_screen_grid.sideMargins.top + (gridItem.top * home_screen_grid.cellHeight.toFloat())
val iconSize = realScreenSize.x / config.drawerColumnCount
y - iconSize / 2f
} else {
(gridItem.top * home_screen_grid.cellHeight.toFloat())
val clickableRect = home_screen_grid.getClickableRect(gridItem)
clickableRect.top.toFloat() - home_screen_grid.iconSize / 2f
}
home_screen_popup_menu_anchor.x = x

View File

@ -120,7 +120,9 @@ class LaunchersAdapter(
setOnClickListener { itemClick(launcher) }
setOnLongClickListener { view ->
allAppsListener.onAppLauncherLongPressed(view.x + width / 2, view.y, launcher)
val location = IntArray(2)
getLocationOnScreen(location)
allAppsListener.onAppLauncherLongPressed((location[0] + width / 2).toFloat(), location[1].toFloat(), launcher)
true
}
}

View File

@ -67,7 +67,8 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Rel
private var resizedWidget: HomeScreenGridItem? = null
private var isFirstDraw = true
private var redrawWidgets = false
private var iconSize = 0
var iconSize = 0
private set
private var lastPage = 0
private var currentPage = 0