aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/eu/siacs')
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java158
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ConversationActivity.java8
-rw-r--r--src/main/java/eu/siacs/conversations/ui/XmppActivity.java11
3 files changed, 105 insertions, 72 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java
index 4eb081ce..c88cd322 100644
--- a/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java
@@ -1,19 +1,6 @@
package eu.siacs.conversations.ui;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.openintents.openpgp.util.OpenPgpUtils;
-
-import eu.siacs.conversations.R;
-import eu.siacs.conversations.crypto.PgpEngine;
-import eu.siacs.conversations.entities.Contact;
-import eu.siacs.conversations.entities.Conversation;
-import eu.siacs.conversations.entities.MucOptions;
-import eu.siacs.conversations.entities.MucOptions.OnRenameListener;
-import eu.siacs.conversations.entities.MucOptions.User;
-import eu.siacs.conversations.services.XmppConnectionService.OnConversationUpdate;
-import eu.siacs.conversations.xmpp.stanzas.MessagePacket;
+import android.annotation.SuppressLint;
import android.app.PendingIntent;
import android.content.Context;
import android.content.IntentSender.SendIntentException;
@@ -31,9 +18,30 @@ import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
+import org.openintents.openpgp.util.OpenPgpUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import eu.siacs.conversations.R;
+import eu.siacs.conversations.crypto.PgpEngine;
+import eu.siacs.conversations.entities.Contact;
+import eu.siacs.conversations.entities.Conversation;
+import eu.siacs.conversations.entities.MucOptions.OnRenameListener;
+import eu.siacs.conversations.entities.MucOptions.User;
+import eu.siacs.conversations.services.XmppConnectionService.OnConversationUpdate;
+import eu.siacs.conversations.xmpp.stanzas.MessagePacket;
+
public class ConferenceDetailsActivity extends XmppActivity implements OnConversationUpdate, OnRenameListener {
public static final String ACTION_VIEW_MUC = "view_muc";
private Conversation conversation;
+ private OnClickListener inviteListener = new OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ inviteToConversation(conversation);
+ }
+ };
private TextView mYourNick;
private ImageView mYourPhoto;
private ImageButton mEditNickButton;
@@ -44,14 +52,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
private LinearLayout mMoreDetails;
private Button mInviteButton;
private String uuid = null;
-
- private OnClickListener inviteListener = new OnClickListener() {
-
- @Override
- public void onClick(View v) {
- inviteToConversation(conversation);
- }
- };
+ private List<User> users = new ArrayList<>();
@Override
public void onRename(final boolean success) {
@@ -74,18 +75,16 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
});
}
- private List<User> users = new ArrayList<>();
-
- @Override
- public void onConversationUpdate() {
- runOnUiThread(new Runnable() {
+ @Override
+ public void onConversationUpdate() {
+ runOnUiThread(new Runnable() {
- @Override
- public void run() {
- populateView();
- }
- });
- }
+ @Override
+ public void run() {
+ populateView();
+ }
+ });
+ }
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -123,45 +122,45 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
@Override
public boolean onOptionsItemSelected(MenuItem menuItem) {
switch (menuItem.getItemId()) {
- case android.R.id.home:
- finish();
- break;
- case R.id.action_edit_subject:
- if (conversation != null) {
- quickEdit(conversation.getName(), new OnValueEdited() {
+ case android.R.id.home:
+ finish();
+ break;
+ case R.id.action_edit_subject:
+ if (conversation != null) {
+ quickEdit(conversation.getName(), new OnValueEdited() {
- @Override
- public void onValueEdited(String value) {
- MessagePacket packet = xmppConnectionService
- .getMessageGenerator().conferenceSubject(
- conversation, value);
- xmppConnectionService.sendMessagePacket(
- conversation.getAccount(), packet);
- }
- });
- }
- break;
+ @Override
+ public void onValueEdited(String value) {
+ MessagePacket packet = xmppConnectionService
+ .getMessageGenerator().conferenceSubject(
+ conversation, value);
+ xmppConnectionService.sendMessagePacket(
+ conversation.getAccount(), packet);
+ }
+ });
+ }
+ break;
}
return super.onOptionsItemSelected(menuItem);
}
public String getReadableRole(int role) {
switch (role) {
- case User.ROLE_MODERATOR:
- return getString(R.string.moderator);
- case User.ROLE_PARTICIPANT:
- return getString(R.string.participant);
- case User.ROLE_VISITOR:
- return getString(R.string.visitor);
- default:
- return "";
+ case User.ROLE_MODERATOR:
+ return getString(R.string.moderator);
+ case User.ROLE_PARTICIPANT:
+ return getString(R.string.participant);
+ case User.ROLE_VISITOR:
+ return getString(R.string.visitor);
+ default:
+ return "";
}
}
@Override
protected String getShareableUri() {
- if (conversation!=null) {
- return "xmpp:"+conversation.getContactJid().toBareJid().toString()+"?join";
+ if (conversation != null) {
+ return "xmpp:" + conversation.getContactJid().toBareJid().toString() + "?join";
} else {
return "";
}
@@ -200,17 +199,17 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
mMoreDetails.setVisibility(View.VISIBLE);
User self = conversation.getMucOptions().getSelf();
switch (self.getAffiliation()) {
- case User.AFFILIATION_ADMIN:
- mRoleAffiliaton.setText(getReadableRole(self.getRole()) + " ("
- + getString(R.string.admin) + ")");
- break;
- case User.AFFILIATION_OWNER:
- mRoleAffiliaton.setText(getReadableRole(self.getRole()) + " ("
- + getString(R.string.owner) + ")");
- break;
- default:
- mRoleAffiliaton.setText(getReadableRole(self.getRole()));
- break;
+ case User.AFFILIATION_ADMIN:
+ mRoleAffiliaton.setText(getReadableRole(self.getRole()) + " ("
+ + getString(R.string.admin) + ")");
+ break;
+ case User.AFFILIATION_OWNER:
+ mRoleAffiliaton.setText(getReadableRole(self.getRole()) + " ("
+ + getString(R.string.owner) + ")");
+ break;
+ default:
+ mRoleAffiliaton.setText(getReadableRole(self.getRole()));
+ break;
}
}
this.users.clear();
@@ -220,6 +219,13 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
for (final User user : conversation.getMucOptions().getUsers()) {
View view = inflater.inflate(R.layout.contact, membersView,
false);
+ this.setListItemBackgroundOnView(view);
+ view.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ highlightInMuc(conversation, user.getName());
+ }
+ });
TextView name = (TextView) view
.findViewById(R.id.contact_display_name);
TextView key = (TextView) view.findViewById(R.id.key);
@@ -253,6 +259,16 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
}
}
+ @SuppressLint("JELLY_BEAN")
+ private void setListItemBackgroundOnView(View view) {
+ int sdk = android.os.Build.VERSION.SDK_INT;
+ if (sdk < android.os.Build.VERSION_CODES.JELLY_BEAN) {
+ view.setBackgroundDrawable(getResources().getDrawable(R.drawable.greybackground));
+ } else {
+ view.setBackground(getResources().getDrawable(R.drawable.greybackground));
+ }
+ }
+
private void viewPgpKey(User user) {
PgpEngine pgp = xmppConnectionService.getPgpEngine();
if (pgp != null) {
diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java
index 5dccde18..56a6bead 100644
--- a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java
@@ -47,6 +47,7 @@ public class ConversationActivity extends XmppActivity implements
public static final String VIEW_CONVERSATION = "viewConversation";
public static final String CONVERSATION = "conversationUuid";
public static final String TEXT = "text";
+ public static final String NICK = "nick";
public static final String PRESENCE = "eu.siacs.conversations.presence";
public static final int REQUEST_SEND_MESSAGE = 0x0201;
@@ -701,9 +702,14 @@ public class ConversationActivity extends XmppActivity implements
private void handleViewConversationIntent(Intent intent) {
String uuid = (String) intent.getExtras().get(CONVERSATION);
String text = intent.getExtras().getString(TEXT, "");
+ String nick = intent.getExtras().getString(NICK,null);
selectConversationByUuid(uuid);
this.mConversationFragment.reInit(getSelectedConversation());
- this.mConversationFragment.appendText(text);
+ if (nick!=null) {
+ this.mConversationFragment.highlightInConference(nick);
+ } else {
+ this.mConversationFragment.appendText(text);
+ }
hideConversationsOverview();
if (mContentView instanceof SlidingPaneLayout) {
openConversation();
diff --git a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
index 98c9cdde..e6e97da3 100644
--- a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
@@ -301,6 +301,14 @@ public abstract class XmppActivity extends Activity {
public void switchToConversation(Conversation conversation, String text,
boolean newTask) {
+ switchToConversation(conversation,text,null,newTask);
+ }
+
+ public void highlightInMuc(Conversation conversation, String nick) {
+ switchToConversation(conversation,null,nick,false);
+ }
+
+ private void switchToConversation(Conversation conversation, String text, String nick, boolean newTask) {
Intent viewConversationIntent = new Intent(this,
ConversationActivity.class);
viewConversationIntent.setAction(Intent.ACTION_VIEW);
@@ -309,6 +317,9 @@ public abstract class XmppActivity extends Activity {
if (text != null) {
viewConversationIntent.putExtra(ConversationActivity.TEXT, text);
}
+ if (nick != null) {
+ viewConversationIntent.putExtra(ConversationActivity.NICK, nick);
+ }
viewConversationIntent.setType(ConversationActivity.VIEW_CONVERSATION);
if (newTask) {
viewConversationIntent.setFlags(viewConversationIntent.getFlags()