android.app.Activity.onContextItemSelected()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(9.7k)|赞(0)|评价(0)|浏览(159)

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

Activity.onContextItemSelected介绍

暂无

代码示例

代码示例来源:origin: rmtheis/android-ocr

return true;
default:
 return super.onContextItemSelected(item);

代码示例来源:origin: termux/termux-app

return super.onContextItemSelected(item);

代码示例来源:origin: com.uphyca/android-junit4-robolectric

/**
 * @param item
 * @return
 * @see android.app.Activity#onContextItemSelected(android.view.MenuItem)
 */
public boolean onContextItemSelected(MenuItem item) {
  return mActivity.onContextItemSelected(item);
}

代码示例来源:origin: iqiyi/Neptune

@Override
public boolean onContextItemSelected(android.view.MenuItem menuitem0) {
  return mOriginActivity.onContextItemSelected(menuitem0);
}

代码示例来源:origin: shazam/android-aspects

@Override
public boolean onContextItemSelected(MenuItem item) {
  return super.onContextItemSelected(item) || dispatcher.dispatchOnContextItemSelected(this, item);
}

代码示例来源:origin: velazcod/Tinfoil-Facebook

/**
 * {@inheritDoc}
 */
@Override
public boolean onContextItemSelected(MenuItem item) {
  switch (item.getItemId()) {
    case ID_CONTEXT_MENU_SAVE_IMAGE:
      saveImageToDisk(mPendingImageUrlToSave);
      break;
  }
  return super.onContextItemSelected(item);
}

代码示例来源:origin: bitstadium/HockeySDK-Android

/**
 * Called when user clicked on context menu item.
 */
@Override
public boolean onContextItemSelected(MenuItem item) {
  switch (item.getItemId()) {
    case ATTACH_FILE:
    case ATTACH_PICTURE:
      return addAttachment(item.getItemId());
    default:
      return super.onContextItemSelected(item);
  }
}

代码示例来源:origin: RWebRTC/WebRTC-Android-Learn

@Override
public boolean onContextItemSelected(MenuItem item) {
 if (item.getItemId() == REMOVE_FAVORITE_INDEX) {
  AdapterView.AdapterContextMenuInfo info =
    (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
  roomList.remove(info.position);
  adapter.notifyDataSetChanged();
  return true;
 }
 return super.onContextItemSelected(item);
}

代码示例来源:origin: MKergall/osmbonuspack

@Override public boolean onContextItemSelected(MenuItem item) {
  AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
  switch (item.getItemId()) {
    case R.id.style_item_menu_cut:
      String style = mStyleList.get(info.position);
      mStyles.remove(style);
      buildStyleList();
      mListAdapter.notifyDataSetChanged();
      return true;
    default:
      return super.onContextItemSelected(item);
  }
}

代码示例来源:origin: indywidualny/FaceSlim

@Override
public boolean onContextItemSelected(MenuItem item) {
  switch (item.getItemId()) {
    case ID_CONTEXT_MENU_SAVE_IMAGE:
      /** In order to save anything we need storage permission.
       *  onRequestPermissionsResult will save an image.
       */
      requestStoragePermission();
      break;
    case ID_CONTEXT_MENU_SHARE_IMAGE:
      Intent share = new Intent(Intent.ACTION_SEND);
      share.setType("text/plain");
      share.putExtra(Intent.EXTRA_TEXT, mPendingImageUrlToSave);
      startActivity(Intent.createChooser(share, getString(R.string.share_link)));
      break;
  }
  return super.onContextItemSelected(item);
}

代码示例来源:origin: huangfangyi/FanXin

@Override
public boolean onContextItemSelected(MenuItem item) {
  if (item.getItemId() == R.id.remove) {
    final String tobeRemoveUser = adapter.getItem(((AdapterContextMenuInfo) item.getMenuInfo()).position);
    // remove user out from blacklist
    removeOutBlacklist(tobeRemoveUser);
    return true;
  }
  return super.onContextItemSelected(item);
}

代码示例来源:origin: ydcx/KooReader

@Override
public boolean onContextItemSelected(MenuItem item) {
  final int position = ((AdapterView.AdapterContextMenuInfo) item.getMenuInfo()).position;
  final String tag = myTabHost.getCurrentTabTag();
  final BookmarksAdapter adapter;
  if ("thisBook".equals(tag)) {
    adapter = myThisBookAdapter;
  } else if ("allBooks".equals(tag)) {
    adapter = myAllBooksAdapter;
  } else if ("search".equals(tag)) {
    adapter = mySearchResultsAdapter;
  } else {
    throw new RuntimeException("Unknown tab tag: " + tag);
  }
  final Bookmark bookmark = adapter.getItem(position);
  switch (item.getItemId()) {
    case OPEN_ITEM_ID:
      gotoBookmark(bookmark);
      return true;
    case EDIT_ITEM_ID:
      final Intent intent = new Intent(this, EditBookmarkActivity.class);
      KooReaderIntents.putBookmarkExtra(intent, bookmark);
      OrientationUtil.startActivity(this, intent);
      return true;
    case DELETE_ITEM_ID:
      myCollection.deleteBookmark(bookmark);
      return true;
  }
  return super.onContextItemSelected(item);
}

代码示例来源:origin: ydcx/KooReader

@Override
public boolean onContextItemSelected(MenuItem item) {
  final int position = ((AdapterView.AdapterContextMenuInfo) item.getMenuInfo()).position;
  final BookmarksAdapter adapter = myThisBookAdapter;
  final Bookmark bookmark = adapter.getItem(position);
  switch (item.getItemId()) {
    case OPEN_ITEM_ID:
      gotoBookmark(bookmark);
      return true;
    case EDIT_ITEM_ID:
      final Intent intent = new Intent(this, EditBookmarkActivity.class);
      intent.putExtra("bgColor", bgValue);
      KooReaderIntents.putBookmarkExtra(intent, bookmark);
      OrientationUtil.startActivity(this, intent);
      return true;
    case DELETE_ITEM_ID:
      myCollection.deleteBookmark(bookmark);
      return true;
  }
  return super.onContextItemSelected(item);
}

代码示例来源:origin: adolfAn/FBReader_AS

@Override
public boolean onContextItemSelected(MenuItem item) {
  final int position = ((AdapterView.AdapterContextMenuInfo)item.getMenuInfo()).position;
  final String tag = myTabHost.getCurrentTabTag();
  final BookmarksAdapter adapter;
  if ("thisBook".equals(tag)) {
    adapter = myThisBookAdapter;
  } else if ("allBooks".equals(tag)) {
    adapter = myAllBooksAdapter;
  } else if ("search".equals(tag)) {
    adapter = mySearchResultsAdapter;
  } else {
    throw new RuntimeException("Unknown tab tag: " + tag);
  }
  final Bookmark bookmark = adapter.getItem(position);
  switch (item.getItemId()) {
    case OPEN_ITEM_ID:
      gotoBookmark(bookmark);
      return true;
    case EDIT_ITEM_ID:
      final Intent intent = new Intent(this, EditBookmarkActivity.class);
      FBReaderIntents.putBookmarkExtra(intent, bookmark);
      OrientationUtil.startActivity(this, intent);
      return true;
    case DELETE_ITEM_ID:
      myCollection.deleteBookmark(bookmark);
      return true;
  }
  return super.onContextItemSelected(item);
}

代码示例来源:origin: Jiangzqts/EpubRead

@Override
public boolean onContextItemSelected(MenuItem item) {
  final int position = ((AdapterView.AdapterContextMenuInfo) item.getMenuInfo()).position;
  final BookmarksAdapter adapter = myThisBookAdapter;
  final Bookmark bookmark = adapter.getItem(position);
  switch (item.getItemId()) {
    case OPEN_ITEM_ID:
      gotoBookmark(bookmark);
      return true;
    case EDIT_ITEM_ID:
      final Intent intent = new Intent(this, EditBookmarkActivity.class);
      intent.putExtra("bgColor", bgValue);
      KooReaderIntents.putBookmarkExtra(intent, bookmark);
      OrientationUtil.startActivity(this, intent);
      return true;
    case DELETE_ITEM_ID:
      myCollection.deleteBookmark(bookmark);
      return true;
  }
  return super.onContextItemSelected(item);
}

代码示例来源:origin: MKergall/osmbonuspack

return true;
default:
  return super.onContextItemSelected(item);

代码示例来源:origin: CypherpunkArmory/UserLAnd

return super.onContextItemSelected(item);

代码示例来源:origin: ELynx/pokemon-go-xposed-mitm

public boolean onContextItemSelected(android.view.MenuItem item) {
 if (ScriptLoader.isCalledFromJRuby()) return super.onContextItemSelected(item);
 if (!JRubyAdapter.isInitialized()) {
  Log.i("Method called before JRuby runtime was initialized: RubotoActivity#onContextItemSelected");
  return super.onContextItemSelected(item);
 }
 String rubyClassName = scriptInfo.getRubyClassName();
 if (rubyClassName == null) return super.onContextItemSelected(item);
 if ((Boolean)JRubyAdapter.runScriptlet(rubyClassName + ".instance_methods(false).any?{|m| m.to_sym == :onContextItemSelected}")) {
  return (Boolean) JRubyAdapter.runRubyMethod(Boolean.class, scriptInfo.getRubyInstance(), "onContextItemSelected", item);
 } else {
  if ((Boolean)JRubyAdapter.runScriptlet(rubyClassName + ".instance_methods(false).any?{|m| m.to_sym == :on_context_item_selected}")) {
   return (Boolean) JRubyAdapter.runRubyMethod(Boolean.class, scriptInfo.getRubyInstance(), "on_context_item_selected", item);
  } else {
   if ((Boolean)JRubyAdapter.runScriptlet(rubyClassName + ".instance_methods(true).any?{|m| m.to_sym == :on_context_item_selected}")) {
    return (Boolean) JRubyAdapter.runRubyMethod(Boolean.class, scriptInfo.getRubyInstance(), "on_context_item_selected", item);
   } else {
    return (Boolean) JRubyAdapter.runRubyMethod(Boolean.class, scriptInfo.getRubyInstance(), "onContextItemSelected", item);
   }
  }
 }
}

代码示例来源:origin: GeoODK/collect

@Override
public boolean onContextItemSelected(MenuItem item) {
  /*
   * We don't have the right view here, so we store the View's ID as the
   * item ID and loop through the possible views to find the one the user
   * clicked on.
   */
  for (QuestionWidget qw : ((ODKView) mCurrentView).getWidgets()) {
    if (item.getItemId() == qw.getId()) {
      Collect.getInstance()
          .getActivityLogger()
          .logInstanceAction(this, "onContextItemSelected",
              "createClearDialog", qw.getPrompt().getIndex());
      createClearDialog(qw);
    }
  }
  if (item.getItemId() == DELETE_REPEAT) {
    Collect.getInstance()
        .getActivityLogger()
        .logInstanceAction(this, "onContextItemSelected",
            "createDeleteRepeatConfirmDialog");
    createDeleteRepeatConfirmDialog();
  }
  return super.onContextItemSelected(item);
}

代码示例来源:origin: MKergall/osmbonuspack

@Override public boolean onContextItemSelected(MenuItem item) {
  switch (item.getItemId()) {
  case R.id.menu_departure:
    startPoint = new GeoPoint(mClickedGeoPoint);
    markerStart = updateItineraryMarker(markerStart, startPoint, START_INDEX,
      R.string.departure, R.drawable.marker_departure, -1, null);
    getRoadAsync();
    return true;
  case R.id.menu_destination:
    destinationPoint = new GeoPoint(mClickedGeoPoint);
    markerDestination = updateItineraryMarker(markerDestination, destinationPoint, DEST_INDEX,
      R.string.destination, R.drawable.marker_destination, -1, null);
    getRoadAsync();
    return true;
  case R.id.menu_viapoint:
    GeoPoint viaPoint = new GeoPoint(mClickedGeoPoint);
    addViaPoint(viaPoint);
    getRoadAsync();
    return true;
  case R.id.menu_kmlpoint:
    GeoPoint kmlPoint = new GeoPoint(mClickedGeoPoint);
    addKmlPoint(kmlPoint);
    return true;
  default:
    return super.onContextItemSelected(item);
  }
}

相关文章

Activity类方法