mirror of
				https://github.com/SimpleMobileTools/Simple-Launcher.git
				synced 2025-06-05 21:59:15 +02:00 
			
		
		
		
	minor code style update
This commit is contained in:
		| @@ -23,7 +23,6 @@ import android.widget.RelativeLayout | |||||||
| import androidx.core.graphics.drawable.toDrawable | import androidx.core.graphics.drawable.toDrawable | ||||||
| import androidx.core.view.ViewCompat | import androidx.core.view.ViewCompat | ||||||
| import androidx.core.view.accessibility.AccessibilityNodeInfoCompat | import androidx.core.view.accessibility.AccessibilityNodeInfoCompat | ||||||
| import androidx.core.view.postDelayed |  | ||||||
| import androidx.customview.widget.ExploreByTouchHelper | import androidx.customview.widget.ExploreByTouchHelper | ||||||
| import com.google.android.material.math.MathUtils | import com.google.android.material.math.MathUtils | ||||||
| import com.simplemobiletools.commons.extensions.* | import com.simplemobiletools.commons.extensions.* | ||||||
| @@ -93,15 +92,9 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Rel | |||||||
|     private val checkAndExecuteDelayedPageChange: Runnable = Runnable { |     private val checkAndExecuteDelayedPageChange: Runnable = Runnable { | ||||||
|         if (System.currentTimeMillis() - pageChangeLastAreaEntryTime > PAGE_CHANGE_HOLD_THRESHOLD) { |         if (System.currentTimeMillis() - pageChangeLastAreaEntryTime > PAGE_CHANGE_HOLD_THRESHOLD) { | ||||||
|             when (pageChangeLastArea) { |             when (pageChangeLastArea) { | ||||||
|                 PageChangeArea.RIGHT -> { |                 PageChangeArea.RIGHT -> nextOrAdditionalPage(true) | ||||||
|                     nextOrAdditionalPage(true) |                 PageChangeArea.LEFT -> prevPage(true) | ||||||
|                 } |                 else -> clearPageChangeFlags() | ||||||
|                 PageChangeArea.LEFT -> { |  | ||||||
|                     prevPage(true) |  | ||||||
|                 } |  | ||||||
|                 else -> { |  | ||||||
|                     clearPageChangeFlags() |  | ||||||
|                 } |  | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| @@ -203,7 +196,6 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Rel | |||||||
|             if (item.type == ITEM_TYPE_WIDGET) { |             if (item.type == ITEM_TYPE_WIDGET) { | ||||||
|                 appWidgetHost.deleteAppWidgetId(item.widgetId) |                 appWidgetHost.deleteAppWidgetId(item.widgetId) | ||||||
|             } |             } | ||||||
|  |  | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -715,13 +707,14 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Rel | |||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         gridItems.filter { (it.drawable != null && it.type == ITEM_TYPE_ICON || it.type == ITEM_TYPE_SHORTCUT) && it.page == currentPage && !it.docked }.forEach { item -> |         gridItems.filter { (it.drawable != null && it.type == ITEM_TYPE_ICON || it.type == ITEM_TYPE_SHORTCUT) && it.page == currentPage && !it.docked } | ||||||
|             if (item.outOfBounds()) { |             .forEach { item -> | ||||||
|                 return@forEach |                 if (item.outOfBounds()) { | ||||||
|             } |                     return@forEach | ||||||
|  |                 } | ||||||
|  |  | ||||||
|             handleItemDrawing(item, currentXFactor) |                 handleItemDrawing(item, currentXFactor) | ||||||
|         } |             } | ||||||
|         gridItems.filter { (it.drawable != null && it.type == ITEM_TYPE_ICON || it.type == ITEM_TYPE_SHORTCUT) && it.docked }.forEach { item -> |         gridItems.filter { (it.drawable != null && it.type == ITEM_TYPE_ICON || it.type == ITEM_TYPE_SHORTCUT) && it.docked }.forEach { item -> | ||||||
|             if (item.outOfBounds()) { |             if (item.outOfBounds()) { | ||||||
|                 return@forEach |                 return@forEach | ||||||
| @@ -730,13 +723,14 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Rel | |||||||
|             handleItemDrawing(item, 0f) |             handleItemDrawing(item, 0f) | ||||||
|         } |         } | ||||||
|         if (pageChangeAnimLeftPercentage > 0f && pageChangeAnimLeftPercentage < 1f) { |         if (pageChangeAnimLeftPercentage > 0f && pageChangeAnimLeftPercentage < 1f) { | ||||||
|             gridItems.filter { (it.drawable != null && it.type == ITEM_TYPE_ICON || it.type == ITEM_TYPE_SHORTCUT) && it.page == lastPage && !it.docked }.forEach { item -> |             gridItems.filter { (it.drawable != null && it.type == ITEM_TYPE_ICON || it.type == ITEM_TYPE_SHORTCUT) && it.page == lastPage && !it.docked } | ||||||
|                 if (item.outOfBounds()) { |                 .forEach { item -> | ||||||
|                     return@forEach |                     if (item.outOfBounds()) { | ||||||
|                 } |                         return@forEach | ||||||
|  |                     } | ||||||
|  |  | ||||||
|                 handleItemDrawing(item, lastXFactor) |                     handleItemDrawing(item, lastXFactor) | ||||||
|             } |                 } | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         if (isFirstDraw) { |         if (isFirstDraw) { | ||||||
| @@ -916,7 +910,7 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Rel | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     fun isClickingGridItem(x: Int, y: Int): HomeScreenGridItem? { |     fun isClickingGridItem(x: Int, y: Int): HomeScreenGridItem? { | ||||||
|         for (gridItem in gridItems.filter { it.page == currentPage  || it.docked }) { |         for (gridItem in gridItems.filter { it.page == currentPage || it.docked }) { | ||||||
|             if (gridItem.outOfBounds()) { |             if (gridItem.outOfBounds()) { | ||||||
|                 continue |                 continue | ||||||
|             } |             } | ||||||
| @@ -950,7 +944,7 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Rel | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     private fun HomeScreenGridItem.outOfBounds(): Boolean { |     private fun HomeScreenGridItem.outOfBounds(): Boolean { | ||||||
|         return (left >= cellXCoords.size || right >= cellXCoords.size || (!docked && (top >= cellYCoords.size - 1  || bottom >= cellYCoords.size - 1))) |         return (left >= cellXCoords.size || right >= cellXCoords.size || (!docked && (top >= cellYCoords.size - 1 || bottom >= cellYCoords.size - 1))) | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     private inner class HomeScreenGridTouchHelper(host: View) : ExploreByTouchHelper(host) { |     private inner class HomeScreenGridTouchHelper(host: View) : ExploreByTouchHelper(host) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user