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;
}
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;
}
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);
}
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;
}
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;
}
Aggregations