Example usage for android.os Bundle getLong

List of usage examples for android.os Bundle getLong

Introduction

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

Prototype

public long getLong(String key) 

Source Link

Document

Returns the value associated with the given key, or 0L if no mapping of the desired type exists for the given key.

Usage

From source file:com.vuze.android.remote.activity.TorrentOpenOptionsActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    AndroidUtilsUI.onCreate(this);
    super.onCreate(savedInstanceState);

    Intent intent = getIntent();//  w  w  w  . j a v  a2 s  .c o  m

    final Bundle extras = intent.getExtras();
    if (extras == null) {
        Log.e(TAG, "No extras!");
        finish();
        return;
    }

    String remoteProfileID = extras.getString(SessionInfoManager.BUNDLE_KEY);
    if (remoteProfileID != null) {
        sessionInfo = SessionInfoManager.getSessionInfo(remoteProfileID, this);
    }

    torrentID = extras.getLong("TorrentID");

    if (sessionInfo == null) {
        Log.e(TAG, "sessionInfo NULL!");
        finish();
        return;
    }

    Map<?, ?> torrent = sessionInfo.getTorrent(torrentID);
    if (torrent == null) {
        Log.e(TAG, "torrent NULL");
        finish();
        return;
    }

    RemoteProfile remoteProfile = sessionInfo.getRemoteProfile();
    positionLast = remoteProfile.isAddPositionLast();
    stateQueued = remoteProfile.isAddStateQueued();

    setContentView(R.layout.activity_torrent_openoptions);
    setupActionBar();

    Button btnAdd = (Button) findViewById(R.id.openoptions_btn_add);
    Button btnCancel = (Button) findViewById(R.id.openoptions_btn_cancel);
    CompoundButton cbSilentAdd = (CompoundButton) findViewById(R.id.openoptions_cb_silentadd);

    if (btnAdd != null) {
        btnAdd.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                finish(true);
            }
        });
    }
    if (btnCancel != null) {
        btnCancel.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                finish(false);
            }
        });
    }
    if (cbSilentAdd != null) {
        cbSilentAdd.setOnCheckedChangeListener(new OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                sessionInfo.getRemoteProfile().setAddTorrentSilently(isChecked);
            }
        });
        cbSilentAdd.setChecked(sessionInfo.getRemoteProfile().isAddTorrentSilently());
    }

}

From source file:ca.rmen.android.scrumchatter.main.MainActivity.java

/**
 * The user tapped on the OK button on a dialog in which s/he entered text.
 *
 * @param actionId the action id which was provided to the {@link DialogFragmentFactory} when creating the dialog.
 * @param input    the text entered by the user.
 * @param extras   any extras which were provided to the {@link DialogFragmentFactory} when creating the dialog.
 * @see ca.rmen.android.scrumchatter.dialog.InputDialogFragment.DialogInputListener#onInputEntered(int, java.lang.String, android.os.Bundle)
 *//*from  w  w  w. ja v a 2  s. com*/
@Override
public void onInputEntered(int actionId, String input, Bundle extras) {
    Log.v(TAG, "onInputEntered: actionId = " + actionId + ", input = " + input + ", extras = " + extras);
    if (actionId == R.id.fab_new_member) {
        long teamId = extras.getLong(Teams.EXTRA_TEAM_ID);
        mMembers.createMember(teamId, input);
    } else if (actionId == R.id.action_rename_member) {
        long memberId = extras.getLong(Members.EXTRA_MEMBER_ID);
        mMembers.renameMember(memberId, input);
    } else if (actionId == R.id.action_team) {
        mTeams.createTeam(input);
    } else if (actionId == R.id.action_team_rename) {
        Uri teamUri = extras.getParcelable(Teams.EXTRA_TEAM_URI);
        mTeams.renameTeam(teamUri, input);
    }
}

From source file:ca.rmen.android.scrumchatter.main.MainActivity.java

/**
 * The user tapped on the OK button of a confirmation dialog. Execute the action requested by the user.
 *
 * @param actionId the action id which was provided to the {@link DialogFragmentFactory} when creating the dialog.
 * @param extras   any extras which were provided to the {@link DialogFragmentFactory} when creating the dialog.
 * @see ca.rmen.android.scrumchatter.dialog.ConfirmDialogFragment.DialogButtonListener#onOkClicked(int, android.os.Bundle)
 *///from   w w w .  j a va  2  s  .c o  m
@Override
public void onOkClicked(int actionId, Bundle extras) {
    Log.v(TAG, "onClicked: actionId = " + actionId + ", extras = " + extras);
    if (actionId == R.id.action_delete_meeting) {
        long meetingId = extras.getLong(Meetings.EXTRA_MEETING_ID);
        mMeetings.delete(meetingId);
    } else if (actionId == R.id.btn_stop_meeting) {
        MeetingFragment meetingFragment = MeetingFragment.lookupMeetingFragment(getSupportFragmentManager());
        if (meetingFragment != null)
            meetingFragment.stopMeeting();
    } else if (actionId == R.id.action_delete_member) {
        long memberId = extras.getLong(Members.EXTRA_MEMBER_ID);
        mMembers.deleteMember(memberId);
    } else if (actionId == R.id.action_team_delete) {
        Uri teamUri = extras.getParcelable(Teams.EXTRA_TEAM_URI);
        mTeams.deleteTeam(teamUri);
    } else if (actionId == R.id.action_import) {
        final Uri uri = extras.getParcelable(EXTRA_IMPORT_URI);
        DialogFragmentFactory.showProgressDialog(MainActivity.this, getString(R.string.progress_dialog_message),
                PROGRESS_DIALOG_FRAGMENT_TAG);
        Schedulers.io().scheduleDirect(() -> {
            boolean result = false;
            try {
                Log.v(TAG, "Importing db from " + uri);
                DBImport.importDB(MainActivity.this, uri);
                result = true;
            } catch (Exception e) {
                Log.e(TAG, "Error importing db: " + e.getMessage(), e);
            }
            // Notify ourselves with a broadcast.  If the user rotated the device, this activity
            // won't be visible any more. The new activity will receive the broadcast and update
            // the UI.
            Intent intent = new Intent(ACTION_IMPORT_COMPLETE).putExtra(EXTRA_IMPORT_RESULT, result);
            LocalBroadcastManager.getInstance(getApplicationContext()).sendBroadcast(intent);
        });
    }
}

From source file:br.org.funcate.dynamicforms.FormActivity.java

public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    // make sure the orientation can't be changed once this activity started
    int currentOrientation = getResources().getConfiguration().orientation;
    if (currentOrientation == Configuration.ORIENTATION_LANDSCAPE) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    } else {//from  w w  w .j av a  2s  .c o m
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    }

    Bundle extras = getIntent().getExtras();
    if (extras != null) {
        sectionName = extras.getString(LibraryConstants.PREFS_KEY_FORM_NAME);
        sectionObjectString = extras.getString(LibraryConstants.PREFS_KEY_FORM_JSON);
        latitude = extras.getDouble(LibraryConstants.LATITUDE);
        longitude = extras.getDouble(LibraryConstants.LONGITUDE);
        elevation = extras.getDouble(LibraryConstants.ELEVATION);
        noteId = extras.getLong(LibraryConstants.SELECTED_POINT_ID);
    }

    try {
        if (sectionObjectString == null) {
            sectionObject = TagsManager.getInstance(this).getSectionByName(sectionName);
            // copy the section object, which will be kept around along the activity
            sectionObjectString = sectionObject.toString();
        }

        sectionObject = new JSONObject(sectionObjectString);
        formNames4Section = TagsManager.getFormNames4Section(sectionObject);
    } catch (Exception e) {
        Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show();
    }
    setContentView(R.layout.form);

}

From source file:com.ultramegasoft.flavordex2.fragment.EntrySearchFragment.java

@Override
public void onLoadFinished(@NonNull Loader<Cursor> loader, Cursor data) {
    final Context context = getContext();
    if (context == null) {
        return;/*from   ww  w .  j  a v  a2  s  . c  o m*/
    }

    switch (loader.getId()) {
    case LOADER_CAT:
        final CatListAdapter adapter = new CatListAdapter(context, data, android.R.layout.simple_spinner_item,
                android.R.layout.simple_spinner_dropdown_item);
        adapter.setShowAllCats(true);
        mSpnCat.setAdapter(adapter);

        final Bundle args = getArguments();
        final long catId = args != null ? args.getLong(ARG_CAT_ID) : 0;
        if (catId > 0) {
            for (int i = 0; i < adapter.getCount(); i++) {
                if (adapter.getItemId(i) == catId) {
                    mSpnCat.setSelection(i);
                    break;
                }
            }
        }
    }
}

From source file:com.frostwire.android.gui.dialogs.HandpickedTorrentDownloadDialog.java

@Override
protected void initComponents(Dialog dlg, Bundle savedInstanceState) {
    byte[] torrentInfoData;
    Bundle arguments = getArguments();
    if (this.torrentInfo == null && arguments != null
            && (torrentInfoData = arguments.getByteArray(BUNDLE_KEY_TORRENT_INFO_DATA)) != null) {
        torrentInfo = TorrentInfo.bdecode(torrentInfoData);
        magnetUri = arguments.getString(BUNDLE_KEY_MAGNET_URI, null);
        torrentFetcherDownloadTokenId = arguments.getLong(BUNDLE_KEY_TORRENT_FETCHER_DOWNLOAD_TOKEN_ID);
        if (torrentFetcherDownloadTokenId != -1) {
            setOnCancelListener(new OnCancelDownloadsClickListener(this));
        }//w  ww . j  a  va  2  s.  c o m
        setOnYesListener(new OnStartDownloadsClickListener(dlg.getContext(), this));
    }

    super.initComponents(dlg, savedInstanceState);
}

From source file:com.mercandalli.android.apps.files.file.image.FileImageActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_file_picture);

    final Toolbar toolbar = (Toolbar) findViewById(R.id.my_toolbar);
    if (toolbar != null) {
        setSupportActionBar(toolbar);//  w  ww .ja v  a2s. c o  m
        ActionBar actionBar = getSupportActionBar();
        if (actionBar != null) {
            actionBar.setDisplayHomeAsUpEnabled(true);
        }
    }

    // Translucent notification bar
    getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);

    // Get views
    mProgressBar = (ProgressBar) this.findViewById(R.id.progressBar);
    mCircle = (ImageButton) this.findViewById(R.id.circle);
    mTitleTextView = (TextView) this.findViewById(R.id.title);
    mProgressTextView = (TextView) this.findViewById(R.id.progress_tv);

    mProgressBar.setProgress(0);

    Bundle extras = getIntent().getExtras();
    if (extras == null) {
        Log.e("" + getClass().getName(), "extras == null");
        finish();
        overridePendingTransition(R.anim.right_in, R.anim.right_out);
        return;
    } else {
        mId = extras.getInt("ID");
        mTitle = extras.getString("TITLE");
        mUrl = extras.getString("URL_FILE");
        online = extras.getBoolean("CLOUD");
        sizeFile = extras.getLong("SIZE_FILE");
        date_creation = (Date) extras.getSerializable("DATE_FILE");

        if (mTitle != null) {
            mTitleTextView.setText(mTitle);
        }

        if (ImageUtils.isImage(this, this.mId)) {
            mBitmap = ImageUtils.loadImage(this, this.mId);
            ((ImageView) this.findViewById(R.id.tab_icon)).setImageBitmap(mBitmap);
            int bgColor = ColorUtils.getMutedColor(mBitmap);
            if (bgColor != 0) {
                mTitleTextView.setBackgroundColor(bgColor);
                mTitleTextView.setTextColor(ColorUtils.colorText(bgColor));
                RippleDrawable cir = ImageUtils.getPressedColorRippleDrawable(bgColor,
                        ColorUtils.getDarkMutedColor(mBitmap));
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                    mCircle.setBackground(cir);
                }
            }
            mProgressBar.setVisibility(View.GONE);
            mProgressTextView.setVisibility(View.GONE);
        } else if (this.mId != 0) {
            mProgressBar.setVisibility(View.VISIBLE);
            mProgressTextView.setVisibility(View.VISIBLE);
            (new TaskGetDownloadImage(this, mUrl, mId, sizeFile, -1, new IBitmapListener() {
                @Override
                public void execute(Bitmap bitmap) {
                    ((ImageView) findViewById(R.id.tab_icon)).setImageBitmap(bitmap);
                    int bgColor = ColorUtils.getMutedColor(bitmap);
                    if (bgColor != 0) {
                        mTitleTextView.setBackgroundColor(bgColor);
                        mTitleTextView.setTextColor(ColorUtils.colorText(bgColor));
                        RippleDrawable cir = ImageUtils.getPressedColorRippleDrawable(bgColor,
                                ColorUtils.getDarkMutedColor(bitmap));
                        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                            mCircle.setBackground(cir);
                        }
                    }
                    mProgressBar.setVisibility(View.GONE);
                    mProgressTextView.setVisibility(View.GONE);
                }
            }, new ILongListener() {
                @Override
                public void execute(long text) {
                    mProgressBar.setProgress((int) text);
                    mProgressTextView.setText(text + "%");
                }
            })).execute();
        }
    }

    mCircle.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent picIntent = new Intent();
            picIntent.setAction(Intent.ACTION_VIEW);
            picIntent.setDataAndType(Uri.parse("file://"
                    + (new File(FileImageActivity.this.getFilesDir() + "/file_" + mId)).getAbsolutePath()),
                    "image/*");
            FileImageActivity.this.startActivity(picIntent);
        }
    });
}

From source file:com.google.samples.apps.iosched.service.SessionCalendarService.java

@Override
protected void onHandleIntent(Intent intent) {
    if (!permissionsAlreadyGranted()) {
        LOGW(TAG, "Calendar permission not granted.");
        return;//from w ww. ja v  a  2  s .  c  om
    }

    final String action = intent.getAction();
    LOGD(TAG, "Received intent: " + action);

    final ContentResolver resolver = getContentResolver();

    boolean isAddEvent = false;

    if (ACTION_ADD_SESSION_CALENDAR.equals(action)) {
        isAddEvent = true;

    } else if (ACTION_REMOVE_SESSION_CALENDAR.equals(action)) {
        isAddEvent = false;

    } else if (ACTION_UPDATE_ALL_SESSIONS_CALENDAR.equals(action) && SettingsUtils.shouldSyncCalendar(this)) {
        try {
            getContentResolver().applyBatch(CalendarContract.AUTHORITY,
                    processAllSessionsCalendar(resolver, getCalendarId(intent)));
            sendBroadcast(new Intent(SessionCalendarService.ACTION_UPDATE_ALL_SESSIONS_CALENDAR_COMPLETED));
        } catch (RemoteException | OperationApplicationException e) {
            LOGE(TAG, "Error adding all sessions to Google Calendar", e);
        }

    } else if (ACTION_CLEAR_ALL_SESSIONS_CALENDAR.equals(action)) {
        try {
            getContentResolver().applyBatch(CalendarContract.AUTHORITY,
                    processClearAllSessions(resolver, getCalendarId(intent)));
        } catch (RemoteException | OperationApplicationException e) {
            LOGE(TAG, "Error clearing all sessions from Google Calendar", e);
        }

    } else {
        return;
    }

    final Uri uri = intent.getData();
    final Bundle extras = intent.getExtras();
    if (uri == null || extras == null || !SettingsUtils.shouldSyncCalendar(this)) {
        return;
    }

    try {
        resolver.applyBatch(CalendarContract.AUTHORITY,
                processSessionCalendar(resolver, getCalendarId(intent), isAddEvent, uri,
                        extras.getLong(EXTRA_SESSION_START), extras.getLong(EXTRA_SESSION_END),
                        extras.getString(EXTRA_SESSION_TITLE), extras.getString(EXTRA_SESSION_ROOM)));
    } catch (RemoteException | OperationApplicationException e) {
        LOGE(TAG, "Error adding session to Google Calendar", e);
    }
}

From source file:com.android.messaging.datamodel.action.SyncMessagesAction.java

/**
 * Perform local database updates and schedule follow on sync actions
 *///from w  ww .  j ava2 s .c o m
@Override
protected Object processBackgroundResponse(final Bundle response) {
    final long lastTimestampMillis = response.getLong(BUNDLE_KEY_LAST_TIMESTAMP);
    final long lowerBoundTimeMillis = actionParameters.getLong(KEY_LOWER_BOUND);
    final long upperBoundTimeMillis = actionParameters.getLong(KEY_UPPER_BOUND);
    final int maxMessagesToUpdate = actionParameters.getInt(KEY_MAX_UPDATE);
    final long startTimestamp = actionParameters.getLong(KEY_START_TIMESTAMP);

    // Check with the sync manager if any conflicting updates have been made to databases
    final SyncManager syncManager = DataModel.get().getSyncManager();
    final boolean orphan = !syncManager.isSyncing(upperBoundTimeMillis);

    // lastTimestampMillis used to indicate failure
    if (orphan) {
        // This batch does not match current in progress timestamp.
        LogUtil.w(TAG, "SyncMessagesAction: Ignoring orphan sync batch for messages from "
                + lowerBoundTimeMillis + " to " + upperBoundTimeMillis);
    } else {
        final boolean dirty = syncManager.isBatchDirty(lastTimestampMillis);
        if (lastTimestampMillis == SYNC_FAILED) {
            LogUtil.e(TAG, "SyncMessagesAction: Sync failed - terminating");

            // Failed - update last sync times to throttle our failure rate
            final BuglePrefs prefs = BuglePrefs.getApplicationPrefs();
            // Save sync completion time so next sync will start from here
            prefs.putLong(BuglePrefsKeys.LAST_SYNC_TIME, startTimestamp);
            // Remember last full sync so that don't start background full sync right away
            prefs.putLong(BuglePrefsKeys.LAST_FULL_SYNC_TIME, startTimestamp);

            syncManager.complete();
        } else if (dirty) {
            LogUtil.w(TAG, "SyncMessagesAction: Redoing dirty sync batch of messages from "
                    + lowerBoundTimeMillis + " to " + upperBoundTimeMillis);

            // Redo this batch
            final SyncMessagesAction nextBatch = new SyncMessagesAction(lowerBoundTimeMillis,
                    upperBoundTimeMillis, maxMessagesToUpdate, startTimestamp);

            syncManager.startSyncBatch(upperBoundTimeMillis);
            requestBackgroundWork(nextBatch);
        } else {
            // Succeeded
            final ArrayList<SmsMessage> smsToAdd = response.getParcelableArrayList(BUNDLE_KEY_SMS_MESSAGES);
            final ArrayList<MmsMessage> mmsToAdd = response.getParcelableArrayList(BUNDLE_KEY_MMS_MESSAGES);
            final ArrayList<LocalDatabaseMessage> messagesToDelete = response
                    .getParcelableArrayList(BUNDLE_KEY_MESSAGES_TO_DELETE);

            final int messagesUpdated = smsToAdd.size() + mmsToAdd.size() + messagesToDelete.size();

            // Perform local database changes in one transaction
            long txnTimeMillis = 0;
            if (messagesUpdated > 0) {
                final long startTimeMillis = SystemClock.elapsedRealtime();
                final SyncMessageBatch batch = new SyncMessageBatch(smsToAdd, mmsToAdd, messagesToDelete,
                        syncManager.getThreadInfoCache());
                batch.updateLocalDatabase();
                final long endTimeMillis = SystemClock.elapsedRealtime();
                txnTimeMillis = endTimeMillis - startTimeMillis;

                LogUtil.i(TAG,
                        "SyncMessagesAction: Updated local database " + "(took " + txnTimeMillis
                                + " ms). Added " + smsToAdd.size() + " SMS, added " + mmsToAdd.size()
                                + " MMS, deleted " + messagesToDelete.size() + " messages.");

                // TODO: Investigate whether we can make this more fine-grained.
                MessagingContentProvider.notifyEverythingChanged();
            } else {
                if (LogUtil.isLoggable(TAG, LogUtil.DEBUG)) {
                    LogUtil.d(TAG, "SyncMessagesAction: No local database updates to make");
                }

                if (!syncManager.getHasFirstSyncCompleted()) {
                    // If we have never completed a sync before (fresh install) and there are
                    // no messages, still inform the UI of a change so it can update syncing
                    // messages shown to the user
                    MessagingContentProvider.notifyConversationListChanged();
                    MessagingContentProvider.notifyPartsChanged();
                }
            }
            // Determine if there are more messages that need to be scanned
            if (lastTimestampMillis >= 0 && lastTimestampMillis >= lowerBoundTimeMillis) {
                if (LogUtil.isLoggable(TAG, LogUtil.DEBUG)) {
                    LogUtil.d(TAG,
                            "SyncMessagesAction: More messages to sync; scheduling next " + "sync batch now.");
                }

                // Include final millisecond of last sync in next sync
                final long newUpperBoundTimeMillis = lastTimestampMillis + 1;
                final int newMaxMessagesToUpdate = nextBatchSize(messagesUpdated, txnTimeMillis);

                final SyncMessagesAction nextBatch = new SyncMessagesAction(lowerBoundTimeMillis,
                        newUpperBoundTimeMillis, newMaxMessagesToUpdate, startTimestamp);

                // Proceed with next batch
                syncManager.startSyncBatch(newUpperBoundTimeMillis);
                requestBackgroundWork(nextBatch);
            } else {
                final BuglePrefs prefs = BuglePrefs.getApplicationPrefs();
                // Save sync completion time so next sync will start from here
                prefs.putLong(BuglePrefsKeys.LAST_SYNC_TIME, startTimestamp);
                if (lowerBoundTimeMillis < 0) {
                    // Remember last full sync so that don't start another full sync right away
                    prefs.putLong(BuglePrefsKeys.LAST_FULL_SYNC_TIME, startTimestamp);
                }

                final long now = System.currentTimeMillis();

                // After any sync check if new messages have arrived
                final SyncCursorPair recents = new SyncCursorPair(startTimestamp, now);
                final SyncCursorPair olders = new SyncCursorPair(-1L, startTimestamp);
                final DatabaseWrapper db = DataModel.get().getDatabase();
                if (!recents.isSynchronized(db)) {
                    LogUtil.i(TAG, "SyncMessagesAction: Changed messages after sync; "
                            + "scheduling an incremental sync now.");

                    // Just add a new batch for recent messages
                    final SyncMessagesAction nextBatch = new SyncMessagesAction(startTimestamp, now, 0,
                            startTimestamp);
                    syncManager.startSyncBatch(now);
                    requestBackgroundWork(nextBatch);
                    // After partial sync verify sync state
                } else if (lowerBoundTimeMillis >= 0 && !olders.isSynchronized(db)) {
                    // Add a batch going back to start of time
                    LogUtil.w(TAG, "SyncMessagesAction: Changed messages before sync batch; "
                            + "scheduling a full sync now.");

                    final SyncMessagesAction nextBatch = new SyncMessagesAction(-1L, startTimestamp, 0,
                            startTimestamp);

                    syncManager.startSyncBatch(startTimestamp);
                    requestBackgroundWork(nextBatch);
                } else {
                    LogUtil.i(TAG, "SyncMessagesAction: All messages now in sync");

                    // All done, in sync
                    syncManager.complete();
                }
            }
            // Either sync should be complete or we should have a follow up request
            Assert.isTrue(hasBackgroundActions() || !syncManager.isSyncing());
        }
    }

    return null;
}

From source file:com.andremion.louvre.data.MediaLoader.java

@Override
public final Loader<Cursor> onCreateLoader(int id, Bundle args) {
    if (id == TIME_LOADER) {
        return new CursorLoader(mActivity, GALLERY_URI, ALL_IMAGE_PROJECTION, mTypeFilter, null,
                MEDIA_SORT_ORDER);/*w  w w.j  a v  a  2 s  .  c om*/
    }
    if (id == BUCKET_LOADER) {
        return new CursorLoader(mActivity, GALLERY_URI, BUCKET_PROJECTION,
                String.format("%s AND %s", mTypeFilter, BUCKET_SELECTION), null, BUCKET_SORT_ORDER);
    }
    // id == MEDIA_LOADER
    return new CursorLoader(
            mActivity, GALLERY_URI, IMAGE_PROJECTION, String.format("%s=%s AND %s",
                    MediaStore.Images.Media.BUCKET_ID, args.getLong(BUCKET_ID), mTypeFilter),
            null, MEDIA_SORT_ORDER);
}