Search in sources :

Example 86 with MenuInflater

use of android.view.MenuInflater in project android by owncloud.

the class UploadListActivity method onCreateOptionsMenu.

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.upload_list_menu, menu);
    return true;
}
Also used : MenuInflater(android.view.MenuInflater)

Example 87 with MenuInflater

use of android.view.MenuInflater in project snackbar by nispok.

the class SnackbarSampleActivity method onCreateOptionsMenu.

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.sample, menu);
    return true;
}
Also used : MenuInflater(android.view.MenuInflater)

Example 88 with MenuInflater

use of android.view.MenuInflater in project Presentation by StanKocken.

the class BaseActivityTest method testShouldCallOnCreateOptionsMenu.

@Test
public void testShouldCallOnCreateOptionsMenu() {
    final MenuInflater menuInflater = Mockito.mock(MenuInflater.class);
    BaseActivity baseActivity = new TestBaseActivity() {

        @NonNull
        @Override
        public MenuInflater getMenuInflater() {
            return menuInflater;
        }
    };
    baseActivity.onCreate(null);
    BasePresenter presenter = baseActivity.getPresenter();
    Menu menu = Mockito.mock(Menu.class);
    verify(presenter, times(0)).onCreateOptionsMenu(menu, menuInflater);
    baseActivity.onCreateOptionsMenu(menu);
    verify(presenter, times(1)).onCreateOptionsMenu(menu, menuInflater);
}
Also used : MenuInflater(android.view.MenuInflater) Menu(android.view.Menu) BasePresenter(com.skocken.presentation.presenter.BasePresenter) Test(org.junit.Test)

Example 89 with MenuInflater

use of android.view.MenuInflater in project SR-Tracker-for-Overwatch by Rexios80.

the class InformationActivity method onCreateOptionsMenu.

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.information_actionbar, menu);
    MenuItem seasonList = menu.findItem(R.id.seasons);
    SubMenu subMenu = seasonList.getSubMenu();
    // Get seasons list from database
    DatabaseHelper mDbHelper = new DatabaseHelper(getApplicationContext());
    SQLiteDatabase db = mDbHelper.getWritableDatabase();
    String[] projection = { DatabaseContract.Database._ID, DatabaseContract.Database.COLUMN_NAME_SEASON };
    String sortOrder = DatabaseContract.Database.COLUMN_NAME_SEASON + " ASC";
    Cursor cursor = db.query(DatabaseContract.Database.SEASONS_TABLE_NAME, projection, null, null, null, null, sortOrder);
    ArrayList<Integer> seasons = new ArrayList<>();
    while (cursor.moveToNext()) {
        seasons.add(cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseContract.Database.COLUMN_NAME_SEASON)));
    }
    cursor.close();
    // Add seasons to subMenu
    if (seasons.size() <= 1) {
        MenuItem item = menu.findItem(R.id.seasons);
        item.setVisible(false);
    }
    for (int i = 0; i < seasons.size(); i++) {
        subMenu.add(0, i, Menu.NONE, "Season " + seasons.get(i));
    }
    return true;
}
Also used : MenuInflater(android.view.MenuInflater) SQLiteDatabase(android.database.sqlite.SQLiteDatabase) ArrayList(java.util.ArrayList) MenuItem(android.view.MenuItem) SubMenu(android.view.SubMenu) Cursor(android.database.Cursor)

Example 90 with MenuInflater

use of android.view.MenuInflater in project SR-Tracker-for-Overwatch by Rexios80.

the class PlacementsActivity method onCreateOptionsMenu.

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.placements_actionbar, menu);
    MenuItem seasonList = menu.findItem(R.id.seasons);
    SubMenu subMenu = seasonList.getSubMenu();
    // Get seasons list from database
    mDbHelper = new DatabaseHelper(getApplicationContext());
    db = mDbHelper.getWritableDatabase();
    String[] projection = { DatabaseContract.Database._ID, DatabaseContract.Database.COLUMN_NAME_SEASON };
    String sortOrder = DatabaseContract.Database.COLUMN_NAME_SEASON + " ASC";
    Cursor cursor = db.query(DatabaseContract.Database.SEASONS_TABLE_NAME, projection, null, null, null, null, sortOrder);
    ArrayList<Integer> seasons = new ArrayList<>();
    while (cursor.moveToNext()) {
        seasons.add(cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseContract.Database.COLUMN_NAME_SEASON)));
    }
    cursor.close();
    // Add seasons to subMenu
    if (seasons.size() <= 1) {
        MenuItem item = menu.findItem(R.id.seasons);
        item.setVisible(false);
    }
    for (int i = 0; i < seasons.size(); i++) {
        subMenu.add(0, i, Menu.NONE, "Season " + seasons.get(i));
    }
    return true;
}
Also used : MenuInflater(android.view.MenuInflater) ArrayList(java.util.ArrayList) MenuItem(android.view.MenuItem) SubMenu(android.view.SubMenu) Cursor(android.database.Cursor)

Aggregations

MenuInflater (android.view.MenuInflater)304 MenuItem (android.view.MenuItem)32 View (android.view.View)16 Intent (android.content.Intent)12 AdapterView (android.widget.AdapterView)12 SearchView (android.support.v7.widget.SearchView)11 PopupMenu (android.widget.PopupMenu)10 TextView (android.widget.TextView)10 Menu (android.view.Menu)9 IconicsDrawable (com.mikepenz.iconics.IconicsDrawable)9 ListView (android.widget.ListView)8 SearchManager (android.app.SearchManager)6 Point (android.graphics.Point)5 AdapterContextMenuInfo (android.widget.AdapterView.AdapterContextMenuInfo)5 ImageView (android.widget.ImageView)5 MenuBuilder (com.android.internal.view.menu.MenuBuilder)5 ActionBar (android.app.ActionBar)4 Cursor (android.database.Cursor)4 MenuBuilder (android.support.v7.view.menu.MenuBuilder)4 SpannableString (android.text.SpannableString)4