Use a getter for iconSize instead of property access

This commit is contained in:
Ensar Sarajčić 2023-07-31 10:35:32 +02:00
parent 83a35664a4
commit 310f81f850
2 changed files with 4 additions and 3 deletions

View File

@ -528,7 +528,7 @@ class MainActivity : SimpleActivity(), FlingListener {
y - iconSize / 2f y - iconSize / 2f
} else { } else {
val clickableRect = home_screen_grid.getClickableRect(gridItem) val clickableRect = home_screen_grid.getClickableRect(gridItem)
clickableRect.top.toFloat() - home_screen_grid.iconSize / 2f clickableRect.top.toFloat() - home_screen_grid.getCurrentIconSize() / 2f
} }
home_screen_popup_menu_anchor.x = x home_screen_popup_menu_anchor.x = x

View File

@ -67,8 +67,7 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Rel
private var resizedWidget: HomeScreenGridItem? = null private var resizedWidget: HomeScreenGridItem? = null
private var isFirstDraw = true private var isFirstDraw = true
private var redrawWidgets = false private var redrawWidgets = false
var iconSize = 0 private var iconSize = 0
private set
private var lastPage = 0 private var lastPage = 0
private var currentPage = 0 private var currentPage = 0
@ -1081,6 +1080,8 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Rel
return false return false
} }
fun getCurrentIconSize(): Int = iconSize
private fun handlePageChange(redraw: Boolean = false) { private fun handlePageChange(redraw: Boolean = false) {
pageChangeEnabled = false pageChangeEnabled = false
pageChangeIndicatorsAlpha = 0f pageChangeIndicatorsAlpha = 0f