android.view.MenuItem.getOrder()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(167)

本文整理了Java中android.view.MenuItem.getOrder()方法的一些代码示例,展示了MenuItem.getOrder()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MenuItem.getOrder()方法的具体详情如下:
包路径:android.view.MenuItem
类名称:MenuItem
方法名:getOrder

暂无

代码示例

代码示例来源:origin: robolectric/robolectric

@Override
 public int compare(MenuItem a, MenuItem b) {
  if (a.getOrder() == b.getOrder()) {
   return 0;
  } else if (a.getOrder() > b.getOrder()) {
   return 1;
  } else {
   return -1;
  }
 }
}

代码示例来源:origin: square/assertj-android

public MenuItemAssert hasOrder(int order) {
 isNotNull();
 int actualOrder = actual.getOrder();
 assertThat(actualOrder) //
   .overridingErrorMessage("Expected order <%s> but was <%s>.", order, actualOrder) //
   .isEqualTo(order);
 return this;
}

代码示例来源:origin: alexvasilkov/GestureViews

break;
case R.string.menu_fit_method:
  fitMethod = Settings.Fit.values()[item.getOrder()];
  break;
case R.string.menu_bounds_type:
  boundsType = Settings.Bounds.values()[item.getOrder()];
  break;
case R.string.menu_gravity:
  gravity = GravityType.values()[item.getOrder()].gravity;
  break;
case R.string.menu_enable_slow:

代码示例来源:origin: ZieIony/Carbon

public static Menu getMenu(Context context, android.view.Menu baseMenu) {
  Context contextWrapper = CarbonContextWrapper.wrap(context);
  Menu menu = new Menu(contextWrapper);
  for (int i = 0; i < baseMenu.size(); i++) {
    android.view.MenuItem menuItem = baseMenu.getItem(i);
    menu.add(menuItem.getGroupId(), menuItem.getItemId(), menuItem.getOrder(), menuItem.getTitle()).setIcon(menuItem.getIcon()).setVisible(menuItem.isVisible()).setEnabled(menuItem.isEnabled());
  }
  return menu;
}

代码示例来源:origin: willowtreeapps/Hyperion-Android

public static Collection<ViewAttribute> createMenuAttributes(@NonNull Context context, @NonNull Menu menu) {
  final Resources res = context.getResources();
  List<ViewAttribute> attributes = new ArrayList<>();
  attributes.add(new ViewAttribute<>("MenuSize", menu.size()));
  attributes.add(new ViewAttribute<>("MenuHasVisibleItems", menu.hasVisibleItems()));
  for (int i = 0; i < menu.size(); i++) {
    MenuItem item = menu.getItem(i);
    String prefix = "Item " + i + ": ";
    attributes.add(new ViewAttribute<>(prefix + "Title", item.getTitle()));
    attributes.add(new ViewAttribute<>(prefix + "ContentDescription",
        MenuItemCompat.getContentDescription(item)));
    attributes.add(new ViewAttribute<>(prefix + "TooltipText", MenuItemCompat.getTooltipText(item)));
    attributes.add(new ViewAttribute<>(prefix + "Checkable", item.isCheckable()));
    attributes.add(new ViewAttribute<>(prefix + "Checked", item.isChecked()));
    attributes.add(new ViewAttribute<>(prefix + "Enabled", item.isEnabled()));
    attributes.add(new ViewAttribute<>(prefix + "Visible", item.isVisible()));
    attributes.add(new ViewAttribute<>(prefix + "Order", item.getOrder()));
    attributes.add(new ViewAttribute<Void>(prefix + "Icon", item.getIcon()));
    attributes.add(createColorAttribute("IconTint",
        MenuItemCompat.getIconTintList(item)));
    attributes.add(new ViewAttribute<>("IconTintMode",
        new PorterDuffModeValue(MenuItemCompat.getIconTintMode(item))));
    attributes.add(new ViewAttribute<>(prefix + "Id", new ResourceValue(res, item.getItemId())));
    attributes.add(new ViewAttribute<>(prefix + "GroupId", new ResourceValue(res, item.getGroupId())));
  }
  return attributes;
}

代码示例来源:origin: org.robolectric/shadows-framework

@Override
 public int compare(MenuItem a, MenuItem b) {
  if (a.getOrder() == b.getOrder()) {
   return 0;
  } else if (a.getOrder() > b.getOrder()) {
   return 1;
  } else {
   return -1;
  }
 }
}

代码示例来源:origin: org.robolectric/shadows-core

@Override
 public int compare(MenuItem a, MenuItem b) {
  if (a.getOrder() == b.getOrder()) {
   return 0;
  } else if (a.getOrder() > b.getOrder()) {
   return 1;
  } else {
   return -1;
  }
 }
}

代码示例来源:origin: org.robolectric/shadows-core-v23

@Override
 public int compare(MenuItem a, MenuItem b) {
  if (a.getOrder() == b.getOrder()) {
   return 0;
  } else if (a.getOrder() > b.getOrder()) {
   return 1;
  } else {
   return -1;
  }
 }
}

代码示例来源:origin: org.robolectric/framework

@Override
 public int compare(MenuItem a, MenuItem b) {
  if (a.getOrder() == b.getOrder()) {
   return 0;
  } else if (a.getOrder() > b.getOrder()) {
   return 1;
  } else {
   return -1;
  }
 }
}

代码示例来源:origin: com.actionbarsherlock/actionbarsherlock

@Override
public int getOrder() {
  return mNativeItem.getOrder();
}

代码示例来源:origin: com.willowtreeapps/oak-demos

@Override
public int getOrder() {
  return mNativeItem.getOrder();
}

代码示例来源:origin: ybonnel/TransportsRennes

private static int findInsertIndex(ArrayList<? extends MenuItem> items, int order) {
  for (int i = items.size() - 1; i >= 0; i--) {
    MenuItem item = items.get(i);
    if (item.getOrder() <= order) {
      return i + 1;
    }
  }
  return 0;
}

代码示例来源:origin: com.squareup.assertj/assertj-android

public MenuItemAssert hasOrder(int order) {
 isNotNull();
 int actualOrder = actual.getOrder();
 assertThat(actualOrder) //
   .overridingErrorMessage("Expected order <%s> but was <%s>.", order, actualOrder) //
   .isEqualTo(order);
 return this;
}

代码示例来源:origin: florent37/AwesomeBar

@Override
  public boolean onMenuItemClick(MenuItem item) {
    if(overflowActionItemClickListener != null){
      overflowActionItemClickListener.onOverflowActionItemClicked(item.getOrder(), item.getTitle().toString());
    }
    return true;
  }
});

代码示例来源:origin: mkulesh/microMathematics

public void updateFragmentInfo(BaseFragment fragment)
{
  if (fragment != null)
  {
    final int position = fragment.getFragmentNumber();
    if (position >= 0 && position < activityTitles.length)
    {
      mToolbar.setTitle(activityTitles[position]);
    }
    if (position >= 0 && position < activitySubtitles.length)
    {
      mToolbar.setSubtitle(activitySubtitles[position]);
    }
    for (MenuItem m : activityMenuItems)
    {
      m.setChecked(m.getOrder() == position);
    }
  }
}

代码示例来源:origin: daquexian/chaoli-forum-for-android-2

@Override
  public boolean onNavigationItemSelected(@NonNull MenuItem item) {
    if (item.getItemId()==R.id.nightMode){
      NightModeHelper.changeMode(viewModel);
      getWindow().setWindowAnimations(R.style.modechange);
      recreate();
    }else {
      selectItem(item.getOrder());
      item.setChecked(true);
    }
    return true;
  }
});

代码示例来源:origin: daquexian/chaoli-forum-for-android-2

@Override
public boolean onOptionsItemSelected(MenuItem item)
{
  super.onOptionsItemSelected(item);
  switch (item.getOrder())
  {
    case MENU_POST:
      Log.d(TAG, "onOptionsItemSelected: ");
      if (!LoginUtils.isLoggedIn()){
        showToast(R.string.please_login);
        break;
      }
      viewModel.postConversation();
      break;
    case MENU_DEMO:
      viewModel.changeDemoMode();
      break;
  }
  return true;
}

代码示例来源:origin: ukanth/afwall

@Override
public boolean onContextItemSelected(MenuItem item) {
  switch (item.getOrder()) {

代码示例来源:origin: daquexian/chaoli-forum-for-android-2

@Override
public boolean onOptionsItemSelected(MenuItem item)
{
  super.onOptionsItemSelected(item);
  switch (item.getOrder())
  {
    case MENU_REPLY:
      switch (viewModel.flag.get())
      {
        case FLAG_NORMAL:
          if (!LoginUtils.isLoggedIn()){
            showToast(R.string.please_login);
            break;
          }
          viewModel.reply();
          break;
        case FLAG_EDIT:
          viewModel.edit();
          break;
      }
      break;
    case MENU_DEMO:
      viewModel.changeDemoMode();
      break;
  }
  return true;
}

代码示例来源:origin: VREMSoftwareDevelopment/WiFiAnalyzer

@Override
  public void execute(NavigationMenu navigationMenu) {
    MenuItem actual = menu.getItem(navigationMenu.ordinal());
    assertEquals(navigationGroup.ordinal(), actual.getGroupId());
    assertEquals(mainActivity.getResources().getString(navigationMenu.getTitle()), actual.getTitle());
    assertEquals(navigationMenu.ordinal(), actual.getItemId());
    assertEquals(navigationMenu.ordinal(), actual.getOrder());
  }
}

相关文章