com.actionbarsherlock.internal.view.menu.MenuBuilder Java Examples
The following examples show how to use
com.actionbarsherlock.internal.view.menu.MenuBuilder.
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: ActionBarView.java From Libraries-for-Android-Developers with MIT License | 6 votes |
@Override public boolean expandItemActionView(MenuBuilder menu, MenuItemImpl item) { mExpandedActionView = item.getActionView(); mExpandedHomeLayout.setIcon(mIcon.getConstantState().newDrawable(/* TODO getResources() */)); mCurrentExpandedItem = item; if (mExpandedActionView.getParent() != ActionBarView.this) { addView(mExpandedActionView); } if (mExpandedHomeLayout.getParent() != ActionBarView.this) { addView(mExpandedHomeLayout); } mHomeLayout.setVisibility(GONE); if (mTitleLayout != null) mTitleLayout.setVisibility(GONE); if (mTabScrollView != null) mTabScrollView.setVisibility(GONE); if (mSpinner != null) mSpinner.setVisibility(GONE); if (mCustomNavView != null) mCustomNavView.setVisibility(GONE); requestLayout(); item.setActionViewExpanded(true); if (mExpandedActionView instanceof CollapsibleActionView) { ((CollapsibleActionView) mExpandedActionView).onActionViewExpanded(); } return true; }
Example #3
Source File: ActionBarView.java From CSipSimple with GNU General Public License v3.0 | 6 votes |
@Override public boolean expandItemActionView(MenuBuilder menu, MenuItemImpl item) { mExpandedActionView = item.getActionView(); mExpandedHomeLayout.setIcon(mIcon.getConstantState().newDrawable(/* TODO getResources() */)); mCurrentExpandedItem = item; if (mExpandedActionView.getParent() != ActionBarView.this) { addView(mExpandedActionView); } if (mExpandedHomeLayout.getParent() != ActionBarView.this) { addView(mExpandedHomeLayout); } mHomeLayout.setVisibility(GONE); if (mTitleLayout != null) mTitleLayout.setVisibility(GONE); if (mTabScrollView != null) mTabScrollView.setVisibility(GONE); if (mSpinner != null) mSpinner.setVisibility(GONE); if (mCustomNavView != null) mCustomNavView.setVisibility(GONE); requestLayout(); item.setActionViewExpanded(true); if (mExpandedActionView instanceof CollapsibleActionView) { ((CollapsibleActionView) mExpandedActionView).onActionViewExpanded(); } return true; }
Example #4
Source File: AccountChooserButton.java From CSipSimple with GNU General Public License v3.0 | 6 votes |
public AccountChooserButton(Context context, AttributeSet attrs) { super(context, attrs); telCmp = new ComponentName(getContext(), com.csipsimple.plugins.telephony.CallHandler.class); // UI management setClickable(true); setFocusable(true); setBackgroundResource(R.drawable.abs__spinner_ab_holo_dark); setOrientation(VERTICAL); setPadding(6, 0, 6, 0); setGravity(Gravity.CENTER); // Inflate sub views LayoutInflater inflater = LayoutInflater.from(context); inflater.inflate(R.layout.account_chooser_button, this, true); setOnClickListener(this); textView = (TextView) findViewById(R.id.quickaction_text); imageView = (ImageView) findViewById(R.id.quickaction_icon); mMenuBuilder = new MenuBuilder(getContext()); // Init accounts setAccount(null); }
Example #5
Source File: ActionBarView.java From zen4android with MIT License | 6 votes |
@Override public boolean expandItemActionView(MenuBuilder menu, MenuItemImpl item) { mExpandedActionView = item.getActionView(); mExpandedHomeLayout.setIcon(mIcon.getConstantState().newDrawable(/* TODO getResources() */)); mCurrentExpandedItem = item; if (mExpandedActionView.getParent() != ActionBarView.this) { addView(mExpandedActionView); } if (mExpandedHomeLayout.getParent() != ActionBarView.this) { addView(mExpandedHomeLayout); } mHomeLayout.setVisibility(GONE); if (mTitleLayout != null) mTitleLayout.setVisibility(GONE); if (mTabScrollView != null) mTabScrollView.setVisibility(GONE); if (mSpinner != null) mSpinner.setVisibility(GONE); if (mCustomNavView != null) mCustomNavView.setVisibility(GONE); requestLayout(); item.setActionViewExpanded(true); if (mExpandedActionView instanceof CollapsibleActionView) { ((CollapsibleActionView) mExpandedActionView).onActionViewExpanded(); } return true; }
Example #6
Source File: ActionBarImpl.java From zhangshangwuda with Apache License 2.0 | 5 votes |
public boolean onMenuItemSelected(MenuBuilder menu, MenuItem item) { if (mCallback != null) { return mCallback.onActionItemClicked(this, item); } else { return false; } }
Example #7
Source File: ActionBarView.java From Libraries-for-Android-Developers with MIT License | 5 votes |
@Override public boolean collapseItemActionView(MenuBuilder menu, MenuItemImpl item) { // Do this before detaching the actionview from the hierarchy, in case // it needs to dismiss the soft keyboard, etc. if (mExpandedActionView instanceof CollapsibleActionView) { ((CollapsibleActionView) mExpandedActionView).onActionViewCollapsed(); } removeView(mExpandedActionView); removeView(mExpandedHomeLayout); mExpandedActionView = null; if ((mDisplayOptions & ActionBar.DISPLAY_SHOW_HOME) != 0) { mHomeLayout.setVisibility(VISIBLE); } if ((mDisplayOptions & ActionBar.DISPLAY_SHOW_TITLE) != 0) { if (mTitleLayout == null) { initTitle(); } else { mTitleLayout.setVisibility(VISIBLE); } } if (mTabScrollView != null && mNavigationMode == ActionBar.NAVIGATION_MODE_TABS) { mTabScrollView.setVisibility(VISIBLE); } if (mSpinner != null && mNavigationMode == ActionBar.NAVIGATION_MODE_LIST) { mSpinner.setVisibility(VISIBLE); } if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) { mCustomNavView.setVisibility(VISIBLE); } mExpandedHomeLayout.setIcon(null); mCurrentExpandedItem = null; requestLayout(); item.setActionViewExpanded(false); return true; }
Example #8
Source File: ActionBarImpl.java From zhangshangwuda with Apache License 2.0 | 5 votes |
public void onMenuModeChange(MenuBuilder menu) { if (mCallback == null) { return; } invalidate(); mContextView.showOverflowMenu(); }
Example #9
Source File: ActionBarImpl.java From zen4android with MIT License | 5 votes |
public void onMenuModeChange(MenuBuilder menu) { if (mCallback == null) { return; } invalidate(); mContextView.showOverflowMenu(); }
Example #10
Source File: StandaloneActionMode.java From zen4android with MIT License | 5 votes |
public StandaloneActionMode(Context context, ActionBarContextView view, ActionMode.Callback callback, boolean isFocusable) { mContext = context; mContextView = view; mCallback = callback; mMenu = new MenuBuilder(context).setDefaultShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); mMenu.setCallback(this); mFocusable = isFocusable; }
Example #11
Source File: ActionBarView.java From zhangshangwuda with Apache License 2.0 | 5 votes |
private void configPresenters(MenuBuilder builder) { if (builder != null) { builder.addMenuPresenter(mActionMenuPresenter); builder.addMenuPresenter(mExpandedMenuPresenter); } else { mActionMenuPresenter.initForMenu(mContext, null); mExpandedMenuPresenter.initForMenu(mContext, null); mActionMenuPresenter.updateMenuView(true); mExpandedMenuPresenter.updateMenuView(true); } }
Example #12
Source File: ActionBarImpl.java From Libraries-for-Android-Developers with MIT License | 5 votes |
public boolean onMenuItemSelected(MenuBuilder menu, MenuItem item) { if (mCallback != null) { return mCallback.onActionItemClicked(this, item); } else { return false; } }
Example #13
Source File: InCallCard.java From CSipSimple with GNU General Public License v3.0 | 5 votes |
private void initControllerView() { photo = (ImageView) findViewById(R.id.contact_photo); remoteName = (TextView) findViewById(R.id.contact_name_display_name); remoteSipAddress = (TextView) findViewById(R.id.contact_name_sip_address); elapsedTime = (Chronometer) findViewById(R.id.elapsedTime); callStatusText = (TextView) findViewById(R.id.call_status_text); callSecureBar = (ViewGroup) findViewById(R.id.call_secure_bar); callSecureText = (TextView) findViewById(R.id.call_secure_text); endCallBar = (ViewGroup) findViewById(R.id.end_call_bar); View btn; btn = findViewById(R.id.endButton); btn.setOnClickListener(this); btnMenuBuilder = new MenuBuilder(getContext()); btnMenuBuilder.setCallback(this); MenuInflater inflater = new MenuInflater(getContext()); inflater.inflate(R.menu.in_call_card_menu, btnMenuBuilder); mActionMenuPresenter = new ActionMenuPresenter(getContext()); mActionMenuPresenter.setReserveOverflow(true); btnMenuBuilder.addMenuPresenter(mActionMenuPresenter); updateMenuView(); }
Example #14
Source File: ActionBarView.java From zhangshangwuda with Apache License 2.0 | 5 votes |
@Override public boolean collapseItemActionView(MenuBuilder menu, MenuItemImpl item) { // Do this before detaching the actionview from the hierarchy, in case // it needs to dismiss the soft keyboard, etc. if (mExpandedActionView instanceof CollapsibleActionView) { ((CollapsibleActionView) mExpandedActionView).onActionViewCollapsed(); } removeView(mExpandedActionView); removeView(mExpandedHomeLayout); mExpandedActionView = null; if ((mDisplayOptions & ActionBar.DISPLAY_SHOW_HOME) != 0) { mHomeLayout.setVisibility(VISIBLE); } if ((mDisplayOptions & ActionBar.DISPLAY_SHOW_TITLE) != 0) { if (mTitleLayout == null) { initTitle(); } else { mTitleLayout.setVisibility(VISIBLE); } } if (mTabScrollView != null && mNavigationMode == ActionBar.NAVIGATION_MODE_TABS) { mTabScrollView.setVisibility(VISIBLE); } if (mSpinner != null && mNavigationMode == ActionBar.NAVIGATION_MODE_LIST) { mSpinner.setVisibility(VISIBLE); } if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) { mCustomNavView.setVisibility(VISIBLE); } mExpandedHomeLayout.setIcon(null); mCurrentExpandedItem = null; requestLayout(); item.setActionViewExpanded(false); return true; }
Example #15
Source File: InCallControls.java From CSipSimple with GNU General Public License v3.0 | 5 votes |
public InCallControls(Context context, AttributeSet attrs, int style) { super(context, attrs, style); if(!isInEditMode()) { supportMultipleCalls = SipConfigManager.getPreferenceBooleanValue(getContext(), SipConfigManager.SUPPORT_MULTIPLE_CALLS, false); } final LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, (int) getResources().getDimension(R.dimen.incall_bottom_bar_height)); ActionMenuPresenter mActionMenuPresenter = new ActionMenuPresenter(getContext()) { public void bindItemView(MenuItemImpl item, MenuView.ItemView itemView) { super.bindItemView(item, itemView); View actionItemView = (View) itemView; actionItemView.setBackgroundResource(R.drawable.btn_compound_background); } }; mActionMenuPresenter.setReserveOverflow(true); // Full width mActionMenuPresenter.setWidthLimit( getContext().getResources().getDisplayMetrics().widthPixels, true); // We use width limit, no need to limit items. mActionMenuPresenter.setItemLimit(20); btnMenuBuilder = new MenuBuilder(getContext()); btnMenuBuilder.setCallback(this); MenuInflater inflater = new MenuInflater(getContext()); inflater.inflate(R.menu.in_call_controls_menu, btnMenuBuilder); btnMenuBuilder.addMenuPresenter(mActionMenuPresenter); ActionMenuView menuView = (ActionMenuView) mActionMenuPresenter.getMenuView(this); menuView.setBackgroundResource(R.drawable.abs__ab_bottom_transparent_dark_holo); this.addView(menuView, layoutParams); }
Example #16
Source File: StandaloneActionMode.java From CSipSimple with GNU General Public License v3.0 | 5 votes |
public StandaloneActionMode(Context context, ActionBarContextView view, Callback callback, boolean isFocusable) { mContext = context; mContextView = view; mCallback = callback; mMenu = new MenuBuilder(context).setDefaultShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); mMenu.setCallback(this); mFocusable = isFocusable; }
Example #17
Source File: ActionBarView.java From android-apps with MIT License | 5 votes |
@Override public boolean collapseItemActionView(MenuBuilder menu, MenuItemImpl item) { // Do this before detaching the actionview from the hierarchy, in case // it needs to dismiss the soft keyboard, etc. if (mExpandedActionView instanceof CollapsibleActionView) { ((CollapsibleActionView) mExpandedActionView).onActionViewCollapsed(); } removeView(mExpandedActionView); removeView(mExpandedHomeLayout); mExpandedActionView = null; if ((mDisplayOptions & ActionBar.DISPLAY_SHOW_HOME) != 0) { mHomeLayout.setVisibility(VISIBLE); } if ((mDisplayOptions & ActionBar.DISPLAY_SHOW_TITLE) != 0) { if (mTitleLayout == null) { initTitle(); } else { mTitleLayout.setVisibility(VISIBLE); } } if (mTabScrollView != null && mNavigationMode == ActionBar.NAVIGATION_MODE_TABS) { mTabScrollView.setVisibility(VISIBLE); } if (mSpinner != null && mNavigationMode == ActionBar.NAVIGATION_MODE_LIST) { mSpinner.setVisibility(VISIBLE); } if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) { mCustomNavView.setVisibility(VISIBLE); } mExpandedHomeLayout.setIcon(null); mCurrentExpandedItem = null; requestLayout(); item.setActionViewExpanded(false); return true; }
Example #18
Source File: ActionBarImpl.java From android-apps with MIT License | 5 votes |
public void onMenuModeChange(MenuBuilder menu) { if (mCallback == null) { return; } invalidate(); mContextView.showOverflowMenu(); }
Example #19
Source File: ActionBarImpl.java From CSipSimple with GNU General Public License v3.0 | 5 votes |
public void onMenuModeChange(MenuBuilder menu) { if (mCallback == null) { return; } invalidate(); mContextView.showOverflowMenu(); }
Example #20
Source File: ActionBarView.java From CSipSimple with GNU General Public License v3.0 | 5 votes |
private void configPresenters(MenuBuilder builder) { if (builder != null) { builder.addMenuPresenter(mActionMenuPresenter); builder.addMenuPresenter(mExpandedMenuPresenter); } else { mActionMenuPresenter.initForMenu(mContext, null); mExpandedMenuPresenter.initForMenu(mContext, null); mActionMenuPresenter.updateMenuView(true); mExpandedMenuPresenter.updateMenuView(true); } }
Example #21
Source File: ActionBarImpl.java From android-apps with MIT License | 5 votes |
public boolean onMenuItemSelected(MenuBuilder menu, MenuItem item) { if (mCallback != null) { return mCallback.onActionItemClicked(this, item); } else { return false; } }
Example #22
Source File: StandaloneActionMode.java From zhangshangwuda with Apache License 2.0 | 5 votes |
public StandaloneActionMode(Context context, ActionBarContextView view, ActionMode.Callback callback, boolean isFocusable) { mContext = context; mContextView = view; mCallback = callback; mMenu = new MenuBuilder(context).setDefaultShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); mMenu.setCallback(this); mFocusable = isFocusable; }
Example #23
Source File: ActionBarView.java From CSipSimple with GNU General Public License v3.0 | 5 votes |
@Override public boolean collapseItemActionView(MenuBuilder menu, MenuItemImpl item) { // Do this before detaching the actionview from the hierarchy, in case // it needs to dismiss the soft keyboard, etc. if (mExpandedActionView instanceof CollapsibleActionView) { ((CollapsibleActionView) mExpandedActionView).onActionViewCollapsed(); } removeView(mExpandedActionView); removeView(mExpandedHomeLayout); mExpandedActionView = null; if ((mDisplayOptions & ActionBar.DISPLAY_SHOW_HOME) != 0) { mHomeLayout.setVisibility(VISIBLE); } if ((mDisplayOptions & ActionBar.DISPLAY_SHOW_TITLE) != 0) { if (mTitleLayout == null) { initTitle(); } else { mTitleLayout.setVisibility(VISIBLE); } } if (mTabScrollView != null && mNavigationMode == ActionBar.NAVIGATION_MODE_TABS) { mTabScrollView.setVisibility(VISIBLE); } if (mSpinner != null && mNavigationMode == ActionBar.NAVIGATION_MODE_LIST) { mSpinner.setVisibility(VISIBLE); } if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) { mCustomNavView.setVisibility(VISIBLE); } mExpandedHomeLayout.setIcon(null); mCurrentExpandedItem = null; requestLayout(); item.setActionViewExpanded(false); return true; }
Example #24
Source File: StandaloneActionMode.java From android-apps with MIT License | 5 votes |
public StandaloneActionMode(Context context, ActionBarContextView view, ActionMode.Callback callback, boolean isFocusable) { mContext = context; mContextView = view; mCallback = callback; mMenu = new MenuBuilder(context).setDefaultShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); mMenu.setCallback(this); mFocusable = isFocusable; }
Example #25
Source File: ActionBarView.java From zen4android with MIT License | 5 votes |
@Override public boolean collapseItemActionView(MenuBuilder menu, MenuItemImpl item) { // Do this before detaching the actionview from the hierarchy, in case // it needs to dismiss the soft keyboard, etc. if (mExpandedActionView instanceof CollapsibleActionView) { ((CollapsibleActionView) mExpandedActionView).onActionViewCollapsed(); } removeView(mExpandedActionView); removeView(mExpandedHomeLayout); mExpandedActionView = null; if ((mDisplayOptions & ActionBar.DISPLAY_SHOW_HOME) != 0) { mHomeLayout.setVisibility(VISIBLE); } if ((mDisplayOptions & ActionBar.DISPLAY_SHOW_TITLE) != 0) { if (mTitleLayout == null) { initTitle(); } else { mTitleLayout.setVisibility(VISIBLE); } } if (mTabScrollView != null && mNavigationMode == ActionBar.NAVIGATION_MODE_TABS) { mTabScrollView.setVisibility(VISIBLE); } if (mSpinner != null && mNavigationMode == ActionBar.NAVIGATION_MODE_LIST) { mSpinner.setVisibility(VISIBLE); } if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) { mCustomNavView.setVisibility(VISIBLE); } mExpandedHomeLayout.setIcon(null); mCurrentExpandedItem = null; requestLayout(); item.setActionViewExpanded(false); return true; }
Example #26
Source File: ActionBarImpl.java From zen4android with MIT License | 5 votes |
public boolean onMenuItemSelected(MenuBuilder menu, MenuItem item) { if (mCallback != null) { return mCallback.onActionItemClicked(this, item); } else { return false; } }
Example #27
Source File: ActionBarImpl.java From Libraries-for-Android-Developers with MIT License | 5 votes |
public void onMenuModeChange(MenuBuilder menu) { if (mCallback == null) { return; } invalidate(); mContextView.showOverflowMenu(); }
Example #28
Source File: ActionBarView.java From zen4android with MIT License | 5 votes |
private void configPresenters(MenuBuilder builder) { if (builder != null) { builder.addMenuPresenter(mActionMenuPresenter); builder.addMenuPresenter(mExpandedMenuPresenter); } else { mActionMenuPresenter.initForMenu(mContext, null); mExpandedMenuPresenter.initForMenu(mContext, null); mActionMenuPresenter.updateMenuView(true); mExpandedMenuPresenter.updateMenuView(true); } }
Example #29
Source File: ActionBarView.java From android-apps with MIT License | 5 votes |
@Override public void initForMenu(Context context, MenuBuilder menu) { // Clear the expanded action view when menus change. if (mMenu != null && mCurrentExpandedItem != null) { mMenu.collapseItemActionView(mCurrentExpandedItem); } mMenu = menu; }
Example #30
Source File: DonutHeHelper.java From PopupMenuCompat with MIT License | 4 votes |
public DonutHeHelper( Context context ) { super( context ); this.menu = new MenuBuilder( context ); this.builder = new AlertDialog.Builder( context ); }