mirror of
https://github.com/SimpleMobileTools/Simple-File-Manager.git
synced 2025-01-28 01:09:32 +01:00
parent
f1ef673b9d
commit
15f714b359
@ -113,7 +113,9 @@ class ItemsAdapter(activity: SimpleActivity, var fileDirItems: MutableList<FileD
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun displayRenameDialog() {
|
private fun displayRenameDialog() {
|
||||||
RenameItemDialog(activity, getSelectedMedia()[0].path) {
|
val oldPath = getSelectedMedia()[0].path
|
||||||
|
RenameItemDialog(activity, oldPath) {
|
||||||
|
activity.config.moveFavorite(oldPath, it)
|
||||||
activity.runOnUiThread {
|
activity.runOnUiThread {
|
||||||
listener?.refreshItems()
|
listener?.refreshItems()
|
||||||
finishActMode()
|
finishActMode()
|
||||||
@ -358,6 +360,7 @@ class ItemsAdapter(activity: SimpleActivity, var fileDirItems: MutableList<FileD
|
|||||||
val file = fileDirItems[it]
|
val file = fileDirItems[it]
|
||||||
files.add(File(file.path))
|
files.add(File(file.path))
|
||||||
removeFiles.add(file)
|
removeFiles.add(file)
|
||||||
|
activity.config.removeFavorite(file.path)
|
||||||
}
|
}
|
||||||
|
|
||||||
fileDirItems.removeAll(removeFiles)
|
fileDirItems.removeAll(removeFiles)
|
||||||
|
@ -5,7 +5,6 @@ import com.simplemobiletools.commons.extensions.getInternalStoragePath
|
|||||||
import com.simplemobiletools.commons.helpers.BaseConfig
|
import com.simplemobiletools.commons.helpers.BaseConfig
|
||||||
import com.simplemobiletools.commons.helpers.SORT_BY_NAME
|
import com.simplemobiletools.commons.helpers.SORT_BY_NAME
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.*
|
|
||||||
|
|
||||||
class Config(context: Context) : BaseConfig(context) {
|
class Config(context: Context) : BaseConfig(context) {
|
||||||
companion object {
|
companion object {
|
||||||
@ -38,7 +37,22 @@ class Config(context: Context) : BaseConfig(context) {
|
|||||||
favorites = currFavorites
|
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) {
|
fun removeFavorite(path: String) {
|
||||||
|
if (!favorites.contains(path)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
val currFavorites = HashSet<String>(favorites)
|
val currFavorites = HashSet<String>(favorites)
|
||||||
currFavorites.remove(path)
|
currFavorites.remove(path)
|
||||||
favorites = currFavorites
|
favorites = currFavorites
|
||||||
|
Loading…
x
Reference in New Issue
Block a user