From 092481bb7469aa75ec0b9571e1e5e6fc2b86f201 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 21 Nov 2016 20:49:36 +0100 Subject: [PATCH] use the filepickers ConfirmationDialog before deleting --- .../notes/activities/MainActivity.kt | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/notes/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/notes/activities/MainActivity.kt index f8900915..0bbbeb3f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/notes/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/notes/activities/MainActivity.kt @@ -5,12 +5,12 @@ import android.content.ComponentName import android.content.Context import android.content.Intent import android.os.Bundle -import android.support.v7.app.AlertDialog import android.util.TypedValue import android.view.Menu import android.view.MenuItem import android.view.View import android.view.inputmethod.InputMethodManager +import com.simplemobiletools.filepicker.dialogs.ConfirmationDialog import com.simplemobiletools.filepicker.extensions.toast import com.simplemobiletools.filepicker.extensions.value import com.simplemobiletools.notes.MyWidgetProvider @@ -140,13 +140,9 @@ class MainActivity : SimpleActivity(), OpenNoteDialog.OpenNoteListener { } private fun displayDeleteNotePrompt() { - val res = resources - AlertDialog.Builder(this).apply { - setTitle(res.getString(R.string.delete_note_prompt_title)) - setMessage(String.format(res.getString(R.string.delete_note_prompt_message), mCurrentNote!!.title)) - setPositiveButton(R.string.ok) { dialog, which -> deleteNote() } - setNegativeButton(R.string.cancel, null) - show() + val message = String.format(getString(R.string.delete_note_prompt_message), mCurrentNote!!.title) + ConfirmationDialog(this, message) { + deleteNote() } }