aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/ui
diff options
context:
space:
mode:
authorDaniel Gultsch <inputmice@siacs.eu>2015-01-07 18:34:24 +0100
committerDaniel Gultsch <inputmice@siacs.eu>2015-01-07 18:34:24 +0100
commit8d655f445a37acff288e39ec237395d303b7c3a2 (patch)
tree5f6db0c7479b5db6724f4fbd86e40326b03ac7aa /src/main/java/eu/siacs/conversations/ui
parentd70b5f93f3b779bf135b2bfe615093a810841dca (diff)
more muc options
* show invite button only with admin privileges or on public conferences * Offer to ban user in public conferences. Thanks to @betheg for the awesome ground work for this
Diffstat (limited to 'src/main/java/eu/siacs/conversations/ui')
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java27
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ConversationActivity.java11
2 files changed, 28 insertions, 10 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java
index 41190ef2..5272c922 100644
--- a/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java
@@ -1,8 +1,10 @@
package eu.siacs.conversations.ui;
import android.annotation.TargetApi;
+import android.app.AlertDialog;
import android.app.PendingIntent;
import android.content.Context;
+import android.content.DialogInterface;
import android.content.IntentSender.SendIntentException;
import android.graphics.Bitmap;
import android.os.Build;
@@ -285,13 +287,31 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
xmppConnectionService.changeAffiliationInConference(mConversation,mSelectedUser.getJid(), MucOptions.Affiliation.MEMBER,this);
return true;
case R.id.remove_from_room:
- xmppConnectionService.changeAffiliationInConference(mConversation,mSelectedUser.getJid(), MucOptions.Affiliation.OUTCAST,this);
+ removeFromRoom(mSelectedUser);
return true;
default:
return super.onContextItemSelected(item);
}
}
+ private void removeFromRoom(final User user) {
+ if (mConversation.getMucOptions().membersOnly()) {
+ xmppConnectionService.changeAffiliationInConference(mConversation,user.getJid(), MucOptions.Affiliation.NONE,this);
+ } else {
+ AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ builder.setTitle(R.string.ban_user_from_conference);
+ builder.setMessage(getString(R.string.removing_from_public_conference,user.getName()));
+ builder.setNegativeButton(R.string.cancel,null);
+ builder.setPositiveButton(R.string.ban_now,new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ xmppConnectionService.changeAffiliationInConference(mConversation,user.getJid(), MucOptions.Affiliation.OUTCAST,ConferenceDetailsActivity.this);
+ }
+ });
+ builder.create().show();
+ }
+ }
+
protected void startConversation(User user) {
if (user.getJid() != null) {
Conversation conversation = xmppConnectionService.findOrCreateConversation(this.mConversation.getAccount(),user.getJid().toBareJid(),false);
@@ -397,6 +417,11 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
ImageView iv = (ImageView) view.findViewById(R.id.contact_photo);
iv.setImageBitmap(bm);
membersView.addView(view);
+ if (mConversation.getMucOptions().canInvite()) {
+ mInviteButton.setVisibility(View.VISIBLE);
+ } else {
+ mInviteButton.setVisibility(View.GONE);
+ }
}
}
diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java
index 795dabf2..ba5b3e59 100644
--- a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java
@@ -9,7 +9,6 @@ import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.content.IntentSender.SendIntentException;
-import android.media.MediaActionSound;
import android.net.Uri;
import android.os.Bundle;
import android.os.SystemClock;
@@ -83,11 +82,6 @@ public class ConversationActivity extends XmppActivity
private boolean mActivityPaused = false;
-
- public List<Conversation> getConversationList() {
- return this.conversationList;
- }
-
public Conversation getSelectedConversation() {
return this.mSelectedConversation;
}
@@ -284,8 +278,7 @@ public class ConversationActivity extends XmppActivity
final MenuItem menuBlock = menu.findItem(R.id.action_block);
final MenuItem menuUnblock = menu.findItem(R.id.action_unblock);
- if (isConversationsOverviewVisable()
- && isConversationsOverviewHideable()) {
+ if (isConversationsOverviewVisable() && isConversationsOverviewHideable()) {
menuArchive.setVisible(false);
menuMucDetails.setVisible(false);
menuContactDetails.setVisible(false);
@@ -309,9 +302,9 @@ public class ConversationActivity extends XmppActivity
menuAttach.setVisible(false);
menuBlock.setVisible(false);
menuUnblock.setVisible(false);
+ menuInviteContact.setVisible(getSelectedConversation().getMucOptions().canInvite());
} else {
menuMucDetails.setVisible(false);
- menuInviteContact.setTitle(R.string.conference_with);
if (this.getSelectedConversation().isBlocked()) {
menuBlock.setVisible(false);
} else {