com.actionbarsherlock.view.MenuItem Java Examples
The following examples show how to use
com.actionbarsherlock.view.MenuItem.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FavAdapter.java From CSipSimple with GNU General Public License v3.0 | 6 votes |
@Override public boolean onMenuItemSelected(MenuBuilder menu, MenuItem item) { int itemId = item.getItemId(); if(itemId == R.id.set_group) { showDialogForGroupSelection(context, profileId, groupName); return true; }else if(itemId == R.id.share_presence) { ContentValues cv = new ContentValues(); cv.put(SipProfile.FIELD_PUBLISH_ENABLED, publishEnabled ? 0 : 1); context.getContentResolver().update(ContentUris.withAppendedId(SipProfile.ACCOUNT_ID_URI_BASE, profileId), cv, null, null); return true; }else if(itemId == R.id.set_sip_data) { showDialogForSipData(context, profileId, groupName, domain); return true; } return false; }
Example #2
Source File: AuthenticationActivity.java From product-emm with Apache License 2.0 | 6 votes |
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.ip_setting: Preference.putString(context, getResources().getString(R.string.shared_pref_ip), getResources().getString(R.string.shared_pref_default_string)); Intent intentIP = new Intent(AuthenticationActivity.this, ServerDetails.class); intentIP.putExtra(getResources().getString(R.string.intent_extra_from_activity), AuthenticationActivity.class.getSimpleName()); startActivity(intentIP); return true; default: return super.onOptionsItemSelected(item); } }
Example #3
Source File: MenuBuilder.java From android-apps with MIT License | 6 votes |
public void saveActionViewStates(Bundle outStates) { SparseArray<Parcelable> viewStates = null; final int itemCount = size(); for (int i = 0; i < itemCount; i++) { final MenuItem item = getItem(i); final View v = item.getActionView(); if (v != null && v.getId() != View.NO_ID) { if (viewStates == null) { viewStates = new SparseArray<Parcelable>(); } v.saveHierarchyState(viewStates); if (item.isActionViewExpanded()) { outStates.putInt(EXPANDED_ACTION_VIEW_ID, item.getItemId()); } } if (item.hasSubMenu()) { final SubMenuBuilder subMenu = (SubMenuBuilder) item.getSubMenu(); subMenu.saveActionViewStates(outStates); } } if (viewStates != null) { outStates.putSparseParcelableArray(getActionViewStatesKey(), viewStates); } }
Example #4
Source File: document_read.java From Favorite-Android-Client with Apache License 2.0 | 6 votes |
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); MenuItem item; menu.add(0, 0, 0, getString(R.string.refresh)).setShowAsAction( MenuItem.SHOW_AS_ACTION_NEVER); if (you_doc_status >= 4) { menu.add(0, 1, 0, getString(R.string.delete)).setShowAsAction( MenuItem.SHOW_AS_ACTION_NEVER); menu.add(0, 2, 0, getString(R.string.privacy_content)) .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); } // item = menu.add(0, 1, 0, R.string.Main_MenuAddBookmark); // item.setIcon(R.drawable.ic_menu_add_bookmark); return true; }
Example #5
Source File: Watson.java From zen4android with MIT License | 6 votes |
@Override public boolean onMenuItemSelected(int featureId, MenuItem item) { if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onMenuItemSelected] featureId: " + featureId + ", item: " + item); if (featureId == Window.FEATURE_OPTIONS_PANEL) { if (onOptionsItemSelected(item)) { return true; } 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 OnOptionsItemSelectedListener) { if (((OnOptionsItemSelectedListener)f).onOptionsItemSelected(item)) { return true; } } } } } return false; }
Example #6
Source File: MonitorMangAty.java From Huochexing12306 with Apache License 2.0 | 6 votes |
@Override public boolean onContextItemSelected(android.view.MenuItem item) { MonitorInfo mInfo = mLstMInfos.get(intCurrDataPos); switch(item.getItemId()){ case 0: mLstMInfos.remove(mInfo); mAdpater.notifyDataSetChanged(); mBgdSerivce2.notifyLstMInfosChanged(mLstMInfos); break; case 1: if (mBgdSerivce2 != null){ mBgdSerivce2.resumeMonitors(); refreshData(false); } hideResumePanel(); break; } return super.onContextItemSelected(item); }
Example #7
Source File: ProfileEdit.java From Favorite-Android-Client with Apache License 2.0 | 6 votes |
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); MenuItem item; SubMenu subMenu1 = menu.addSubMenu(getString(R.string.permission)); subMenu1.add(0, 1001, 0, getString(R.string.privacy_content)); subMenu1.add(0, 1002, 0, getString(R.string.write_permission)); MenuItem subMenu1Item = subMenu1.getItem(); subMenu1Item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); if(!Global.getSetting("user_srl", "0").matches(member_srl)) menu.add(0, 1, 0, getString(R.string.delete)) .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); // item = menu.add(0, 1, 0, R.string.Main_MenuAddBookmark); // item.setIcon(R.drawable.ic_menu_add_bookmark); return true; }
Example #8
Source File: MenuBuilder.java From android-apps with MIT License | 6 votes |
public MenuItem findItem(int id) { final int size = size(); for (int i = 0; i < size; i++) { MenuItemImpl item = mItems.get(i); if (item.getItemId() == id) { return item; } else if (item.hasSubMenu()) { MenuItem possibleItem = item.getSubMenu().findItem(id); if (possibleItem != null) { return possibleItem; } } } return null; }
Example #9
Source File: DialerFragment.java From CSipSimple with GNU General Public License v3.0 | 6 votes |
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); int action = getResources().getBoolean(R.bool.menu_in_bar) ? MenuItem.SHOW_AS_ACTION_IF_ROOM : MenuItem.SHOW_AS_ACTION_NEVER; MenuItem delMenu = menu.add(isDigit ? R.string.switch_to_text : R.string.switch_to_digit); delMenu.setIcon( isDigit ? R.drawable.ic_menu_switch_txt : R.drawable.ic_menu_switch_digit).setShowAsAction( action ); delMenu.setOnMenuItemClickListener(new OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { setTextDialing(isDigit); return true; } }); }
Example #10
Source File: TwoLinesArrayAdapterActivity.java From MultiChoiceAdapter with Apache License 2.0 | 6 votes |
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: Intent parentActivityIntent = new Intent(this, HomeActivity.class); parentActivityIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(parentActivityIntent); finish(); return true; case R.id.menu_select_all: selectAll(); return true; case R.id.menu_reset_list: rebuildList(null); return true; } return false; }
Example #11
Source File: ActionMenuPresenter.java From zen4android with MIT License | 6 votes |
public ActionButtonSubmenu(Context context, SubMenuBuilder subMenu) { super(context, subMenu); //UNUSED mSubMenu = subMenu; MenuItemImpl item = (MenuItemImpl) subMenu.getItem(); if (!item.isActionButton()) { // Give a reasonable anchor to nested submenus. setAnchorView(mOverflowButton == null ? (View) mMenuView : mOverflowButton); } setCallback(mPopupPresenterCallback); boolean preserveIconSpacing = false; final int count = subMenu.size(); for (int i = 0; i < count; i++) { MenuItem childItem = subMenu.getItem(i); if (childItem.isVisible() && childItem.getIcon() != null) { preserveIconSpacing = true; break; } } setForceShowIcon(preserveIconSpacing); }
Example #12
Source File: SubMenuWrapper.java From zen4android with MIT License | 5 votes |
@Override public MenuItem getItem() { if (mItem == null) { mItem = new MenuItemWrapper(mNativeSubMenu.getItem()); } return mItem; }
Example #13
Source File: MyBaseAdapter.java From MultiChoiceAdapter with Apache License 2.0 | 5 votes |
@Override public boolean onActionItemClicked(ActionMode mode, MenuItem item) { if (item.getItemId() == R.id.menu_share) { Toast.makeText(getContext(), "Share", Toast.LENGTH_SHORT).show(); return true; } if (item.getItemId() == R.id.menu_discard) { discardSelectedItems(); return true; } return false; }
Example #14
Source File: LoginActivity.java From buddycloud-android with Apache License 2.0 | 5 votes |
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getSupportMenuInflater(); inflater.inflate(R.menu.login_screen_options, menu); MenuItem item = menu.findItem(R.id.menu_signup); if (item != null) { item.setTitle(getString(R.string.signup_button).toUpperCase(Locale.ENGLISH)); } return super.onCreateOptionsMenu(menu); }
Example #15
Source File: SherlockExpandableListActivity.java From zhangshangwuda with Apache License 2.0 | 5 votes |
@Override public boolean onMenuItemSelected(int featureId, MenuItem item) { if (featureId == Window.FEATURE_OPTIONS_PANEL) { return onOptionsItemSelected(item); } return false; }
Example #16
Source File: MenuItemWrapper.java From zhangshangwuda with Apache License 2.0 | 5 votes |
@Override public boolean onMenuItemClick(android.view.MenuItem item) { if (mMenuItemClickListener != null) { return mMenuItemClickListener.onMenuItemClick(this); } return false; }
Example #17
Source File: CountriesAdapter.java From MultiChoiceAdapter with Apache License 2.0 | 5 votes |
@Override public boolean onActionItemClicked(ActionMode mode, MenuItem item) { if (item.getItemId() == R.id.menu_share) { Toast.makeText(getContext(), "Share", Toast.LENGTH_SHORT).show(); return true; } if (item.getItemId() == R.id.menu_discard) { discardSelectedItems(); return true; } return false; }
Example #18
Source File: MenuWrapper.java From zhangshangwuda with Apache License 2.0 | 5 votes |
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 #19
Source File: DefaultProgressListFragment.java From Android-ProgressFragment with Apache License 2.0 | 5 votes |
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_refresh: obtainData(); return true; default: return super.onOptionsItemSelected(item); } }
Example #20
Source File: BaseAty.java From Huochexing12306 with Apache License 2.0 | 5 votes |
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: this.finish(); break; } return super.onOptionsItemSelected(item); }
Example #21
Source File: BasicUsageActivity.java From RefreshActionItem with Apache License 2.0 | 5 votes |
@Override public boolean onCreateOptionsMenu(Menu menu) { getSupportMenuInflater().inflate(R.menu.refresh, menu); MenuItem item = menu.findItem(R.id.refresh_button); mRefreshActionItem = (RefreshActionItem) item.getActionView(); mRefreshActionItem.setMenuItem(item); mRefreshActionItem.setMax(100); mRefreshActionItem.setRefreshActionListener(this); loadData(); return true; }
Example #22
Source File: EditImageAty.java From Huochexing12306 with Apache License 2.0 | 5 votes |
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: this.finish(); break; } return super.onOptionsItemSelected(item); }
Example #23
Source File: AddInfoAty.java From Huochexing12306 with Apache License 2.0 | 5 votes |
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: startActivity(new Intent(AddInfoAty.this, MainActivity.class)); break; } return super.onOptionsItemSelected(item); }
Example #24
Source File: ChangePasswordActivity.java From buddycloud-android with Apache License 2.0 | 5 votes |
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: InputUtils.hideKeyboard(ChangePasswordActivity.this); finish(); return true; default: return super.onOptionsItemSelected(item); } }
Example #25
Source File: MenuItemImpl.java From CSipSimple with GNU General Public License v3.0 | 5 votes |
public MenuItem setTitle(CharSequence title) { mTitle = title; mMenu.onItemsChanged(false); if (mSubMenu != null) { mSubMenu.setHeaderTitle(title); } return this; }
Example #26
Source File: MenuItemWrapper.java From CSipSimple with GNU General Public License v3.0 | 5 votes |
@Override public boolean onMenuItemClick(android.view.MenuItem item) { if (mMenuItemClickListener != null) { return mMenuItemClickListener.onMenuItemClick(this); } return false; }
Example #27
Source File: ExampleListActivity.java From Moring-Alarm with Apache License 2.0 | 5 votes |
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.github: Util.goToGitHub(this); return true; case R.id.about: new AlertDialog.Builder(this) .setTitle(R.string.about) .setMessage(Html.fromHtml(getString(R.string.about_msg))) .show(); break; case R.id.licenses: new AlertDialog.Builder(this) .setTitle(R.string.licenses) .setMessage(Html.fromHtml(getString(R.string.apache_license))) .show(); break; case R.id.contact: final Intent email = new Intent(android.content.Intent.ACTION_SENDTO); String uriText = "mailto:[email protected]" + "?subject=" + URLEncoder.encode("SlidingMenu Demos Feedback"); email.setData(Uri.parse(uriText)); try { startActivity(email); } catch (Exception e) { Toast.makeText(this, R.string.no_email, Toast.LENGTH_SHORT).show(); } break; } return super.onOptionsItemSelected(item); }
Example #28
Source File: MenuItemWrapper.java From zen4android with MIT License | 5 votes |
@Override public boolean onMenuItemClick(android.view.MenuItem item) { if (mMenuItemClickListener != null) { return mMenuItemClickListener.onMenuItemClick(this); } return false; }
Example #29
Source File: MainActivity.java From ContentProviderHelper with MIT License | 5 votes |
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.add: showAddDialog(); return true; case R.id.delete: showDeleteDialog(); return true; } return super.onOptionsItemSelected(item); }
Example #30
Source File: MenuBuilder.java From Libraries-for-Android-Developers with MIT License | 5 votes |
void setExclusiveItemChecked(MenuItem item) { final int group = item.getGroupId(); final int N = mItems.size(); for (int i = 0; i < N; i++) { MenuItemImpl curItem = mItems.get(i); if (curItem.getGroupId() == group) { if (!curItem.isExclusiveCheckable()) continue; if (!curItem.isCheckable()) continue; // Check the item meant to be checked, uncheck the others (that are in the group) curItem.setCheckedInt(curItem == item); } } }