mirror of
https://github.com/jrpie/Launcher.git
synced 2025-02-23 06:21:31 +01:00
cleanup
This commit is contained in:
parent
7f2a52c79c
commit
d63461ea40
3 changed files with 10 additions and 20 deletions
|
@ -40,6 +40,8 @@ const val REQUEST_UNINSTALL = 2
|
|||
|
||||
const val REQUEST_SET_DEFAULT_HOME = 42
|
||||
|
||||
const val LOG_TAG = "Launcher"
|
||||
|
||||
/* Animate */
|
||||
|
||||
// Taken from https://stackoverflow.com/questions/47293269
|
||||
|
@ -110,7 +112,7 @@ fun uninstallApp(appInfo: AppInfo, activity: Activity) {
|
|||
val packageName = appInfo.packageName.toString()
|
||||
val user = appInfo.user
|
||||
|
||||
Log.i("Launcher", "uninstalling $appInfo")
|
||||
Log.i(LOG_TAG, "uninstalling $appInfo")
|
||||
val intent = Intent(Intent.ACTION_UNINSTALL_PACKAGE)
|
||||
intent.data = Uri.parse("package:$packageName")
|
||||
getUserFromId(user, activity).let { user ->
|
||||
|
@ -171,7 +173,7 @@ fun loadApps(packageManager: PackageManager, context: Context) {
|
|||
|
||||
// fallback option
|
||||
if (loadList.isEmpty()) {
|
||||
Log.i("Launcher", "using fallback option to load packages")
|
||||
Log.w(LOG_TAG, "using fallback option to load packages")
|
||||
val i = Intent(Intent.ACTION_MAIN, null)
|
||||
i.addCategory(Intent.CATEGORY_LAUNCHER)
|
||||
val allApps = packageManager.queryIntentActivities(i, 0)
|
||||
|
|
|
@ -414,7 +414,7 @@ fun migratePreferencesToNewVersion(context: Context) {
|
|||
}
|
||||
|
||||
fun resetPreferences(context: Context) {
|
||||
Log.i(TAG, "resetting preferences")
|
||||
Log.i(TAG, "Resetting preferences")
|
||||
LauncherPreferences.clear()
|
||||
LauncherPreferences.internal().versionCode(PREFERENCE_VERSION)
|
||||
|
||||
|
|
|
@ -51,6 +51,8 @@ class AppsRecyclerAdapter(
|
|||
) :
|
||||
RecyclerView.Adapter<AppsRecyclerAdapter.ViewHolder>() {
|
||||
|
||||
private val LOG_TAG = "Launcher"
|
||||
|
||||
private val appsListDisplayed: MutableList<DetailedAppInfo> = mutableListOf()
|
||||
|
||||
|
||||
|
@ -138,32 +140,18 @@ class AppsRecyclerAdapter(
|
|||
}
|
||||
|
||||
R.id.app_menu_favorite -> {
|
||||
var favorites: MutableSet<AppInfo> =
|
||||
val favorites: MutableSet<AppInfo> =
|
||||
LauncherPreferences.apps().favorites() ?: mutableSetOf()
|
||||
|
||||
Log.i("LAUNCHER", favorites.size.toString())
|
||||
for (app in favorites) {
|
||||
Log.i("LAUNCHER", app.serialize())
|
||||
|
||||
}
|
||||
|
||||
if (favorites.contains(appInfo.app)) {
|
||||
favorites.remove(appInfo.app)
|
||||
Log.i(
|
||||
"LAUNCHER",
|
||||
"Removing " + appInfo.app.serialize() + " from favorites."
|
||||
)
|
||||
Log.i(LOG_TAG, "Removing $appInfo from favorites.")
|
||||
} else {
|
||||
Log.i("LAUNCHER", "Adding " + appInfo.app.serialize() + " to favorites.")
|
||||
Log.i(LOG_TAG, "Adding $appInfo to favorites.")
|
||||
favorites.add(appInfo.app)
|
||||
}
|
||||
Log.i("LAUNCHER", favorites.size.toString())
|
||||
for (app in favorites) {
|
||||
Log.i("LAUNCHER", app.serialize())
|
||||
|
||||
}
|
||||
LauncherPreferences.apps().favorites(favorites)
|
||||
|
||||
true
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue