Example usage for android.os Bundle putBoolean

List of usage examples for android.os Bundle putBoolean

Introduction

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

Prototype

public void putBoolean(@Nullable String key, boolean value) 

Source Link

Document

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

Usage

From source file:cat.wuyingren.rorhelper.activities.MainActivity.java

private void showManageSenatorDialog(boolean kill, boolean statesman) {

    if (isActionPossible()) {
        ManageSenatorDialogFragment dialog = new ManageSenatorDialogFragment();

        Bundle args = new Bundle();
        args.putBoolean(ManageSenatorDialogFragment.ARG_MODE, kill);
        args.putBoolean(ManageSenatorDialogFragment.ARG_TYPE, statesman);
        args.putLong(ManageSenatorDialogFragment.ARG_GAMEID, currentGameId);
        if (!kill) {
            String[] keys;/*from  ww w .  j  av a 2  s. c  o m*/
            ArrayList<String> values = new ArrayList<String>();
            if (statesman) {
                keys = new String[statesmanMap.size()];
                keys = statesmanMap.keySet().toArray(keys);

                for (String key : keys) {
                    values.add(statesmanMap.get(key).getName());
                }
            } else {
                keys = new String[senatorMap.size()];
                keys = senatorMap.keySet().toArray(keys);

                for (String key : keys) {
                    values.add(senatorMap.get(key).getName());
                }
            }

            args.putStringArray(ManageSenatorDialogFragment.ARG_ARRAY, keys);
            args.putStringArrayList(ManageSenatorDialogFragment.ARG_VALUES, values);
        }
        dialog.setArguments(args);
        dialog.show(getSupportFragmentManager(), "");
    }
}

From source file:com.activiti.android.platform.provider.transfer.ContentTransferManager.java

public static void requestUpload(Fragment fr, Uri uri, String objectId, int type, String mimetyp) {
    Cursor cursor = null;//from ww  w.j a v  a  2  s  .c  o m
    String name = null, source, sourceId, mimetype = mimetyp;
    try {
        Bundle settingsBundle = new Bundle();

        // Retrieve other info
        cursor = fr.getActivity().getContentResolver().query(uri, null, null, null, null);

        if (cursor == null && uri != null) {
            // Is it a file ?
            File file = new File(uri.getPath());
            if (file.exists()) {
                // It's a file
                name = file.getName();
                settingsBundle.putString(ContentTransferSyncAdapter.ARGUMENT_CONTENT_PATH, file.getPath());
                if (mimetype == null) {
                    MimeType mime = MimeTypeManager.getInstance(fr.getActivity()).getMimetype(file.getName());
                    mimetype = (mime != null) ? mime.getMimeType() : mimetyp;
                }
            }
        } else if (cursor != null && cursor.moveToFirst()) {
            name = cursor.getString(cursor.getColumnIndex(DocumentsContract.Document.COLUMN_DISPLAY_NAME));
            mimetype = cursor.getString(cursor.getColumnIndex(DocumentsContract.Document.COLUMN_MIME_TYPE));
            settingsBundle.putString(ContentTransferSyncAdapter.ARGUMENT_CONTENT_URI, uri.toString());
        } else {
            throw new Exception("Cursor is empty");
        }

        settingsBundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
        settingsBundle.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true);

        settingsBundle.putInt(ContentTransferSyncAdapter.ARGUMENT_MODE,
                ContentTransferSyncAdapter.MODE_SAF_UPLOAD);
        settingsBundle.putString(ContentTransferSyncAdapter.ARGUMENT_FILE_PATH, name);
        if (type == TYPE_TASK_ID) {
            settingsBundle.putString(ContentTransferSyncAdapter.ARGUMENT_TASK_ID, objectId);
        } else if (type == TYPE_PROCESS_ID) {
            settingsBundle.putString(ContentTransferSyncAdapter.ARGUMENT_PROCESS_ID, objectId);
        } else if (type == TYPE_PROFILE_ID) {
            settingsBundle.putString(ContentTransferSyncAdapter.ARGUMENT_PROFILE_ID, objectId);
        }
        settingsBundle.putString(ContentTransferSyncAdapter.ARGUMENT_MIMETYPE, mimetype);
        ContentResolver.requestSync(
                ActivitiAccountManager.getInstance(fr.getActivity()).getCurrentAndroidAccount(),
                ContentTransferProvider.AUTHORITY, settingsBundle);
    } catch (Exception e) {
        Log.w("COntent Transfer", Log.getStackTraceString(e));
    } finally {
        CursorUtils.closeCursor(cursor);
    }
}

From source file:com.achep.base.ui.activities.SettingsActivity.java

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

    if (mCategories.size() > 0) {
        outState.putParcelableArrayList(SAVE_KEY_CATEGORIES, mCategories);
    }/*w w w .  ja  va 2s  . c o m*/

    outState.putBoolean(SAVE_KEY_SHOW_HOME_AS_UP, mDisplayHomeAsUpEnabled);
}

From source file:bucci.dev.freestyle.TimerActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    outState.putLong(TIME_LEFT_PARAM, timeLeft);
    outState.putString(START_PAUSE_STATE_PARAM, (String) playButton.getTag());

    if (isExtraButtonShown)
        outState.putBoolean(SHOW_EXTRA_ROUND_BUTTON_PARAM, true);

    if (DEBUG)// w  w  w.j a  va 2  s.  c o m
        Log.i(TAG, "onSaveInstanceState(): " + outState.toString());
    super.onSaveInstanceState(outState);
}

From source file:com.eutectoid.dosomething.picker.PlacePickerFragment.java

void saveSettingsToBundle(Bundle outState) {
    super.saveSettingsToBundle(outState);

    outState.putInt(RADIUS_IN_METERS_BUNDLE_KEY, radiusInMeters);
    outState.putInt(RESULTS_LIMIT_BUNDLE_KEY, resultsLimit);
    outState.putString(SEARCH_TEXT_BUNDLE_KEY, searchText);
    outState.putParcelable(LOCATION_BUNDLE_KEY, location);
    outState.putBoolean(SHOW_SEARCH_BOX_BUNDLE_KEY, showSearchBox);
}

From source file:li.barter.fragments.AddOrEditBookFragment.java

@Override
public void onSaveInstanceState(final Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putBoolean(Keys.HAS_FETCHED_INFO, mHasFetchedDetails);
}

From source file:li.barter.fragments.ChatsFragment.java

/**
 * Loads the actual chat screen. This is used in the case where the user taps on an item in the
 * list of chats//from  w  w  w.j  a  v  a2 s .  co m
 *
 * @param userId               The user Id of the chat to load
 * @param chatId               The ID of the chat
 * @param fromClick            Whether the chat was loaded as a result of a click on the list. Will be used
 *                             to decide whether to animate the detail fragment in
 * @param prefilledChatMessage Any message to prefill when loading it in
 */
private void loadChat(String userId, String chatId, boolean fromClick, String prefilledChatMessage) {

    final Bundle args = new Bundle(4);

    args.putString(Keys.USER_ID, userId);
    args.putString(Keys.CHAT_ID, chatId);
    args.putString(Keys.CHAT_MESSAGE, prefilledChatMessage);

    /*If Loaded directly, ensure that pressing back will finish the Activity*/
    if (mShouldLoadChat) {
        args.putBoolean(Keys.FINISH_ON_BACK, true);
    }

    ChatDetailsFragment chatDetailsFragment = (ChatDetailsFragment) getFragmentManager()
            .findFragmentByTag(FragmentTags.CHAT_DETAILS);

    /*Chat details fragment will not be null in case of a multi-pane layout.
     * Makes no sense to instantiate a new fragment. Instead we just update
     * the one that's already visible*/
    if (chatDetailsFragment != null && chatDetailsFragment.isResumed()) {
        chatDetailsFragment.updateUserInfo(args);

    } else {

        loadFragment(R.id.frame_content,
                (AbstractBarterLiFragment) Fragment.instantiate(getActivity(),
                        ChatDetailsFragment.class.getName(), args),
                FragmentTags.CHAT_DETAILS, true, null, fromClick);
    }
}

From source file:cn.tycoon.lighttrans.fileManager.AbstractFilePickerFragment.java

@Override
public void onSaveInstanceState(Bundle b) {
    super.onSaveInstanceState(b);
    b.putString(KEY_CURRENT_PATH, mCurrentPath.toString());
    b.putBoolean(KEY_ALLOW_MULTIPLE, allowMultiple);
    b.putBoolean(KEY_ALLOW_DIR_CREATE, allowCreateDir);
    b.putInt(KEY_MODE, mode);/*from w w w . j a  v a2s .c om*/
}

From source file:net.homelinux.penecoptero.android.citybikes.app.MainActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    ////Log.i("openBicing", "SaveInstanceState!");
    outState.putInt("homeRadius", hOverlay.getRadius());
    outState.putBoolean("view_all", view_all);
    outState.putInt("zoom", mapView.getZoomLevel());
}

From source file:com.hybris.mobile.lib.commerce.provider.CatalogProvider.java

/**
 * Request a sync (we force it)/*from  www .j ava 2  s  . c o  m*/
 *
 * @param bundle extras parameters for the sync
 */
private void requestSync(Bundle bundle) {

    if (bundle == null) {
        bundle = new Bundle();
    }

    Log.i(TAG, "Requesting a sync with bundle: " + bundle.toString());

    // Parameters to force the sync without any delay
    bundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
    bundle.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true);
    ContentResolver.requestSync(account, authority, bundle);
}