Java Code Examples for com.actionbarsherlock.view.MenuItem

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project 2Degrees-Toolbox, under directory /ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/.

Source file: ActionMenuPresenter.java

  22 
vote

@Override public void onRestoreInstanceState(Parcelable state){
  SavedState saved=(SavedState)state;
  if (saved.openSubMenuId > 0) {
    MenuItem item=mMenu.findItem(saved.openSubMenuId);
    if (item != null) {
      SubMenuBuilder subMenu=(SubMenuBuilder)item.getSubMenu();
      onSubMenuSelected(subMenu);
    }
  }
}
 

Example 2

From project 2Degrees-Toolbox, under directory /ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/.

Source file: MenuWrapper.java

  22 
vote

private SubMenu addInternal(android.view.SubMenu nativeSubMenu){
  SubMenu subMenu=new SubMenuWrapper(nativeSubMenu);
  android.view.MenuItem nativeItem=nativeSubMenu.getItem();
  MenuItem item=subMenu.getItem();
  mNativeMap.put(nativeItem,item);
  return subMenu;
}
 

Example 3

From project 2Degrees-Toolbox, under directory /ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/.

Source file: MenuWrapper.java

  22 
vote

public MenuItem findItem(android.view.MenuItem nativeItem){
  if (nativeItem == null) {
    return null;
  }
  MenuItem wrapped=mNativeMap.get(nativeItem);
  if (wrapped != null) {
    return wrapped;
  }
  return addInternal(nativeItem);
}
 

Example 4

From project 4308Cirrus, under directory /Extras/actionbarsherlock/src/com/actionbarsherlock/internal/view/menu/.

Source file: ActionMenuPresenter.java

  22 
vote

@Override public void onRestoreInstanceState(Parcelable state){
  SavedState saved=(SavedState)state;
  if (saved.openSubMenuId > 0) {
    MenuItem item=mMenu.findItem(saved.openSubMenuId);
    if (item != null) {
      SubMenuBuilder subMenu=(SubMenuBuilder)item.getSubMenu();
      onSubMenuSelected(subMenu);
    }
  }
}
 

Example 5

From project 4308Cirrus, under directory /Extras/actionbarsherlock/src/com/actionbarsherlock/internal/view/menu/.

Source file: MenuWrapper.java

  22 
vote

private SubMenu addInternal(android.view.SubMenu nativeSubMenu){
  SubMenu subMenu=new SubMenuWrapper(nativeSubMenu);
  android.view.MenuItem nativeItem=nativeSubMenu.getItem();
  MenuItem item=subMenu.getItem();
  mNativeMap.put(nativeItem,item);
  return subMenu;
}
 

Example 6

From project 4308Cirrus, under directory /Extras/actionbarsherlock/src/com/actionbarsherlock/internal/view/menu/.

Source file: MenuWrapper.java

  22 
vote

public MenuItem findItem(android.view.MenuItem nativeItem){
  if (nativeItem == null) {
    return null;
  }
  MenuItem wrapped=mNativeMap.get(nativeItem);
  if (wrapped != null) {
    return wrapped;
  }
  return addInternal(nativeItem);
}
 

Example 7

From project ActionBarSherlock, under directory /library/src/com/actionbarsherlock/internal/view/menu/.

Source file: ActionMenuPresenter.java

  22 
vote

@Override public void onRestoreInstanceState(Parcelable state){
  SavedState saved=(SavedState)state;
  if (saved.openSubMenuId > 0) {
    MenuItem item=mMenu.findItem(saved.openSubMenuId);
    if (item != null) {
      SubMenuBuilder subMenu=(SubMenuBuilder)item.getSubMenu();
      onSubMenuSelected(subMenu);
    }
  }
}
 

Example 8

From project ActionBarSherlock, under directory /library/src/com/actionbarsherlock/internal/view/menu/.

Source file: MenuWrapper.java

  22 
vote

private SubMenu addInternal(android.view.SubMenu nativeSubMenu){
  SubMenu subMenu=new SubMenuWrapper(nativeSubMenu);
  android.view.MenuItem nativeItem=nativeSubMenu.getItem();
  MenuItem item=subMenu.getItem();
  mNativeMap.put(nativeItem,item);
  return subMenu;
}
 

Example 9

From project ActionBarSherlock, under directory /library/src/com/actionbarsherlock/internal/view/menu/.

Source file: MenuWrapper.java

  22 
vote

public MenuItem findItem(android.view.MenuItem nativeItem){
  if (nativeItem == null) {
    return null;
  }
  MenuItem wrapped=mNativeMap.get(nativeItem);
  if (wrapped != null) {
    return wrapped;
  }
  return addInternal(nativeItem);
}
 

Example 10

From project agit, under directory /agit/src/main/java/com/madgag/agit/.

Source file: FileListFragment.java

  22 
vote

@Override public void onCreateOptionsMenu(Menu menu,MenuInflater menuInflater){
  menuInflater.inflate(R.menu.file_list,menu);
  MenuItem item=menu.findItem(R.id.filter_files);
  filterWidgetSupport=new FilterWidgetSupport(item,this);
  String monospaceRevisionText=code(shortenRevName(getArguments().getString(REVISION)));
  filterWidgetSupport.setQueryHint(fromHtml(getString(R.string.filter_files_on_ref_hint,monospaceRevisionText)));
}
 

Example 11

From project adg-android, under directory /src/com/analysedesgeeks/android/.

Source file: BaseDefaultActivity.java

  19 
vote

@Override public boolean onOptionsItemSelected(final MenuItem item){
switch (item.getItemId()) {
case android.R.id.home:
    ActivityController.showMainActivity(this);
  return true;
default :
return super.onOptionsItemSelected(item);
}
}
 

Example 12

From project adg-android, under directory /src/com/analysedesgeeks/android/.

Source file: MainActivity.java

  19 
vote

@Override public boolean onOptionsItemSelected(final MenuItem item){
switch (item.getItemId()) {
case android.R.id.home:
    return true;
default :
  return super.onOptionsItemSelected(item);
}
}
 

Example 13

From project agit, under directory /agit/src/main/java/com/madgag/agit/.

Source file: AboutActivity.java

  19 
vote

@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case android.R.id.home:
    return homewardsWith(this,new Intent(this,DashboardActivity.class));
}
return super.onOptionsItemSelected(item);
}
 

Example 14

From project agit, under directory /agit/src/main/java/com/madgag/agit/.

Source file: AboutUsingSshActivity.java

  19 
vote

@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case android.R.id.home:
    return homewardsWith(this,new Intent(this,CloneLauncherActivity.class));
}
return super.onOptionsItemSelected(item);
}
 

Example 15

From project Airports, under directory /src/com/nadmm/airports/afd/.

Source file: AirportDetailsActivity.java

  19 
vote

@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.menu_refresh:
    AirportDetailsFragment f=(AirportDetailsFragment)getFragment(AirportDetailsFragment.class);
  f.requestMetars(true);
return true;
default :
return super.onOptionsItemSelected(item);
}
}
 

Example 16

From project Airports, under directory /src/com/nadmm/airports/wx/.

Source file: AirSigmetFragment.java

  19 
vote

@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.menu_refresh:
    startRefreshAnimation();
  requestAirSigmetText(true);
return true;
default :
return super.onOptionsItemSelected(item);
}
}
 

Example 17

From project Airports, under directory /src/com/nadmm/airports/wx/.

Source file: MetarFragment.java

  19 
vote

@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.menu_refresh:
    startRefreshAnimation();
  requestMetar(true);
return true;
default :
return super.onOptionsItemSelected(item);
}
}
 

Example 18

From project Amantech, under directory /Android/action_bar_sherlock/src/com/actionbarsherlock/.

Source file: ActionBarSherlock.java

  19 
vote

/** 
 * Internal method for dispatching options menu selection to the owning activity callback.
 * @param item Selected options menu item.
 * @return {@code true} if the item selection was handled in the callback.
 */
protected final boolean callbackOptionsItemSelected(MenuItem item){
  if (DEBUG)   Log.d(TAG,"[callbackOptionsItemSelected] item: " + item.getTitleCondensed());
  boolean result=false;
  if (mActivity instanceof OnMenuItemSelectedListener) {
    OnMenuItemSelectedListener listener=(OnMenuItemSelectedListener)mActivity;
    result=listener.onMenuItemSelected(Window.FEATURE_OPTIONS_PANEL,item);
  }
 else   if (mActivity instanceof OnOptionsItemSelectedListener) {
    OnOptionsItemSelectedListener listener=(OnOptionsItemSelectedListener)mActivity;
    result=listener.onOptionsItemSelected(item);
  }
  if (DEBUG)   Log.d(TAG,"[callbackOptionsItemSelected] returning " + result);
  return result;
}
 

Example 19

From project Amantech, under directory /Android/action_bar_sherlock/src/com/actionbarsherlock/app/.

Source file: SherlockActivity.java

  19 
vote

@Override public boolean onMenuItemSelected(int featureId,MenuItem item){
  if (featureId == Window.FEATURE_OPTIONS_PANEL) {
    return onOptionsItemSelected(item);
  }
  return false;
}
 

Example 20

From project Amantech, under directory /Android/action_bar_sherlock/src/com/actionbarsherlock/app/.

Source file: SherlockDialogFragment.java

  19 
vote

@Override public final boolean onOptionsItemSelected(android.view.MenuItem item){
  if (DEBUG)   Log.d(TAG,"[onOptionsItemSelected] item: " + item);
  if (item instanceof MenuItemMule) {
    return onOptionsItemSelected(((MenuItemMule)item).unwrap());
  }
  return false;
}