本文整理匯總了Java中com.actionbarsherlock.internal.view.menu.MenuBuilder類的典型用法代碼示例。如果您正苦於以下問題:Java MenuBuilder類的具體用法?Java MenuBuilder怎麽用?Java MenuBuilder使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
MenuBuilder類屬於com.actionbarsherlock.internal.view.menu包,在下文中一共展示了MenuBuilder類的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onMenuItemSelected
import com.actionbarsherlock.internal.view.menu.MenuBuilder; //導入依賴的package包/類
@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;
}
示例2: AccountChooserButton
import com.actionbarsherlock.internal.view.menu.MenuBuilder; //導入依賴的package包/類
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);
}
示例3: expandItemActionView
import com.actionbarsherlock.internal.view.menu.MenuBuilder; //導入依賴的package包/類
@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;
}
示例4: initializePanelMenu
import com.actionbarsherlock.internal.view.menu.MenuBuilder; //導入依賴的package包/類
private boolean initializePanelMenu() {
Context context = mActivity;//getContext();
// If we have an action bar, initialize the menu with a context themed for it.
if (wActionBar != null) {
TypedValue outValue = new TypedValue();
Resources.Theme currentTheme = context.getTheme();
currentTheme.resolveAttribute(R.attr.actionBarWidgetTheme,
outValue, true);
final int targetThemeRes = outValue.resourceId;
if (targetThemeRes != 0 /*&& context.getThemeResId() != targetThemeRes*/) {
context = new ContextThemeWrapper(context, targetThemeRes);
}
}
mMenu = new MenuBuilder(context);
mMenu.setCallback(this);
return true;
}
示例5: InCallControls
import com.actionbarsherlock.internal.view.menu.MenuBuilder; //導入依賴的package包/類
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);
}
示例6: onMenuItemSelected
import com.actionbarsherlock.internal.view.menu.MenuBuilder; //導入依賴的package包/類
@Override
public boolean onMenuItemSelected(MenuBuilder menu, MenuItem item) {
int id = item.getItemId();
if (item.isCheckable()) {
item.setChecked(!item.isChecked());
}
if (id == R.id.bluetoothButton) {
if (item.isChecked()) {
dispatchTriggerEvent(IOnCallActionTrigger.BLUETOOTH_ON);
} else {
dispatchTriggerEvent(IOnCallActionTrigger.BLUETOOTH_OFF);
}
return true;
} else if (id == R.id.speakerButton) {
if (item.isChecked()) {
dispatchTriggerEvent(IOnCallActionTrigger.SPEAKER_ON);
} else {
dispatchTriggerEvent(IOnCallActionTrigger.SPEAKER_OFF);
}
return true;
} else if (id == R.id.muteButton) {
if (item.isChecked()) {
dispatchTriggerEvent(IOnCallActionTrigger.MUTE_ON);
} else {
dispatchTriggerEvent(IOnCallActionTrigger.MUTE_OFF);
}
return true;
} else if (id == R.id.addCallButton) {
dispatchTriggerEvent(IOnCallActionTrigger.ADD_CALL);
return true;
} else if (id == R.id.mediaSettingsButton) {
dispatchTriggerEvent(IOnCallActionTrigger.MEDIA_SETTINGS);
return true;
}
return false;
}
示例7: initControllerView
import com.actionbarsherlock.internal.view.menu.MenuBuilder; //導入依賴的package包/類
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();
}
示例8: StandaloneActionMode
import com.actionbarsherlock.internal.view.menu.MenuBuilder; //導入依賴的package包/類
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;
}
示例9: onMenuItemSelected
import com.actionbarsherlock.internal.view.menu.MenuBuilder; //導入依賴的package包/類
public boolean onMenuItemSelected(MenuBuilder menu, MenuItem item) {
if (mCallback != null) {
return mCallback.onActionItemClicked(this, item);
} else {
return false;
}
}
示例10: onMenuModeChange
import com.actionbarsherlock.internal.view.menu.MenuBuilder; //導入依賴的package包/類
public void onMenuModeChange(MenuBuilder menu) {
if (mCallback == null) {
return;
}
invalidate();
mContextView.showOverflowMenu();
}
示例11: configPresenters
import com.actionbarsherlock.internal.view.menu.MenuBuilder; //導入依賴的package包/類
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);
}
}
示例12: initForMenu
import com.actionbarsherlock.internal.view.menu.MenuBuilder; //導入依賴的package包/類
@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;
}
示例13: collapseItemActionView
import com.actionbarsherlock.internal.view.menu.MenuBuilder; //導入依賴的package包/類
@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;
}
示例14: StandaloneActionMode
import com.actionbarsherlock.internal.view.menu.MenuBuilder; //導入依賴的package包/類
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;
}