use of com.actionbarsherlock.view.MenuInflater in project Libraries-for-Android-Developers by eoecn.
the class Watson method onCreatePanelMenu.
///////////////////////////////////////////////////////////////////////////
// Sherlock menu handling
///////////////////////////////////////////////////////////////////////////
@Override
public boolean onCreatePanelMenu(int featureId, Menu menu) {
if (ActionBarSherlock.DEBUG)
Log.d(TAG, "[onCreatePanelMenu] featureId: " + featureId + ", menu: " + menu);
if (featureId == Window.FEATURE_OPTIONS_PANEL) {
boolean result = onCreateOptionsMenu(menu);
if (ActionBarSherlock.DEBUG)
Log.d(TAG, "[onCreatePanelMenu] activity create result: " + result);
MenuInflater inflater = getSupportMenuInflater();
boolean show = false;
ArrayList<Fragment> newMenus = null;
if (mFragments.mAdded != null) {
for (int i = 0; i < mFragments.mAdded.size(); i++) {
Fragment f = mFragments.mAdded.get(i);
if (f != null && !f.mHidden && f.mHasMenu && f.mMenuVisible && f instanceof OnCreateOptionsMenuListener) {
show = true;
((OnCreateOptionsMenuListener) f).onCreateOptionsMenu(menu, inflater);
if (newMenus == null) {
newMenus = new ArrayList<Fragment>();
}
newMenus.add(f);
}
}
}
if (mCreatedMenus != null) {
for (int i = 0; i < mCreatedMenus.size(); i++) {
Fragment f = mCreatedMenus.get(i);
if (newMenus == null || !newMenus.contains(f)) {
f.onDestroyOptionsMenu();
}
}
}
mCreatedMenus = newMenus;
if (ActionBarSherlock.DEBUG)
Log.d(TAG, "[onCreatePanelMenu] fragments create result: " + show);
result |= show;
if (ActionBarSherlock.DEBUG)
Log.d(TAG, "[onCreatePanelMenu] returning " + result);
return result;
}
return false;
}
use of com.actionbarsherlock.view.MenuInflater in project KeepScore by nolanlawson.
the class OrganizePlayersActivity method onCreateOptionsMenu.
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getSupportMenuInflater();
inflater.inflate(R.menu.organize_players_menu, menu);
return true;
}
use of com.actionbarsherlock.view.MenuInflater in project KeepScore by nolanlawson.
the class MainActivity method onCreateOptionsMenu.
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getSupportMenuInflater();
inflater.inflate(R.menu.main_menu, menu);
return true;
}
use of com.actionbarsherlock.view.MenuInflater in project howabout-android by recomio.
the class MainActivity method onCreateOptionsMenu.
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getSupportMenuInflater();
inflater.inflate(R.menu.main, menu);
// Place an action bar item for searching.
final SearchView searchView = new SearchView(getSupportActionBar().getThemedContext());
searchView.setQueryHint("Search");
searchView.setIconified(true);
searchMenu = menu.getItem(0);
searchMenu.setActionView(searchView).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
searchView.setOnQueryTextFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View view, boolean queryTextFocused) {
if (!queryTextFocused) {
Log.d("searchMenu.collapseActionView();", Boolean.toString(searchMenu.collapseActionView()));
searchView.setQuery("", false);
}
}
});
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String searchKeyword) {
Intent intent = new Intent(MainActivity.this, SearchedTrackListActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Bundle bundle = new Bundle();
bundle.putString("category", "music");
bundle.putString("method", "search");
bundle.putString("searchKeyword", searchKeyword);
intent.putExtras(bundle);
startActivity(intent);
return true;
}
@Override
public boolean onQueryTextChange(String newText) {
return true;
}
});
return super.onCreateOptionsMenu(menu);
}
use of com.actionbarsherlock.view.MenuInflater in project howabout-android by recomio.
the class ShowImageActivity method onCreateOptionsMenu.
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
MenuInflater inflater = getSupportMenuInflater();
inflater.inflate(R.menu.show_image, menu);
return true;
}
Aggregations