当前位置: 首页>>代码示例>>Java>>正文


Java MenuItem.getOrder方法代码示例

本文整理汇总了Java中android.view.MenuItem.getOrder方法的典型用法代码示例。如果您正苦于以下问题:Java MenuItem.getOrder方法的具体用法?Java MenuItem.getOrder怎么用?Java MenuItem.getOrder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.view.MenuItem的用法示例。


在下文中一共展示了MenuItem.getOrder方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onNavigationItemSelected

import android.view.MenuItem; //导入方法依赖的package包/类
@Override
public boolean onNavigationItemSelected(final MenuItem menuItem) {
    if (menuItem.getItemId() != R.id.navigation_item_settings) {
        if (mSelectedNavigationPosition != menuItem.getOrder() ||
                mSelectedAccountId != mAccounts.get(0).id()) {
            mPager.post(new Runnable() {
                @Override
                public void run() {
                    mPager.setCurrentItem(menuItem.getOrder(), false);
                }
            });
        }

        selectNavigation(menuItem);
    } else {
        ActivityCompat.startActivity(this, new Intent(this, SettingsActivity.class), null);
    }

    return true;
}
 
开发者ID:mecid,项目名称:robird-reborn,代码行数:21,代码来源:HomeActivity.java

示例2: onContextItemSelected

import android.view.MenuItem; //导入方法依赖的package包/类
@Override
public boolean onContextItemSelected(MenuItem item) {
    // TODO Auto-generated method stub
    int clickedItemPosition = item.getOrder();
    TodoEvent event = eventList.get(clickedItemPosition);
    switch (item.getItemId()) {
        case 1:
            event.delete();
            eventList.remove(clickedItemPosition);
            MyAdapter.notifyItemRangeRemoved(clickedItemPosition, 1);
            MyAdapter.setTodoEventSize(MyAdapter.getTodoEventSize()-1);
            Snackbar.make(MyAdapter.getHolder().itemView,"你删掉了这条项目",Snackbar.LENGTH_SHORT).show();
            showNoEvent();
            break;
        default:
            break;
    }
    return super.onContextItemSelected(item);
}
 
开发者ID:wendyltan,项目名称:EasyTodo,代码行数:20,代码来源:MainActivity.java

示例3: onNavigationItemSelected

import android.view.MenuItem; //导入方法依赖的package包/类
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
    int order = item.getOrder();

    if (order >= 0 && order <= 3) {
        handleToolbarElevation(order);
        switchFragment(order);
        return true;
    }

    return false;
}
 
开发者ID:iAcn,项目名称:MBEStyle,代码行数:13,代码来源:MainActivity.java

示例4: onMenuItemClick

import android.view.MenuItem; //导入方法依赖的package包/类
@Override
public boolean onMenuItemClick(MenuItem item) {
  switch (item.getOrder()) {
    case 0:
      Intent intent = new Intent(getActivity(), WeatherActivity.class);
      startActivity(intent);
      return true;
    case 1:
      AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
      View alertDialogView = LayoutInflater.from(getActivity()).inflate(R.layout.alert_add_todo, null);
      builder.setView(alertDialogView);
      final EditText contentEt = (EditText) alertDialogView.findViewById(R.id.contentEt);
      builder.setMessage(R.string.please_type);
      builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
          String todoContent = contentEt.getText().toString();
          if (todoContent.length() > 0) {
            localTodoData.add(todoContent);
            SharedPreferencesUtil.saveLocalTodos(localTodoData, getActivity());
            contentEt.setText("");
            fetchData();
          }
        }
      });
      builder.setNegativeButton(android.R.string.cancel, null);
      builder.create().show();
      return true;
    default:
      return false;
  }
}
 
开发者ID:tomoya92,项目名称:android-apps,代码行数:33,代码来源:TodoFragment.java

示例5: selectNavigation

import android.view.MenuItem; //导入方法依赖的package包/类
public void selectNavigation(MenuItem menuItem) {
    mSelectedAccountId = mAccounts.get(0).id();
    mSelectedNavigationPosition = menuItem.getOrder();
    setTitle(menuItem.getTitle());
    menuItem.setChecked(true);
    mDrawerLayout.closeDrawers();
}
 
开发者ID:mecid,项目名称:robird-reborn,代码行数:8,代码来源:HomeActivity.java

示例6: compare

import android.view.MenuItem; //导入方法依赖的package包/类
@Override
public int compare(MenuItem o1, MenuItem o2) {
    return o1.getOrder() - o2.getOrder();
}
 
开发者ID:kobakei,项目名称:MaterialFabSpeedDial,代码行数:5,代码来源:FabSpeedDialMenu.java


注:本文中的android.view.MenuItem.getOrder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。