added group add button

This commit is contained in:
iNPUTmice 2014-07-04 14:22:17 +02:00
parent c1ee9e682a
commit 7c3f3b2a3e
3 changed files with 30 additions and 20 deletions

View File

@ -1,23 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@+id/search"
android:title="@string/search"
<item
android:id="@+id/action_search"
android:actionViewClass="android.widget.SearchView"
android:icon="@drawable/ic_action_search"
android:showAsAction="collapseActionView|ifRoom"
android:actionViewClass="android.widget.SearchView" />
<item android:id="@+id/create_contact"
android:title="@string/create_contact"
android:title="@string/search"/>
<item
android:id="@+id/action_create_contact"
android:icon="@drawable/ic_action_add_person"
android:showAsAction="ifRoom"
/>
android:title="@string/create_contact"/>
<item
android:id="@+id/action_create_conference"
android:icon="@drawable/ic_action_add_group"
android:showAsAction="ifRoom"
android:title="@string/create_conference"/>
<item
android:id="@+id/action_accounts"
android:orderInCategory="90"
android:showAsAction="never"
android:title="@string/action_accounts"
/>
android:title="@string/action_accounts"/>
<item
android:id="@+id/action_settings"
android:orderInCategory="100"

View File

@ -258,4 +258,5 @@
<string name="conferences">Conferences</string>
<string name="search">Search</string>
<string name="create_contact">Create Contact</string>
<string name="create_conference">Create Conference</string>
</resources>

View File

@ -9,12 +9,8 @@ import android.app.ListFragment;
import android.os.Bundle;
import android.support.v13.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.PopupMenu;
import android.widget.PopupMenu.OnMenuItemClickListener;
import eu.siacs.conversations.R;
public class StartConversation extends XmppActivity {
@ -36,6 +32,7 @@ public class StartConversation extends XmppActivity {
@Override
public void onTabSelected(Tab tab, FragmentTransaction ft) {
mViewPager.setCurrentItem(tab.getPosition());
invalidateOptionsMenu();
}
@Override
@ -49,6 +46,7 @@ public class StartConversation extends XmppActivity {
@Override
public void onPageSelected(int position) {
getActionBar().setSelectedNavigationItem(position);
invalidateOptionsMenu();
}
};
@ -91,6 +89,13 @@ public class StartConversation extends XmppActivity {
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.start_conversation, menu);
MenuItem menuCreateContact = (MenuItem) menu.findItem(R.id.action_create_contact);
MenuItem menuCreateConference = (MenuItem) menu.findItem(R.id.action_create_conference);
if (getActionBar().getSelectedNavigationIndex() == 0) {
menuCreateConference.setVisible(false);
} else {
menuCreateContact.setVisible(false);
}
return true;
}