diff --git a/app/src/main/java/com/github/droidworksstudio/launcher/listener/OnSwipeTouchListener.kt b/app/src/main/java/com/github/droidworksstudio/launcher/listener/OnSwipeTouchListener.kt index 985ce90e..8ab69a41 100644 --- a/app/src/main/java/com/github/droidworksstudio/launcher/listener/OnSwipeTouchListener.kt +++ b/app/src/main/java/com/github/droidworksstudio/launcher/listener/OnSwipeTouchListener.kt @@ -35,6 +35,7 @@ internal open class OnSwipeTouchListener(c: Context?) : OnTouchListener { private inner class GestureListener : SimpleOnGestureListener() { private val swipeThreshold: Int = 100 private val swipeVelocityThreshold: Int = 100 + private val swipeScrollThreshold: Int = 100 override fun onDown(e: MotionEvent): Boolean { return true @@ -82,13 +83,13 @@ internal open class OnSwipeTouchListener(c: Context?) : OnTouchListener { // Horizontal swipe if (abs(diffX) > abs(diffY)) { - if (abs(diffX) > swipeThreshold && abs(distanceX) > swipeVelocityThreshold) { + if (abs(diffX) > swipeThreshold && abs(distanceX) > swipeScrollThreshold) { if (diffX > 0) onSwipeRight() else onSwipeLeft() } } // Vertical swipe else { - if (abs(diffY) > swipeThreshold && abs(distanceY) > swipeVelocityThreshold) { + if (abs(diffY) > swipeThreshold && abs(distanceY) > swipeScrollThreshold) { if (diffY > 0) onSwipeDown() else onSwipeUp() } } diff --git a/app/src/main/java/com/github/droidworksstudio/launcher/ui/drawer/DrawFragment.kt b/app/src/main/java/com/github/droidworksstudio/launcher/ui/drawer/DrawFragment.kt index 6caba6f5..c5933b29 100644 --- a/app/src/main/java/com/github/droidworksstudio/launcher/ui/drawer/DrawFragment.kt +++ b/app/src/main/java/com/github/droidworksstudio/launcher/ui/drawer/DrawFragment.kt @@ -201,7 +201,7 @@ class DrawFragment : Fragment(), Handler(Looper.getMainLooper()).post { findNavController().navigate( - R.id.action_DrawFragment_to_HomeFragment, + R.id.HomeFragment, null, actionTypeNavOptions ) @@ -220,7 +220,7 @@ class DrawFragment : Fragment(), Handler(Looper.getMainLooper()).post { findNavController().navigate( - R.id.action_DrawFragment_to_HomeFragment, + R.id.HomeFragment, null, actionTypeNavOptions ) @@ -244,7 +244,7 @@ class DrawFragment : Fragment(), Handler(Looper.getMainLooper()).post { findNavController().navigate( - R.id.action_DrawFragment_to_HomeFragment, + R.id.HomeFragment, null, actionTypeNavOptions ) @@ -259,7 +259,7 @@ class DrawFragment : Fragment(), Handler(Looper.getMainLooper()).post { findNavController().navigate( - R.id.action_DrawFragment_to_HomeFragment, + R.id.HomeFragment, null, actionTypeNavOptions ) diff --git a/app/src/main/java/com/github/droidworksstudio/launcher/ui/home/HomeFragment.kt b/app/src/main/java/com/github/droidworksstudio/launcher/ui/home/HomeFragment.kt index fd9ef75e..4e72784b 100644 --- a/app/src/main/java/com/github/droidworksstudio/launcher/ui/home/HomeFragment.kt +++ b/app/src/main/java/com/github/droidworksstudio/launcher/ui/home/HomeFragment.kt @@ -423,7 +423,7 @@ class HomeFragment : Fragment(), else appHelper.getActionType(actionType) Handler(Looper.getMainLooper()).post { findNavController().navigate( - R.id.action_HomeFragment_to_DrawFragment, + R.id.DrawFragment, null, actionTypeNavOptions ) @@ -437,7 +437,7 @@ class HomeFragment : Fragment(), else appHelper.getActionType(actionType) Handler(Looper.getMainLooper()).post { findNavController().navigate( - R.id.action_HomeFragment_to_FavoriteFragment, + R.id.FavoriteFragment, null, actionTypeNavOptions ) @@ -450,7 +450,7 @@ class HomeFragment : Fragment(), else appHelper.getActionType(actionType) Handler(Looper.getMainLooper()).post { findNavController().navigate( - R.id.action_HomeFragment_to_HiddenFragment, + R.id.HiddenFragment, null, actionTypeNavOptions ) @@ -476,7 +476,7 @@ class HomeFragment : Fragment(), else appHelper.getActionType(actionType) Handler(Looper.getMainLooper()).post { findNavController().navigate( - R.id.action_HomeFragment_to_WidgetsFragment, + R.id.WidgetsFragment, null, actionTypeNavOptions ) diff --git a/app/src/main/java/com/github/droidworksstudio/launcher/ui/settings/SettingsFragment.kt b/app/src/main/java/com/github/droidworksstudio/launcher/ui/settings/SettingsFragment.kt index a4d9fc72..adf72c5a 100644 --- a/app/src/main/java/com/github/droidworksstudio/launcher/ui/settings/SettingsFragment.kt +++ b/app/src/main/java/com/github/droidworksstudio/launcher/ui/settings/SettingsFragment.kt @@ -70,23 +70,23 @@ class SettingsFragment : Fragment(), private fun observeClickListener() { binding.apply { featuresSettings.setOnClickListener { - navController.navigate(R.id.action_SettingsFragment_to_SettingsFeaturesFragment) + navController.navigate(R.id.SettingsFeaturesFragment) } lookFeelSettings.setOnClickListener { - navController.navigate(R.id.action_SettingsFragment_to_SettingsLookFeelFragment) + navController.navigate(R.id.SettingsLookFeelFragment) } favoriteApps.setOnClickListener { - navController.navigate(R.id.action_SettingsFragment_to_FavoriteFragment) + navController.navigate(R.id.FavoriteFragment) } hiddenApps.setOnClickListener { - navController.navigate(R.id.action_SettingsFragment_to_HiddenFragment) + navController.navigate(R.id.HiddenFragment) } advancedSettings.setOnClickListener { - navController.navigate(R.id.action_SettingsFragment_to_SettingsAdvancedFragment) + navController.navigate(R.id.SettingsAdvancedFragment) } } } diff --git a/app/src/main/java/com/github/droidworksstudio/launcher/ui/widgets/WidgetFragment.kt b/app/src/main/java/com/github/droidworksstudio/launcher/ui/widgets/WidgetFragment.kt index 4dc8172b..29318143 100644 --- a/app/src/main/java/com/github/droidworksstudio/launcher/ui/widgets/WidgetFragment.kt +++ b/app/src/main/java/com/github/droidworksstudio/launcher/ui/widgets/WidgetFragment.kt @@ -395,7 +395,7 @@ class WidgetFragment : Fragment(), Handler(Looper.getMainLooper()).post { findNavController().navigate( - R.id.action_WidgetsFragment_to_WidgetsSettingsFragment, + R.id.WidgetsSettingsFragment, null, actionTypeNavOptions ) @@ -410,7 +410,7 @@ class WidgetFragment : Fragment(), Handler(Looper.getMainLooper()).post { findNavController().navigate( - R.id.action_WidgetsFragment_to_HomeFragment, + R.id.HomeFragment, null, actionTypeNavOptions ) @@ -425,7 +425,7 @@ class WidgetFragment : Fragment(), Handler(Looper.getMainLooper()).post { findNavController().navigate( - R.id.action_WidgetsFragment_to_HomeFragment, + R.id.HomeFragment, null, actionTypeNavOptions ) diff --git a/app/src/main/res/navigation/nav_graph.xml b/app/src/main/res/navigation/nav_graph.xml index 789dce1b..9a5ef3a1 100644 --- a/app/src/main/res/navigation/nav_graph.xml +++ b/app/src/main/res/navigation/nav_graph.xml @@ -8,67 +8,19 @@ android:id="@+id/HomeFragment" android:name="com.github.droidworksstudio.launcher.ui.home.HomeFragment" android:label="@string/home_fragment_label" - tools:layout="@layout/fragment_home"> - - - - - - - + tools:layout="@layout/fragment_home" /> - - - - - - - - + tools:layout="@layout/fragment_settings" /> - - - - - + tools:layout="@layout/fragment_widgets" /> - - - - + tools:layout="@layout/fragment_draw" />