File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
app/src/main/java/com/github/droidworksstudio/mlauncher Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,8 @@ object Constants {
6161 const val MAX_THRESHOLD = 100 // pixels
6262 var SHORT_SWIPE_THRESHOLD = 0f // pixels
6363 var LONG_SWIPE_THRESHOLD = 0f // pixels
64+ var USR_DPIX = 0
65+ var USR_DPIY = 0
6466
6567
6668 // Update MAX_HOME_PAGES dynamically based on MAX_HOME_APPS
@@ -94,8 +96,11 @@ object Constants {
9496 val prefs = Prefs (context)
9597 val metrics = context.resources.displayMetrics
9698
97- val screenWidthInches = metrics.widthPixels / metrics.xdpi
98- val screenHeightInches = metrics.heightPixels / metrics.ydpi
99+ USR_DPIX = metrics.xdpi
100+ USR_DPIY = metrics.ydpi
101+
102+ val screenWidthInches = metrics.widthPixels / USR_DPIX
103+ val screenHeightInches = metrics.heightPixels / USR_DPIY
99104
100105 if (direction.equals(" left" , true ) || direction.equals(" right" , true )) {
101106 LONG_SWIPE_THRESHOLD = screenWidthInches * prefs.longSwipeThreshold
Original file line number Diff line number Diff line change @@ -134,7 +134,7 @@ class GestureManager(
134134 val longThreshold = Constants .LONG_SWIPE_THRESHOLD
135135 val velocityThreshold = Constants .SWIPE_VELOCITY_THRESHOLD
136136
137- val distance = if (isHorizontalSwipe) abs(diffX) else abs(diffY)
137+ val distance = if (isHorizontalSwipe) ( abs(diffX)/ Constants . USR_DPIX ) else ( abs(diffY) / Constants . USR_DPIY )
138138 val isLongSwipe = distance > longThreshold
139139 val isShortSwipe = distance in (shortThreshold + 1 ).. longThreshold
140140
You can’t perform that action at this time.
0 commit comments