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:com.eutectoid.dosomething.picker.PickerFragment.java

void saveSettingsToBundle(Bundle outState) {
    outState.putBoolean(SHOW_PICTURES_BUNDLE_KEY, showPictures);
    if (!extraFields.isEmpty()) {
        outState.putString(EXTRA_FIELDS_BUNDLE_KEY, TextUtils.join(",", extraFields));
    }/*from  w  w w  .  j  av  a2s .  c  o m*/
    outState.putBoolean(SHOW_TITLE_BAR_BUNDLE_KEY, showTitleBar);
    outState.putString(TITLE_TEXT_BUNDLE_KEY, titleText);
    outState.putString(DONE_BUTTON_TEXT_BUNDLE_KEY, doneButtonText);
}

From source file:com.amaze.carbonfilemanager.fragments.ZipViewer.java

void putDatatoSavedInstance(Bundle outState) {
    if (openmode == 0) {

        outState.putParcelableArrayList(KEY_WHOLE_LIST, wholelist);
        outState.putParcelableArrayList(KEY_ELEMENTS, elements);
    }/*from   w w  w. jav  a2  s. c o m*/
    outState.putInt(KEY_OPEN_MODE, openmode);
    outState.putString(KEY_PATH, current);
    outState.putString(KEY_URI, s);
    outState.putString(KEY_FILE, f.getPath());
    outState.putParcelableArrayList(KEY_CACHE_FILES, files);
    outState.putBoolean(KEY_OPEN, isOpen);
}

From source file:at.ac.tuwien.detlef.activities.MainActivity.java

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

    Log.d(TAG, String.format("onActivityResult(%d, %d, %s)", requestCode, resultCode, data));

    if (data == null) {
        return;// ww  w. j  a va 2s  . c om
    }

    if (data.getBooleanExtra(EXTRA_REFRESH_FEED_LIST, false)
            || data.getBooleanExtra(PODCAST_ADD_REFRESH_FEED_LIST, false)) {

        if (resultCode == Activity.RESULT_OK) {
            Bundle bundle = new Bundle();
            if (data.getBooleanExtra(PODCAST_ADD_REFRESH_FEED_LIST, false)) {
                bundle.putBoolean(PODCAST_ADD_REFRESH_FEED_LIST, true);
            } else {
                bundle.putBoolean(EXTRA_REFRESH_FEED_LIST, true);
            }
            onRefreshPressed(bundle);
        } else {
            if (data.getBooleanExtra(EXTRA_REFRESH_FEED_LIST, false)) {
                Toast.makeText(this, getString(R.string.you_can_refresh_your_podcasts_later), Toast.LENGTH_LONG)
                        .show();
            }
        }
    }

}

From source file:com.amazon.android.contentbrowser.helper.AuthHelper.java

/**
 * Authenticate With Activity Observable.
 *
 * @return RX Observable.//w  w w . j  a v a2 s  . co m
 */
public Observable<Bundle> authenticateWithActivity() {

    return mRxLauncher.from(mContentBrowser.getNavigator().getActiveActivity())
            .startActivityForResult(
                    getIAuthentication().getAuthenticationActivityIntent(
                            mContentBrowser.getNavigator().getActiveActivity()),
                    AuthHelper.AUTH_ON_ACTIVITY_RESULT_REQUEST_CODE, null)
            .map(activityResult -> {
                Bundle resultBundle = null;
                if (activityResult.isOk() && activityResult.data == null) {
                    resultBundle = new Bundle();
                } else if (activityResult.data != null) {
                    resultBundle = activityResult.data.getExtras();
                }
                handleAuthenticationActivityResultBundle(resultBundle);

                if (resultBundle != null) {
                    resultBundle.putBoolean(RESULT, activityResult.isOk());
                    broadcastAuthenticationStatus(activityResult.isOk());
                    resultBundle.putBoolean(RESULT_FROM_ACTIVITY, true);
                }
                return resultBundle;
            });
}

From source file:com.actionbarsherlock.plus.SherlockDialogPlusFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    if (mDialog != null) {
        Bundle dialogState = mDialog.onSaveInstanceState();
        if (dialogState != null) {
            outState.putBundle(SAVED_DIALOG_STATE_TAG, dialogState);
        }//from   w ww  .ja v  a2s  .  c  om
    }
    if (mStyle != STYLE_NORMAL) {
        outState.putInt(SAVED_STYLE, mStyle);
    }
    if (mTheme != 0) {
        outState.putInt(SAVED_THEME, mTheme);
    }
    if (!mCancelable) {
        outState.putBoolean(SAVED_CANCELABLE, mCancelable);
    }
    if (!mShowsDialog) {
        outState.putBoolean(SAVED_SHOWS_DIALOG, mShowsDialog);
    }
    if (mBackStackId != -1) {
        outState.putInt(SAVED_BACK_STACK_ID, mBackStackId);
    }
}

From source file:com.android.dialer.voicemail.VoicemailPlaybackPresenter.java

/**
 * Must be invoked when the parent Activity is saving it state.
 *//* w w  w.ja va2  s  . c o m*/
public void onSaveInstanceState(Bundle outState) {
    if (mView != null) {
        outState.putParcelable(VOICEMAIL_URI_KEY, mVoicemailUri);
        outState.putBoolean(IS_PREPARED_KEY, mIsPrepared);
        outState.putInt(CLIP_POSITION_KEY, mView.getDesiredClipPosition());
        outState.putBoolean(IS_PLAYING_STATE_KEY, mIsPlaying);
        outState.putBoolean(IS_SPEAKERPHONE_ON_KEY, mIsSpeakerphoneOn);
    }
}

From source file:chaitanya.im.searchforreddit.LauncherActivity.java

@Override
protected void onSaveInstanceState(Bundle savedInstanceState) {
    savedInstanceState.putString(SORT_BUTTON_LABEL, sortButtonLabel);
    savedInstanceState.putString(TIME_BUTTON_LABEL, timeButtonLabel);
    savedInstanceState.putString(TIME_VALUE, timeValue);
    savedInstanceState.putString(SORT_VALUE, sortValue);
    if (searchOptions.getVisibility() == View.VISIBLE)
        savedInstanceState.putBoolean(SEARCH_OPTIONS_FLAG, true);
    else//from  w w  w  .  ja v  a2s.co m
        savedInstanceState.putBoolean(SEARCH_OPTIONS_FLAG, false);
    savedInstanceState.putBoolean(CLEAR_SEARCH_BOX_BUTTON_FLAG, clearSearchBoxButtonFlag);

    super.onSaveInstanceState(savedInstanceState);
}

From source file:com.dwdesign.tweetings.fragment.UserListDetailsFragment.java

@Override
public boolean onLongClick(final View view) {
    if (mUserList == null)
        return false;
    final boolean is_my_activated_account = isMyActivatedAccount(getActivity(), mUserId);
    if (!is_my_activated_account)
        return false;
    switch (view.getId()) {
    case R.id.name_container:
    case R.id.description_container:
        final Bundle args = new Bundle();
        args.putLong(INTENT_KEY_ACCOUNT_ID, mAccountId);
        args.putString(INTENT_KEY_LIST_NAME, mUserList.getName());
        args.putString(INTENT_KEY_DESCRIPTION, mUserList.getDescription());
        args.putString(INTENT_KEY_TITLE, getString(R.string.description));
        args.putBoolean(INTENT_KEY_IS_PUBLIC, mUserList.isPublic());
        args.putInt(INTENT_KEY_LIST_ID, mUserList.getId());
        mEditUserListDialogFragment.setArguments(args);
        mEditUserListDialogFragment.show(getFragmentManager(), "edit_user_list_details");
        return true;
    }/*  ww w  .j  a  va2 s. c  om*/
    return false;
}

From source file:app.hacked.MainActivity.java

@Override
public void onProjectItemSelected(Project project) {
    if (findViewById(R.id.ProjectDetails) != null) {
        mTwoPane = true;//from  w  w  w.j  a  va  2  s  .  c  o  m

        Bundle arguments = new Bundle();
        arguments.putInt(ProjectDetailsFragment.PROJECTID, project.ID);
        arguments.putString(ProjectDetailsFragment.NAME, project.Name);
        arguments.putString(ProjectDetailsFragment.SYNOPSIS, project.Synopsis);
        arguments.putString(ProjectDetailsFragment.DESCRIPTION, project.Description);
        arguments.putString(ProjectDetailsFragment.LOCATION, project.Location);
        arguments.putString(ProjectDetailsFragment.TECHNOLOGIES, project.Technologies);
        arguments.putInt(ProjectDetailsFragment.POPULARITY, project.Popularity);
        //arguments.putString(ProjectDetailsFragment.TEAMMEMBERS, project.getTeamMembers());
        arguments.putBoolean(ProjectDetailsFragment.ARG_2PANE, true);
        arguments.putParcelableArrayList(ProjectDetailsFragment.TEAMMEMBERS, project.TeamMembers);

        ProjectDetailsFragment fragment = new ProjectDetailsFragment();
        fragment.setArguments(arguments);
        fragment.setHasOptionsMenu(true);
        getSupportFragmentManager().beginTransaction().replace(R.id.ProjectDetails, fragment).commit();
    } else {
        mTwoPane = false;

        Intent detailIntent = new Intent(this, ProjectDetailsActivity.class);
        detailIntent.putExtra(ProjectDetailsFragment.PROJECTID, project.ID);
        detailIntent.putExtra(ProjectDetailsFragment.NAME, project.Name);
        detailIntent.putExtra(ProjectDetailsFragment.SYNOPSIS, project.Synopsis);
        detailIntent.putExtra(ProjectDetailsFragment.DESCRIPTION, project.Description);
        detailIntent.putExtra(ProjectDetailsFragment.LOCATION, project.Location);
        detailIntent.putExtra(ProjectDetailsFragment.TECHNOLOGIES, project.Technologies);
        detailIntent.putExtra(ProjectDetailsFragment.POPULARITY, project.Popularity);
        //detailIntent.putExtra(ProjectDetailsFragment.TEAMMEMBERS, project.getTeamMembers());
        detailIntent.putParcelableArrayListExtra(ProjectDetailsFragment.TEAMMEMBERS, project.TeamMembers);
        detailIntent.putExtra(ProjectDetailsFragment.ARG_2PANE, false);
        startActivity(detailIntent);
    }
}

From source file:ch.bfh.evoting.alljoyn.BusHandler.java

/**
 * Send a message to the given group/* ww w.ja  va 2 s . c  om*/
 * @param groupName group to send the message to
 * @param message message to send
 * @param encrypted indicate if message must be encrypted or not 
 * @param type type of the content in the message
 */
private void doPing(String groupName, String message, boolean encrypted, Type type) {

    //if messageEncrypter is not ready or group joining is not terminated, we enqueue the message
    if ((!messageEncrypter.isReady() && encrypted) || !connected) {
        Message msg = this.obtainMessage(BusHandler.PING);
        Bundle data = new Bundle();
        data.putString("groupName", groupName);
        data.putString("pingString", message);
        data.putBoolean("encrypted", encrypted);
        data.putSerializable("type", type);
        msg.setData(data);
        this.sendMessage(msg);
        Log.d(TAG, "Queueing message to send " + message);
        return;
    }

    //Create the message object with the received parameter
    AllJoynMessage messageObject = new AllJoynMessage(this.messageEncrypter, this.messageAuthenticater);
    if (type == null)
        type = Type.NORMAL;
    messageObject.setType(type);
    messageObject.setSender(this.getIdentification());
    boolean messageEncrypted = messageObject.setMessage(message, encrypted);
    if (!messageEncrypted) {
        Log.e(TAG, "Message encryption failed");
        return;
    }
    boolean messageSigned = messageObject.signMessage();
    if (!messageSigned) {
        Log.e(TAG, "Signature failed");
        return;
    }

    //Serialize the message
    messageObject.setMessageAuthenticater(null);
    messageObject.setMessageEncrypter(null);
    String toSend = su.serialize(messageObject);

    try {
        Log.d(TAG, "sending message of size " + toSend.getBytes("UTF-8").length
                + " bytes. Maximum allowed by AllJoyn is 128Kb.");
    } catch (UnsupportedEncodingException e1) {
        e1.printStackTrace();
    }

    //Send the message
    SimpleInterface simpleInterface = mGroupManager.getSignalInterface(groupName, mSimpleService,
            SimpleInterface.class);
    try {
        if (simpleInterface != null) {
            simpleInterface.Ping(toSend);
        }
    } catch (BusException e) {
        e.printStackTrace();
    }
}