aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/ui
diff options
context:
space:
mode:
authorSam Whited <sam@samwhited.com>2015-01-15 19:08:12 -0500
committeriNPUTmice <daniel@gultsch.de>2015-01-21 13:07:36 +0100
commit764ef3c8cdebe0bd189a7d7c1031bb25dafa5f15 (patch)
tree229837b73eef1d04b73e7f5d7143f3d69437549a /src/main/java/eu/siacs/conversations/ui
parent818c0e609cb822cb67af1b0ec9166ef4d6eca29c (diff)
Add block/unblock to contact details menu
See #889
Diffstat (limited to 'src/main/java/eu/siacs/conversations/ui')
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java17
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ConversationActivity.java4
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ConversationFragment.java3
3 files changed, 15 insertions, 9 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java
index 657ae75b9..7a500c0bd 100644
--- a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java
@@ -201,7 +201,7 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd
@Override
public boolean onOptionsItemSelected(final MenuItem menuItem) {
- AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ final AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setNegativeButton(getString(R.string.cancel), null);
switch (menuItem.getItemId()) {
case android.R.id.home:
@@ -237,13 +237,25 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd
startActivity(intent);
}
break;
+ case R.id.action_block:
+ BlockContactDialog.show(this, xmppConnectionService, contact);
+ break;
+ case R.id.action_unblock:
+ BlockContactDialog.show(this, xmppConnectionService, contact);
+ break;
}
return super.onOptionsItemSelected(menuItem);
}
@Override
- public boolean onCreateOptionsMenu(Menu menu) {
+ public boolean onCreateOptionsMenu(final Menu menu) {
getMenuInflater().inflate(R.menu.contact_details, menu);
+ if (this.contact.isBlocked()) {
+ menu.findItem(R.id.action_block).setVisible(false);
+ } else {
+ menu.findItem(R.id.action_unblock).setVisible(false);
+ }
+
return true;
}
@@ -424,6 +436,7 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd
@Override
public void run() {
+ invalidateOptionsMenu();
populateView();
}
});
diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java
index 1356e6161..ad9c13aaa 100644
--- a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java
@@ -1075,10 +1075,6 @@ public class ConversationActivity extends XmppActivity
xmppConnectionService.sendUnblockRequest(conversation);
}
- public void blockConversation(final Blockable conversation) {
- xmppConnectionService.sendBlockRequest(conversation);
- }
-
public boolean enterIsSend() {
return getPreferences().getBoolean("enter_is_send",false);
}
diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
index 0a38daee7..e767fbea3 100644
--- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
+++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
@@ -974,7 +974,4 @@ public class ConversationFragment extends Fragment {
this.mEditMessage.append(text);
}
- public void clearInputField() {
- this.mEditMessage.setText("");
- }
}