aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/ui/ConversationActivity.java11
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/ui/listeners/AvatarLogoOnClickListener.java75
2 files changed, 82 insertions, 4 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/ConversationActivity.java b/src/main/java/de/thedevstack/conversationsplus/ui/ConversationActivity.java
index 71db3e3a..af8eeea1 100644
--- a/src/main/java/de/thedevstack/conversationsplus/ui/ConversationActivity.java
+++ b/src/main/java/de/thedevstack/conversationsplus/ui/ConversationActivity.java
@@ -51,6 +51,7 @@ import de.thedevstack.android.logcat.Logging;
import de.thedevstack.conversationsplus.ConversationsPlusPreferences;
import de.thedevstack.conversationsplus.services.AvatarService;
import de.thedevstack.conversationsplus.ui.dialogs.UserDecisionDialog;
+import de.thedevstack.conversationsplus.ui.listeners.AvatarLogoOnClickListener;
import de.thedevstack.conversationsplus.ui.listeners.AvatarLogoPositioningListener;
import de.thedevstack.conversationsplus.ui.listeners.ResizePictureUserDecisionListener;
import de.thedevstack.conversationsplus.utils.ConversationUtil;
@@ -417,10 +418,12 @@ public class ConversationActivity extends XmppActivity
}
private void showLogoAvatar() {
- ImageView avatarView = (ImageView) this.avatarLogoView.findViewById(R.id.logoViewAvatar);
- avatarView.setImageBitmap(AvatarService.getInstance().getCircled(getSelectedConversation(), getPixel(56)));
- //avatarView.setAlpha(0.5f);
- avatarLogoView.setVisibility(View.VISIBLE);
+ if (null != this.avatarLogoView) {
+ ImageView avatarView = (ImageView) this.avatarLogoView.findViewById(R.id.logoViewAvatar);
+ avatarView.setImageBitmap(AvatarService.getInstance().getCircled(getSelectedConversation(), getPixel(56)));
+ avatarLogoView.setVisibility(View.VISIBLE);
+ avatarView.setOnClickListener(new AvatarLogoOnClickListener(getSelectedConversation()));
+ }
}
private void openConversation() {
diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/listeners/AvatarLogoOnClickListener.java b/src/main/java/de/thedevstack/conversationsplus/ui/listeners/AvatarLogoOnClickListener.java
new file mode 100644
index 00000000..7951a8ec
--- /dev/null
+++ b/src/main/java/de/thedevstack/conversationsplus/ui/listeners/AvatarLogoOnClickListener.java
@@ -0,0 +1,75 @@
+package de.thedevstack.conversationsplus.ui.listeners;
+
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewGroup;
+
+import de.thedevstack.conversationsplus.entities.Contact;
+import de.thedevstack.conversationsplus.entities.Conversation;
+import de.thedevstack.conversationsplus.ui.ConferenceDetailsActivity;
+import de.thedevstack.conversationsplus.ui.ContactDetailsActivity;
+import de.thedevstack.conversationsplus.ui.XmppActivity;
+
+/**
+ * This listener opens on click
+ * <ul>
+ * <li>the conference details activity if the conversation is a MUC conversation</li>
+ * <li>the contact details activity if the conversation is a One-To-One conversation</li>
+ * </ul>
+ */
+public class AvatarLogoOnClickListener implements View.OnClickListener {
+ private final Conversation conversation;
+
+ /**
+ * Initializes the on click listener for a conversation.
+ * @param conversation the conversation to be used
+ */
+ public AvatarLogoOnClickListener(Conversation conversation) {
+ this.conversation = conversation;
+ }
+
+ /**
+ * Called when a view has been clicked.
+ *
+ * @param v The view that was clicked.
+ */
+ @Override
+ public void onClick(View v) {
+ if (this.conversation.getMode() == Conversation.MODE_MULTI) {
+ this.openConferenceDetails(v.getContext());
+ } else {
+ this.openContactDetails(v.getContext());
+ }
+ }
+
+ /**
+ * Opens the conference details activity.
+ * @see de.thedevstack.conversationsplus.ui.ConversationFragment#onCreateView(LayoutInflater, ViewGroup, Bundle)
+ * @param context the context to start the activity from.
+ */
+ private void openConferenceDetails(Context context) {
+ Intent intent = new Intent(context, ConferenceDetailsActivity.class);
+ intent.setAction(ConferenceDetailsActivity.ACTION_VIEW_MUC);
+ intent.putExtra("uuid", this.conversation.getUuid());
+ context.startActivity(intent);
+ }
+
+ /**
+ * Opens the contact details activity.
+ * @param context the context to start the activity from.
+ * @see de.thedevstack.conversationsplus.ui.ConversationActivity#onOptionsItemSelected(MenuItem)
+ */
+ public void openContactDetails(Context context) {
+ Contact contact = this.conversation.getContact();
+ Intent intent = new Intent(context, ContactDetailsActivity.class);
+ intent.setAction(ContactDetailsActivity.ACTION_VIEW_CONTACT);
+ intent.putExtra(XmppActivity.EXTRA_ACCOUNT, contact.getAccount().getJid().toBareJid().toString());
+ intent.putExtra("contact", contact.getJid().toBareJid().toString());
+ intent.putExtra("fingerprint", (String)null);
+ context.startActivity(intent);
+ }
+}