mirror of
https://github.com/SimpleMobileTools/Simple-App-Launcher.git
synced 2025-02-01 01:46:44 +01:00
reset app launcher name after deletion
This commit is contained in:
parent
26de994032
commit
6b1fd0f072
@ -110,14 +110,22 @@ class RecyclerAdapter(val act: Activity, val launchers: List<AppLauncher>, val i
|
||||
val deleteIds = ArrayList<String>(positions.size)
|
||||
val deletedLaunchers = ArrayList<AppLauncher>(positions.size)
|
||||
for (i in positions) {
|
||||
deletedLaunchers.add(launchers[i])
|
||||
deleteIds.add(launchers[i].id.toString())
|
||||
val launcher = launchers[i]
|
||||
deleteIds.add(launcher.id.toString())
|
||||
|
||||
launcher.name = getRealAppName(launcher)
|
||||
deletedLaunchers.add(launcher)
|
||||
}
|
||||
DbHelper(act).deleteLaunchers(deleteIds)
|
||||
finishActionMode()
|
||||
(act as EditLaunchersInterface).launchersDeleted(positions, deletedLaunchers)
|
||||
}
|
||||
|
||||
private fun getRealAppName(launcher: AppLauncher): String {
|
||||
val applicationInfo = act.packageManager.getApplicationInfo(launcher.pkgName, 0)
|
||||
return act.packageManager.getApplicationLabel(applicationInfo).toString()
|
||||
}
|
||||
|
||||
class ViewHolder(view: View, val itemClick: (AppLauncher) -> (Unit)) : SwappingHolder(view, MultiSelector()) {
|
||||
val viewHolder = this
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.simplemobiletools.applauncher.models
|
||||
|
||||
data class AppLauncher(val id: Int, val name: String, val pkgName: String, val iconId: Int, var isChecked: Boolean = false) {
|
||||
data class AppLauncher(val id: Int, var name: String, val pkgName: String, val iconId: Int, var isChecked: Boolean = false) {
|
||||
override fun equals(other: Any?): Boolean {
|
||||
return pkgName.equals((other as AppLauncher).pkgName)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user