fix #413, add a button for showing Favorites at the destination picker

This commit is contained in:
tibbi 2020-09-26 23:14:28 +02:00
parent 665b401aee
commit 723f8481c3
8 changed files with 6 additions and 12 deletions

View File

@ -58,7 +58,7 @@ android {
}
dependencies {
implementation 'com.simplemobiletools:commons:5.30.14'
implementation 'com.simplemobiletools:commons:5.30.16'
implementation 'com.github.Stericson:RootTools:df729dcb13'
implementation 'com.github.Stericson:RootShell:1.6'
implementation 'com.alexvasilkov:gesture-views:2.5.2'

View File

@ -79,7 +79,7 @@ class DecompressActivity : SimpleActivity() {
private fun decompressFiles() {
val defaultFolder = getRealPathFromURI(uri!!) ?: internalStoragePath
FilePickerDialog(this, defaultFolder, false, config.showHidden, true, true) { destination ->
FilePickerDialog(this, defaultFolder, false, config.showHidden, true, true, showFavoritesButton = true) { destination ->
handleSAFDialog(destination) {
if (it) {
ensureBackgroundThread {

View File

@ -16,7 +16,7 @@ class SaveAsActivity : SimpleActivity() {
setContentView(R.layout.activity_save_as)
if (intent.action == Intent.ACTION_SEND && intent.extras?.containsKey(Intent.EXTRA_STREAM) == true) {
FilePickerDialog(this, pickFile = false, showHidden = config.shouldShowHidden, showFAB = true) {
FilePickerDialog(this, pickFile = false, showHidden = config.shouldShowHidden, showFAB = true, showFavoritesButton = true) {
val destination = it
handleSAFDialog(destination) {
toast(R.string.saving)

View File

@ -357,7 +357,7 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList<ListItem
val files = getSelectedFileDirItems()
val firstFile = files[0]
val source = if (firstFile.isDirectory) firstFile.path else firstFile.getParentPath()
FilePickerDialog(activity, source, false, activity.config.shouldShowHidden, true, true) {
FilePickerDialog(activity, source, false, activity.config.shouldShowHidden, true, true, showFavoritesButton = true) {
if (activity.isPathOnRoot(it) || activity.isPathOnRoot(firstFile.path)) {
copyMoveRootItems(files, it, isCopyOperation)
} else {

View File

@ -23,7 +23,7 @@ class CompressAsDialog(val activity: BaseSimpleActivity, val path: String, val c
file_path.text = activity.humanizePath(realPath)
file_path.setOnClickListener {
FilePickerDialog(activity, realPath, false, activity.config.shouldShowHidden, true, true) {
FilePickerDialog(activity, realPath, false, activity.config.shouldShowHidden, true, true, showFavoritesButton = true) {
file_path.text = activity.humanizePath(it)
realPath = it
}

View File

@ -37,7 +37,7 @@ class SaveAsDialog(val activity: BaseSimpleActivity, var path: String, val hideP
save_as_path.beGone()
} else {
save_as_path.setOnClickListener {
FilePickerDialog(activity, realPath, false, false, true, true) {
FilePickerDialog(activity, realPath, false, false, true, true, showFavoritesButton = true) {
save_as_path.text = activity.humanizePath(it)
realPath = it
}

View File

@ -58,10 +58,6 @@ class Config(context: Context) : BaseConfig(context) {
favorites = currFavorites
}
var favorites: MutableSet<String>
get() = prefs.getStringSet(FAVORITES, HashSet<String>())!!
set(favorites) = prefs.edit().remove(FAVORITES).putStringSet(FAVORITES, favorites).apply()
var isRootAvailable: Boolean
get() = prefs.getBoolean(IS_ROOT_AVAILABLE, false)
set(isRootAvailable) = prefs.edit().putBoolean(IS_ROOT_AVAILABLE, isRootAvailable).apply()

View File

@ -5,8 +5,6 @@ const val PATH = "path"
// shared preferences
const val SHOW_HIDDEN = "show_hidden"
const val HOME_FOLDER = "home_folder"
const val FAVORITES = "favorites"
const val SORT_FOLDER_PREFIX = "sort_folder_"
const val TEMPORARILY_SHOW_HIDDEN = "temporarily_show_hidden"
const val IS_ROOT_AVAILABLE = "is_root_available"
const val ENABLE_ROOT_ACCESS = "enable_root_access"