added clear history dialog (no funcionality)
This commit is contained in:
parent
e711da7248
commit
4a36abf30f
18
res/layout/dialog_clear_history.xml
Normal file
18
res/layout/dialog_clear_history.xml
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="8dp">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/clear_histor_msg"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:paddingBottom="8dp"/>
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/end_conversation_checkbox"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/also_end_conversation"/>
|
||||||
|
</LinearLayout>
|
|
@ -43,7 +43,11 @@
|
||||||
android:orderInCategory="50"
|
android:orderInCategory="50"
|
||||||
android:showAsAction="never"
|
android:showAsAction="never"
|
||||||
android:title="@string/action_end_conversation"/>
|
android:title="@string/action_end_conversation"/>
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_clear_history"
|
||||||
|
android:orderInCategory="60"
|
||||||
|
android:showAsAction="never"
|
||||||
|
android:title="@string/action_clear_history"/>
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_accounts"
|
android:id="@+id/action_accounts"
|
||||||
android:orderInCategory="90"
|
android:orderInCategory="90"
|
||||||
|
|
|
@ -54,4 +54,9 @@
|
||||||
<string name="send_rejected">rejected</string>
|
<string name="send_rejected">rejected</string>
|
||||||
<string name="receiving_image">Receiving image file. Please wait…</string>
|
<string name="receiving_image">Receiving image file. Please wait…</string>
|
||||||
<string name="preparing_image">Preparing image for transmission. Please wait…</string>
|
<string name="preparing_image">Preparing image for transmission. Please wait…</string>
|
||||||
|
<string name="action_clear_history">Clear history</string>
|
||||||
|
<string name="clear_conversation_history">Clear Conversation history</string>
|
||||||
|
<string name="clear_histor_msg">Do you want to delete all messages within this Conversation?\n\n<b>Warning:</b> This will not influence messages stored on other devices or servers.</string>
|
||||||
|
<string name="delete_messages">Delete messages</string>
|
||||||
|
<string name="also_end_conversation">End this conversations afterwards</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -14,9 +14,11 @@ import eu.siacs.conversations.utils.UIHelper;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
|
import android.app.AlertDialog.Builder;
|
||||||
import android.app.FragmentTransaction;
|
import android.app.FragmentTransaction;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
|
import android.content.DialogInterface.OnClickListener;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
|
@ -239,6 +241,7 @@ public class ConversationActivity extends XmppActivity {
|
||||||
MenuItem menuInviteContacts = (MenuItem) menu
|
MenuItem menuInviteContacts = (MenuItem) menu
|
||||||
.findItem(R.id.action_invite);
|
.findItem(R.id.action_invite);
|
||||||
MenuItem menuAttach = (MenuItem) menu.findItem(R.id.action_attach_file);
|
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()))) {
|
if ((spl.isOpen() && (spl.isSlideable()))) {
|
||||||
menuArchive.setVisible(false);
|
menuArchive.setVisible(false);
|
||||||
|
@ -247,21 +250,18 @@ public class ConversationActivity extends XmppActivity {
|
||||||
menuSecure.setVisible(false);
|
menuSecure.setVisible(false);
|
||||||
menuInviteContacts.setVisible(false);
|
menuInviteContacts.setVisible(false);
|
||||||
menuAttach.setVisible(false);
|
menuAttach.setVisible(false);
|
||||||
|
menuClearHistory.setVisible(false);
|
||||||
} else {
|
} else {
|
||||||
((MenuItem) menu.findItem(R.id.action_add)).setVisible(!spl
|
((MenuItem) menu.findItem(R.id.action_add)).setVisible(!spl
|
||||||
.isSlideable());
|
.isSlideable());
|
||||||
if (this.getSelectedConversation() != null) {
|
if (this.getSelectedConversation() != null) {
|
||||||
if (this.getSelectedConversation().getMode() == Conversation.MODE_MULTI) {
|
if (this.getSelectedConversation().getMode() == Conversation.MODE_MULTI) {
|
||||||
menuMucDetails.setVisible(true);
|
|
||||||
menuContactDetails.setVisible(false);
|
menuContactDetails.setVisible(false);
|
||||||
menuSecure.setVisible(false);
|
menuSecure.setVisible(false);
|
||||||
menuInviteContacts.setVisible(true);
|
|
||||||
menuAttach.setVisible(false);
|
menuAttach.setVisible(false);
|
||||||
} else {
|
} else {
|
||||||
menuContactDetails.setVisible(true);
|
|
||||||
menuMucDetails.setVisible(false);
|
menuMucDetails.setVisible(false);
|
||||||
menuInviteContacts.setVisible(false);
|
menuInviteContacts.setVisible(false);
|
||||||
menuAttach.setVisible(true);
|
|
||||||
if (this.getSelectedConversation().getLatestMessage()
|
if (this.getSelectedConversation().getLatestMessage()
|
||||||
.getEncryption() != Message.ENCRYPTION_NONE) {
|
.getEncryption() != Message.ENCRYPTION_NONE) {
|
||||||
menuSecure.setIcon(R.drawable.ic_action_secure);
|
menuSecure.setIcon(R.drawable.ic_action_secure);
|
||||||
|
@ -390,6 +390,9 @@ public class ConversationActivity extends XmppActivity {
|
||||||
popup.show();
|
popup.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case R.id.action_clear_history:
|
||||||
|
clearHistoryDialog(getSelectedConversation());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -397,6 +400,23 @@ public class ConversationActivity extends XmppActivity {
|
||||||
return super.onOptionsItemSelected(item);
|
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() {
|
protected ConversationFragment swapConversationFragment() {
|
||||||
ConversationFragment selectedFragment = new ConversationFragment();
|
ConversationFragment selectedFragment = new ConversationFragment();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue