Java Code Examples for android.content.Intent#putParcelableArrayListExtra()

The following examples show how to use android.content.Intent#putParcelableArrayListExtra() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: QiscusChatActivity.java    From qiscus-sdk-android with Apache License 2.0 6 votes vote down vote up
public static Intent generateIntent(Context context, QiscusChatRoom qiscusChatRoom,
                                    String startingMessage, List<File> shareFiles,
                                    boolean autoSendExtra, List<QiscusComment> comments,
                                    QiscusComment scrollToComment) {
    if (qiscusChatRoom.isGroup()) {
        return QiscusGroupChatActivity.generateIntent(context, qiscusChatRoom, startingMessage,
                shareFiles, autoSendExtra, comments, scrollToComment);
    }

    Intent intent = new Intent(context, QiscusChatActivity.class);
    intent.putExtra(CHAT_ROOM_DATA, qiscusChatRoom);
    intent.putExtra(EXTRA_STARTING_MESSAGE, startingMessage);
    intent.putExtra(EXTRA_SHARING_FILES, (Serializable) shareFiles);
    intent.putExtra(EXTRA_AUTO_SEND, autoSendExtra);
    intent.putParcelableArrayListExtra(EXTRA_FORWARD_COMMENTS, (ArrayList<QiscusComment>) comments);
    intent.putExtra(EXTRA_SCROLL_TO_COMMENT, scrollToComment);
    return intent;
}
 
Example 2
Source File: NotificationController.java    From NGA-CLIENT-VER-OPEN-SOURCE with GNU General Public License v2.0 6 votes vote down vote up
private void showReplyNotification(ArrayList<RecentReplyInfo> infoList) {

        int id = Integer.parseInt(infoList.get(0).getPidStr());
        Context context = ApplicationContextHolder.getContext();

        Intent intent = new Intent(context, RecentNotificationActivity.class);

        intent.putParcelableArrayListExtra("unread", infoList);

        PendingIntent pending = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);

        NotificationCompat.Builder builder = buildNotification(context);
        builder.setContentIntent(pending)
                .setTicker("有新的被喷提醒,请查看")
                .setContentTitle("有新的被喷提醒,请查看")
                .setContentText("有新的被喷提醒,请查看");

        NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
        if (nm != null) {
            nm.notify(id, builder.build()); // 通过通知管理器发送通知
        }
    }
 
Example 3
Source File: ImageMultipleWrapper.java    From Album with Apache License 2.0 6 votes vote down vote up
@Override
public void start() {
    AlbumActivity.sSizeFilter = mSizeFilter;
    AlbumActivity.sMimeFilter = mMimeTypeFilter;
    AlbumActivity.sResult = mResult;
    AlbumActivity.sCancel = mCancel;
    Intent intent = new Intent(mContext, AlbumActivity.class);
    intent.putExtra(Album.KEY_INPUT_WIDGET, mWidget);
    intent.putParcelableArrayListExtra(Album.KEY_INPUT_CHECKED_LIST, mChecked);

    intent.putExtra(Album.KEY_INPUT_FUNCTION, Album.FUNCTION_CHOICE_IMAGE);
    intent.putExtra(Album.KEY_INPUT_CHOICE_MODE, Album.MODE_MULTIPLE);
    intent.putExtra(Album.KEY_INPUT_COLUMN_COUNT, mColumnCount);
    intent.putExtra(Album.KEY_INPUT_ALLOW_CAMERA, mHasCamera);
    intent.putExtra(Album.KEY_INPUT_LIMIT_COUNT, mLimitCount);
    intent.putExtra(Album.KEY_INPUT_FILTER_VISIBILITY, mFilterVisibility);
    mContext.startActivity(intent);
}
 
Example 4
Source File: SipServiceCommand.java    From pjsip-android with Apache License 2.0 6 votes vote down vote up
/**
 * Adds a new SIP account and changes the sip stack codec priority settings.
 * This is handy to set an account plus the global codec priority configuration with
 * just a single call.
 * @param context application context
 * @param sipAccount sip account data
 * @param codecPriorities list with the codec priorities to set
 * @return sip account ID uri as a string
 */
public static String setAccountWithCodecs(Context context, SipAccountData sipAccount,
                                          ArrayList<CodecPriority> codecPriorities) {
    if (sipAccount == null) {
        throw new IllegalArgumentException("sipAccount MUST not be null!");
    }

    String accountID = sipAccount.getIdUri();
    checkAccount(accountID);

    Intent intent = new Intent(context, SipService.class);
    intent.setAction(ACTION_SET_ACCOUNT);
    intent.putExtra(PARAM_ACCOUNT_DATA, sipAccount);
    intent.putParcelableArrayListExtra(PARAM_CODEC_PRIORITIES, codecPriorities);
    context.startService(intent);

    return accountID;
}
 
Example 5
Source File: RelayUtil.java    From deltachat-android with GNU General Public License v3.0 6 votes vote down vote up
public static void acquireRelayMessageContent(Activity currentActivity, @NonNull Intent newActivityIntent) {
    if (isForwarding(currentActivity)) {
        newActivityIntent.putExtra(FORWARDED_MESSAGE_IDS, getForwardedMessageIDs(currentActivity));
    } else if (isSharing(currentActivity)) {
        newActivityIntent.putExtra(IS_SHARING, true);
        if (isDirectSharing(currentActivity)) {
            newActivityIntent.putExtra(DIRECT_SHARING_CHAT_ID, getDirectSharingChatId(currentActivity));
        }
        if (!getSharedUris(currentActivity).isEmpty()) {
            newActivityIntent.putParcelableArrayListExtra(SHARED_URIS, getSharedUris(currentActivity));
        }
        if (getSharedText(currentActivity) != null) {
            newActivityIntent.putExtra(TEXT_EXTRA, getSharedText(currentActivity));
        }
    }
}
 
Example 6
Source File: ProfileFragment.java    From SmartPack-Kernel-Manager with GNU General Public License v3.0 6 votes vote down vote up
private Intent createProfileActivityIntent() {
    Intent intent = new Intent(getActivity(), ProfileActivity.class);

    NavigationActivity activity = (NavigationActivity) requireActivity();
    ArrayList<NavigationActivity.NavigationFragment> fragments = new ArrayList<>();
    boolean add = false;
    for (NavigationActivity.NavigationFragment fragment : activity.getFragments()) {
        if (fragment.mId == R.string.kernel) {
            add = true;
            continue;
        }
        if (!add) continue;
        if (fragment.mFragmentClass == null) break;
        if (activity.getActualFragments().get(fragment.mId) != null) {
            fragments.add(fragment);
        }
    }
    intent.putParcelableArrayListExtra(ProfileActivity.FRAGMENTS_INTENT, fragments);

    return intent;
}
 
Example 7
Source File: Detail.java    From iZhihu with GNU General Public License v2.0 5 votes vote down vote up
private boolean returnModifiedListsAndFinish() {
    Intent intent = new Intent();
    intent.putParcelableArrayListExtra(INTENT_MODIFIED_LISTS, questionsList);
    setResult(Intent.FILL_IN_PACKAGE, intent);
    finish();
    return true;
}
 
Example 8
Source File: AudioBrowserFragment.java    From VCL-Android with Apache License 2.0 5 votes vote down vote up
@Override
public void onItemClick(AdapterView<?> av, View v, int p, long id) {
    ArrayList<MediaWrapper> mediaList = mAlbumsAdapter.getMedias(p);
    Intent i = new Intent(getActivity(), SecondaryActivity.class);
    i.putExtra("fragment", SecondaryActivity.ALBUM);
    i.putParcelableArrayListExtra("list", mediaList);
    i.putExtra("filter", Util.getMediaAlbum(getActivity(), mediaList.get(0)));
    startActivity(i);
}
 
Example 9
Source File: AudioAlbumsSongsFragment.java    From VCL-Android with Apache License 2.0 5 votes vote down vote up
@Override
public void onItemClick(AdapterView<?> av, View v, int p, long id) {
    ArrayList<MediaWrapper> mediaList = mAlbumsAdapter.getMedias(p);
    Intent i = new Intent(getActivity(), SecondaryActivity.class);
    i.putExtra("fragment", SecondaryActivity.ALBUM);
    i.putParcelableArrayListExtra("list", mediaList);
    i.putExtra("filter", mAlbumsAdapter.getTitle(p));
    startActivity(i);
}
 
Example 10
Source File: AdvancedSettingsActivity.java    From alpha-wallet-android with MIT License 5 votes vote down vote up
private void onChangeLanguageClicked() {
    Intent intent = new Intent(this, SelectLocaleActivity.class);
    String currentLocale = viewModel.getDefaultLocale();
    intent.putExtra(EXTRA_LOCALE, currentLocale);
    intent.putParcelableArrayListExtra(EXTRA_STATE, viewModel.getLocaleList(this));
    startActivityForResult(intent, C.UPDATE_LOCALE);
}
 
Example 11
Source File: FavoriteRowSupportFragment.java    From alltv with MIT License 5 votes vote down vote up
private void playVideo(int currentChannel) {
    if (PlayerActivity.active) return;

    int requestCode = Utils.Code.FavoritePlay.ordinal();
    Intent intent = new Intent(getActivity(), PlayerActivity.class);
    intent.addFlags(FLAG_ACTIVITY_SINGLE_TOP);
    intent.putParcelableArrayListExtra(getStringById(R.string.CHANNELS_STR), mChannels.get(mType));
    intent.putExtra(getStringById(R.string.CURRENTCHANNEL_STR), currentChannel);

    getActivity().startActivityForResult(intent, requestCode);
}
 
Example 12
Source File: PlaceAddPresenter.java    From Fishing with GNU General Public License v3.0 5 votes vote down vote up
public void startPhotoSelect(){
    Intent intent = new Intent(getView(), PlacePhotoSelectActivity.class);
    ArrayList<Uri> uris = new ArrayList<>();
    uris.addAll(mPreUpload);
    uris.addAll(mHasUpload);
    intent.putParcelableArrayListExtra("uri",uris);
    getView().startActivityForResult(intent, PHOTO);
}
 
Example 13
Source File: SelectPictureActivity.java    From FilePicker with MIT License 5 votes vote down vote up
@Override
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
    //单选
    mSelectedFileList.add(mMediaAdapter.getData().get(position));
    Intent result = new Intent();
    result.putParcelableArrayListExtra(Const.EXTRA_RESULT_SELECTION, EssFile.getEssFileList(this, mSelectedFileList));
    setResult(RESULT_OK, result);
    super.onBackPressed();
}
 
Example 14
Source File: ImagepickerModule.java    From titanium-imagepicker with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
@Kroll.method
public void createCustomGallery(KrollDict options) {
	if ( (options != null) && options.containsKeyAndNotNull(Defaults.Params.IMAGES) ) {
		Object[] imageArray = (Object []) options.get(Defaults.Params.IMAGES);
		int size = imageArray.length;

		if (size != 0) {
			ArrayList<ImageViewerInfo> imagesInfo = new ArrayList<ImageViewerInfo>();

			for (int i=0; i<size; i++) {
				Object o = imageArray[i];
				KrollDict info = new KrollDict((HashMap<String, Object>) o);

				if ( (info != null) && info.containsKeyAndNotNull(Defaults.Params.IMAGE_PATH) ) {
					String path = info.getString(Defaults.Params.IMAGE_PATH);
					String title = info.containsKeyAndNotNull(Defaults.Params.IMAGE_TITLE) ? info.getString(Defaults.Params.IMAGE_TITLE) : "";
					String titleColor = info.containsKeyAndNotNull(Defaults.Params.IMAGE_TITLE_COLOR) ? info.getString(Defaults.Params.IMAGE_TITLE_COLOR) : Defaults.IMAGE_TITLE_COLOR;
					String titleBgColor = info.containsKeyAndNotNull(Defaults.Params.IMAGE_TITLE_BACKGROUND_COLOR) ? info.getString(Defaults.Params.IMAGE_TITLE_BACKGROUND_COLOR) : Defaults.IMAGE_TITLE_BACKGROUND_COLOR;

					imagesInfo.add(new ImageViewerInfo(path, title, titleColor, titleBgColor));
				}
			}

			if (imagesInfo.size() > 0) {
				Activity activity = TiApplication.getAppCurrentActivity();

				Intent intent = new Intent(activity, ImageViewerActivity.class);
				intent = prepareExtrasForIntent(intent, options, false);
				intent.putParcelableArrayListExtra(Defaults.Params.IMAGES, imagesInfo);

				activity.startActivity(intent);
			}

		} else {
			Log.e(Defaults.LCAT, "No images passed.");
		}

	} else {
		Log.e(Defaults.LCAT, "No options passed.");
	}
}
 
Example 15
Source File: PreviewActivity.java    From MediaPickerPoject with MIT License 4 votes vote down vote up
public void done(ArrayList<Media> list, int code) {
    Intent intent = new Intent();
    intent.putParcelableArrayListExtra(PickerConfig.EXTRA_RESULT, list);
    setResult(code, intent);
    finish();
}
 
Example 16
Source File: VMPicker.java    From VMLibrary with Apache License 2.0 4 votes vote down vote up
/**
 * 启动选择器,通过 Fragment 打开
 */
public void startPicker(Fragment fragment) {
    Intent intent = new Intent(fragment.getContext(), VMPickGridActivity.class);
    intent.putParcelableArrayListExtra(VMConstant.VM_KEY_PICK_PICTURES, (ArrayList<? extends Parcelable>) mSelectedPictures);
    fragment.startActivityForResult(intent, VMConstant.VM_PICK_REQUEST_CODE);
}
 
Example 17
Source File: ContactsManager.java    From react-native-contacts with MIT License 4 votes vote down vote up
@ReactMethod
public void editExistingContact(ReadableMap contact, Callback callback) {

    String recordID = contact.hasKey("recordID") ? contact.getString("recordID") : null;

    try {
        Uri uri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_URI, recordID);

        ReadableArray phoneNumbers = contact.hasKey("phoneNumbers") ? contact.getArray("phoneNumbers") : null;
        int numOfPhones = 0;
        String[] phones = null;
        Integer[] phonesLabels = null;
        if (phoneNumbers != null) {
            numOfPhones = phoneNumbers.size();
            phones = new String[numOfPhones];
            phonesLabels = new Integer[numOfPhones];
            for (int i = 0; i < numOfPhones; i++) {
                phones[i] = phoneNumbers.getMap(i).getString("number");
                String label = phoneNumbers.getMap(i).getString("label");
                phonesLabels[i] = mapStringToPhoneType(label);
            }
        }

        ArrayList<ContentValues> contactData = new ArrayList<>();
        for (int i = 0; i < numOfPhones; i++) {
            ContentValues phone = new ContentValues();
            phone.put(ContactsContract.Data.MIMETYPE, CommonDataKinds.Phone.CONTENT_ITEM_TYPE);
            phone.put(CommonDataKinds.Phone.TYPE, phonesLabels[i]);
            phone.put(CommonDataKinds.Phone.NUMBER, phones[i]);
            contactData.add(phone);
        }

        Intent intent = new Intent(Intent.ACTION_EDIT);
        intent.setDataAndType(uri, ContactsContract.Contacts.CONTENT_ITEM_TYPE);
        intent.putExtra("finishActivityOnSaveCompleted", true);
        intent.putParcelableArrayListExtra(ContactsContract.Intents.Insert.DATA, contactData);

        updateContactCallback = callback;
        getReactApplicationContext().startActivityForResult(intent, REQUEST_OPEN_EXISTING_CONTACT, Bundle.EMPTY);

    } catch (Exception e) {
        callback.invoke(e.toString());
    }
}
 
Example 18
Source File: ImageSelectActivity.java    From MultipleImageSelect with Apache License 2.0 4 votes vote down vote up
private void sendIntent() {
    Intent intent = new Intent();
    intent.putParcelableArrayListExtra(Constants.INTENT_EXTRA_IMAGES, getSelected());
    setResult(RESULT_OK, intent);
    finish();
}
 
Example 19
Source File: BugReportLens.java    From u2020-mvp with Apache License 2.0 4 votes vote down vote up
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[] { "[email protected]" });
    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);
}
 
Example 20
Source File: BasicUtils.java    From UltimateAndroid with Apache License 2.0 3 votes vote down vote up
/**
 * Launch a new activity with one ArrayList data and one pair of String data.
 *
 * @param context
 * @param classes
 * @param key
 * @param value
 * @param anotherKey
 * @param anotherValue
 */
public static void sendIntent(Context context, Class classes, String key, ArrayList<? extends Parcelable> value, String anotherKey, String anotherValue) {
    Intent intent = new Intent();
    intent.setClass(context, classes);
    intent.putParcelableArrayListExtra(key, value);
    intent.putExtra(anotherKey, anotherValue);
    context.startActivity(intent);
}