close the resolution picker dialog after changing a resolution

This commit is contained in:
tibbi 2017-03-21 23:05:23 +01:00
parent 0fe47acc4e
commit af72725ad7
1 changed files with 5 additions and 1 deletions

View File

@ -13,13 +13,15 @@ import com.simplemobiletools.commons.models.RadioItem
import kotlinx.android.synthetic.main.dialog_change_resolution.view.* import kotlinx.android.synthetic.main.dialog_change_resolution.view.*
class ChangeResolutionDialog(val activity: SimpleActivity, val isBackCamera: Boolean, val camera: Camera, val callback: () -> Unit) { class ChangeResolutionDialog(val activity: SimpleActivity, val isBackCamera: Boolean, val camera: Camera, val callback: () -> Unit) {
var dialog: AlertDialog
init { init {
val view = LayoutInflater.from(activity).inflate(R.layout.dialog_change_resolution, null).apply { val view = LayoutInflater.from(activity).inflate(R.layout.dialog_change_resolution, null).apply {
setupPhotoResolutionPicker(this) setupPhotoResolutionPicker(this)
setupVideoResolutionPicker(this) setupVideoResolutionPicker(this)
} }
AlertDialog.Builder(activity) dialog = AlertDialog.Builder(activity)
.setPositiveButton(R.string.ok, null) .setPositiveButton(R.string.ok, null)
.setOnDismissListener { callback() } .setOnDismissListener { callback() }
.create().apply { .create().apply {
@ -39,6 +41,7 @@ class ChangeResolutionDialog(val activity: SimpleActivity, val isBackCamera: Boo
config.backPhotoResIndex = it config.backPhotoResIndex = it
else else
config.frontPhotoResIndex = it config.frontPhotoResIndex = it
dialog.dismiss()
} }
} }
view.change_resolution_photo.text = items[selectionIndex].title view.change_resolution_photo.text = items[selectionIndex].title
@ -56,6 +59,7 @@ class ChangeResolutionDialog(val activity: SimpleActivity, val isBackCamera: Boo
config.backVideoResIndex = it config.backVideoResIndex = it
else else
config.frontVideoResIndex = it config.frontVideoResIndex = it
dialog.dismiss()
} }
} }
view.change_resolution_video.text = items[selectionIndex].title view.change_resolution_video.text = items[selectionIndex].title