mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-02-20 21:30:59 +01:00
add a prompt for deleting note
This commit is contained in:
parent
642feedd48
commit
6ee62f46d8
@ -1,6 +1,7 @@
|
||||
package com.simplemobiletools.notes.activities;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Bundle;
|
||||
@ -78,7 +79,7 @@ public class MainActivity extends SimpleActivity {
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.delete_note:
|
||||
deleteNote();
|
||||
displayDeleteNotePrompt();
|
||||
return true;
|
||||
case R.id.open_note:
|
||||
displayOpenNoteDialog();
|
||||
@ -127,6 +128,21 @@ public class MainActivity extends SimpleActivity {
|
||||
});
|
||||
}
|
||||
|
||||
private void displayDeleteNotePrompt() {
|
||||
final Resources res = getResources();
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle(res.getString(R.string.delete_note_prompt_title));
|
||||
builder.setMessage(String.format(res.getString(R.string.delete_note_prompt_message), mCurrentNote.getTitle()));
|
||||
builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
deleteNote();
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(R.string.cancel, null);
|
||||
builder.show();
|
||||
}
|
||||
|
||||
private void deleteNote() {
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,8 @@
|
||||
<string name="title_taken">A note with that title already exists</string>
|
||||
<string name="open_note">Open note</string>
|
||||
<string name="delete_note">Delete note</string>
|
||||
<string name="delete_note_prompt_title">Delete note</string>
|
||||
<string name="delete_note_prompt_message">Are you sure you want to delete note \"%1$s\"?</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="settings">Einstellungen</string>
|
||||
|
@ -15,6 +15,8 @@
|
||||
<string name="title_taken">A note with that title already exists</string>
|
||||
<string name="open_note">Open note</string>
|
||||
<string name="delete_note">Delete note</string>
|
||||
<string name="delete_note_prompt_title">Delete note</string>
|
||||
<string name="delete_note_prompt_message">Are you sure you want to delete note \"%1$s\"?</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="settings">Impostazioni</string>
|
||||
|
@ -15,6 +15,8 @@
|
||||
<string name="title_taken">A note with that title already exists</string>
|
||||
<string name="open_note">Open note</string>
|
||||
<string name="delete_note">Delete note</string>
|
||||
<string name="delete_note_prompt_title">Delete note</string>
|
||||
<string name="delete_note_prompt_message">Are you sure you want to delete note \"%1$s\"?</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="settings">設定</string>
|
||||
|
@ -15,6 +15,8 @@
|
||||
<string name="title_taken">A note with that title already exists</string>
|
||||
<string name="open_note">Open note</string>
|
||||
<string name="delete_note">Delete note</string>
|
||||
<string name="delete_note_prompt_title">Delete note</string>
|
||||
<string name="delete_note_prompt_message">Are you sure you want to delete note \"%1$s\"?</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="settings">Inställningar</string>
|
||||
|
@ -15,6 +15,8 @@
|
||||
<string name="title_taken">A note with that title already exists</string>
|
||||
<string name="open_note">Open note</string>
|
||||
<string name="delete_note">Delete note</string>
|
||||
<string name="delete_note_prompt_title">Delete note</string>
|
||||
<string name="delete_note_prompt_message">Are you sure you want to delete note \"%1$s\"?</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="settings">Settings</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user