mirror of
https://github.com/SimpleMobileTools/Simple-App-Launcher.git
synced 2025-04-26 07:38:53 +02: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 deleteIds = ArrayList<String>(positions.size)
|
||||||
val deletedLaunchers = ArrayList<AppLauncher>(positions.size)
|
val deletedLaunchers = ArrayList<AppLauncher>(positions.size)
|
||||||
for (i in positions) {
|
for (i in positions) {
|
||||||
deletedLaunchers.add(launchers[i])
|
val launcher = launchers[i]
|
||||||
deleteIds.add(launchers[i].id.toString())
|
deleteIds.add(launcher.id.toString())
|
||||||
|
|
||||||
|
launcher.name = getRealAppName(launcher)
|
||||||
|
deletedLaunchers.add(launcher)
|
||||||
}
|
}
|
||||||
DbHelper(act).deleteLaunchers(deleteIds)
|
DbHelper(act).deleteLaunchers(deleteIds)
|
||||||
finishActionMode()
|
finishActionMode()
|
||||||
(act as EditLaunchersInterface).launchersDeleted(positions, deletedLaunchers)
|
(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()) {
|
class ViewHolder(view: View, val itemClick: (AppLauncher) -> (Unit)) : SwappingHolder(view, MultiSelector()) {
|
||||||
val viewHolder = this
|
val viewHolder = this
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.simplemobiletools.applauncher.models
|
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 {
|
override fun equals(other: Any?): Boolean {
|
||||||
return pkgName.equals((other as AppLauncher).pkgName)
|
return pkgName.equals((other as AppLauncher).pkgName)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user