mirror of
https://github.com/SimpleMobileTools/Simple-App-Launcher.git
synced 2025-06-05 21:49:21 +02:00
minor code cleanup ad AddAppLauncherDialog
This commit is contained in:
@ -13,7 +13,6 @@ import com.simplemobiletools.applauncher.extensions.isAPredefinedApp
|
|||||||
import com.simplemobiletools.applauncher.models.AppLauncher
|
import com.simplemobiletools.applauncher.models.AppLauncher
|
||||||
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||||
import kotlinx.android.synthetic.main.dialog_pick_launchers.view.*
|
import kotlinx.android.synthetic.main.dialog_pick_launchers.view.*
|
||||||
import java.util.*
|
|
||||||
|
|
||||||
class AddAppLauncherDialog(val activity: Activity, val displayedLaunchers: ArrayList<AppLauncher>, val callback: () -> Unit) {
|
class AddAppLauncherDialog(val activity: Activity, val displayedLaunchers: ArrayList<AppLauncher>, val callback: () -> Unit) {
|
||||||
private var dialog: AlertDialog
|
private var dialog: AlertDialog
|
||||||
@ -62,12 +61,11 @@ class AddAppLauncherDialog(val activity: Activity, val displayedLaunchers: Array
|
|||||||
packageManager.getApplicationIcon(packageName)
|
packageManager.getApplicationIcon(packageName)
|
||||||
}
|
}
|
||||||
|
|
||||||
allApps.add(AppLauncher(0, label, componentInfo.packageName, drawable))
|
allApps.add(AppLauncher(0, label, packageName, drawable))
|
||||||
}
|
}
|
||||||
|
|
||||||
val sorted = allApps.sortedWith(compareBy { it.name.toLowerCase() })
|
val sorted = allApps.sortedWith(compareBy { it.name.toLowerCase() })
|
||||||
val unique = sorted.distinctBy { it.packageName }
|
val unique = sorted.distinctBy { it.packageName }
|
||||||
val filtered = unique.filter { !displayedLaunchers.contains(it) && it.packageName != "com.simplemobiletools.applauncher" }
|
return unique.filter { !displayedLaunchers.contains(it) && it.packageName != "com.simplemobiletools.applauncher" } as ArrayList<AppLauncher>
|
||||||
return filtered as ArrayList<AppLauncher>
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user