Пример #1
0
 public void onGalleryImageClick(int paramInt1, int paramInt2, Drawable paramDrawable) {
   boolean bool = true;
   if ((paramInt1 == paramInt2 - 1) && (this.totalCount > paramInt2)) {
     paramDrawable = getShop();
     paramInt1 = paramDrawable.getInt("ID");
     localIntent = new Intent("android.intent.action.VIEW", Uri.parse("dianping://shopphoto"));
     localIntent.putExtra("shopId", paramInt1);
     localIntent.putExtra("objShop", paramDrawable);
     if ((paramDrawable != null)
         && (paramDrawable.getInt("Status") != 1)
         && (paramDrawable.getInt("Status") != 4)) ;
     while (true) {
       localIntent.putExtra("enableUpload", bool);
       startActivity(localIntent);
       return;
       bool = false;
     }
   }
   Intent localIntent =
       new Intent("android.intent.action.VIEW", Uri.parse("dianping://showphotoandmore"));
   localIntent.putExtra("position", paramInt1);
   localIntent.putExtra("totalPicCount", this.totalCount);
   Object localObject = new ArrayList();
   ((ArrayList) localObject).add(getShop());
   localIntent.putParcelableArrayListExtra("arrShopObjs", (ArrayList) localObject);
   localIntent.putParcelableArrayListExtra("pageList", this.pageList);
   if (paramDrawable != null) {
     localObject = new ByteArrayOutputStream();
     ((BitmapDrawable) paramDrawable)
         .getBitmap()
         .compress(Bitmap.CompressFormat.JPEG, 90, (OutputStream) localObject);
     localIntent.putExtra("currentbitmap", ((ByteArrayOutputStream) localObject).toByteArray());
   }
   getContext().startActivity(localIntent);
 }
Пример #2
0
  public void email(ArrayList<String> filePaths) {

    String emailTo = "*****@*****.**";
    String emailCC = "";
    String subject = "QLog";
    String emailText = getEmailbody();

    // need to "send multiple" to get more than one attachment
    final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND_MULTIPLE);
    emailIntent.setType("text/plain");
    emailIntent.putExtra(
        android.content.Intent.EXTRA_EMAIL, new String[] {emailTo, "*****@*****.**"});
    emailIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
    emailIntent.putExtra(Intent.EXTRA_TEXT, emailText);
    //		    emailIntent.putExtra(android.content.Intent.EXTRA_CC,
    //		        new String[]{emailCC});
    // has to be an ArrayList
    ArrayList<Uri> uris = new ArrayList<Uri>();
    // convert from paths to Android friendly Parcelable Uri's
    for (String file : filePaths) {
      File fileIn = new File(file);
      //		        fileIn.setReadable(true);
      Uri u = Uri.fromFile(fileIn);
      uris.add(u);
    }
    emailIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
    startActivity(Intent.createChooser(emailIntent, "Send mail..."));
  }
Пример #3
0
  public Intent getAddNumberIntent() {
    final Intent intent = new Intent(Intent.ACTION_INSERT_OR_EDIT);
    intent.setType(ContactsContract.Contacts.CONTENT_ITEM_TYPE);

    ArrayList<ContentValues> data = new ArrayList<>();
    ContentValues values = new ContentValues();

    SipUri number = getPhones().get(0).getNumber();
    if (number.isRingId()) {
      values.put(
          ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.Im.CONTENT_ITEM_TYPE);
      values.put(ContactsContract.CommonDataKinds.Im.DATA, number.getRawUriString());
      values.put(
          ContactsContract.CommonDataKinds.Im.PROTOCOL,
          ContactsContract.CommonDataKinds.Im.PROTOCOL_CUSTOM);
      values.put(ContactsContract.CommonDataKinds.Im.CUSTOM_PROTOCOL, "Ring");
    } else {
      values.put(
          ContactsContract.Data.MIMETYPE,
          ContactsContract.CommonDataKinds.SipAddress.CONTENT_ITEM_TYPE);
      values.put(ContactsContract.CommonDataKinds.SipAddress.SIP_ADDRESS, number.getRawUriString());
    }
    data.add(values);
    intent.putParcelableArrayListExtra(ContactsContract.Intents.Insert.DATA, data);
    return intent;
  }
Пример #4
0
  public static Intent buildSendFile(ArrayList<FileInfo> files) {
    ArrayList<Uri> uris = new ArrayList<Uri>();

    String mimeType = "*/*";
    for (FileInfo file : files) {
      if (file.IsDir) continue;

      File fileIn = new File(file.filePath);
      mimeType = getMimeType(file.fileName);
      Uri u = Uri.fromFile(fileIn);
      uris.add(u);
    }

    if (uris.size() == 0) return null;

    boolean multiple = uris.size() > 1;
    Intent intent =
        new Intent(
            multiple
                ? android.content.Intent.ACTION_SEND_MULTIPLE
                : android.content.Intent.ACTION_SEND);

    if (multiple) {
      intent.setType("*/*");
      intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
    } else {
      intent.setType(mimeType);
      intent.putExtra(Intent.EXTRA_STREAM, uris.get(0));
    }

    return intent;
  }
 public static Intent instanceIntent(
     @NonNull Context context, @NonNull String defaultDomain, ArrayList<WsUrlModel> wsUrlModels) {
   Intent intent = new Intent(context, DomainDevOptionActivity.class);
   intent.putExtra(EXTRA_DEFAULT_DOMAIN, defaultDomain);
   intent.putParcelableArrayListExtra(EXTRA_WS_URL_LIST, wsUrlModels);
   return intent;
 }
Пример #6
0
  public static void SendEmail(
      Context context,
      String emailTo,
      String emailCC,
      String subject,
      String emailText,
      List<String> filePaths) {
    // need to "send multiple" to get more than one attachment
    final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND_MULTIPLE);
    emailIntent.setType("plain/text");
    emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] {emailTo});
    emailIntent.putExtra(android.content.Intent.EXTRA_CC, new String[] {emailCC});
    emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
    emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailText);
    emailIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    // has to be an ArrayList
    ArrayList<Uri> uris = new ArrayList<Uri>();
    // convert from paths to Android friendly Parcelable Uri's
    for (String file : filePaths) {
      File fileIn = new File(file);
      Uri u = Uri.fromFile(fileIn);
      uris.add(u);
    }
    emailIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);

    Intent intent = Intent.createChooser(emailIntent, "Share your sculpture");
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);
  }
Пример #7
0
    @Override
    protected Intent processCursor(Cursor cursor) {
      int columnIndex = cursor.getColumnIndex(Image.COLUMN_FILENAME);
      String filename;

      int i = 0;
      int size = mCheckedPositions.size();

      ArrayList<Uri> uris = new ArrayList<>();

      while (cursor.moveToNext()) {

        if (mCheckedPositions.get(cursor.getPosition())) {
          filename = cursor.getString(columnIndex);

          uris.add(Uri.parse("file://" + filename));

          publishProgress(++i, size);
        }
      }

      Intent shareIntent = new Intent(Intent.ACTION_SEND_MULTIPLE);
      shareIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
      shareIntent.setType("image/*");

      return shareIntent;
    }
 public static void luanch(
     Activity activity, ArrayList<Photo> selectedPhotos, int selectIndex, int requsetCode) {
   Intent intent = new Intent(activity, PhotoSelectedPreviewActivity.class);
   intent.putParcelableArrayListExtra(BUNDLE_SELECTED_PHOTOS, selectedPhotos);
   intent.putExtra(BUNDLE_SELECT_INDEX, selectIndex);
   activity.startActivityForResult(intent, requsetCode);
 }
 @Override
 public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
   Intent pagerIntent = new Intent(mContext, PagerActivity.class);
   pagerIntent.putParcelableArrayListExtra(PagerActivity.PHOTOS, mPhotos);
   pagerIntent.putExtra(PagerActivity.INIT_POSITION, position);
   startActivity(pagerIntent);
 }
Пример #10
0
  public void endGame(ArrayList<BombermanPlayer> sortedPlayers) {
    Intent intent = new Intent(this, EndGameActivity.class);

    intent.putParcelableArrayListExtra(EndGameActivity.INTENT_PLAYERS, sortedPlayers);
    finish();
    startActivity(intent);
  }
Пример #11
0
  void startPlaybackInService(boolean fg, boolean freshStart) {
    Leg.i(
        TAG,
        "startPlaybackInService =====================  mUris : "
            + mUris.size()
            + ", muris :"
            + mUris.toString());

    Intent localIntent = mStartIntent;
    localIntent.setClass(this, PlaybackService.class);
    localIntent.putExtra("com.example.tinyplayer.Binding", false);
    localIntent.putExtra("com.example.tinyplayer.CurrentPosition", 0);
    localIntent.putExtra("com.example.tinyplayer.StartAtOnce", true);
    localIntent.putParcelableArrayListExtra("com.example.tinyplayer.Uris", mUris);

    localIntent.putExtra("com.example.tinyplayer.Foreground", fg);
    localIntent.putExtra("com.example.tinyplayer.FreshStart", freshStart);
    localIntent.putExtra("com.example.tinyplayer.PresentationDisplayId", mPresentationId);

    if (mPlaybackService == null) {
      if (fg || freshStart) {
        Leg.i(TAG, "start new service");
        startService(localIntent);
      }

    } else {
      Leg.i(TAG, "use existing service");
      mPlaybackService.continueInBackground(localIntent);
    }
  }
  @Override
  public void playTrack(ArrayList<Track> trackList, int selectedTrack) {

    if (mTwoPane) {

      // Create the fragment and show it as a dialog
      PlaybackFragment playbackFragment = new PlaybackFragment();

      Bundle b = new Bundle();
      b.putString(Utils.ARTIST_NAME, mArtistName);
      b.putParcelableArrayList(Utils.TRACK_LIST, trackList);
      b.putInt(Utils.SELECTED_TRACK_POSITION, selectedTrack);

      playbackFragment.setArguments(b);

      playbackFragment.show(getSupportFragmentManager(), PLAYBACK_FRAGMENT_TAG);

    } else {

      Intent playbackIntent = new Intent(MainActivity.this, PlaybackActivity.class);
      playbackIntent.putParcelableArrayListExtra(Utils.TRACK_LIST, trackList);
      playbackIntent.putExtra(Utils.SELECTED_TRACK_POSITION, selectedTrack);
      playbackIntent.putExtra(Utils.ARTIST_NAME, mArtistName);
      startActivity(playbackIntent);
    }
  }
Пример #13
0
  /**
   * Set share intent
   *
   * @param selectedItems
   * @return shared intent
   */
  public static Intent createShareIntent(ArrayList<MediaObject> selectedItems) {
    final ArrayList<Uri> uris = new ArrayList<Uri>();
    final Intent intent = new Intent();
    int mediaType = 0;
    String mimeType = "image/*";

    for (int i = 0; selectedItems.size() > i; i++) {
      if (uris.size() >= 1000) break;
      mediaType = selectedItems.get(i).getType();
      mimeType = (mediaType == MediaItem.IMAGE) ? "image/*" : "video/*";

      MediaItem item = (MediaItem) selectedItems.get(i);
      Uri uri = ContentUris.withAppendedId(item.getUri(mediaType), item.getId());
      uris.add(uri);
    }

    final int size = uris.size();
    if (size > 0) {

      if (size > 1) {
        intent.setAction(Intent.ACTION_SEND_MULTIPLE).setType(mimeType);
        intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
      } else {
        intent.setAction(Intent.ACTION_SEND).setType(mimeType);
        intent.putExtra(Intent.EXTRA_STREAM, uris.get(0));
      }
      intent.setType(mimeType);
    }

    return intent;
  }
  private void startSend(
      final CharSequence subject, final CharSequence text, final ArrayList<Uri> attachments) {
    final Intent intent;

    if (attachments.size() == 0) {
      intent = new Intent(Intent.ACTION_SEND);
      intent.setType("message/rfc822");
    } else if (attachments.size() == 1) {
      intent = new Intent(Intent.ACTION_SEND);
      intent.setType("text/plain");
      intent.putExtra(Intent.EXTRA_STREAM, attachments.get(0));
    } else {
      intent = new Intent(Intent.ACTION_SEND_MULTIPLE);
      intent.setType("text/plain");
      intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, attachments);
    }

    intent.putExtra(Intent.EXTRA_EMAIL, new String[] {Constants.REPORT_EMAIL});
    if (subject != null) intent.putExtra(Intent.EXTRA_SUBJECT, subject);
    intent.putExtra(Intent.EXTRA_TEXT, text);

    try {
      context.startActivity(
          Intent.createChooser(
              intent, context.getString(R.string.report_issue_dialog_mail_intent_chooser)));
      log.info("invoked chooser for sending issue report");
    } catch (final Exception x) {
      Toast.makeText(context, R.string.report_issue_dialog_mail_intent_failed, Toast.LENGTH_LONG)
          .show();
      log.error("report issue failed", x);
    }
  }
 public void goToAllContactList(View v) {
   for (Contact contact : allContactsList) {
     Log.d(TAG, "inside gotoAllContactList " + contact.isSelected());
   }
   Intent intent = new Intent(this, AllFriendsList.class);
   intent.putParcelableArrayListExtra("FRIENDS_LIST", (ArrayList<Contact>) allContactsList);
   startActivityForResult(intent, 1);
 }
 @Click
 void btn_edit() {
   Intent intent = new Intent(ShowEventContent.this, EditEvent_.class);
   intent.putExtra("bean", bhq_XHSJ);
   intent.putParcelableArrayListExtra("beanlist", (ArrayList<? extends Parcelable>) list_FJ_SCFJ);
   startActivity(intent);
   finish();
 }
Пример #17
0
 void sendProfileBack(Profile profile) {
   // Send the profile back to MainActivity
   Intent cityManagerIntent = getIntent();
   cityManagerIntent.putParcelableArrayListExtra(
       "profile", new ArrayList<Profile>(Collections.singletonList(profile)));
   cityManagerIntent.putExtra("status", "statusOK");
   setResult(RESULT_OK, cityManagerIntent);
 }
 private void renderMap(ArrayList<SelectedImage> images) {
   Intent intent = new Intent(MainActivity.RENDER_MAP);
   intent.putExtra(MainActivity.TRACK_ID_EXTRA, trackId);
   intent.putExtra(MainActivity.LEG_IDS_EXTRA, legIds);
   intent.putParcelableArrayListExtra(MainActivity.SELECTED_IMAGES_EXTRA, images);
   getContext().sendBroadcast(intent);
   dismiss();
 }
 @Override
 public void onClick(View v) {
   // TODO Auto-generated method stub
   Log.d("Find friend FB activity", "Start new activity with data");
   Intent intent = new Intent(mContext, InviteFriendActivity.class);
   intent.putParcelableArrayListExtra("invitelist", arr_facebook);
   startActivity(intent);
 }
Пример #20
0
 @Override
 /** Start the Search tab with the members we have at this exact location. */
 public void onClusterInfoWindowClick(Cluster<HostBriefInfo> hostBriefInfoCluster) {
   Intent intent = new Intent(this, ListSearchTabActivity.class);
   intent.putParcelableArrayListExtra(
       "search_results", (ArrayList<HostBriefInfo>) hostBriefInfoCluster.getItems());
   startActivity(intent);
 }
  private void onDone() {
    ArrayList<SocialMember> result =
        (ArrayList<SocialMember>) friendListAdapter.getSelectedFriends();

    Intent returnIntent = new Intent();
    returnIntent.putParcelableArrayListExtra(RESULT_FRIEND_LIST, result);
    getActivity().setResult(Activity.RESULT_OK, returnIntent);
    getActivity().finish();
  }
 /*
  *  goes to currently running map activity and puts pins on it
  */
 public static void viewMapItem(Context context, MapItem focusedMapItem) {
   ArrayList<MapItem> mapItems = new ArrayList<MapItem>();
   mapItems.add(focusedMapItem);
   Intent i = new Intent(context, MITMapActivity.class);
   i.putParcelableArrayListExtra(MAP_ITEMS_KEY, mapItems);
   i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
   i.putExtra(KEY_VIEW_PINS, true);
   context.startActivity(i);
 };
 @Override
 protected void addHeaderView(ListView listView) {
   Intent intent = getIntent();
   mForumInfo = intent.getParcelableExtra(AppConstants.PARCELABLE_KEY);
   mBlockInfo = intent.getParcelableExtra(AppConstants.PARCELABLE_KEY_TWO);
   if (null == mForumInfo) JumpManager.doJumpBack(mActivity);
   if (TextUtils.isEmpty(mForumInfo.getSectionname()))
     mForumInfo.setSectionname(
         null == mBlockInfo ? getString(R.string.string_history) : mBlockInfo.getSectionname());
   ReadHistoryManager.add(mForumInfo);
   HeaderForumDetailBinding inflate =
       DataBindingUtil.inflate(
           LayoutInflater.from(mActivity), R.layout.header_forum_detail, null, false);
   inflate.setImgInfo(
       new ImgBinding(
           mForumInfo.getUserImage(), R.drawable.ic_default_head, R.dimen.dimen_30, 10));
   inflate.tvName.setOnClickListener(
       v -> UserManager.jumpToOtherPeople(mActivity, mForumInfo.getPkUser()));
   inflate.setInfo(mForumInfo);
   String images = mForumInfo.getImages();
   if (!TextUtils.isEmpty(images)) {
     String[] split = images.split(",");
     inflate.llImgContent.removeAllViews();
     ArrayList<ImgInfo> imgList = new ArrayList<>();
     for (String url : split) {
       ImgInfo info = new ImgInfo();
       info.setPath(url);
       imgList.add(info);
     }
     for (int position = 0; position < imgList.size(); position++) {
       ItemForumImageBinding imgBinding =
           DataBindingUtil.inflate(
               LayoutInflater.from(mActivity), R.layout.item_forum_image, null, false);
       imgBinding.setImgInfo(
           new ImgBinding(imgList.get(position).getPath(), R.drawable.ic_default_img));
       final int currentPosition = position;
       imgBinding.ivInfo.setOnClickListener(
           v -> {
             Intent photoIntent = new Intent(mActivity, PhotoPreviewActivity.class);
             photoIntent.putParcelableArrayListExtra(AppConstants.PARCELABLE_KEY, imgList);
             photoIntent.putExtra(PhotoPreviewActivity.POSITION, currentPosition);
             photoIntent.putExtra(PhotoPreviewActivity.HIDENDELETE, true);
             JumpManager.doJumpForward(mActivity, photoIntent);
           });
       inflate.llImgContent.addView(imgBinding.getRoot());
     }
   }
   inflate.tvForumName.setText(
       mBlockInfo == null ? mForumInfo.getSectionname() : mBlockInfo.getSectionname());
   inflate.tvForumName.setOnClickListener(v -> JumpManager.doJumpBack(mActivity));
   inflate.ivShowAction.setOnClickListener(v -> showAction(inflate));
   listView.addHeaderView(inflate.getRoot());
 }
Пример #24
0
  private void submitReport(BugReportView.Report report, File logs) {
    DisplayMetrics dm = context.getResources().getDisplayMetrics();
    String densityBucket = getDensityString(dm);

    Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);
    intent.setType("message/rfc822");
    // TODO: intent.putExtra(Intent.EXTRA_EMAIL, new String[] { "*****@*****.**" });
    intent.putExtra(Intent.EXTRA_SUBJECT, report.title);

    StringBuilder body = new StringBuilder();
    if (!Strings.isBlank(report.description)) {
      body.append("{panel:title=Description}\n").append(report.description).append("\n{panel}\n\n");
    }

    body.append("{panel:title=App}\n");
    body.append("Version: ").append(BuildConfig.VERSION_NAME).append('\n');
    body.append("Version code: ").append(BuildConfig.VERSION_CODE).append('\n');
    body.append("{panel}\n\n");

    body.append("{panel:title=Device}\n");
    body.append("Make: ").append(Build.MANUFACTURER).append('\n');
    body.append("Model: ").append(Build.MODEL).append('\n');
    body.append("Resolution: ")
        .append(dm.heightPixels)
        .append("x")
        .append(dm.widthPixels)
        .append('\n');
    body.append("Density: ")
        .append(dm.densityDpi)
        .append("dpi (")
        .append(densityBucket)
        .append(")\n");
    body.append("Release: ").append(Build.VERSION.RELEASE).append('\n');
    body.append("API: ").append(Build.VERSION.SDK_INT).append('\n');
    body.append("{panel}");

    intent.putExtra(Intent.EXTRA_TEXT, body.toString());

    ArrayList<Uri> attachments = new ArrayList<>();
    if (screenshot != null && report.includeScreenshot) {
      attachments.add(Uri.fromFile(screenshot));
    }
    if (logs != null) {
      attachments.add(Uri.fromFile(logs));
    }

    if (!attachments.isEmpty()) {
      intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, attachments);
    }

    Intents.maybeStartActivity(context, intent);
  }
Пример #25
0
 @Override
 public void onClick(View v) {
   switch (v.getId()) {
     case R.id.header_text_iv_left:
       startActivity(new Intent(getActivity(), SearchActivity.class));
       break;
     case R.id.header_text_iv_right:
       Intent intent = new Intent(getActivity(), EditActivity.class);
       intent.putParcelableArrayListExtra("cartGoods", (ArrayList<? extends Parcelable>) list);
       startActivityForResult(intent, Constant.CART_REQUST_CODE);
       break;
   }
 }
  /**
   * Returns an Intent to edit a different contact (in the fully expaned editor) with whatever
   * values were already entered on the currently displayed contact editor.
   */
  public static Intent createEditOtherContactIntent(
      Uri contactLookupUri, ArrayList<ContentValues> contentValues) {
    final Intent intent = new Intent(Intent.ACTION_EDIT, contactLookupUri);
    intent.setFlags(
        Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS | Intent.FLAG_ACTIVITY_FORWARD_RESULT);
    intent.putExtra(ContactEditorFragment.INTENT_EXTRA_ADD_TO_DEFAULT_DIRECTORY, "");

    // Pass on all the data that has been entered so far
    if (contentValues != null && contentValues.size() != 0) {
      intent.putParcelableArrayListExtra(ContactsContract.Intents.Insert.DATA, contentValues);
    }
    return intent;
  }
Пример #27
0
  public static Intent getStartIntent(Context context, SkylarkSet set) {
    Intent intent = new Intent(context, SetDetailActivity.class);
    ArrayList<ParcelableItem> pItems = new ArrayList<>();
    for (Item item : set.getItems()) {
      pItems.add(new ParcelableItem(item));
    }

    intent.putParcelableArrayListExtra(EXTRA_ITEMS, pItems);
    intent.putExtra(EXTRA_TITLE, set.getTitle());
    intent.putExtra(EXTRA_BODY, set.getBody());
    intent.putExtra(EXTRA_TEMP_IMAGE, set.getTempImage());

    return intent;
  }
Пример #28
0
 private void attachLogFiles(Intent i, String... logFileNames) {
   ArrayList<Uri> logFiles = new ArrayList<Uri>();
   for (String logFileName : logFileNames) {
     File logFile = new File(LOG_DIR + "/" + logFileName);
     if (logFile.exists()) {
       logFiles.add(Uri.fromFile(logFile));
     }
   }
   try {
     i.putParcelableArrayListExtra(Intent.EXTRA_STREAM, logFiles);
   } catch (Exception e) {
     LogUtils.e("failed to attach log", e);
   }
 }
Пример #29
0
  @Test
  public void testParcelableArrayListExtra() {
    Intent intent = new Intent();
    Parcelable parcel1 = new TestParcelable(22);
    Parcelable parcel2 = new TestParcelable(23);
    ArrayList<Parcelable> parcels = new ArrayList<Parcelable>();
    parcels.add(parcel1);
    parcels.add(parcel2);

    assertSame(intent, intent.putParcelableArrayListExtra("foo", parcels));
    assertSame(parcels, intent.getParcelableArrayListExtra("foo"));
    assertSame(parcel1, intent.getParcelableArrayListExtra("foo").get(0));
    assertSame(parcel2, intent.getParcelableArrayListExtra("foo").get(1));
    assertSame(parcels, intent.getExtras().getParcelableArrayList("foo"));
  }
Пример #30
0
  private void updatePicture() {

    if (mSelectedImages.size() < mConfig.getSelectionMin()) {
      String text =
          String.format(
              getResources().getString(R.string.min_count_msg), mConfig.getSelectionMin());
      Toast.makeText(this, text, Toast.LENGTH_SHORT).show();
      return;
    }

    Intent intent = new Intent();
    intent.putParcelableArrayListExtra(EXTRA_IMAGE_URIS, mSelectedImages);
    setResult(Activity.RESULT_OK, intent);
    finish();
  }