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 { 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:RootTools:df729dcb13'
implementation 'com.github.Stericson:RootShell:1.6' implementation 'com.github.Stericson:RootShell:1.6'
implementation 'com.alexvasilkov:gesture-views:2.5.2' implementation 'com.alexvasilkov:gesture-views:2.5.2'

View File

@ -79,7 +79,7 @@ class DecompressActivity : SimpleActivity() {
private fun decompressFiles() { private fun decompressFiles() {
val defaultFolder = getRealPathFromURI(uri!!) ?: internalStoragePath 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) { handleSAFDialog(destination) {
if (it) { if (it) {
ensureBackgroundThread { ensureBackgroundThread {

View File

@ -16,7 +16,7 @@ class SaveAsActivity : SimpleActivity() {
setContentView(R.layout.activity_save_as) setContentView(R.layout.activity_save_as)
if (intent.action == Intent.ACTION_SEND && intent.extras?.containsKey(Intent.EXTRA_STREAM) == true) { 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 val destination = it
handleSAFDialog(destination) { handleSAFDialog(destination) {
toast(R.string.saving) toast(R.string.saving)

View File

@ -357,7 +357,7 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList<ListItem
val files = getSelectedFileDirItems() val files = getSelectedFileDirItems()
val firstFile = files[0] val firstFile = files[0]
val source = if (firstFile.isDirectory) firstFile.path else firstFile.getParentPath() 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)) { if (activity.isPathOnRoot(it) || activity.isPathOnRoot(firstFile.path)) {
copyMoveRootItems(files, it, isCopyOperation) copyMoveRootItems(files, it, isCopyOperation)
} else { } 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.text = activity.humanizePath(realPath)
file_path.setOnClickListener { 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) file_path.text = activity.humanizePath(it)
realPath = it realPath = it
} }

View File

@ -37,7 +37,7 @@ class SaveAsDialog(val activity: BaseSimpleActivity, var path: String, val hideP
save_as_path.beGone() save_as_path.beGone()
} else { } else {
save_as_path.setOnClickListener { 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) save_as_path.text = activity.humanizePath(it)
realPath = it realPath = it
} }

View File

@ -58,10 +58,6 @@ class Config(context: Context) : BaseConfig(context) {
favorites = currFavorites 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 var isRootAvailable: Boolean
get() = prefs.getBoolean(IS_ROOT_AVAILABLE, false) get() = prefs.getBoolean(IS_ROOT_AVAILABLE, false)
set(isRootAvailable) = prefs.edit().putBoolean(IS_ROOT_AVAILABLE, isRootAvailable).apply() set(isRootAvailable) = prefs.edit().putBoolean(IS_ROOT_AVAILABLE, isRootAvailable).apply()

View File

@ -5,8 +5,6 @@ const val PATH = "path"
// shared preferences // shared preferences
const val SHOW_HIDDEN = "show_hidden" const val SHOW_HIDDEN = "show_hidden"
const val HOME_FOLDER = "home_folder" 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 TEMPORARILY_SHOW_HIDDEN = "temporarily_show_hidden"
const val IS_ROOT_AVAILABLE = "is_root_available" const val IS_ROOT_AVAILABLE = "is_root_available"
const val ENABLE_ROOT_ACCESS = "enable_root_access" const val ENABLE_ROOT_ACCESS = "enable_root_access"