本文整理汇总了Java中com.actionbarsherlock.view.MenuItem.OnMenuItemClickListener类的典型用法代码示例。如果您正苦于以下问题:Java OnMenuItemClickListener类的具体用法?Java OnMenuItemClickListener怎么用?Java OnMenuItemClickListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OnMenuItemClickListener类属于com.actionbarsherlock.view.MenuItem包,在下文中一共展示了OnMenuItemClickListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateOptionsMenu
import com.actionbarsherlock.view.MenuItem.OnMenuItemClickListener; //导入依赖的package包/类
@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;
}
});
}
示例2: onCreateOptionsMenu
import com.actionbarsherlock.view.MenuItem.OnMenuItemClickListener; //导入依赖的package包/类
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
int actionRoom = getResources().getBoolean(R.bool.menu_in_bar) ? MenuItem.SHOW_AS_ACTION_IF_ROOM : MenuItem.SHOW_AS_ACTION_NEVER;
MenuItem addContactMenu = menu.add(R.string.menu_add_to_contacts);
addContactMenu.setIcon(R.drawable.ic_add_contact_holo_dark).setShowAsAction(actionRoom);
addContactMenu.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
Intent it = ContactsWrapper.getInstance().getAddContactIntent(null, remoteFrom);
startActivity(it);
return true;
}
});
}
示例3: onCreateOptionsMenu
import com.actionbarsherlock.view.MenuItem.OnMenuItemClickListener; //导入依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
if (mIsShowSaveButton){
MenuItem miSave = menu.add("保存");
miSave.setIcon(R.drawable.head_save);
miSave.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
miSave.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
savePInfo(true);
return false;
}
});
}
return super.onCreateOptionsMenu(menu);
}
示例4: onCreateOptionsMenu
import com.actionbarsherlock.view.MenuItem.OnMenuItemClickListener; //导入依赖的package包/类
/**
* Responding to menu items
*/
@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.mainmenu, menu);
// return true;
final MenuItem refresh = (MenuItem) menu.findItem(R.id.action_refresh);
refresh.setOnMenuItemClickListener(new OnMenuItemClickListener() {
// on selecting show progress spinner for 1s
public boolean onMenuItemClick(MenuItem item) {
// item.setActionView(R.layout.progress_action);
handler.postDelayed(new Runnable() {
public void run() {
refresh.setActionView(null);
}
}, 1000);
return false;
}
});
return super.onCreateOptionsMenu(menu);
}
示例5: onCreateOptionsMenu
import com.actionbarsherlock.view.MenuItem.OnMenuItemClickListener; //导入依赖的package包/类
/**
* Responding to menu items
*/
@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.promomenu, menu);
// return true;
final MenuItem refresh = (MenuItem) menu.findItem(R.id.action_refresh);
refresh.setOnMenuItemClickListener(new OnMenuItemClickListener() {
// on selecting show progress spinner for 1s
public boolean onMenuItemClick(MenuItem item) {
// item.setActionView(R.layout.progress_action);
handler.postDelayed(new Runnable() {
public void run() {
refresh.setActionView(null);
}
}, 1000);
return false;
}
});
return super.onCreateOptionsMenu(menu);
}
示例6: onCreateOptionsMenu
import com.actionbarsherlock.view.MenuItem.OnMenuItemClickListener; //导入依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuItem menuItem = menu.add("delete");
menuItem.setIcon(R.drawable.action_bar_delete_btn_bg)
.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM
| MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
menuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
dialog();
return true;
}
});
return true;
}
示例7: onCreateOptionsMenu
import com.actionbarsherlock.view.MenuItem.OnMenuItemClickListener; //导入依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
mDeleteMenuItem = menu.add(R.string.delete)
.setIcon(R.drawable.action_bar_delete_btn_bg)
.setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_ALWAYS);
mDeleteMenuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
mFavAdapter.setMultiChoiceMode(!mInDeleteMode);
mInDeleteMode = !mInDeleteMode;
if (mInDeleteMode) {
showBottomPanel();
} else {
hideBottomPanel();
}
return true;
}
});
return true;
}
示例8: onCreateOptionsMenu
import com.actionbarsherlock.view.MenuItem.OnMenuItemClickListener; //导入依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
MenuInflater inflater = getSupportMenuInflater();
inflater.inflate(R.menu.star, menu);
if (DEBUG_TRANSITIONS) {
final MenuItem toggleSocial =
menu.add(mLoaderFragment.getLoadStreamItems() ? "less" : "more");
toggleSocial.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
toggleSocial.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
mLoaderFragment.toggleLoadStreamItems();
supportInvalidateOptionsMenu();
return false;
}
});
}
return true;
}
示例9: onCreateOptionsMenu
import com.actionbarsherlock.view.MenuItem.OnMenuItemClickListener; //导入依赖的package包/类
@Override
public boolean onCreateOptionsMenu(com.actionbarsherlock.view.Menu menu) {
menu.add(R.string.about)
.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(
com.actionbarsherlock.view.MenuItem item) {
startActivity(new Intent(MainActivity.this,
AboutActivity.class));
return true;
}
})
.setShowAsAction(
com.actionbarsherlock.view.MenuItem.SHOW_AS_ACTION_NEVER);
return super.onCreateOptionsMenu(menu);
}
示例10: onCreateOptionsMenu
import com.actionbarsherlock.view.MenuItem.OnMenuItemClickListener; //导入依赖的package包/类
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
int actionRoom = getResources().getBoolean(R.bool.menu_in_bar) ? MenuItem.SHOW_AS_ACTION_IF_ROOM : MenuItem.SHOW_AS_ACTION_NEVER;
MenuItem delMenu = menu.add(R.string.callLog_delete_all);
delMenu.setIcon(R.drawable.ic_ab_trash_dark).setShowAsAction(actionRoom);
delMenu.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
deleteAllCalls();
return true;
}
});
}
示例11: onCreateOptionsMenu
import com.actionbarsherlock.view.MenuItem.OnMenuItemClickListener; //导入依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// MenuItem miAdd = menu.add("添加乘车人");
// miAdd.setIcon(R.drawable.head_add);
// miAdd.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
// miAdd.setOnMenuItemClickListener(new OnMenuItemClickListener() {
//
// @Override
// public boolean onMenuItemClick(MenuItem item) {
// Intent intent = new Intent(PassengerMangAty.this,
// EditPassengerAty.class);
// intent.putExtra(EditPassengerAty.EXTRA_OPERATE, EditPassengerAty.EXTRA_OPERATE_ADD);
// startActivityForResult(intent, REQUEST_ADD);
// return false;
// }
// });
MenuItem miSync = menu.add("同步12306乘车人");
miSync.setIcon(R.drawable.refesh);
miSync.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
miSync.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
//初始化变量
mNoPInfoAtLocalType = 0;
mPInfoConflictType = 0;
syncPassengers();
return false;
}
});
return super.onCreateOptionsMenu(menu);
}
示例12: onCreateOptionsMenu
import com.actionbarsherlock.view.MenuItem.OnMenuItemClickListener; //导入依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
mCommit = menu.add("提交")
.setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_ALWAYS);
mCommit.setEnabled(false);
mCommit.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
publishFeedback();
return true;
}
});
return true;
}
示例13: onPrepareOptionsMenu
import com.actionbarsherlock.view.MenuItem.OnMenuItemClickListener; //导入依赖的package包/类
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
final MenuItem starredMenuItem = menu.findItem(R.id.menu_star);
starredMenuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
// Toggle "starred" state
// Make sure there is a contact
if (mLookupUri != null) {
// Read the current starred value from the UI instead of using the last
// loaded state. This allows rapid tapping without writing the same
// value several times
final boolean isStarred = starredMenuItem.isChecked();
// To improve responsiveness, swap out the picture (and tag) in the UI already
ContactDetailDisplayUtils.configureStarredMenuItem(starredMenuItem,
mContactData.isDirectoryEntry(), mContactData.isUserProfile(),
!isStarred);
// Now perform the real save
Intent intent = ScContactSaveService.createSetStarredIntent(
ScContactDetailActivity.this, mLookupUri, !isStarred);
ScContactDetailActivity.this.startService(intent);
}
return true;
}
});
// If there is contact data, update the starred state
if (mContactData != null) {
ContactDetailDisplayUtils.configureStarredMenuItem(starredMenuItem,
mContactData.isDirectoryEntry(), mContactData.isUserProfile(),
mContactData.getStarred());
}
return true;
}
示例14: actionBarItemsListeners
import com.actionbarsherlock.view.MenuItem.OnMenuItemClickListener; //导入依赖的package包/类
private void actionBarItemsListeners (Menu menu){
MenuItem menuLogoff = (MenuItem) menu.findItem(R.id.menu_logoff);
menuLogoff.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
finish();
return false;
}
});
}
示例15: onCreateView
import com.actionbarsherlock.view.MenuItem.OnMenuItemClickListener; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.dialer_digit, container, false);
// Store the backgrounds objects that will be in use later
/*
Resources r = getResources();
digitsBackground = r.getDrawable(R.drawable.btn_dial_textfield_active);
digitsEmptyBackground = r.getDrawable(R.drawable.btn_dial_textfield_normal);
*/
// Store some object that could be useful later
digits = (DigitsEditText) v.findViewById(R.id.digitsText);
dialPad = (Dialpad) v.findViewById(R.id.dialPad);
callBar = (DialerCallBar) v.findViewById(R.id.dialerCallBar);
autoCompleteList = (ListView) v.findViewById(R.id.autoCompleteList);
rewriteTextInfo = (TextView) v.findViewById(R.id.rewriteTextInfo);
accountChooserButton = (AccountChooserButton) v.findViewById(R.id.accountChooserButton);
accountChooserFilterItem = accountChooserButton.addExtraMenuItem(R.string.apply_rewrite);
accountChooserFilterItem.setCheckable(true);
accountChooserFilterItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
setRewritingFeature(!accountChooserFilterItem.isChecked());
return true;
}
});
setRewritingFeature(prefsWrapper.getPreferenceBooleanValue(SipConfigManager.REWRITE_RULES_DIALER));
dialerLayout = (DialerLayout) v.findViewById(R.id.top_digit_dialer);
//switchTextView = (ImageButton) v.findViewById(R.id.switchTextView);
// isTablet = Compatibility.isTabletScreen(getActivity());
// Digits field setup
if(savedInstanceState != null) {
isDigit = savedInstanceState.getBoolean(TEXT_MODE_KEY, isDigit);
}
digits.setOnEditorActionListener(keyboardActionListener);
// Layout
dialerLayout.setForceNoList(mDualPane);
dialerLayout.setAutoCompleteListVisibiltyChangedListener(this);
// Account chooser button setup
accountChooserButton.setShowExternals(true);
accountChooserButton.setOnAccountChangeListener(accountButtonChangeListener);
// Dialpad
dialPad.setOnDialKeyListener(this);
// We only need to add the autocomplete list if we
autoCompleteList.setAdapter(autoCompleteAdapter);
autoCompleteList.setOnItemClickListener(autoCompleteListItemListener);
autoCompleteList.setFastScrollEnabled(true);
// Bottom bar setup
callBar.setOnDialActionListener(this);
callBar.setVideoEnabled(prefsWrapper.getPreferenceBooleanValue(SipConfigManager.USE_VIDEO));
//switchTextView.setVisibility(Compatibility.isCompatible(11) ? View.GONE : View.VISIBLE);
// Init other buttons
initButtons(v);
// Ensure that current mode (text/digit) is applied
setTextDialing(!isDigit, true);
if(initText != null) {
digits.setText(initText);
initText = null;
}
// Apply third party theme if any
applyTheme(v);
v.setOnKeyListener(this);
applyTextToAutoComplete();
return v;
}