hide the Other Folder button at the widget folder picker
This commit is contained in:
parent
abb0a69f7a
commit
5f10bebb19
4 changed files with 20 additions and 16 deletions
|
@ -128,7 +128,7 @@ class WidgetConfigureActivity : SimpleActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun changeSelectedFolder() {
|
private fun changeSelectedFolder() {
|
||||||
PickDirectoryDialog(this, mFolderPath) {
|
PickDirectoryDialog(this, mFolderPath, false) {
|
||||||
updateFolderImage(it)
|
updateFolderImage(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ import com.simplemobiletools.gallery.pro.helpers.VIEW_TYPE_GRID
|
||||||
import com.simplemobiletools.gallery.pro.models.Directory
|
import com.simplemobiletools.gallery.pro.models.Directory
|
||||||
import kotlinx.android.synthetic.main.dialog_directory_picker.view.*
|
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 dialog: AlertDialog
|
||||||
var shownDirectories = ArrayList<Directory>()
|
var shownDirectories = ArrayList<Directory>()
|
||||||
var view = activity.layoutInflater.inflate(R.layout.dialog_directory_picker, null)
|
var view = activity.layoutInflater.inflate(R.layout.dialog_directory_picker, null)
|
||||||
|
@ -29,22 +29,26 @@ class PickDirectoryDialog(val activity: BaseSimpleActivity, val sourcePath: Stri
|
||||||
spanCount = if (isGridViewType) activity.config.dirColumnCnt else 1
|
spanCount = if (isGridViewType) activity.config.dirColumnCnt else 1
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog = AlertDialog.Builder(activity)
|
val builder = AlertDialog.Builder(activity)
|
||||||
.setPositiveButton(R.string.ok, null)
|
.setPositiveButton(R.string.ok, null)
|
||||||
.setNegativeButton(R.string.cancel, null)
|
.setNegativeButton(R.string.cancel, null)
|
||||||
.setNeutralButton(R.string.other_folder) { dialogInterface, i -> showOtherFolder() }
|
|
||||||
.create().apply {
|
if (showOtherFolderButton) {
|
||||||
activity.setupDialogStuff(view, this, R.string.select_destination) {
|
builder.setNeutralButton(R.string.other_folder) { dialogInterface, i -> showOtherFolder() }
|
||||||
view.directories_show_hidden.beVisibleIf(!context.config.shouldShowHidden)
|
}
|
||||||
view.directories_show_hidden.setOnClickListener {
|
|
||||||
activity.handleHiddenFolderPasswordProtection {
|
dialog = builder.create().apply {
|
||||||
view.directories_show_hidden.beGone()
|
activity.setupDialogStuff(view, this, R.string.select_destination) {
|
||||||
showHidden = true
|
view.directories_show_hidden.beVisibleIf(!context.config.shouldShowHidden)
|
||||||
fetchDirectories(true)
|
view.directories_show_hidden.setOnClickListener {
|
||||||
}
|
activity.handleHiddenFolderPasswordProtection {
|
||||||
}
|
view.directories_show_hidden.beGone()
|
||||||
|
showHidden = true
|
||||||
|
fetchDirectories(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fetchDirectories(false)
|
fetchDirectories(false)
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ class PickMediumDialog(val activity: BaseSimpleActivity, val path: String, val c
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showOtherFolder() {
|
private fun showOtherFolder() {
|
||||||
PickDirectoryDialog(activity, path) {
|
PickDirectoryDialog(activity, path, true) {
|
||||||
callback(it)
|
callback(it)
|
||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
}
|
}
|
||||||
|
|
|
@ -183,7 +183,7 @@ fun BaseSimpleActivity.tryCopyMoveFilesTo(fileDirItems: ArrayList<FileDirItem>,
|
||||||
}
|
}
|
||||||
|
|
||||||
val source = fileDirItems[0].getParentPath()
|
val source = fileDirItems[0].getParentPath()
|
||||||
PickDirectoryDialog(this, source) {
|
PickDirectoryDialog(this, source, true) {
|
||||||
copyMoveFilesTo(fileDirItems, source.trimEnd('/'), it, isCopyOperation, true, config.shouldShowHidden, callback)
|
copyMoveFilesTo(fileDirItems, source.trimEnd('/'), it, isCopyOperation, true, config.shouldShowHidden, callback)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue