當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。