From acf8ec95fd9ce906a76599bbfae54924f1ccefa0 Mon Sep 17 00:00:00 2001 From: Tanuj Date: Wed, 4 Jan 2023 18:55:12 +0530 Subject: [PATCH] Fixed a lint error --- app/src/main/java/app/olauncher/MainViewModel.kt | 5 ++--- app/src/main/java/app/olauncher/ui/AppDrawerFragment.kt | 6 ++++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/app/olauncher/MainViewModel.kt b/app/src/main/java/app/olauncher/MainViewModel.kt index 0a31d27b..b84ad29c 100644 --- a/app/src/main/java/app/olauncher/MainViewModel.kt +++ b/app/src/main/java/app/olauncher/MainViewModel.kt @@ -24,8 +24,8 @@ class MainViewModel(application: Application) : AndroidViewModel(application) { val refreshHome = MutableLiveData() val toggleDateTime = MutableLiveData() val updateSwipeApps = MutableLiveData() - val appList = MutableLiveData>() - val hiddenApps = MutableLiveData>() + val appList = MutableLiveData?>() + val hiddenApps = MutableLiveData?>() val isOlauncherDefault = MutableLiveData() val launcherResetFailed = MutableLiveData() val homeAppAlignment = MutableLiveData() @@ -133,7 +133,6 @@ class MainViewModel(application: Application) : AndroidViewModel(application) { val activityInfo = launcher.getActivityList(packageName, userHandle) val component = if (activityClassName.isNullOrBlank()) { - // TODO: Handle multiple launch activities in an app. This is NOT the way. // activityClassName will be null for hidden apps. when (activityInfo.size) { 0 -> { diff --git a/app/src/main/java/app/olauncher/ui/AppDrawerFragment.kt b/app/src/main/java/app/olauncher/ui/AppDrawerFragment.kt index 185bff84..029a7daf 100644 --- a/app/src/main/java/app/olauncher/ui/AppDrawerFragment.kt +++ b/app/src/main/java/app/olauncher/ui/AppDrawerFragment.kt @@ -113,8 +113,10 @@ class AppDrawerFragment : Fragment() { }) viewModel.appList.observe(viewLifecycleOwner, Observer { - if (flag == Constants.FLAG_HIDDEN_APPS) return@Observer - if (it == appAdapter.appsList) return@Observer + if (it == null + || it == appAdapter.appsList + || flag == Constants.FLAG_HIDDEN_APPS + ) return@Observer populateAppList(it, appAdapter) })