parent
f1ef673b9d
commit
15f714b359
2 changed files with 19 additions and 2 deletions
|
@ -113,7 +113,9 @@ class ItemsAdapter(activity: SimpleActivity, var fileDirItems: MutableList<FileD
|
|||
}
|
||||
|
||||
private fun displayRenameDialog() {
|
||||
RenameItemDialog(activity, getSelectedMedia()[0].path) {
|
||||
val oldPath = getSelectedMedia()[0].path
|
||||
RenameItemDialog(activity, oldPath) {
|
||||
activity.config.moveFavorite(oldPath, it)
|
||||
activity.runOnUiThread {
|
||||
listener?.refreshItems()
|
||||
finishActMode()
|
||||
|
@ -358,6 +360,7 @@ class ItemsAdapter(activity: SimpleActivity, var fileDirItems: MutableList<FileD
|
|||
val file = fileDirItems[it]
|
||||
files.add(File(file.path))
|
||||
removeFiles.add(file)
|
||||
activity.config.removeFavorite(file.path)
|
||||
}
|
||||
|
||||
fileDirItems.removeAll(removeFiles)
|
||||
|
|
|
@ -5,7 +5,6 @@ import com.simplemobiletools.commons.extensions.getInternalStoragePath
|
|||
import com.simplemobiletools.commons.helpers.BaseConfig
|
||||
import com.simplemobiletools.commons.helpers.SORT_BY_NAME
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
|
||||
class Config(context: Context) : BaseConfig(context) {
|
||||
companion object {
|
||||
|
@ -38,7 +37,22 @@ class Config(context: Context) : BaseConfig(context) {
|
|||
favorites = currFavorites
|
||||
}
|
||||
|
||||
fun moveFavorite(oldPath: String, newPath: String) {
|
||||
if (!favorites.contains(oldPath)) {
|
||||
return
|
||||
}
|
||||
|
||||
val currFavorites = HashSet<String>(favorites)
|
||||
currFavorites.remove(oldPath)
|
||||
currFavorites.add(newPath)
|
||||
favorites = currFavorites
|
||||
}
|
||||
|
||||
fun removeFavorite(path: String) {
|
||||
if (!favorites.contains(path)) {
|
||||
return
|
||||
}
|
||||
|
||||
val currFavorites = HashSet<String>(favorites)
|
||||
currFavorites.remove(path)
|
||||
favorites = currFavorites
|
||||
|
|
Loading…
Reference in a new issue