Search in sources :

Example 1 with UploadPhotoTask

use of com.bourke.glimmr.tasks.UploadPhotoTask in project glimmr by brk3.

the class UploadPhotoTaskQueueService method initTaskQueue.

@Override
protected void initTaskQueue() {
    TaskQueueDelegateFactory<UploadPhotoTask> factory = new TaskQueueDelegateFactory<UploadPhotoTask>(this);
    mQueue = new TaskQueue(factory.get(Constants.UPLOAD_QUEUE, UploadPhotoTask.class));
}
Also used : TaskQueueDelegateFactory(com.bourke.glimmr.common.TaskQueueDelegateFactory) UploadPhotoTask(com.bourke.glimmr.tasks.UploadPhotoTask) TaskQueue(com.squareup.tape.TaskQueue)

Example 2 with UploadPhotoTask

use of com.bourke.glimmr.tasks.UploadPhotoTask in project glimmr by brk3.

the class PhotoUploadActivity method onOptionsItemSelected.

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()) {
        case R.id.menu_upload_photos:
            /* make sure to grab UI state for current photo before finishing */
            mPhotoUploadFragment.updateMetadataFromUI();
            /* now add each photo to upload queue, and start the tape service */
            for (LocalPhotosGridFragment.LocalPhoto photo : mUploadImages) {
                mUploadQueue.add(new UploadPhotoTask(mOAuth, photo));
            }
            startService(new Intent(this, UploadPhotoTaskQueueService.class));
            final Intent mainActivity = new Intent(this, MainActivity.class);
            mainActivity.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            startActivity(mainActivity);
    }
    return super.onOptionsItemSelected(item);
}
Also used : UploadPhotoTask(com.bourke.glimmr.tasks.UploadPhotoTask) Intent(android.content.Intent) LocalPhotosGridFragment(com.bourke.glimmr.fragments.upload.LocalPhotosGridFragment) UploadPhotoTaskQueueService(com.bourke.glimmr.tape.UploadPhotoTaskQueueService)

Example 3 with UploadPhotoTask

use of com.bourke.glimmr.tasks.UploadPhotoTask in project glimmr by brk3.

the class PhotoUploadActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (BuildConfig.DEBUG)
        Log.d(getLogTag(), "onCreate");
    setContentView(R.layout.photo_upload_activity);
    mPhotoUploadFragment = (PhotoUploadFragment) getSupportFragmentManager().findFragmentById(R.id.photoUploadFragment);
    mActionBar.setDisplayHomeAsUpEnabled(true);
    TaskQueueDelegateFactory<UploadPhotoTask> factory = new TaskQueueDelegateFactory<UploadPhotoTask>(this);
    mUploadQueue = new TaskQueue(factory.get(Constants.UPLOAD_QUEUE, UploadPhotoTask.class));
    /* hide the keyboard */
    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
    handleIntent(getIntent());
}
Also used : TaskQueueDelegateFactory(com.bourke.glimmr.common.TaskQueueDelegateFactory) UploadPhotoTask(com.bourke.glimmr.tasks.UploadPhotoTask) TaskQueue(com.squareup.tape.TaskQueue)

Aggregations

UploadPhotoTask (com.bourke.glimmr.tasks.UploadPhotoTask)3 TaskQueueDelegateFactory (com.bourke.glimmr.common.TaskQueueDelegateFactory)2 TaskQueue (com.squareup.tape.TaskQueue)2 Intent (android.content.Intent)1 LocalPhotosGridFragment (com.bourke.glimmr.fragments.upload.LocalPhotosGridFragment)1 UploadPhotoTaskQueueService (com.bourke.glimmr.tape.UploadPhotoTaskQueueService)1