Skip to content

Commit

Permalink
crash on double tap gesture (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
HeCodes2Much committed Dec 22, 2022
1 parent 429664e commit 3c118ef
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions app/src/main/java/app/mlauncher/ui/HomeFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import androidx.core.view.children
import androidx.core.view.size
import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.lifecycleScope
import androidx.navigation.fragment.findNavController
import app.mlauncher.MainViewModel
import app.mlauncher.R
Expand All @@ -27,6 +28,7 @@ import app.mlauncher.databinding.FragmentHomeBinding
import app.mlauncher.helper.*
import app.mlauncher.listener.OnSwipeTouchListener
import app.mlauncher.listener.ViewSwipeTouchListener
import kotlinx.coroutines.launch

class HomeFragment : Fragment(), View.OnClickListener, View.OnLongClickListener {

Expand Down Expand Up @@ -170,17 +172,19 @@ class HomeFragment : Fragment(), View.OnClickListener, View.OnLongClickListener

private fun showAppList(flag: AppDrawerFlag, showHiddenApps: Boolean = false, n: Int = 0) {
viewModel.getAppList(showHiddenApps)
try {
findNavController().navigate(
R.id.action_mainFragment_to_appListFragment,
bundleOf("flag" to flag.toString(), "n" to n)
)
} catch (e: Exception) {
findNavController().navigate(
R.id.appListFragment,
bundleOf("flag" to flag.toString())
)
e.printStackTrace()
lifecycleScope.launch {
try {
findNavController().navigate(
R.id.action_mainFragment_to_appListFragment,
bundleOf("flag" to flag.toString(), "n" to n)
)
} catch (e: Exception) {
findNavController().navigate(
R.id.appListFragment,
bundleOf("flag" to flag.toString())
)
e.printStackTrace()
}
}
}

Expand Down

0 comments on commit 3c118ef

Please sign in to comment.