make sure dialogs are cancellable by clicking outside

This commit is contained in:
tibbi 2016-12-04 10:27:53 +01:00
parent 49247ee9f1
commit b0f3ac99a4
6 changed files with 9 additions and 2 deletions

View file

@ -20,13 +20,15 @@ class ChangeSortingDialog(val activity: Activity, val isDirectorySorting: Boolea
config = Config.newInstance(activity) config = Config.newInstance(activity)
view = LayoutInflater.from(activity).inflate(R.layout.dialog_change_sorting, null) view = LayoutInflater.from(activity).inflate(R.layout.dialog_change_sorting, null)
AlertDialog.Builder(activity) val dialog = AlertDialog.Builder(activity)
.setTitle(activity.resources.getString(R.string.sort_by)) .setTitle(activity.resources.getString(R.string.sort_by))
.setView(view) .setView(view)
.setPositiveButton(R.string.ok, this) .setPositiveButton(R.string.ok, this)
.setNegativeButton(R.string.cancel, null) .setNegativeButton(R.string.cancel, null)
.create() .create()
.show()
dialog.setCanceledOnTouchOutside(true)
dialog.show()
currSorting = if (isDirectorySorting) config.directorySorting else config.sorting currSorting = if (isDirectorySorting) config.directorySorting else config.sorting
setupSortRadio() setupSortRadio()

View file

@ -39,6 +39,7 @@ class CopyDialog(val activity: SimpleActivity, val files: ArrayList<File>, val c
.setNegativeButton(R.string.cancel, null) .setNegativeButton(R.string.cancel, null)
.create().apply { .create().apply {
window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
setCanceledOnTouchOutside(true)
show() show()
getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener({ getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener({
if (destinationPath == context.resources.getString(R.string.select_destination) || destinationPath.isEmpty()) { if (destinationPath == context.resources.getString(R.string.select_destination) || destinationPath.isEmpty()) {

View file

@ -25,6 +25,7 @@ class PickAlbumDialog(val activity: SimpleActivity, val callback: (path: String)
.setNegativeButton(R.string.cancel, null) .setNegativeButton(R.string.cancel, null)
.create() .create()
dialog.setCanceledOnTouchOutside(true)
dialog.show() dialog.show()
GetDirectoriesAsynctask(activity, false, false, ArrayList<String>()) { GetDirectoriesAsynctask(activity, false, false, ArrayList<String>()) {
val adapter = DirectoryAdapter(activity, it, null) { val adapter = DirectoryAdapter(activity, it, null) {

View file

@ -25,6 +25,7 @@ class RenameDirectoryDialog(val activity: SimpleActivity, val dir: File, val cal
.setNegativeButton(R.string.cancel, null) .setNegativeButton(R.string.cancel, null)
.create().apply { .create().apply {
window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
setCanceledOnTouchOutside(true)
show() show()
getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener({ getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener({
val newDirName = view.directory_name.value val newDirName = view.directory_name.value

View file

@ -34,6 +34,7 @@ class RenameFileDialog(val activity: SimpleActivity, val file: File, val callbac
.setNegativeButton(R.string.cancel, null) .setNegativeButton(R.string.cancel, null)
.create().apply { .create().apply {
window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
setCanceledOnTouchOutside(true)
show() show()
getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener({ getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener({
val fileName = view.file_name.value val fileName = view.file_name.value

View file

@ -24,6 +24,7 @@ class SaveAsDialog(val activity: Activity, val path: String, val callback: (file
.setNegativeButton(R.string.cancel, null) .setNegativeButton(R.string.cancel, null)
.create().apply { .create().apply {
window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
setCanceledOnTouchOutside(true)
show() show()
getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener({ getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener({
val filename = view.file_name.value val filename = view.file_name.value