Java Code Examples for android.content.Intent.getParcelableArrayListExtra()

The following are Jave code examples for showing how to use getParcelableArrayListExtra() of the android.content.Intent class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: GitHub   File: BoxingViewFragment.java   View Source Code Vote up 7 votes
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (data == null) {
        return;
    }
    if (resultCode == Activity.RESULT_OK && requestCode == IMAGE_PREVIEW_REQUEST_CODE) {
        mIsPreview = false;
        boolean isBackClick = data.getBooleanExtra(BoxingViewActivity.EXTRA_TYPE_BACK, false);
        List<BaseMedia> selectedMedias = data.getParcelableArrayListExtra(Boxing.EXTRA_SELECTED_MEDIA);
        onViewActivityRequest(selectedMedias, mMediaAdapter.getAllMedias(), isBackClick);
        if (isBackClick) {
            mMediaAdapter.setSelectedMedias(selectedMedias);
            mMediaAdapter.notifyDataSetChanged();
        }
        updateMultiPickerLayoutState(selectedMedias);
    }

}
 
Example 2
Project: Simpler   File: WBPostActivity.java   View Source Code Vote up 7 votes
private void handleSendMultipleImages(Intent intent) {
    ArrayList<Uri> imageUris = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM);
    mEtContent.setText("分享照片");
    mEtContent.setSelection(mEtContent.length());
    if (imageUris != null && !imageUris.isEmpty()) {
        int size = imageUris.size();
        if (size > 9) {
            size = 9;
        }
        Uri uri;
        for (int i = 0; i < size; i++) {
            uri = imageUris.get(i);
            mPhotoList.add(new Photo(uri.getPath()));
        }
        mPhotoAdapter.setData(mPhotoList);
    }
}
 
Example 3
Project: Phoenix-for-VK   File: DocsFragment.java   View Source Code Vote up 7 votes
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (requestCode == REQUEST_CODE_FILE && resultCode == Activity.RESULT_OK) {
        String file = data.getStringExtra(FileManagerFragment.returnFileParameter);

        ArrayList<LocalPhoto> photos = data.getParcelableArrayListExtra(Extra.PHOTOS);

        if(nonEmpty(file)){
            getPresenter().fireFileForUploadSelected(file);
        } else if(nonEmpty(photos)){
            getPresenter().fireLocalPhotosForUploadSelected(photos);
        }
    }
}
 
Example 4
Project: Phoenix-for-VK   File: MessageAttachmentsFragment.java   View Source Code Vote up 7 votes
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    Bundle extras = nonNull(data) ? data.getExtras() : null;
    Logger.d(tag(), "onActivityResult, extras: " + extras);

    if(requestCode == REQUEST_ADD_VKPHOTO && resultCode == Activity.RESULT_OK){
        ArrayList<Photo> vkphotos = data.getParcelableArrayListExtra(Extra.ATTACHMENTS);
        ArrayList<LocalPhoto> localPhotos = data.getParcelableArrayListExtra(Extra.PHOTOS);
        getPresenter().firePhotosSelected(vkphotos, localPhotos);
    }

    if(requestCode == REQUEST_SELECT_ATTACHMENTS && resultCode == Activity.RESULT_OK){
        ArrayList<AbsModel> attachments = data.getParcelableArrayListExtra(Extra.ATTACHMENTS);
        getPresenter().fireAttachmentsSelected(attachments);
    }

    if (requestCode == REQUEST_PHOTO_FROM_CAMERA && resultCode == Activity.RESULT_OK) {
        getPresenter().firePhotoMaked();
    }
}
 
Example 5
Project: NeiHanDuanZiTV   File: BoxingViewFragment.java   View Source Code Vote up 7 votes
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (data == null) {
        return;
    }
    if (resultCode == Activity.RESULT_OK && requestCode == IMAGE_PREVIEW_REQUEST_CODE) {
        mIsPreview = false;
        boolean isBackClick = data.getBooleanExtra(BoxingViewActivity.EXTRA_TYPE_BACK, false);
        List<BaseMedia> selectedMedias = data.getParcelableArrayListExtra(Boxing.EXTRA_SELECTED_MEDIA);
        onViewActivityRequest(selectedMedias, mMediaAdapter.getAllMedias(), isBackClick);
        if (isBackClick) {
            mMediaAdapter.setSelectedMedias(selectedMedias);
            mMediaAdapter.notifyDataSetChanged();
        }
        updateMultiPickerLayoutState(selectedMedias);
    }

}
 
Example 6
Project: Protestr   File: CreateEventActivity.java   View Source Code Vote up 6 votes
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode == RESULT_OK) {
        if (requestCode == ADDED_ADMINS_CODE) {
            addedUsers = data.getParcelableArrayListExtra(Constants.ADDED_ADMINS_EXTRA);
            tvAdmins.setText(getString(R.string.add_admins_with_number, addedUsers.size()));
        } else if (requestCode == ImagePicker.PICK_IMAGE_REQUEST_CODE) {
            eventBitmapIntent = data;
            updateEventImage(ImagePicker.getImageFromResult(this, requestCode, resultCode, data));
        }
    }
}
 
Example 7
Project: DoorPhone   File: SipService.java   View Source Code Vote up 6 votes
/**
 * Sets codec priorities
 * Sends {@link BroadcastEventSender#codecPrioritiesSetStatus(boolean)}.
 * @param intent The caller intent.
 */
private void setCodecPriorities(Intent intent) {
    ArrayList<CodecPriority> codecPriorities = intent.getParcelableArrayListExtra(PARAM_CODEC_PRIORITIES);

    if (codecPriorities == null) {
        return;
    }

    startStack();

    if (!mStarted) {
        mBroadcastEventSender.codecPrioritiesSetStatus(false);
        return;
    }

    try {
        StringBuilder log = new StringBuilder();
        log.append("Codec priorities successfully set. The priority order is now:\n");

        for (CodecPriority codecPriority : codecPriorities) {
            mEndpoint.codecSetPriority(codecPriority.getCodecId(), (short) codecPriority.getPriority());
            log.append(codecPriority.toString()).append("\n");
        }

        SharedPreferencesUtil.persistConfiguredCodecPriorities(this, codecPriorities);
        Log.d(TAG, log.toString());
        mBroadcastEventSender.codecPrioritiesSetStatus(true);

    } catch (Exception exc) {
        Log.e(TAG, "Error while setting codec priorities", exc);
        mBroadcastEventSender.codecPrioritiesSetStatus(false);
    }
}
 
Example 8
Project: TPlayer   File: ChooseTypeAndAccountActivity.java   View Source Code Vote up 6 votes
/**
 * Returns a set of whitelisted accounts given by the intent or null if none specified by the
 * intent.
 */
private Set<Account> getAllowableAccountSet(final Intent intent) {
    Set<Account> setOfAllowableAccounts = null;
    final ArrayList<Parcelable> validAccounts =
            intent.getParcelableArrayListExtra(EXTRA_ALLOWABLE_ACCOUNTS_ARRAYLIST);
    if (validAccounts != null) {
        setOfAllowableAccounts = new HashSet<>(validAccounts.size());
        for (Parcelable parcelable : validAccounts) {
            setOfAllowableAccounts.add((Account) parcelable);
        }
    }
    return setOfAllowableAccounts;
}
 
Example 9
Project: NeiHanDuanZiTV   File: Boxing.java   View Source Code Vote up 6 votes
/**
 * get the media result.
 */
@Nullable
public static ArrayList<BaseMedia> getResult(Intent data) {
    if (data != null) {
        return data.getParcelableArrayListExtra(EXTRA_RESULT);
    }
    return null;
}
 
Example 10
Project: GitHub   File: Boxing.java   View Source Code Vote up 6 votes
/**
 * get the media result.
 */
@Nullable
public static ArrayList<BaseMedia> getResult(Intent data) {
    if (data != null) {
        return data.getParcelableArrayListExtra(EXTRA_RESULT);
    }
    return null;
}
 
Example 11
Project: AliZhiBoHao   File: PushParamsActivity.java   View Source Code Vote up 6 votes
public void getExternalData() {
        Intent intent = getIntent();
        pushUrl = intent.getStringExtra("pushurl");
//        pushUrl=" rtmp://video-center.alivecdn.com/live/123?vhost=ali.zipindao.tv";//阿里流
//        pushUrl="rtmp://appa-push.zipindao.tv/live/110";//网宿流
        eventUrl = intent.getStringExtra("eventurl");
        openID = intent.getStringExtra("openid");
        memberlevelId = Integer.parseInt(intent.getStringExtra("memberlevelid"));
        productList = intent.getParcelableArrayListExtra("products_list");
        mShareInfo = intent.getParcelableExtra("shareinfo");
    }
 
Example 12
Project: Phoenix-for-VK   File: CommunityBlacklistFragment.java   View Source Code Vote up 6 votes
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if(requestCode == REQUEST_SELECT_PROFILES && resultCode == Activity.RESULT_OK){
        ArrayList<User> users = data.getParcelableArrayListExtra(Extra.USERS);
        AssertUtils.requireNonNull(users);
        postPrenseterReceive(presenter -> presenter.fireAddToBanUsersSelected(users));
    }
}
 
Example 13
Project: Phoenix-for-VK   File: DialogsFragment.java   View Source Code Vote up 6 votes
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (requestCode == REQUEST_CODE_SELECT_USERS_FOR_CHAT && resultCode == Activity.RESULT_OK) {
        ArrayList<User> users = data.getParcelableArrayListExtra(Extra.USERS);
        AssertUtils.requireNonNull(users);

        getPresenter().fireUsersForChatSelected(users);
    }
}
 
Example 14
Project: rongyunDemo   File: SealSearchMoreFriendsActivity.java   View Source Code Vote up 6 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_more_friends_detail_info);

    Intent intent = getIntent();
    mFilterString = intent.getStringExtra("filterString");
    mFilterFriendList = intent.getParcelableArrayListExtra("filterFriendList");
    initView();
    initData();
}
 
Example 15
Project: boxing   File: Boxing.java   View Source Code Vote up 6 votes
/**
 * get the media result.
 */
@Nullable
public static ArrayList<BaseMedia> getResult(Intent data) {
    if (data != null) {
        return data.getParcelableArrayListExtra(EXTRA_RESULT);
    }
    return null;
}
 
Example 16
Project: Phoenix-for-VK   File: ActivityUtils.java   View Source Code Vote up 6 votes
public static ArrayList<Uri> checkLocalStreams(Activity activity) {
    Intent intent = activity.getIntent();
    if (intent == null) {
        return null;
    }

    Bundle extras = intent.getExtras();
    String action = intent.getAction();
    if (extras == null || action == null) {
        return null;
    }

    if (Intent.ACTION_SEND_MULTIPLE.equals(action)) {
        if (extras.containsKey(Intent.EXTRA_STREAM)) {
            return intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM);
        }
    }

    if (Intent.ACTION_SEND.equals(action)) {
        if (extras.containsKey(Intent.EXTRA_STREAM)) {
            Uri uri = intent.getParcelableExtra(Intent.EXTRA_STREAM);
            if (uri != null) {
                ArrayList<Uri> streams = new ArrayList<>(1);
                streams.add(uri);
                return streams;
            }
        }
    }

    return null;
}
 
Example 17
Project: redpacketui-open   File: SendGroupPacketFragment.java   View Source Code Vote up 5 votes
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (data == null) {
        return;
    }
    if (requestCode == FLAG_OPEN_GROUP_MEMBER && resultCode == Activity.RESULT_OK) {
        mRPUserBean = data.getParcelableExtra(RPConstant.EXTRA_GROUP_USER);
        mList = data.getParcelableArrayListExtra(RPConstant.EXTRA_GROUP_MEMBERS);
        if (!TextUtils.equals(mRPUserBean.userNickname, mContext.getString(R.string.tv_all_person))) {
            mIsExclusive = true;
            mEtMoneyCount.setEnabled(false);
            mEtMoneyCount.setText("1");
            mEtMoneyAmount.setText("");
            mTvAmount.setText("");
            enableButton(false);
            mIvRandomIcon.setVisibility(View.VISIBLE);
            mIvRandomIcon.setBackgroundResource(R.drawable.rp_exclusive_icon);
            mTvMoneyType.setVisibility(View.GONE);
            mTvAmount.setText(mContext.getString(R.string.group_money_total));
            if (mRedPacketInfo.groupMemberCount <= 0) {
                mTvGroupCount.setVisibility(View.VISIBLE);
                mTvGroupCount.setText(R.string.group_choose_few_person2);
            } else {
                mTvGroupCount.setText(String.format(getResources().getString(R.string.group_choose_few_person), mRedPacketInfo.groupMemberCount + ""));
            }
            mTvMoneyTypeInfo.setText(mContext.getString(R.string.msg_choose_few_person_red_packet));
        } else {//恢复之前的红包类型
            mIsExclusive = false;
            mEtMoneyCount.setEnabled(true);
            mTvMoneyType.setVisibility(View.VISIBLE);
            if (mRedPacketInfo.groupMemberCount <= 0) {
                mTvGroupCount.setVisibility(View.GONE);
            } else {
                mTvGroupCount.setText(String.format(getResources().getString(R.string.group_member_count), mRedPacketInfo.groupMemberCount + ""));

            }
            switchDefaultRedPacketType();
        }
        mTvReceiveName.setText(mRPUserBean.userNickname);

    }
}
 
Example 18
Project: Sega   File: ImagePickerActivity.java   View Source Code Vote up 5 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_image_picker);

    Intent intent = getIntent();
    if (intent == null) {
        finish();
    }

    mainLayout = (RelativeLayout) findViewById(R.id.main);
    progressBar = (ProgressWheel) findViewById(R.id.progress_bar);
    emptyTextView = (TextView) findViewById(R.id.tv_empty_images);
    recyclerView = (RecyclerView) findViewById(R.id.recyclerView);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    actionBar = getSupportActionBar();

    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setHomeAsUpIndicator(R.drawable.ic_arrow_back);
        actionBar.setDisplayShowTitleEnabled(true);
    }

    /** Get extras */
    limit = intent.getIntExtra(ImagePickerActivity.INTENT_EXTRA_LIMIT, Constants.MAX_LIMIT);
    mode = intent.getIntExtra(ImagePickerActivity.INTENT_EXTRA_MODE, ImagePickerActivity.MODE_MULTIPLE);
    folderMode = intent.getBooleanExtra(ImagePickerActivity.INTENT_EXTRA_FOLDER_MODE, false);

    if (intent.hasExtra(INTENT_EXTRA_FOLDER_TITLE)) {
        folderTitle = intent.getStringExtra(ImagePickerActivity.INTENT_EXTRA_FOLDER_TITLE);
    } else {
        folderTitle = getString(R.string.title_folder);
    }

    if (intent.hasExtra(INTENT_EXTRA_IMAGE_TITLE)) {
        imageTitle = intent.getStringExtra(ImagePickerActivity.INTENT_EXTRA_IMAGE_TITLE);
    } else {
        imageTitle = getString(R.string.title_select_image);
    }

    imageDirectory = intent.getStringExtra(ImagePickerActivity.INTENT_EXTRA_IMAGE_DIRECTORY);
    if (imageDirectory == null || TextUtils.isEmpty(imageDirectory)) {
        imageDirectory = getString(R.string.image_directory);
    }

    showCamera = intent.getBooleanExtra(ImagePickerActivity.INTENT_EXTRA_SHOW_CAMERA, true);
    if (mode == ImagePickerActivity.MODE_MULTIPLE && intent.hasExtra(ImagePickerActivity.INTENT_EXTRA_SELECTED_IMAGES)) {
        selectedImages = intent.getParcelableArrayListExtra(ImagePickerActivity.INTENT_EXTRA_SELECTED_IMAGES);
    }
    if (selectedImages == null)
        selectedImages = new ArrayList<>();
    images = new ArrayList<>();


    /** Set activity title */
    if (actionBar != null) {
        actionBar.setTitle(folderMode ? folderTitle : imageTitle);
    }

    /** Init folder and image adapter */
    imageAdapter = new ImagePickerAdapter(this, images, selectedImages, this);
    folderAdapter = new FolderPickerAdapter(this, new OnFolderClickListener() {
        @Override
        public void onFolderClick(Folder bucket) {
            foldersState = recyclerView.getLayoutManager().onSaveInstanceState();
            setImageAdapter(bucket.getImages());
        }
    });

    orientationBasedUI(getResources().getConfiguration().orientation);

}
 
Example 19
Project: Tribe   File: ChooseCountryFragment.java   View Source Code Vote up 5 votes
private void initIntentData() {
    Intent intent = getActivity().getIntent();
    mOpenCountries = intent.getParcelableArrayListExtra("openCountries");
}
 
Example 20
Project: Bridge   File: FileSaveService.java   View Source Code Vote up 5 votes
private void handleSaveFile(Intent intent) {
    boolean share = intent.getBooleanExtra(EXTRA_SHARE, false);

    if (!checkPermission(share)) {
        Log.d(TAG, "no write storage permission");

        toast(getString(R.string.fail_no_write_storage_permission));
        return;
    }

    ArrayList<Uri> uris;
    if (intent.getAction().equals(Intent.ACTION_SEND)) {
        uris = new ArrayList<>();
        uris.add(intent.<Uri>getParcelableExtra(Intent.EXTRA_STREAM));
    } else {
        uris = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM);
    }

    File firstFile = null;
    Uri firstUri = null;

    ArrayList<Uri> u = new ArrayList<>();
    for (Uri uri : uris) {
        Result result = save(uri, share);

        if (result.e != null) {
            toast(getString(R.string.save_failed, result.e.getMessage()));
            continue;
        }

        if (firstFile == null) {
            firstFile = result.file;
            firstUri = result.uri;
        }

        if (!share) {
            sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.fromFile(result.file)));
        }

        u.add(result.uri);
    }

    if (firstFile == null) {
        return;
    }

    String path = FileUtils.getRelativePathOfExternalStorage(firstFile);
    if (!share) {
        if (intent.getAction().equals(Intent.ACTION_SEND) || u.size() == 1) {
            toast(getString(R.string.saved, path));
        } else {
            path = path.substring(0, path.length() - firstFile.getName().length());
            toast(getResources().getQuantityString(R.plurals.saved_multiple, u.size() - 1, u.size() - 1, firstFile.getName(), path));
        }
    } else {
        intent.setPackage(null)
                .setComponent(null)
                .removeExtra(EXTRA_SHARE);

        if (intent.getAction().equals(Intent.ACTION_SEND)) {
            intent.putExtra(Intent.EXTRA_STREAM, firstUri);
        } else {
            intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, u);
        }

        ChooserActivity.start(this, intent, ResolveInfoHelper.filter(getPackageManager().queryIntentActivities(intent, 0), false));
    }
}