本文整理汇总了Java中android.view.MenuItem.isChecked方法的典型用法代码示例。如果您正苦于以下问题:Java MenuItem.isChecked方法的具体用法?Java MenuItem.isChecked怎么用?Java MenuItem.isChecked使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.MenuItem
的用法示例。
在下文中一共展示了MenuItem.isChecked方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupImageButton
import android.view.MenuItem; //导入方法依赖的package包/类
private void setupImageButton(TintedImageButton button, final MenuItem item) {
// Store and recover the level of image as button.setimageDrawable
// resets drawable to default level.
int currentLevel = item.getIcon().getLevel();
button.setImageDrawable(item.getIcon());
item.getIcon().setLevel(currentLevel);
if (item.isChecked()) {
button.setTint(ApiCompatibilityUtils.getColorStateList(
button.getResources(), R.color.blue_mode_tint));
}
button.setEnabled(item.isEnabled());
button.setFocusable(item.isEnabled());
button.setContentDescription(item.getTitleCondensed());
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
mAppMenu.onItemClick(item);
}
});
// Menu items may be hidden by command line flags before they get to this point.
button.setVisibility(item.isVisible() ? View.VISIBLE : View.GONE);
}
示例2: onOptionsItemSelected
import android.view.MenuItem; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id=item.getItemId();
switch (id){
case R.id.toRecycler:
startActivity(new Intent(this,RecyclerViewActivity.class));
return true;
case R.id.ban_refresh:
boolean enable=item.isChecked();
item.setChecked(!enable);
refreshLoadLayout.setRefreshingEnabled(enable);
return true;
case R.id.ban_load:
boolean checked=item.isChecked();
item.setChecked(!checked);
refreshLoadLayout.setLoadingEnabled(checked);
return true;
default:
return super.onOptionsItemSelected(item);
}
}
示例3: onOptionsItemSelected
import android.view.MenuItem; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if(item.getItemId() == R.id.action_wrap_lines){
item.setChecked(!item.isChecked());
wrap = item.isChecked();
PrefUtils.set(PrefUtils.CODE_WRAP, wrap);
if(ViewerActivity.ViewerType.RepoFile.equals(mPresenter.getViewerType())){
loadCode(mPresenter.getDownloadSource(), mPresenter.getExtension());
} else if(ViewerActivity.ViewerType.DiffFile.equals(mPresenter.getViewerType())){
loadDiffFile(mPresenter.getCommitFile().getPatch());
}
return true;
} else if(item.getItemId() == R.id.action_refresh){
refresh();
return true;
}
return super.onOptionsItemSelected(item);
}
示例4: onOptionsItemSelected
import android.view.MenuItem; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.show_user_video) {
item.setChecked(!item.isChecked());
showUserVideo = item.isChecked();
if (showUserVideo) {
initVideoDataUser();
} else {
initVideoDataAll();
}
adapter.resetData(videoList.toArray(), false);
PreferencesUtils.putBoolean(SHOW_USER_VIDEO, showUserVideo);
return true;
}
return super.onOptionsItemSelected(item);
}
示例5: onNavigationItemSelected
import android.view.MenuItem; //导入方法依赖的package包/类
@Override
public boolean onNavigationItemSelected(@NonNull final MenuItem item) {
mDrawerLayout.closeDrawer(GravityCompat.START);
if (item.isChecked()) {
return true;
}
mItemId = item.getItemId();
return true;
}
示例6: onOptionsItemSelected
import android.view.MenuItem; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_zoom_out:
webview.zoomOut();
return true;
case R.id.menu_zoom_in:
webview.zoomIn();
return true;
case R.id.menu_swap_map:
portraitMap = !portraitMap;
SharedPreferences sharedPref = getContext().getSharedPreferences("settings", MODE_PRIVATE);
SharedPreferences.Editor e = sharedPref.edit();
e.putBoolean("pref_portrait_map", portraitMap);
e.apply();
if (portraitMap) {
webview.getSettings().setUseWideViewPort(false);
webview.loadUrl("file:///android_asset/map-" + networkId + "-portrait.html");
} else {
webview.getSettings().setUseWideViewPort(true);
webview.loadUrl("file:///android_asset/map-" + networkId + ".html");
}
return true;
case R.id.menu_mock_location:
mockLocationMode = !item.isChecked();
item.setChecked(mockLocationMode);
return true;
}
return super.onOptionsItemSelected(item);
}
示例7: onOptionsItemSelected
import android.view.MenuItem; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.isCheckable()) {
item.setChecked(!item.isChecked());
if (item.getItemId() == MENU_ENABLE_REDIRECTS) {
enableRedirects = item.isChecked();
} else if (item.getItemId() == MENU_ENABLE_RELATIVE_REDIRECTs) {
enableRelativeRedirects = item.isChecked();
} else if (item.getItemId() == MENU_ENABLE_CIRCULAR_REDIRECTS) {
enableCircularRedirects = item.isChecked();
}
}
return super.onOptionsItemSelected(item);
}
示例8: setPreviousSelectedItemIdInternal
import android.view.MenuItem; //导入方法依赖的package包/类
private void setPreviousSelectedItemIdInternal() {
final Menu menu = getMenu();
for (int i = 0; i < menu.size(); i++) {
final MenuItem item = menu.getItem(i);
if (item.isChecked()) {
mPreviousSelectedItemId = item.getItemId();
break;
}
}
}
开发者ID:Applications-Development,项目名称:SimpleRssReader,代码行数:13,代码来源:HistoryAwareBottomNavigationView.java
示例9: onOptionsItemSelected
import android.view.MenuItem; //导入方法依赖的package包/类
@Override public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.wrap) {
item.setChecked(!item.isChecked());
isWrap = item.isChecked();
setLoading(true);
onSetCode(viewModel.getDownloadedStream());
}
return super.onOptionsItemSelected(item);
}
示例10: onNavigationItemSelected
import android.view.MenuItem; //导入方法依赖的package包/类
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
// Handle navigation view item clicks here.
switch (item.getItemId()) {
case R.id.nav_signin:
signIn();
break;
case R.id.nav_signout:
signOut();
break;
case R.id.nav_register:
getRegisterRequest();
break;
case R.id.nav_auth:
getSignRequest();
break;
case R.id.nav_gitbuh:
Intent browser = new Intent(Intent.ACTION_VIEW,
Uri.parse(getString(R.string.github_location)));
this.startActivity(browser);
break;
case R.id.nav_allowReregistration:
boolean newStatus = !item.isChecked();
item.setChecked(newStatus);
return true;
}
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
return true;
}
示例11: onOptionsItemSelected
import android.view.MenuItem; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
// Respond to the action bar's Up/Home button
case android.R.id.home:
bluetoothService.stop();
NavUtils.navigateUpFromSameTask(this);
return true;
case R.id.action_reconnect:
reconnect();
return true;
case R.id.action_clear:
// chatAdapter.clear();
return true;
case R.id.checkable_auto_scroll:
autoScrollIsChecked = !item.isChecked();
item.setChecked(autoScrollIsChecked);
return true;
case R.id.checkable_show_messages:
openTimePickerDialog(false);
return true;
case R.id.checkable_show_time:
showTimeIsChecked = !item.isChecked();
item.setChecked(showTimeIsChecked);
// chatAdapter.notifyDataSetChanged();
return true;
}
return super.onOptionsItemSelected(item);
}
示例12: setBookMarkIcon
import android.view.MenuItem; //导入方法依赖的package包/类
private void setBookMarkIcon(MenuItem item) {
TypedValue typedvalueattr = new TypedValue();
getActivity().getTheme().resolveAttribute(R.attr.menuBookmarkIcon, typedvalueattr, true);
StateListDrawable stateListDrawable = (StateListDrawable) getResources().getDrawable(typedvalueattr.resourceId);
int[] state = {item.isChecked() ? android.R.attr.state_checked : -android.R.attr.state_checked};
stateListDrawable.setState(state);
item.setIcon(stateListDrawable.getCurrent());
item.setTitle(item.isChecked() ? R.string.action_remove_book_mark : R.string.action_add_book_mark);
}
示例13: handleButtomNavigationItem
import android.view.MenuItem; //导入方法依赖的package包/类
boolean handleButtomNavigationItem(MenuItem item) {
if (!item.isChecked()) {
saveBottomBarPosition(item);
return switchBottomNavigationTo(item.getItemId());
} else {
return false;
}
}
开发者ID:fekracomputers,项目名称:IslamicLibraryAndroid,代码行数:9,代码来源:BrowsingActivityNavigationController.java
示例14: onActionItemClicked
import android.view.MenuItem; //导入方法依赖的package包/类
@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
int id = item.getItemId();
if (id == R.id.select_all) {
if (!item.isChecked()) {
view.setSelectAll(true);
item.setChecked(true);
item.setTitle(R.string.cancel_select_all);
} else {
view.setSelectAll(false);
}
} else if (id == R.id.copy && !checkedList.isEmpty()) {
fileClipboard.setData(true, checkedList);
destroyActionMode();
} else if (id == R.id.cut && !checkedList.isEmpty()) {
fileClipboard.setData(false, checkedList);
destroyActionMode();
} else if (id == R.id.paste) {
destroyActionMode();
fileClipboard.paste(context, explorerContext.getCurrentDirectory(), new OnClipboardPasteFinishListener() {
@Override
public void onFinish(int count, String error) {
fileClipboard.showPasteResult(context, count, error);
}
});
} else if (id == R.id.rename) {
doRenameAction();
} else if (id == R.id.share) {
shareFile();
} else if (id == R.id.delete) {
doDeleteAction();
} else {
return false;
}
return true;
}
示例15: onOptionsItemSelected
import android.view.MenuItem; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_clear_all:
mLogLines.clear();
logOnUiThread("");
break;
case R.id.action_keep_screen_on:
boolean checked = !item.isChecked();
setKeepScreenOn(checked);
item.setChecked(checked);
break;
}
return super.onOptionsItemSelected(item);
}