mirror of
https://github.com/SimpleMobileTools/Simple-App-Launcher.git
synced 2025-04-16 02:47:22 +02:00
uncheck launchers at pressing Back
This commit is contained in:
parent
0f71fd3f3b
commit
86d1d3211c
@ -17,7 +17,7 @@ import kotlinx.android.synthetic.main.activity_main.*
|
|||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.comparisons.compareBy
|
import kotlin.comparisons.compareBy
|
||||||
|
|
||||||
class MainActivity : SimpleActivity(), AddAppDialog.AddLaunchersInterface, RecyclerAdapter.EditLaunchersInterface {
|
class MainActivity : SimpleActivity(), AddAppDialog.AddLaunchersInterface, RecyclerAdapter.RecyclerInterface {
|
||||||
lateinit var dbHelper: DbHelper
|
lateinit var dbHelper: DbHelper
|
||||||
lateinit var launchers: ArrayList<AppLauncher>
|
lateinit var launchers: ArrayList<AppLauncher>
|
||||||
lateinit var remainingLaunchers: ArrayList<AppLauncher>
|
lateinit var remainingLaunchers: ArrayList<AppLauncher>
|
||||||
@ -101,7 +101,7 @@ class MainActivity : SimpleActivity(), AddAppDialog.AddLaunchersInterface, Recyc
|
|||||||
for ((id, name, pkgName) in launchers) {
|
for ((id, name, pkgName) in launchers) {
|
||||||
dbHelper.addLauncher(name, pkgName)
|
dbHelper.addLauncher(name, pkgName)
|
||||||
}
|
}
|
||||||
refreshLaunchers()
|
refreshLauncherIcons()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun launchersDeleted(indexes: List<Int>, deletedLaunchers: List<AppLauncher>) {
|
override fun launchersDeleted(indexes: List<Int>, deletedLaunchers: List<AppLauncher>) {
|
||||||
@ -128,6 +128,10 @@ class MainActivity : SimpleActivity(), AddAppDialog.AddLaunchersInterface, Recyc
|
|||||||
setupLaunchers()
|
setupLaunchers()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun refreshLauncherIcons() {
|
||||||
|
setupLaunchers()
|
||||||
|
}
|
||||||
|
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
super.onDestroy()
|
super.onDestroy()
|
||||||
preferences.isFirstRun = false
|
preferences.isFirstRun = false
|
||||||
|
@ -56,6 +56,11 @@ class RecyclerAdapter(val act: Activity, val launchers: List<AppLauncher>, val i
|
|||||||
menuItem?.isVisible = multiSelector.selectedPositions.size == 1
|
menuItem?.isVisible = multiSelector.selectedPositions.size == 1
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onDestroyActionMode(actionMode: ActionMode?) {
|
||||||
|
super.onDestroyActionMode(actionMode)
|
||||||
|
(act as RecyclerInterface).refreshLauncherIcons()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||||
@ -90,7 +95,7 @@ class RecyclerAdapter(val act: Activity, val launchers: List<AppLauncher>, val i
|
|||||||
val newName = editView.edit_launcher_edittext.text.toString().trim()
|
val newName = editView.edit_launcher_edittext.text.toString().trim()
|
||||||
if (!newName.isEmpty()) {
|
if (!newName.isEmpty()) {
|
||||||
if (DbHelper(act).updateLauncherName(selectedLauncher.id, newName) > 0) {
|
if (DbHelper(act).updateLauncherName(selectedLauncher.id, newName) > 0) {
|
||||||
(act as EditLaunchersInterface).launcherRenamed()
|
(act as RecyclerInterface).launcherRenamed()
|
||||||
finishActionMode()
|
finishActionMode()
|
||||||
alertDialog.dismiss()
|
alertDialog.dismiss()
|
||||||
} else {
|
} else {
|
||||||
@ -120,7 +125,7 @@ class RecyclerAdapter(val act: Activity, val launchers: List<AppLauncher>, val i
|
|||||||
}
|
}
|
||||||
DbHelper(act).deleteLaunchers(deleteIds)
|
DbHelper(act).deleteLaunchers(deleteIds)
|
||||||
finishActionMode()
|
finishActionMode()
|
||||||
(act as EditLaunchersInterface).launchersDeleted(positions, deletedLaunchers)
|
(act as RecyclerInterface).launchersDeleted(positions, deletedLaunchers)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getRealAppName(launcher: AppLauncher): String {
|
private fun getRealAppName(launcher: AppLauncher): String {
|
||||||
@ -185,9 +190,11 @@ class RecyclerAdapter(val act: Activity, val launchers: List<AppLauncher>, val i
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface EditLaunchersInterface {
|
interface RecyclerInterface {
|
||||||
fun launchersDeleted(indexes: List<Int>, deletedLaunchers: List<AppLauncher>)
|
fun launchersDeleted(indexes: List<Int>, deletedLaunchers: List<AppLauncher>)
|
||||||
|
|
||||||
fun launcherRenamed()
|
fun launcherRenamed()
|
||||||
|
|
||||||
|
fun refreshLauncherIcons()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user