Example usage for android.os Bundle putParcelableArrayList

List of usage examples for android.os Bundle putParcelableArrayList

Introduction

In this page you can find the example usage for android.os Bundle putParcelableArrayList.

Prototype

public void putParcelableArrayList(@Nullable String key, @Nullable ArrayList<? extends Parcelable> value) 

Source Link

Document

Inserts a List of Parcelable values into the mapping of this Bundle, replacing any existing value for the given key.

Usage

From source file:org.getlantern.firetweet.activity.support.ComposeActivity.java

@Override
public void onSaveInstanceState(final Bundle outState) {
    outState.putLongArray(EXTRA_ACCOUNT_IDS, mAccountsAdapter.getSelectedAccountIds());
    outState.putParcelableArrayList(EXTRA_MEDIA, new ArrayList<Parcelable>(getMediaList()));
    outState.putBoolean(EXTRA_IS_POSSIBLY_SENSITIVE, mIsPossiblySensitive);
    outState.putParcelable(EXTRA_STATUS, mInReplyToStatus);
    outState.putLong(EXTRA_STATUS_ID, mInReplyToStatusId);
    outState.putParcelable(EXTRA_USER, mMentionUser);
    outState.putParcelable(EXTRA_DRAFT, mDraftItem);
    outState.putBoolean(EXTRA_SHOULD_SAVE_ACCOUNTS, mShouldSaveAccounts);
    outState.putString(EXTRA_ORIGINAL_TEXT, mOriginalText);
    outState.putParcelable(EXTRA_TEMP_URI, mTempPhotoUri);
    super.onSaveInstanceState(outState);
}

From source file:com.android.tv.settings.dialog.DialogFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putString(EXTRA_CONTENT_TITLE, mTitle);
    outState.putString(EXTRA_CONTENT_BREADCRUMB, mBreadcrumb);
    outState.putString(EXTRA_CONTENT_DESCRIPTION, mDescription);
    outState.putInt(EXTRA_CONTENT_ICON_RESOURCE_ID, mIconResourceId);
    outState.putParcelable(EXTRA_CONTENT_ICON_URI, mIconUri);
    outState.putParcelable(EXTRA_CONTENT_ICON_BITMAP, mIconBitmap);
    outState.putInt(EXTRA_CONTENT_ICON_BACKGROUND, mIconBackgroundColor);
    outState.putParcelableArrayList(EXTRA_ACTION_ACTIONS, mActions);
    outState.putInt(EXTRA_ACTION_SELECTED_INDEX,
            (mListView != null) ? getSelectedItemPosition() : mSelectedIndex);
    outState.putString(EXTRA_ACTION_NAME, mName);
    outState.putBoolean(EXTRA_ENTRY_TRANSITION_PERFORMED, mEntryTransitionPerformed);
}

From source file:org.mariotaku.twidere.activity.support.ComposeActivity.java

@Override
public void onSaveInstanceState(final Bundle outState) {
    outState.putLongArray(EXTRA_ACCOUNT_IDS, mAccountsAdapter.getSelectedAccountIds());
    outState.putParcelableArrayList(EXTRA_MEDIA, new ArrayList<Parcelable>(getMediaList()));
    outState.putBoolean(EXTRA_IS_POSSIBLY_SENSITIVE, mIsPossiblySensitive);
    outState.putParcelable(EXTRA_STATUS, mInReplyToStatus);
    outState.putLong(EXTRA_STATUS_ID, mInReplyToStatusId);
    outState.putParcelable(EXTRA_USER, mMentionUser);
    outState.putParcelable(EXTRA_DRAFT, mDraftItem);
    outState.putBoolean(EXTRA_SHOULD_SAVE_ACCOUNTS, mShouldSaveAccounts);
    outState.putString(EXTRA_ORIGINAL_TEXT, mOriginalText);
    super.onSaveInstanceState(outState);
}

From source file:com.filemanager.free.services.CopyService.java

@Override
public int onStartCommand(Intent intent, int flags, int startId) throws NullPointerException {
    Bundle b = new Bundle();
    ArrayList<BaseFile> files = intent.getParcelableArrayListExtra("FILE_PATHS");
    String FILE2 = intent.getStringExtra("COPY_DIRECTORY");
    int mode = intent.getIntExtra("MODE", 0);
    mNotifyManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    b.putInt("id", startId);
    Intent notificationIntent = new Intent(this, MainActivity.class);
    notificationIntent.setAction(Intent.ACTION_MAIN);
    notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    notificationIntent.putExtra("openprocesses", true);
    PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
    mBuilder = new NotificationCompat.Builder(c);
    mBuilder.setContentIntent(pendingIntent);
    mBuilder.setContentTitle(getResources().getString(R.string.copying))

            .setSmallIcon(R.drawable.ic_content_copy_white_36dp);
    if (foreground) {
        startForeground(Integer.parseInt("456" + startId), mBuilder.build());
        foreground = false;/* www.j  a v  a  2 s  .co m*/
    }
    b.putBoolean("move", intent.getBooleanExtra("move", false));
    b.putString("FILE2", FILE2);
    b.putInt("MODE", mode);
    b.putParcelableArrayList("files", files);
    hash.put(startId, true);
    DataPackage intent1 = new DataPackage();
    intent1.setName(files.get(0).getName());
    intent1.setTotal(0);
    intent1.setDone(0);
    intent1.setId(startId);
    intent1.setP1(0);
    intent1.setP2(0);
    intent1.setMove(intent.getBooleanExtra("move", false));
    intent1.setCompleted(false);
    hash1.put(startId, intent1);
    //going async
    new DoInBackground().execute(b);

    // If we get killed, after returning from here, restart
    return START_STICKY;
}

From source file:com.amaze.filemanager.services.CopyService.java

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    Bundle b = new Bundle();
    ArrayList<BaseFile> files = intent.getParcelableArrayListExtra("FILE_PATHS");
    String FILE2 = intent.getStringExtra("COPY_DIRECTORY");
    int mode = intent.getIntExtra("MODE", 0);
    mNotifyManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    b.putInt("id", startId);
    Intent notificationIntent = new Intent(this, MainActivity.class);
    notificationIntent.setAction(Intent.ACTION_MAIN);
    notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    notificationIntent.putExtra("openprocesses", true);
    PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
    mBuilder = new NotificationCompat.Builder(c);
    mBuilder.setContentIntent(pendingIntent);
    mBuilder.setContentTitle(getResources().getString(R.string.copying))

            .setSmallIcon(R.drawable.ic_content_copy_white_36dp);
    if (foreground) {
        startForeground(Integer.parseInt("456" + startId), mBuilder.build());
        foreground = false;// ww  w . j  av a 2s. c  o m
    }
    b.putBoolean("move", intent.getBooleanExtra("move", false));
    b.putString("FILE2", FILE2);
    b.putInt("MODE", mode);
    b.putParcelableArrayList("files", files);
    hash.put(startId, true);
    DataPackage intent1 = new DataPackage();
    intent1.setName(files.get(0).getName());
    intent1.setTotal(0);
    intent1.setDone(0);
    intent1.setId(startId);
    intent1.setP1(0);
    intent1.setP2(0);
    intent1.setMove(intent.getBooleanExtra("move", false));
    intent1.setCompleted(false);
    hash1.put(startId, intent1);
    //going async
    new DoInBackground().execute(b);

    // If we get killed, after returning from here, restart
    return START_STICKY;
}

From source file:com.amaze.carbonfilemanager.services.ZipTask.java

@Override
public int onStartCommand(Intent intent, int flags, final int startId) {
    Bundle b = new Bundle();
    String path = intent.getStringExtra(KEY_COMPRESS_PATH);

    ArrayList<BaseFile> baseFiles = intent.getParcelableArrayListExtra(KEY_COMPRESS_FILES);

    File zipFile = new File(path);
    mZipPath = PreferenceManager.getDefaultSharedPreferences(this).getString(PreferenceUtils.KEY_PATH_COMPRESS,
            path);/* w  w w  .  j  a va 2  s. c o  m*/
    mNotifyManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    if (!mZipPath.equals(path)) {
        mZipPath.concat(mZipPath.endsWith("/") ? (zipFile.getName()) : ("/" + zipFile.getName()));
    }

    if (!zipFile.exists()) {
        try {
            zipFile.createNewFile();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    mBuilder = new NotificationCompat.Builder(this);
    Intent notificationIntent = new Intent(this, MainActivity.class);
    notificationIntent.putExtra(MainActivity.KEY_INTENT_PROCESS_VIEWER, true);
    PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
    mBuilder.setContentIntent(pendingIntent);
    mBuilder.setContentTitle(getResources().getString(R.string.compressing))
            .setSmallIcon(R.drawable.ic_zip_box_grey600_36dp);
    startForeground(Integer.parseInt("789" + startId), mBuilder.build());
    b.putInt("id", startId);
    b.putParcelableArrayList(KEY_COMPRESS_FILES, baseFiles);
    b.putString(KEY_COMPRESS_PATH, mZipPath);
    new DoWork().execute(b);
    // If we get killed, after returning from here, restart
    return START_STICKY;
}

From source file:com.veniosg.dir.android.fragment.SimpleFileListFragment.java

private boolean handleMultipleSelectionAction(ActionMode mode, MenuItem item) {
    DialogFragment dialog;//from   w ww  .j  av a 2s .  com
    Bundle args;
    ArrayList<FileHolder> fItems = getCheckedItems();

    switch (item.getItemId()) {
    case R.id.menu_send:
        mode.finish();
        Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);
        ArrayList<Uri> uris = new ArrayList<Uri>();
        intent.setType("text/plain");

        for (FileHolder fh : fItems) {
            if (!fh.getFile().isDirectory())
                uris.add(FileUtils.getUri(fh));
        }

        intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);

        try {
            startActivity(Intent.createChooser(intent, getString(R.string.send_chooser_title)));
            return true;
        } catch (ActivityNotFoundException e) {
            Toast.makeText(getActivity(), R.string.send_not_available, Toast.LENGTH_SHORT).show();
            return true;
        }
    case R.id.menu_delete:
        mode.finish();
        dialog = new MultiDeleteDialog();
        dialog.setTargetFragment(this, 0);
        args = new Bundle();
        args.putParcelableArrayList(IntentConstants.EXTRA_DIALOG_FILE_HOLDER,
                new ArrayList<Parcelable>(fItems));
        dialog.setArguments(args);
        dialog.show(getFragmentManager(), MultiDeleteDialog.class.getName());
        return true;
    case R.id.menu_move:
        mode.finish();
        ((FileManagerApplication) getActivity().getApplication()).getCopyHelper().cut(fItems);
        getActivity().supportInvalidateOptionsMenu();
        return true;
    case R.id.menu_copy:
        mode.finish();
        ((FileManagerApplication) getActivity().getApplication()).getCopyHelper().copy(fItems);
        getActivity().supportInvalidateOptionsMenu();
        return true;
    case R.id.menu_compress:
        mode.finish();
        dialog = new MultiCompressDialog();
        dialog.setTargetFragment(this, 0);
        args = new Bundle();
        args.putParcelableArrayList(IntentConstants.EXTRA_DIALOG_FILE_HOLDER,
                new ArrayList<Parcelable>(fItems));
        dialog.setArguments(args);
        dialog.show(getFragmentManager(), MultiCompressDialog.class.getName());
        return true;
    default:
        return false;
    }
}

From source file:com.keylesspalace.tusky.ComposeActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    ArrayList<SavedQueuedMedia> savedMediaQueued = new ArrayList<>();
    for (QueuedMedia item : mediaQueued) {
        savedMediaQueued.add(new SavedQueuedMedia(item.id, item.type, item.uri, item.mediaSize, item.readyStage,
                item.description));//from   www  .  j  a  va 2 s . c  o  m
    }
    outState.putParcelableArrayList("savedMediaQueued", savedMediaQueued);
    outState.putBoolean("statusMarkSensitive", statusMarkSensitive);
    outState.putBoolean("statusHideText", statusHideText);
    if (currentInputContentInfo != null) {
        outState.putParcelable("commitContentInputContentInfo", (Parcelable) currentInputContentInfo.unwrap());
        outState.putInt("commitContentFlags", currentFlags);
    }
    currentInputContentInfo = null;
    currentFlags = 0;
    outState.putParcelable("photoUploadUri", photoUploadUri);
    outState.putInt("statusVisibility", statusVisibility.getNum());
    super.onSaveInstanceState(outState);
}

From source file:com.amaze.carbonfilemanager.services.CopyService.java

@Override
public int onStartCommand(Intent intent, int flags, final int startId) {
    Bundle b = new Bundle();
    ArrayList<BaseFile> files = intent.getParcelableArrayListExtra(TAG_COPY_SOURCES);
    String targetPath = intent.getStringExtra(TAG_COPY_TARGET);
    int mode = intent.getIntExtra(TAG_COPY_OPEN_MODE, OpenMode.UNKNOWN.ordinal());
    final boolean move = intent.getBooleanExtra(TAG_COPY_MOVE, false);

    mNotifyManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    b.putInt(TAG_COPY_START_ID, startId);
    Intent notificationIntent = new Intent(this, MainActivity.class);
    notificationIntent.setAction(Intent.ACTION_MAIN);
    notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    notificationIntent.putExtra(MainActivity.KEY_INTENT_PROCESS_VIEWER, true);
    PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
    mBuilder = new NotificationCompat.Builder(c);
    mBuilder.setContentIntent(pendingIntent);
    mBuilder.setContentTitle(getResources().getString(R.string.copying))
            .setSmallIcon(R.drawable.ic_content_copy_white_36dp);

    startForeground(Integer.parseInt("456" + startId), mBuilder.build());

    b.putBoolean(TAG_COPY_MOVE, move);/*from   w w  w .j a  v  a  2s .  c  om*/
    b.putString(TAG_COPY_TARGET, targetPath);
    b.putInt(TAG_COPY_OPEN_MODE, mode);
    b.putParcelableArrayList(TAG_COPY_SOURCES, files);

    //going async
    new DoInBackground().execute(b);

    // If we get killed, after returning from here, restart
    return START_STICKY;
}

From source file:com.amaze.filemanager.fragments.Main.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);

    int index;//from   w w w  .  j  av  a2s .c  om
    View vi;
    if (listView != null) {
        if (IS_LIST) {

            index = (mLayoutManager).findFirstVisibleItemPosition();
            vi = listView.getChildAt(0);
        } else {
            index = (mLayoutManagerGrid).findFirstVisibleItemPosition();
            vi = listView.getChildAt(0);
        }
        int top = (vi == null) ? 0 : vi.getTop();
        outState.putInt("index", index);
        outState.putInt("top", top);
        outState.putBoolean("IS_LIST", IS_LIST);
        outState.putParcelableArrayList("list", LIST_ELEMENTS);
        outState.putString("CURRENT_PATH", CURRENT_PATH);
        outState.putBoolean("selection", selection);
        outState.putInt("openMode", openMode);
        outState.putInt("folder_count", folder_count);
        outState.putInt("file_count", file_count);
        if (selection) {
            outState.putIntegerArrayList("position", adapter.getCheckedItemPositions());
        }
        outState.putBoolean("results", results);
        outState.putParcelable("adapter", adapter);
        if (openMode == 1) {
            outState.putString("SmbPath", smbPath);
        }
    }
}