From 4a36abf30fb2d59934d5bfd121542fa82f5c98ce Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Wed, 16 Apr 2014 18:16:23 +0200 Subject: [PATCH] added clear history dialog (no funcionality) --- res/layout/dialog_clear_history.xml | 18 ++++++++++++ res/menu/conversations.xml | 6 +++- res/values/strings.xml | 5 ++++ .../ui/ConversationActivity.java | 28 ++++++++++++++++--- 4 files changed, 52 insertions(+), 5 deletions(-) create mode 100644 res/layout/dialog_clear_history.xml diff --git a/res/layout/dialog_clear_history.xml b/res/layout/dialog_clear_history.xml new file mode 100644 index 000000000..789bbae9b --- /dev/null +++ b/res/layout/dialog_clear_history.xml @@ -0,0 +1,18 @@ + + + + + diff --git a/res/menu/conversations.xml b/res/menu/conversations.xml index 3dfc12ddb..b6e82c406 100644 --- a/res/menu/conversations.xml +++ b/res/menu/conversations.xml @@ -43,7 +43,11 @@ android:orderInCategory="50" android:showAsAction="never" android:title="@string/action_end_conversation"/> - + rejected Receiving image file. Please wait… Preparing image for transmission. Please wait… + Clear history + Clear Conversation history + Do you want to delete all messages within this Conversation?\n\nWarning: This will not influence messages stored on other devices or servers. + Delete messages + End this conversations afterwards diff --git a/src/eu/siacs/conversations/ui/ConversationActivity.java b/src/eu/siacs/conversations/ui/ConversationActivity.java index 6ce31302e..9b908138f 100644 --- a/src/eu/siacs/conversations/ui/ConversationActivity.java +++ b/src/eu/siacs/conversations/ui/ConversationActivity.java @@ -14,9 +14,11 @@ import eu.siacs.conversations.utils.UIHelper; import android.os.Bundle; import android.preference.PreferenceManager; import android.app.AlertDialog; +import android.app.AlertDialog.Builder; import android.app.FragmentTransaction; import android.content.Context; import android.content.DialogInterface; +import android.content.DialogInterface.OnClickListener; import android.content.Intent; import android.content.SharedPreferences; import android.graphics.Color; @@ -239,6 +241,7 @@ public class ConversationActivity extends XmppActivity { MenuItem menuInviteContacts = (MenuItem) menu .findItem(R.id.action_invite); MenuItem menuAttach = (MenuItem) menu.findItem(R.id.action_attach_file); + MenuItem menuClearHistory = (MenuItem) menu.findItem(R.id.action_clear_history); if ((spl.isOpen() && (spl.isSlideable()))) { menuArchive.setVisible(false); @@ -247,21 +250,18 @@ public class ConversationActivity extends XmppActivity { menuSecure.setVisible(false); menuInviteContacts.setVisible(false); menuAttach.setVisible(false); + menuClearHistory.setVisible(false); } else { ((MenuItem) menu.findItem(R.id.action_add)).setVisible(!spl .isSlideable()); if (this.getSelectedConversation() != null) { if (this.getSelectedConversation().getMode() == Conversation.MODE_MULTI) { - menuMucDetails.setVisible(true); menuContactDetails.setVisible(false); menuSecure.setVisible(false); - menuInviteContacts.setVisible(true); menuAttach.setVisible(false); } else { - menuContactDetails.setVisible(true); menuMucDetails.setVisible(false); menuInviteContacts.setVisible(false); - menuAttach.setVisible(true); if (this.getSelectedConversation().getLatestMessage() .getEncryption() != Message.ENCRYPTION_NONE) { menuSecure.setIcon(R.drawable.ic_action_secure); @@ -390,12 +390,32 @@ public class ConversationActivity extends XmppActivity { popup.show(); } + break; + case R.id.action_clear_history: + clearHistoryDialog(getSelectedConversation()); break; default: break; } return super.onOptionsItemSelected(item); } + + protected void clearHistoryDialog(Conversation conversation) { + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setTitle(getString(R.string.clear_conversation_history)); + View dialogView = getLayoutInflater().inflate(R.layout.dialog_clear_history, null); + builder.setView(dialogView); + builder.setNegativeButton(getString(R.string.cancel), null); + builder.setPositiveButton(getString(R.string.delete_messages), new OnClickListener() { + + @Override + public void onClick(DialogInterface dialog, int which) { + // TODO Auto-generated method stub + + } + }); + builder.create().show(); + } protected ConversationFragment swapConversationFragment() { ConversationFragment selectedFragment = new ConversationFragment();