mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-04-19 17:57:27 +02: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;
|
package com.simplemobiletools.notes.activities;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -78,7 +79,7 @@ public class MainActivity extends SimpleActivity {
|
|||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
case R.id.delete_note:
|
case R.id.delete_note:
|
||||||
deleteNote();
|
displayDeleteNotePrompt();
|
||||||
return true;
|
return true;
|
||||||
case R.id.open_note:
|
case R.id.open_note:
|
||||||
displayOpenNoteDialog();
|
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() {
|
private void deleteNote() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
<string name="title_taken">A note with that title already exists</string>
|
<string name="title_taken">A note with that title already exists</string>
|
||||||
<string name="open_note">Open note</string>
|
<string name="open_note">Open note</string>
|
||||||
<string name="delete_note">Delete 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 -->
|
<!-- Settings -->
|
||||||
<string name="settings">Einstellungen</string>
|
<string name="settings">Einstellungen</string>
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
<string name="title_taken">A note with that title already exists</string>
|
<string name="title_taken">A note with that title already exists</string>
|
||||||
<string name="open_note">Open note</string>
|
<string name="open_note">Open note</string>
|
||||||
<string name="delete_note">Delete 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 -->
|
<!-- Settings -->
|
||||||
<string name="settings">Impostazioni</string>
|
<string name="settings">Impostazioni</string>
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
<string name="title_taken">A note with that title already exists</string>
|
<string name="title_taken">A note with that title already exists</string>
|
||||||
<string name="open_note">Open note</string>
|
<string name="open_note">Open note</string>
|
||||||
<string name="delete_note">Delete 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 -->
|
<!-- Settings -->
|
||||||
<string name="settings">設定</string>
|
<string name="settings">設定</string>
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
<string name="title_taken">A note with that title already exists</string>
|
<string name="title_taken">A note with that title already exists</string>
|
||||||
<string name="open_note">Open note</string>
|
<string name="open_note">Open note</string>
|
||||||
<string name="delete_note">Delete 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 -->
|
<!-- Settings -->
|
||||||
<string name="settings">Inställningar</string>
|
<string name="settings">Inställningar</string>
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
<string name="title_taken">A note with that title already exists</string>
|
<string name="title_taken">A note with that title already exists</string>
|
||||||
<string name="open_note">Open note</string>
|
<string name="open_note">Open note</string>
|
||||||
<string name="delete_note">Delete 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 -->
|
<!-- Settings -->
|
||||||
<string name="settings">Settings</string>
|
<string name="settings">Settings</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user