hide the Other Folder button at the widget folder picker

This commit is contained in:
tibbi 2018-12-16 16:54:56 +01:00
parent abb0a69f7a
commit 5f10bebb19
4 changed files with 20 additions and 16 deletions

View file

@ -128,7 +128,7 @@ class WidgetConfigureActivity : SimpleActivity() {
}
private fun changeSelectedFolder() {
PickDirectoryDialog(this, mFolderPath) {
PickDirectoryDialog(this, mFolderPath, false) {
updateFolderImage(it)
}
}

View file

@ -16,7 +16,7 @@ import com.simplemobiletools.gallery.pro.helpers.VIEW_TYPE_GRID
import com.simplemobiletools.gallery.pro.models.Directory
import kotlinx.android.synthetic.main.dialog_directory_picker.view.*
class PickDirectoryDialog(val activity: BaseSimpleActivity, val sourcePath: String, val callback: (path: String) -> Unit) {
class PickDirectoryDialog(val activity: BaseSimpleActivity, val sourcePath: String, val showOtherFolderButton: Boolean, val callback: (path: String) -> Unit) {
var dialog: AlertDialog
var shownDirectories = ArrayList<Directory>()
var view = activity.layoutInflater.inflate(R.layout.dialog_directory_picker, null)
@ -29,11 +29,15 @@ class PickDirectoryDialog(val activity: BaseSimpleActivity, val sourcePath: Stri
spanCount = if (isGridViewType) activity.config.dirColumnCnt else 1
}
dialog = AlertDialog.Builder(activity)
val builder = AlertDialog.Builder(activity)
.setPositiveButton(R.string.ok, null)
.setNegativeButton(R.string.cancel, null)
.setNeutralButton(R.string.other_folder) { dialogInterface, i -> showOtherFolder() }
.create().apply {
if (showOtherFolderButton) {
builder.setNeutralButton(R.string.other_folder) { dialogInterface, i -> showOtherFolder() }
}
dialog = builder.create().apply {
activity.setupDialogStuff(view, this, R.string.select_destination) {
view.directories_show_hidden.beVisibleIf(!context.config.shouldShowHidden)
view.directories_show_hidden.setOnClickListener {

View file

@ -53,7 +53,7 @@ class PickMediumDialog(val activity: BaseSimpleActivity, val path: String, val c
}
private fun showOtherFolder() {
PickDirectoryDialog(activity, path) {
PickDirectoryDialog(activity, path, true) {
callback(it)
dialog.dismiss()
}

View file

@ -183,7 +183,7 @@ fun BaseSimpleActivity.tryCopyMoveFilesTo(fileDirItems: ArrayList<FileDirItem>,
}
val source = fileDirItems[0].getParentPath()
PickDirectoryDialog(this, source) {
PickDirectoryDialog(this, source, true) {
copyMoveFilesTo(fileDirItems, source.trimEnd('/'), it, isCopyOperation, true, config.shouldShowHidden, callback)
}
}