add contextual menu items to NewConversationActivity

Closes #5390
// FREEBIE
This commit is contained in:
Christian Ascheberg 2016-03-28 13:09:04 +02:00 committed by Moxie Marlinspike
parent a8a8ec1d40
commit 2a23b53988
2 changed files with 20 additions and 2 deletions

View File

@ -1,7 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item android:title="@string/new_conversation_activity__refresh"
android:id="@+id/menu_refresh"
app:showAsAction="never" />
<item android:title="@string/text_secure_normal__menu_new_group"
android:id="@+id/menu_new_group" />
<item android:title="@string/text_secure_normal__invite_friends"
android:id="@+id/menu_invite" />
</menu>

View File

@ -70,8 +70,10 @@ public class NewConversationActivity extends ContactSelectionActivity {
super.onOptionsItemSelected(item);
switch (item.getItemId()) {
case android.R.id.home: super.onBackPressed(); return true;
case R.id.menu_refresh: handleManualRefresh(); return true;
case android.R.id.home: super.onBackPressed(); return true;
case R.id.menu_refresh: handleManualRefresh(); return true;
case R.id.menu_new_group: handleCreateGroup(); return true;
case R.id.menu_invite: handleInvite(); return true;
}
return false;
@ -82,6 +84,14 @@ public class NewConversationActivity extends ContactSelectionActivity {
onRefresh();
}
private void handleCreateGroup() {
startActivity(new Intent(this, GroupCreateActivity.class));
}
private void handleInvite() {
startActivity(new Intent(this, InviteActivity.class));
}
@Override
protected boolean onPrepareOptionsPanel(View view, Menu menu) {
MenuInflater inflater = this.getMenuInflater();