aboutsummaryrefslogtreecommitdiffstats
path: root/src/de/gultsch/chat/ui
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/de/gultsch/chat/ui/ConversationActivity.java7
-rw-r--r--src/de/gultsch/chat/ui/ConversationFragment.java8
-rw-r--r--src/de/gultsch/chat/ui/DialogContactDetails.java82
-rw-r--r--src/de/gultsch/chat/ui/NewConversationActivity.java13
4 files changed, 105 insertions, 5 deletions
diff --git a/src/de/gultsch/chat/ui/ConversationActivity.java b/src/de/gultsch/chat/ui/ConversationActivity.java
index 7e4cd34d..37a988fb 100644
--- a/src/de/gultsch/chat/ui/ConversationActivity.java
+++ b/src/de/gultsch/chat/ui/ConversationActivity.java
@@ -7,6 +7,7 @@ import java.util.List;
import de.gultsch.chat.R;
import de.gultsch.chat.R.id;
+import de.gultsch.chat.entities.Contact;
import de.gultsch.chat.entities.Conversation;
import de.gultsch.chat.utils.UIHelper;
import android.net.Uri;
@@ -257,6 +258,12 @@ public class ConversationActivity extends XmppActivity {
xmppConnectionService.archiveConversation(conv);
selectedConversation = conversationList.get(0);
break;
+ case R.id.action_details:
+ DialogContactDetails details = new DialogContactDetails();
+ Contact contact = xmppConnectionService.findOrCreateContact(this.getSelectedConversation().getAccount(),this.getSelectedConversation().getContactJid());
+ details.setContact(contact);
+ details.show(getFragmentManager(), "details");
+ break;
default:
break;
}
diff --git a/src/de/gultsch/chat/ui/ConversationFragment.java b/src/de/gultsch/chat/ui/ConversationFragment.java
index 319c3a31..2da0940b 100644
--- a/src/de/gultsch/chat/ui/ConversationFragment.java
+++ b/src/de/gultsch/chat/ui/ConversationFragment.java
@@ -59,7 +59,9 @@ public class ConversationFragment extends Fragment {
conversation.getMessages().add(message);
chatMsg.setText("");
- messageList.add(message);
+ if (conversation.getMode()==Conversation.MODE_SINGLE) {
+ messageList.add(message);
+ }
activity.updateConversationList();
@@ -155,9 +157,6 @@ public class ConversationFragment extends Fragment {
@Override
public void onStart() {
super.onStart();
-
- Log.d("gultsch","conversationfragment onStart");
-
final ConversationActivity activity = (ConversationActivity) getActivity();
if (activity.xmppConnectionServiceBound) {
@@ -174,7 +173,6 @@ public class ConversationFragment extends Fragment {
}
public void onBackendConnected() {
- Log.d("gultsch","calling on backend connected in conversation fragment");
final ConversationActivity activity = (ConversationActivity) getActivity();
this.conversation = activity.getSelectedConversation();
updateMessages();
diff --git a/src/de/gultsch/chat/ui/DialogContactDetails.java b/src/de/gultsch/chat/ui/DialogContactDetails.java
new file mode 100644
index 00000000..7af8db70
--- /dev/null
+++ b/src/de/gultsch/chat/ui/DialogContactDetails.java
@@ -0,0 +1,82 @@
+package de.gultsch.chat.ui;
+
+import de.gultsch.chat.R;
+import de.gultsch.chat.entities.Contact;
+import de.gultsch.chat.entities.Presences;
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.app.DialogFragment;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.CheckBox;
+import android.widget.TextView;
+
+public class DialogContactDetails extends DialogFragment {
+
+ private Contact contact = null;
+ boolean displayingInRoster = false;
+
+ public void setContact(Contact contact) {
+ this.contact = contact;
+ }
+
+ @Override
+ public Dialog onCreateDialog(Bundle savedInstanceState) {
+ final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
+ LayoutInflater inflater = getActivity().getLayoutInflater();
+ View view = inflater.inflate(R.layout.dialog_contact_details, null);
+ TextView contactJid = (TextView) view.findViewById(R.id.details_contact_jid);
+ TextView accountJid = (TextView) view.findViewById(R.id.details_account);
+ TextView status = (TextView) view.findViewById(R.id.details_contact_status);
+ CheckBox send = (CheckBox) view.findViewById(R.id.details_send_presence);
+ CheckBox receive = (CheckBox) view.findViewById(R.id.details_receive_presence);
+
+ boolean subscriptionSend = false;
+ boolean subscriptionReceive = false;
+ if (contact.getSubscription().equals("both")) {
+ subscriptionReceive = true;
+ subscriptionSend = true;
+ } else if (contact.getSubscription().equals("from")) {
+ subscriptionSend = true;
+ } else if (contact.getSubscription().equals("to")) {
+ subscriptionReceive = true;
+ }
+
+ switch (contact.getMostAvailableStatus()) {
+ case Presences.CHAT:
+ status.setText("free to chat");
+ break;
+ case Presences.ONLINE:
+ status.setText("online");
+ break;
+ case Presences.AWAY:
+ status.setText("away");
+ break;
+ case Presences.XA:
+ status.setText("extended away");
+ break;
+ case Presences.DND:
+ status.setText("do not disturb");
+ break;
+ case Presences.OFFLINE:
+ status.setText("offline");
+ break;
+ default:
+ status.setText("offline");
+ break;
+ }
+
+ send.setChecked(subscriptionSend);
+ receive.setChecked(subscriptionReceive);
+ contactJid.setText(contact.getJid());
+ accountJid.setText(contact.getAccount().getJid());
+
+ builder.setView(view);
+ builder.setTitle(contact.getDisplayName());
+
+ builder.setNeutralButton("Done", null);
+ builder.setPositiveButton("Remove from roster", null);
+ return builder.create();
+ }
+}
diff --git a/src/de/gultsch/chat/ui/NewConversationActivity.java b/src/de/gultsch/chat/ui/NewConversationActivity.java
index c5f9695e..4e2628a6 100644
--- a/src/de/gultsch/chat/ui/NewConversationActivity.java
+++ b/src/de/gultsch/chat/ui/NewConversationActivity.java
@@ -24,6 +24,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
+import android.widget.AdapterView.OnItemLongClickListener;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ListView;
@@ -185,6 +186,18 @@ public class NewConversationActivity extends XmppActivity {
}
}
});
+ contactsView.setOnItemLongClickListener(new OnItemLongClickListener() {
+
+ @Override
+ public boolean onItemLongClick(AdapterView<?> arg0, View arg1,
+ int pos, long arg3) {
+ Contact clickedContact = aggregatedContacts.get(pos);
+ DialogContactDetails dialog = new DialogContactDetails();
+ dialog.setContact(clickedContact);
+ dialog.show(getFragmentManager(), "details");
+ return true;
+ }
+ });
}
public void showIsMucDialogIfNeeded(final Contact clickedContact) {