Example usage for android.content Intent getParcelableArrayListExtra

List of usage examples for android.content Intent getParcelableArrayListExtra

Introduction

In this page you can find the example usage for android.content Intent getParcelableArrayListExtra.

Prototype

public <T extends Parcelable> ArrayList<T> getParcelableArrayListExtra(String name) 

Source Link

Document

Retrieve extended data from the intent.

Usage

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   ww  w  .j a  v a2  s . co m
    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.asynchronous.services.CopyService.java

@Override
public int onStartCommand(Intent intent, int flags, final int startId) {

    Bundle b = new Bundle();
    isRootExplorer = intent.getBooleanExtra(TAG_IS_ROOT_EXPLORER, false);
    ArrayList<HybridFileParcelable> 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);
    sharedPreferences = PreferenceManager.getDefaultSharedPreferences(c);
    accentColor = ((AppConfig) getApplication()).getUtilsProvider().getColorPreference()
            .getCurrentUserColorPreferences(this, sharedPreferences).accent;

    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);

    customSmallContentViews = new RemoteViews(getPackageName(), R.layout.notification_service_small);
    customBigContentViews = new RemoteViews(getPackageName(), R.layout.notification_service_big);

    Intent stopIntent = new Intent(TAG_BROADCAST_COPY_CANCEL);
    PendingIntent stopPendingIntent = PendingIntent.getBroadcast(c, 1234, stopIntent,
            PendingIntent.FLAG_UPDATE_CURRENT);
    NotificationCompat.Action action = new NotificationCompat.Action(R.drawable.ic_content_copy_white_36dp,
            getString(R.string.stop_ftp), stopPendingIntent);

    mBuilder = new NotificationCompat.Builder(c, NotificationConstants.CHANNEL_NORMAL_ID)
            .setContentIntent(pendingIntent).setSmallIcon(R.drawable.ic_content_copy_white_36dp)
            .setCustomContentView(customSmallContentViews).setCustomBigContentView(customBigContentViews)
            .setCustomHeadsUpContentView(customSmallContentViews)
            .setStyle(new NotificationCompat.DecoratedCustomViewStyle()).addAction(action).setOngoing(true)
            .setColor(accentColor);//w w  w. j av a  2s.  com

    // set default notification views text

    NotificationConstants.setMetadata(c, mBuilder, NotificationConstants.TYPE_NORMAL);

    startForeground(NotificationConstants.COPY_ID, mBuilder.build());
    initNotificationViews();

    b.putBoolean(TAG_COPY_MOVE, move);
    b.putString(TAG_COPY_TARGET, targetPath);
    b.putInt(TAG_COPY_OPEN_MODE, mode);
    b.putParcelableArrayList(TAG_COPY_SOURCES, files);

    super.onStartCommand(intent, flags, startId);
    super.progressHalted();
    //going async
    new DoInBackground(isRootExplorer).execute(b);

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

From source file:com.laevatein.ui.PhotoSelectionActivity.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (requestCode == REQUEST_CODE_CAPTURE && resultCode == Activity.RESULT_OK) {
        Uri captured = mMediaStoreCompat.getCapturedPhotoUri(data, mCapturePhotoUriHolder);
        if (captured != null) {
            mCollection.add(captured);// w  w  w. ja v a  2  s  .  c  o  m
            mMediaStoreCompat.cleanUp(mCapturePhotoUriHolder);
        }
        supportInvalidateOptionsMenu();
    } else if (requestCode == REQUEST_CODE_PREVIEW && resultCode == Activity.RESULT_OK) {
        ArrayList<Uri> checked = data.getParcelableArrayListExtra(ImagePreviewActivity.EXTRA_RESULT_CHECKED);
        mCollection.overwrite(checked);
        PhotoSelectionViewHelper.refreshGridView(this);
        supportInvalidateOptionsMenu();
    }
}

From source file:io.demiseq.jetreader.service.DownloadService.java

private void handleIntent(Intent intent) {

    prefs = PreferenceManager.getDefaultSharedPreferences(this);

    String numberString = prefs.getString(GeneralSettingsActivity.KEY_DOWNLOAD_NUM, "3");
    maxDownload = Integer.parseInt(numberString);

    isNotificationEnabled = prefs.getBoolean(GeneralSettingsActivity.KEY_SHOW_NOTIFICATION, true);

    fileUtils = new FileUtils();
    image = intent.getStringExtra("image");

    ArrayList<Chapter> chapters = intent.getParcelableArrayListExtra("list");

    list.addAll(chapters);//  w ww. j  av  a 2s  .  c  om

    if (notificationManager == null && builder == null) {
        registerReceiver(stopServiceReceiver, new IntentFilter("stopFilter"));
        PendingIntent stopIntent = PendingIntent.getBroadcast(this, 0, new Intent("stopFilter"), 0);
        notificationManager = (NotificationManager) DownloadService.this
                .getSystemService(Context.NOTIFICATION_SERVICE);
        builder = new NotificationCompat.Builder(DownloadService.this);
        builder.setContentTitle("Jet Reader")
                .setContentText(getResources().getString(R.string.background_progress))
                .setSmallIcon(R.drawable.ic_stat_notification).setAutoCancel(false).setOngoing(true)
                .setPriority(NotificationCompat.PRIORITY_MAX).addAction(R.drawable.ic_action_stop,
                        getResources().getString(R.string.stop_download), stopIntent);

        Notification note = builder.build();

        notificationManager.notify(1337, builder.build());
        startForeground(1337, note);
    }

    if (list.size() > 0 && list != null) {
        getChapterToDownload();
    }
}

From source file:eu.thecoder4.gpl.pleftdroid.EditEventActivity.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (resultCode == RESULT_OK && data != null) {
        Bundle extras = data.getExtras();

        switch (requestCode) {
        case ACT_INVITEE:
            String email = extras.getString(DN_EMAIL);
            String dname = extras.getString(DN_NAME);
            if (isUseDispNameSet()) {
                email = dname + " <" + email + ">";
            }/*from w w w.j  a va  2 s  .c o m*/
            mEmails.add(email);
            ((EditText) findViewById(R.id.einvitees)).setText(getInvitees());
            break;
        case ACT_ADDDATE:
            mDates = data.getParcelableArrayListExtra(PickDateDialogActivity.DTLIST);
            ((EditText) findViewById(R.id.edatetimes)).setText(getDates());
            break;

        }
    }

}

From source file:com.perm.DoomPlay.PlayingService.java

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    String action = intent.getAction();

    assert action != null;

    if (action.equals(actionOffline) || action.equals(actionOnline)) {
        isOnline = action.equals(actionOnline);

        audios = intent.getParcelableArrayListExtra(FullPlaybackActivity.keyService);

        if (intent.getIntExtra(FullPlaybackActivity.keyIndex, 0) != valueIncredible)
            indexCurrentTrack = intent.getIntExtra(FullPlaybackActivity.keyIndex, 0);

        loadMusic();/*from  ww w . j  ava  2s.c o  m*/
    } else
        handleNotifControll(action);

    return START_NOT_STICKY;
}

From source file:se.team05.activity.RouteActivity.java

/**
 * This is called when the user has selected a media from the media
 * selection activity. A list of tracks is then passed back as a result
 * which this method then saves into the database.
 *//*from  w  w w . j ava 2s  .c o  m*/
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == MediaSelectorActivity.REQUEST_MEDIA && resultCode == RESULT_OK) {
        ArrayList<Track> selectedTracks = data
                .getParcelableArrayListExtra(MediaSelectorActivity.EXTRA_SELECTED_ITEMS);
        currentCheckPoint.addTracks(selectedTracks);
    }
}

From source file:com.bilibili.boxing_impl.ui.BoxingViewFragment.java

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (data == null) {
        return;/*from  w w  w.j a  va  2  s . co m*/
    }
    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);
    }

}

From source file:org.kontalk.ui.ConversationsActivity.java

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    // contact chooser
    if (requestCode == REQUEST_CONTACT_PICKER) {
        if (resultCode == Activity.RESULT_OK) {
            ArrayList<Uri> uris;
            Uri uri = data.getData();//  www.  java  2s .  co m
            if (uri != null) {
                openConversation(uri);
            } else if ((uris = data.getParcelableArrayListExtra("org.kontalk.contacts")) != null) {
                startGroupChat(uris);
            }
        }
    } else {
        super.onActivityResult(requestCode, resultCode, data);
    }
}

From source file:ee.ria.DigiDoc.activity.OpenExternalFileActivity.java

private void handleIntentAction() {
    Intent intent = getIntent();
    ContainerFacade container = null;//w w w. j a va2 s  . co  m
    Timber.d("Handling action: %s ", intent.getAction());
    switch (intent.getAction()) {
    case Intent.ACTION_VIEW:
        try {
            container = createContainer(intent.getData());
        } catch (Exception e) {
            Timber.e(e, "Error creating container from uri %s", intent.getData().toString());
        }
        break;
    case Intent.ACTION_SEND:
        Uri sendUri = intent.getParcelableExtra(Intent.EXTRA_STREAM);
        if (sendUri != null) {
            container = createContainer(sendUri);
        }
        break;
    case Intent.ACTION_SEND_MULTIPLE:
        ArrayList<Uri> uris = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM);
        if (uris != null) {
            container = createContainer(uris);
        }
        break;
    }

    if (container != null) {
        createContainerDetailsFragment(container);
    } else {
        createErrorFragment();
    }
}