コード例 #1
0
  @Override
  public boolean onContextItemSelected(MenuItem item) {
    ContextMenuRecyclerView.RecyclerContextMenuInfo info =
        (ContextMenuRecyclerView.RecyclerContextMenuInfo) item.getMenuInfo();
    TagRecyclerAdapter ada = (TagRecyclerAdapter) mRecyclerView.getAdapter();

    long arrayAdapterPosition = info.position;
    final SoulissTag todoItem = (SoulissTag) ada.getTag((int) arrayAdapterPosition);

    switch (item.getItemId()) {
      case R.id.eliminaTag:
        AlertDialogGridHelper.removeTagDialog(this, tagAdapter, datasource, todoItem, opzioni);
        return true;
      case R.id.rinominaTag:
        AlertDialog.Builder alert3 =
            AlertDialogGridHelper.renameSoulissObjectDialog(
                this, null, tagAdapter, datasource, todoItem);
        alert3.show();
        return true;
      case R.id.scegliconaTag:
        AlertDialog.Builder alert2 =
            AlertDialogGridHelper.chooseIconDialog(this, tagAdapter, datasource, todoItem);
        alert2.show();
        // nodesAdapter.notifyDataSetChanged();
        // listaNodiView.invalidateViews();
        return true;
      case R.id.scegliImmagineTag:
        Intent intent =
            new Intent(
                Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
        startActivityForResult(intent, (int) arrayAdapterPosition);

        return true;
      case R.id.scegliOrdineTag:
        AlertDialog alertOrder =
            AlertDialogGridHelper.tagOrderPickerDialog(
                this, todoItem, (int) arrayAdapterPosition, tagAdapter);
        alertOrder.show();
        return true;
      default:
        return super.onContextItemSelected(item);
    }
  }
コード例 #2
0
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent imageReturnedIntent) {
    super.onActivityResult(requestCode, resultCode, imageReturnedIntent);
    Log.i(Constants.TAG, "SAVED IMG RESULT:" + resultCode);

    if (resultCode == RESULT_OK) {
      Uri selectedImage = imageReturnedIntent.getData();
      Log.i(Constants.TAG, "SAVED IMG PATH:" + selectedImage.toString());
      tags[requestCode].setImagePath(selectedImage.toString());
      // String[] filePathColumn = {MediaStore.Images.Media.DATA};
      datasource.createOrUpdateTag(tags[requestCode]);
      // Bitmap yourSelectedImage = BitmapFactory.decodeFile(filePath);
      Log.i(Constants.TAG, "SAVED IMG PATH:" + tags[requestCode].getImagePath());
      tagAdapter.notifyItemChanged(requestCode);
    }
  }