Here are the examples of the java api class android.os.Bundle taken from open source projects.
1. UserAccountTest#createTestAccountBundle()
View license/** * Creates a test {@link Bundle} with all {@link UserAccount} fields populated * * @return {@link Bundle} */ private Bundle createTestAccountBundle() { final Bundle object = new Bundle(); object.putString(UserAccount.AUTH_TOKEN, TEST_AUTH_TOKEN); object.putString(UserAccount.REFRESH_TOKEN, TEST_REFRESH_TOKEN); object.putString(UserAccount.LOGIN_SERVER, TEST_LOGIN_URL); object.putString(UserAccount.ID_URL, TEST_IDENTITY_URL); object.putString(UserAccount.INSTANCE_SERVER, TEST_INSTANCE_URL); object.putString(UserAccount.ORG_ID, TEST_ORG_ID); object.putString(UserAccount.USER_ID, TEST_USER_ID); object.putString(UserAccount.USERNAME, TEST_USERNAME); object.putString(UserAccount.CLIENT_ID, TEST_CLIENT_ID); object.putString(UserAccount.ACCOUNT_NAME, TEST_ACCOUNT_NAME); object.putString(UserAccount.COMMUNITY_ID, TEST_COMMUNITY_ID); object.putString(UserAccount.COMMUNITY_URL, TEST_COMMUNITY_URL); object.putString(UserAccount.FIRST_NAME, TEST_FIRST_NAME); object.putString(UserAccount.LAST_NAME, TEST_LAST_NAME); object.putString(UserAccount.DISPLAY_NAME, TEST_DISPLAY_NAME); object.putString(UserAccount.EMAIL, TEST_EMAIL); object.putString(UserAccount.PHOTO_URL, TEST_PHOTO_URL); object.putString(UserAccount.THUMBNAIL_URL, TEST_THUMBNAIL_URL); return object; }
2. UserAccount#toBundle()
View license/** * Returns a representation of this instance in a bundle. * * @return Bundle instance. */ public Bundle toBundle() { final Bundle object = new Bundle(); object.putString(AUTH_TOKEN, authToken); object.putString(REFRESH_TOKEN, refreshToken); object.putString(LOGIN_SERVER, loginServer); object.putString(ID_URL, idUrl); object.putString(INSTANCE_SERVER, instanceServer); object.putString(ORG_ID, orgId); object.putString(USER_ID, userId); object.putString(USERNAME, username); object.putString(CLIENT_ID, clientId); object.putString(ACCOUNT_NAME, accountName); object.putString(COMMUNITY_ID, communityId); object.putString(COMMUNITY_URL, communityUrl); object.putString(FIRST_NAME, firstName); object.putString(LAST_NAME, lastName); object.putString(DISPLAY_NAME, displayName); object.putString(EMAIL, email); object.putString(PHOTO_URL, photoUrl); object.putString(THUMBNAIL_URL, thumbnailUrl); return object; }
3. ArrowDownloadButton#onSaveInstanceState()
View license@Override protected Parcelable onSaveInstanceState() { final Bundle bundle = new Bundle(); bundle.putParcelable(INSTANCE_STATE, super.onSaveInstanceState()); bundle.putFloat(X_I, x); bundle.putFloat(Y_I, y); bundle.putFloat(RADIUS_I, radius); bundle.putFloat(MAX_WAVE_HEIGHT_I, maxWaveHeight); bundle.putFloat(MIN_WAVE_HEIGHT_I, minWaveHeight); bundle.putFloat(TEXT_Y_I, textY); bundle.putFloat(STEP_I, step); bundle.putFloat(ELASTICITY_STEP_I, elasticityStep); bundle.putFloat(ROPE_STEP_X_I, ropeStepX); bundle.putFloat(ROPE_STEP_Y_I, ropeStepY); bundle.putFloat(ROPE_HEAD_STEP_Y_I, ropeHeadStepY); bundle.putFloat(JUMP_STEP_I, jumpStep); bundle.putFloat(DOWN_STEP_I, downStep); bundle.putFloat(TRI_STEP_I, triStep); bundle.putFloat(HOOK_STEP_Y_I, hookStepY); bundle.putFloat(LITTLE_STEP_I, littleStep); bundle.putFloat(SMALL_RADIUS_I, smallRadius); bundle.putFloat(TEXT_SIZE_I, textSize); bundle.putFloat(ARC_WIDTH_I, arcWidth); bundle.putFloat(ARROW_WIDTH_I, arrowWidth); bundle.putFloat(TRI_WIDTH_I, triWidth); bundle.putFloat(LOADING_WIDTH_I, loadingWidth); bundle.putBoolean(IS_FIRST_I, isFirst); bundle.putBoolean(IS_ANIMATING_I, isAnimating); bundle.putBoolean(BEZIER_I, bezier); bundle.putBoolean(IS_LOADING_I, isLoading); bundle.putBoolean(IS_COMPLETED_I, isCompleted); bundle.putBoolean(IS_END_I, isEnd); bundle.putInt(COUNT_I, count); bundle.putFloat(LENGTH_I, length); bundle.putInt(CURRENT_TIME_I, currentTime); bundle.putFloat(WAVE_HEIGHT_I, waveHeight); bundle.putFloat(PROGRESS_I, progress); bundle.putInt(HOOK_COUNT_I, hookCount); bundle.putFloat(LENGTH_X_I, lengthX); bundle.putFloat(LENGTH_Y_I, lengthY); return bundle; }
4. CircularBar#onSaveInstanceState()
View license@Override protected Parcelable onSaveInstanceState() { final Bundle bundle = new Bundle(); bundle.putParcelable(INSTANCE_STATE, super.onSaveInstanceState()); bundle.putBoolean(INSTANCE_START_LINE_ENABLED, isStartLineEnabled()); bundle.putFloat(INSTANCE_CLOCKWISE_REACHED_BAR_HEIGHT, getClockwiseReachedArcWidth()); bundle.putFloat(INSTANCE_CLOCKWISE_OUTLINE_BAR_HEIGHT, getClockwiseOutlineArcWidth()); bundle.putInt(INSTANCE_CLOCKWISE_REACHED_BAR_COLOR, getClockwiseReachedArcColor()); bundle.putInt(INSTANCE_CLOCKWISE_OUTLINE_BAR_COLOR, getClockwiseOutlineArcColor()); bundle.putFloat(INSTANCE_COUNTER_CLOCKWISE_REACHED_BAR_HEIGHT, getCounterClockwiseReachedArcWidth()); bundle.putFloat(INSTANCE_COUNTER_CLOCKWISE_OUTLINE_BAR_HEIGHT, getCounterClockwiseOutlineArcWidth()); bundle.putInt(INSTANCE_COUNTER_CLOCKWISE_REACHED_BAR_COLOR, getCounterClockwiseReachedArcColor()); bundle.putInt(INSTANCE_COUNTER_CLOCKWISE_OUTLINE_BAR_COLOR, getCounterClockwiseOutlineArcColor()); bundle.putBoolean(INSTANCE_CIRCLE_FILL_ENABLED, isCircleFillEnabled()); bundle.putInt(INSTANCE_CIRCLE_FILL_COLOR, getCircleFillColor()); bundle.putInt(INSTANCE_MAX, getMax()); bundle.putFloat(INSTANCE_PROGRESS, getProgress()); bundle.putString(INSTANCE_SUFFIX, getSuffix()); bundle.putString(INSTANCE_PREFIX, getPrefix()); return bundle; }
5. SmsMmsMessage#toBundle()
View license/** * Convert all SmsMmsMessage data to an extras bundle to send via an intent */ public Bundle toBundle() { Bundle b = new Bundle(); b.putString(EXTRAS_FROM_ADDRESS, fromAddress); b.putString(EXTRAS_MESSAGE_BODY, messageBody); b.putLong(EXTRAS_TIMESTAMP, timestamp); b.putString(EXTRAS_CONTACT_ID, contactId); b.putString(EXTRAS_CONTACT_LOOKUP, contactLookupKey); b.putString(EXTRAS_CONTACT_NAME, contactName); b.putInt(EXTRAS_UNREAD_COUNT, unreadCount); b.putLong(EXTRAS_THREAD_ID, threadId); b.putInt(EXTRAS_MESSAGE_TYPE, messageType); b.putBoolean(EXTRAS_NOTIFY, notify); b.putInt(EXTRAS_REMINDER_COUNT, reminderCount); b.putLong(EXTRAS_MESSAGE_ID, messageId); b.putBoolean(EXTRAS_EMAIL_GATEWAY, fromEmailGateway); return b; }
6. CircularSeekBar#onSaveInstanceState()
View license@Override protected Parcelable onSaveInstanceState() { Parcelable superState = super.onSaveInstanceState(); Bundle state = new Bundle(); state.putParcelable("PARENT", superState); state.putInt("MAX", mMax); state.putInt("PROGRESS", mProgress); state.putInt("mCircleColor", mCircleColor); state.putInt("mCircleProgressColor", mCircleProgressColor); state.putInt("mPointerColor", mPointerColor); state.putInt("mPointerHaloColor", mPointerHaloColor); state.putInt("mPointerHaloColorOnTouch", mPointerHaloColorOnTouch); state.putInt("mPointerAlpha", mPointerAlpha); state.putInt("mPointerAlphaOnTouch", mPointerAlphaOnTouch); state.putBoolean("lockEnabled", lockEnabled); state.putBoolean("isTouchEnabled", isTouchEnabled); return state; }
7. SmsMmsMessage#toBundle()
View license/** * Convert all SmsMmsMessage data to an extras bundle to send via an intent */ public Bundle toBundle() { Bundle b = new Bundle(); b.putString(EXTRAS_FROM_ADDRESS, mFromAddress); b.putString(EXTRAS_MESSAGE_BODY, mMessageBody); b.putLong(EXTRAS_TIMESTAMP, mTimestamp); b.putString(EXTRAS_CONTACT_ID, mContactId); b.putString(EXTRAS_CONTACT_NAME, mContactName); b.putByteArray(EXTRAS_CONTACT_PHOTO, mContactPhoto); b.putInt(EXTRAS_UNREAD_COUNT, mUnreadCount); b.putLong(EXTRAS_THREAD_ID, mThreadId); b.putInt(EXTRAS_MESSAGE_TYPE, mMessageType); b.putBoolean(EXTRAS_NOTIFY, mNotify); b.putInt(EXTRAS_REMINDER_COUNT, mReminderCount); b.putLong(EXTRAS_MESSAGE_ID, mMessageId); return b; }
8. NumberProgressBar#onSaveInstanceState()
View license@Override protected Parcelable onSaveInstanceState() { final Bundle bundle = new Bundle(); bundle.putParcelable(INSTANCE_STATE, super.onSaveInstanceState()); bundle.putInt(INSTANCE_TEXT_COLOR, getTextColor()); bundle.putFloat(INSTANCE_TEXT_SIZE, getProgressTextSize()); bundle.putFloat(INSTANCE_REACHED_BAR_HEIGHT, getReachedBarHeight()); bundle.putFloat(INSTANCE_UNREACHED_BAR_HEIGHT, getUnreachedBarHeight()); bundle.putInt(INSTANCE_REACHED_BAR_COLOR, getReachedBarColor()); bundle.putInt(INSTANCE_UNREACHED_BAR_COLOR, getUnreachedBarColor()); bundle.putInt(INSTANCE_MAX, getMax()); bundle.putInt(INSTANCE_PROGRESS, getProgress()); bundle.putString(INSTANCE_SUFFIX, getSuffix()); bundle.putString(INSTANCE_PREFIX, getPrefix()); bundle.putBoolean(INSTANCE_TEXT_VISIBILITY, getProgressTextVisibility()); return bundle; }
9. CameraLauncher#onSaveInstanceState()
View license/** * Taking or choosing a picture launches another Activity, so we need to implement the * save/restore APIs to handle the case where the CordovaActivity is killed by the OS * before we get the launched Activity's result. */ public Bundle onSaveInstanceState() { Bundle state = new Bundle(); state.putInt("destType", this.destType); state.putInt("srcType", this.srcType); state.putInt("mQuality", this.mQuality); state.putInt("targetWidth", this.targetWidth); state.putInt("targetHeight", this.targetHeight); state.putInt("encodingType", this.encodingType); state.putInt("mediaType", this.mediaType); state.putInt("numPics", this.numPics); state.putBoolean("allowEdit", this.allowEdit); state.putBoolean("correctOrientation", this.correctOrientation); state.putBoolean("saveToPhotoAlbum", this.saveToPhotoAlbum); if (this.croppedUri != null) { state.putString("croppedUri", this.croppedUri.toString()); } if (this.imageUri != null) { state.putString("imageUri", this.imageUri.toString()); } return state; }
10. CameraLauncher#onSaveInstanceState()
View license/** * Taking or choosing a picture launches another Activity, so we need to implement the * save/restore APIs to handle the case where the CordovaActivity is killed by the OS * before we get the launched Activity's result. */ public Bundle onSaveInstanceState() { Bundle state = new Bundle(); state.putInt("destType", this.destType); state.putInt("srcType", this.srcType); state.putInt("mQuality", this.mQuality); state.putInt("targetWidth", this.targetWidth); state.putInt("targetHeight", this.targetHeight); state.putInt("encodingType", this.encodingType); state.putInt("mediaType", this.mediaType); state.putInt("numPics", this.numPics); state.putBoolean("allowEdit", this.allowEdit); state.putBoolean("correctOrientation", this.correctOrientation); state.putBoolean("saveToPhotoAlbum", this.saveToPhotoAlbum); if (this.croppedUri != null) { state.putString("croppedUri", this.croppedUri.toString()); } if (this.imageUri != null) { state.putString("imageUri", this.imageUri.toString()); } return state; }
11. CircularSeekBar#onSaveInstanceState()
View license@Override protected Parcelable onSaveInstanceState() { Parcelable superState = super.onSaveInstanceState(); Bundle state = new Bundle(); state.putParcelable("PARENT", superState); state.putInt("MAX", mMax); state.putInt("PROGRESS", mProgress); state.putInt("mCircleColor", mCircleColor); state.putInt("mCircleProgressColor", mCircleProgressColor); state.putInt("mPointerColor", mPointerColor); state.putInt("mPointerHaloColor", mPointerHaloColor); state.putInt("mPointerHaloColorOnTouch", mPointerHaloColorOnTouch); state.putInt("mPointerAlpha", mPointerAlpha); state.putInt("mPointerAlphaOnTouch", mPointerAlphaOnTouch); state.putBoolean("lockEnabled", lockEnabled); return state; }
12. CameraLauncher#onSaveInstanceState()
View license/** * Taking or choosing a picture launches another Activity, so we need to implement the * save/restore APIs to handle the case where the CordovaActivity is killed by the OS * before we get the launched Activity's result. */ public Bundle onSaveInstanceState() { Bundle state = new Bundle(); state.putInt("destType", this.destType); state.putInt("srcType", this.srcType); state.putInt("mQuality", this.mQuality); state.putInt("targetWidth", this.targetWidth); state.putInt("targetHeight", this.targetHeight); state.putInt("encodingType", this.encodingType); state.putInt("mediaType", this.mediaType); state.putInt("numPics", this.numPics); state.putBoolean("allowEdit", this.allowEdit); state.putBoolean("correctOrientation", this.correctOrientation); state.putBoolean("saveToPhotoAlbum", this.saveToPhotoAlbum); if (this.croppedUri != null) { state.putString("croppedUri", this.croppedUri.toString()); } if (this.imageUri != null) { state.putString("imageUri", this.imageUri.toString()); } return state; }
13. TagsEditText#onSaveInstanceState()
View license@Override public Parcelable onSaveInstanceState() { Bundle bundle = new Bundle(); bundle.putParcelable(SUPER_STATE, super.onSaveInstanceState()); Tag[] tags = new Tag[mTags.size()]; mTags.toArray(tags); bundle.putParcelableArray(TAGS, tags); bundle.putString(LAST_STRING, mLastString); bundle.putString(UNDER_CONSTRUCTION_TAG, getNewTag(getText().toString())); bundle.putInt(TAGS_TEXT_COLOR, mTagsTextColor); bundle.putInt(TAGS_BACKGROUND_RESOURCE, mTagsBackgroundResource); bundle.putFloat(TAGS_TEXT_SIZE, mTagsTextSize); bundle.putInt(LEFT_DRAWABLE_RESOURCE, mLeftDrawableResouce); bundle.putInt(RIGHT_DRAWABLE_RESOURCE, mRightDrawableResouce); bundle.putInt(DRAWABLE_PADDING, mDrawablePadding); bundle.putBoolean(ALLOW_SPACES_IN_TAGS, mIsSpacesAllowedInTags); return bundle; }
14. SublimeBaseMenuItem#saveState()
View licenseprivate Bundle saveState() { Bundle bundle = new Bundle(); bundle.putInt(SS_ID, mId); bundle.putInt(SS_GROUP_ID, mGroup); bundle.putCharSequence(SS_TITLE, mTitle); bundle.putCharSequence(SS_HINT, mHint); bundle.putParcelable(SS_INTENT, mIntent); bundle.putBoolean(SS_SHOWS_ICON_SPACE, mShowsIconSpace); bundle.putString(SS_ITEM_TYPE, mItemType.name()); bundle.putBoolean(SS_VALUE_PROVIDED_ASYNC, mValueProvidedAsync); bundle.putInt(SS_ICON_RES_ID, mIconResId); bundle.putInt(SS_FLAGS, mFlags); return bundle; }
15. AddonDetailsFragment#newInstance()
View license/** * Create a new instance of this, initialized to show the addon addonId */ @TargetApi(21) public static AddonDetailsFragment newInstance(AddonListFragment.ViewHolder vh) { AddonDetailsFragment fragment = new AddonDetailsFragment(); Bundle args = new Bundle(); args.putString(BUNDLE_KEY_ADDONID, vh.addonId); args.putString(BUNDLE_KEY_NAME, vh.addonName); args.putString(BUNDLE_KEY_AUTHOR, vh.author); args.putString(BUNDLE_KEY_VERSION, vh.version); args.putString(BUNDLE_KEY_SUMMARY, vh.summary); args.putString(BUNDLE_KEY_DESCRIPTION, vh.description); args.putString(BUNDLE_KEY_FANART, vh.fanart); args.putString(BUNDLE_KEY_POSTER, vh.poster); args.putBoolean(BUNDLE_KEY_ENABLED, vh.enabled); args.putBoolean(BUNDLE_KEY_BROWSABLE, vh.browsable); if (Utils.isLollipopOrLater()) { args.putString(POSTER_TRANS_NAME, vh.artView.getTransitionName()); } fragment.setArguments(args); return fragment; }
16. AddonOverviewFragment#newInstance()
View license/** * Create a new instance of this, initialized to show the addon addonId */ @TargetApi(21) public static AddonOverviewFragment newInstance(AddonListFragment.ViewHolder vh) { AddonOverviewFragment fragment = new AddonOverviewFragment(); Bundle args = new Bundle(); args.putString(AddonDetailsFragment.BUNDLE_KEY_ADDONID, vh.addonId); args.putString(AddonDetailsFragment.BUNDLE_KEY_NAME, vh.addonName); args.putString(AddonDetailsFragment.BUNDLE_KEY_AUTHOR, vh.author); args.putString(AddonDetailsFragment.BUNDLE_KEY_VERSION, vh.version); args.putString(AddonDetailsFragment.BUNDLE_KEY_SUMMARY, vh.summary); args.putString(AddonDetailsFragment.BUNDLE_KEY_DESCRIPTION, vh.description); args.putString(AddonDetailsFragment.BUNDLE_KEY_FANART, vh.fanart); args.putString(AddonDetailsFragment.BUNDLE_KEY_POSTER, vh.poster); args.putBoolean(AddonDetailsFragment.BUNDLE_KEY_ENABLED, vh.enabled); args.putBoolean(AddonDetailsFragment.BUNDLE_KEY_BROWSABLE, vh.browsable); if (Utils.isLollipopOrLater()) { args.putString(AddonDetailsFragment.POSTER_TRANS_NAME, vh.artView.getTransitionName()); } fragment.setArguments(args); return fragment; }
17. TVShowDetailsFragment#newInstance()
View license/** * Create a new instance of this, initialized to show tvshowId */ @TargetApi(21) public static TVShowDetailsFragment newInstance(TVShowListFragment.ViewHolder vh) { TVShowDetailsFragment fragment = new TVShowDetailsFragment(); Bundle args = new Bundle(); args.putInt(BUNDLE_KEY_TVSHOWID, vh.tvshowId); args.putInt(BUNDLE_KEY_EPISODE, vh.episode); args.putString(BUNDLE_KEY_GENRES, vh.genres); args.putString(BUNDLE_KEY_PLOT, vh.plot); args.putString(BUNDLE_KEY_PREMIERED, vh.premiered); args.putDouble(BUNDLE_KEY_RATING, vh.rating); args.putString(BUNDLE_KEY_STUDIO, vh.studio); args.putString(BUNDLE_KEY_TITLE, vh.tvshowTitle); args.putInt(BUNDLE_KEY_WATCHEDEPISODES, vh.watchedEpisodes); if (Utils.isLollipopOrLater()) { args.putString(POSTER_TRANS_NAME, vh.artView.getTransitionName()); } fragment.setArguments(args); return fragment; }
18. MainActivity#displayClassSelectionActivity()
View license@Subscribe public void displayClassSelectionActivity(SelectClassEvent event) { Bundle bundle = new Bundle(); bundle.putString("size", user.getPreferences().getSize()); bundle.putString("skin", user.getPreferences().getSkin()); bundle.putString("shirt", user.getPreferences().getShirt()); bundle.putInt("hairBangs", user.getPreferences().getHair().getBangs()); bundle.putInt("hairBase", user.getPreferences().getHair().getBase()); bundle.putString("hairColor", user.getPreferences().getHair().getColor()); bundle.putInt("hairMustache", user.getPreferences().getHair().getMustache()); bundle.putInt("hairBeard", user.getPreferences().getHair().getBeard()); bundle.putBoolean("isInitialSelection", event.isInitialSelection); Intent intent = new Intent(this, ClassSelectionActivity.class); intent.putExtras(bundle); startActivityForResult(intent, SELECT_CLASS_RESULT); }
19. Episode#toBundle()
View license/** * Serializes this {@link Episode} object to a {@link android.os.Bundle} representation. */ public Bundle toBundle() { Bundle bundle = new Bundle(); bundle.putString(KEY_TITLE, mTitle); bundle.putInt(KEY_NUMBER, mNumber); bundle.putInt(KEY_NUMBER_ABSOLUTE, mNumberAbsolute); bundle.putInt(KEY_SEASON, mSeason); bundle.putInt(KEY_TVDBID, mTvdbId); bundle.putString(KEY_IMDBID, mImdbId); bundle.putString(KEY_SHOW_TITLE, mShowTitle); bundle.putInt(KEY_SHOW_TVDBID, mShowTvdbId); bundle.putString(KEY_SHOW_IMDBID, mShowImdbId); return bundle; }
20. NumberProgressBar#onSaveInstanceState()
View license@Override protected Parcelable onSaveInstanceState() { final Bundle bundle = new Bundle(); bundle.putParcelable(INSTANCE_STATE, super.onSaveInstanceState()); bundle.putInt(INSTANCE_TEXT_COLOR, getTextColor()); bundle.putFloat(INSTANCE_TEXT_SIZE, getProgressTextSize()); bundle.putFloat(INSTANCE_REACHED_BAR_HEIGHT, getReachedBarHeight()); bundle.putFloat(INSTANCE_UNREACHED_BAR_HEIGHT, getUnreachedBarHeight()); bundle.putInt(INSTANCE_REACHED_BAR_COLOR, getReachedBarColor()); bundle.putInt(INSTANCE_UNREACHED_BAR_COLOR, getUnreachedBarColor()); bundle.putInt(INSTANCE_MAX, getMax()); bundle.putInt(INSTANCE_PROGRESS, getProgress()); return bundle; }
21. NumberProgressBar#onSaveInstanceState()
View license@Override protected Parcelable onSaveInstanceState() { final Bundle bundle = new Bundle(); bundle.putParcelable(INSTANCE_STATE, super.onSaveInstanceState()); bundle.putInt(INSTANCE_TEXT_COLOR, getTextColor()); bundle.putFloat(INSTANCE_TEXT_SIZE, getProgressTextSize()); bundle.putFloat(INSTANCE_REACHED_BAR_HEIGHT, getReachedBarHeight()); bundle.putFloat(INSTANCE_UNREACHED_BAR_HEIGHT, getUnreachedBarHeight()); bundle.putInt(INSTANCE_REACHED_BAR_COLOR, getReachedBarColor()); bundle.putInt(INSTANCE_UNREACHED_BAR_COLOR, getUnreachedBarColor()); bundle.putInt(INSTANCE_MAX, getMax()); bundle.putInt(INSTANCE_PROGRESS, getProgress()); return bundle; }
22. SignInDialogFragment#newInstance()
View licensepublic static SignInDialogFragment newInstance(String title, String message, int imageSource, int numberOfButtons, String firstButtonLabel, String secondButtonLabel, String thirdButtonLabel, int secondButtonAction, int thirdButtonAction) { SignInDialogFragment adf = new SignInDialogFragment(); Bundle bundle = new Bundle(); bundle.putString(ARG_TITLE, title); bundle.putString(ARG_DESCRIPTION, message); bundle.putInt(ARG_IMAGE, imageSource); bundle.putInt(ARG_NUMBER_OF_BUTTONS, numberOfButtons); bundle.putString(ARG_FIRST_BUTTON_LABEL, firstButtonLabel); bundle.putString(ARG_SECOND_BUTTON_LABEL, secondButtonLabel); bundle.putString(ARG_THIRD_BUTTON_LABEL, thirdButtonLabel); bundle.putInt(ARG_SECOND_BUTTON_ACTION, secondButtonAction); bundle.putInt(ARG_THIRD_BUTTON_ACTION, thirdButtonAction); adf.setArguments(bundle); adf.setStyle(DialogFragment.STYLE_NO_TITLE, android.R.style.Theme); return adf; }
23. SiteSettingsFragment#showPagingDialog()
View licenseprivate void showPagingDialog() { Bundle args = new Bundle(); args.putBoolean(NumberPickerDialog.SHOW_SWITCH_KEY, true); args.putBoolean(NumberPickerDialog.SWITCH_ENABLED_KEY, mSiteSettings.getShouldPageComments()); args.putString(NumberPickerDialog.SWITCH_TITLE_KEY, getString(R.string.site_settings_paging_title)); args.putString(NumberPickerDialog.SWITCH_DESC_KEY, getString(R.string.site_settings_paging_dialog_description)); args.putString(NumberPickerDialog.TITLE_KEY, getString(R.string.site_settings_paging_title)); args.putString(NumberPickerDialog.HEADER_TEXT_KEY, getString(R.string.site_settings_paging_dialog_header)); args.putInt(NumberPickerDialog.MIN_VALUE_KEY, 1); args.putInt(NumberPickerDialog.MAX_VALUE_KEY, getResources().getInteger(R.integer.paging_limit)); args.putInt(NumberPickerDialog.CUR_VALUE_KEY, mSiteSettings.getPagingCount()); showNumberPickerDialog(args, PAGING_REQUEST_CODE, "paging-dialog"); }
24. SiteSettingsFragment#showThreadingDialog()
View licenseprivate void showThreadingDialog() { Bundle args = new Bundle(); args.putBoolean(NumberPickerDialog.SHOW_SWITCH_KEY, true); args.putBoolean(NumberPickerDialog.SWITCH_ENABLED_KEY, mSiteSettings.getShouldThreadComments()); args.putString(NumberPickerDialog.SWITCH_TITLE_KEY, getString(R.string.site_settings_threading_title)); args.putString(NumberPickerDialog.SWITCH_DESC_KEY, getString(R.string.site_settings_threading_dialog_description)); args.putString(NumberPickerDialog.TITLE_KEY, getString(R.string.site_settings_threading_title)); args.putString(NumberPickerDialog.HEADER_TEXT_KEY, getString(R.string.site_settings_threading_dialog_header)); args.putInt(NumberPickerDialog.MIN_VALUE_KEY, 2); args.putInt(NumberPickerDialog.MAX_VALUE_KEY, getResources().getInteger(R.integer.threading_limit)); args.putInt(NumberPickerDialog.CUR_VALUE_KEY, mSiteSettings.getThreadingLevels()); showNumberPickerDialog(args, THREADING_REQUEST_CODE, "threading-dialog", new Formatter() { @Override public String format(int value) { return mSiteSettings.getThreadingDescriptionForLevel(value); } }); }
25. SiteSettingsFragment#showCloseAfterDialog()
View licenseprivate void showCloseAfterDialog() { Bundle args = new Bundle(); args.putBoolean(NumberPickerDialog.SHOW_SWITCH_KEY, true); args.putBoolean(NumberPickerDialog.SWITCH_ENABLED_KEY, mSiteSettings.getShouldCloseAfter()); args.putString(NumberPickerDialog.SWITCH_TITLE_KEY, getString(R.string.site_settings_close_after_dialog_switch_text)); args.putString(NumberPickerDialog.SWITCH_DESC_KEY, getString(R.string.site_settings_close_after_dialog_description)); args.putString(NumberPickerDialog.TITLE_KEY, getString(R.string.site_settings_close_after_dialog_title)); args.putString(NumberPickerDialog.HEADER_TEXT_KEY, getString(R.string.site_settings_close_after_dialog_header)); args.putInt(NumberPickerDialog.MIN_VALUE_KEY, 1); args.putInt(NumberPickerDialog.MAX_VALUE_KEY, getResources().getInteger(R.integer.close_after_limit)); args.putInt(NumberPickerDialog.CUR_VALUE_KEY, mSiteSettings.getCloseAfter()); showNumberPickerDialog(args, CLOSE_AFTER_REQUEST_CODE, "close-after-dialog"); }
26. CircularSeekBar#onSaveInstanceState()
View license@Override protected Parcelable onSaveInstanceState() { Parcelable superState = super.onSaveInstanceState(); Bundle state = new Bundle(); state.putParcelable("PARENT", superState); state.putFloat("MAX", mMax); state.putFloat("PROGRESS", mProgress); state.putInt("mCircleColor", mCircleColor); state.putInt("mCircleProgressColor", mCircleProgressColor); state.putInt("mPointerColor", mPointerColor); state.putInt("mPointerHaloColor", mPointerHaloColor); state.putInt("mPointerAlpha", mPointerAlpha); state.putInt("mPointerAlphaOnTouch", mPointerAlphaOnTouch); return state; }
27. ProfilePictureView#onSaveInstanceState()
View license/** * Some of the current state is returned as a Bundle to allow quick restoration * of the ProfilePictureView object in scenarios like orientation changes. * @return a Parcelable containing the current state */ @Override protected Parcelable onSaveInstanceState() { Parcelable superState = super.onSaveInstanceState(); Bundle instanceState = new Bundle(); instanceState.putParcelable(SUPER_STATE_KEY, superState); instanceState.putString(PROFILE_ID_KEY, profileId); instanceState.putInt(PRESET_SIZE_KEY, presetSizeType); instanceState.putBoolean(IS_CROPPED_KEY, isCropped); instanceState.putParcelable(BITMAP_KEY, imageContents); instanceState.putInt(BITMAP_WIDTH_KEY, queryWidth); instanceState.putInt(BITMAP_HEIGHT_KEY, queryHeight); instanceState.putBoolean(PENDING_REFRESH_KEY, lastRequest != null); return instanceState; }
28. ExtensionData#toBundle()
View license/** * Serializes the contents of this object to a {@link Bundle}. */ public Bundle toBundle() { Bundle data = new Bundle(); data.putBoolean(KEY_VISIBLE, mVisible); data.putInt(KEY_ICON, mIcon); data.putString(KEY_ICON_URI, (mIconUri == null ? null : mIconUri.toString())); data.putString(KEY_STATUS, mStatus); data.putString(KEY_EXPANDED_TITLE, mExpandedTitle); data.putString(KEY_EXPANDED_BODY, mExpandedBody); data.putString(KEY_CLICK_INTENT, (mClickIntent == null) ? null : mClickIntent.toUri(0)); data.putString(KEY_CONTENT_DESCRIPTION, mContentDescription); return data; }
29. BluetoothLeDevice#writeToParcel()
View license/* (non-Javadoc) * @see android.os.Parcelable#writeToParcel(android.os.Parcel, int) */ @Override public void writeToParcel(final Parcel parcel, final int arg1) { final Bundle b = new Bundle(getClass().getClassLoader()); b.putByteArray(PARCEL_EXTRA_DEVICE_SCANRECORD, mScanRecord); b.putInt(PARCEL_EXTRA_FIRST_RSSI, mFirstRssi); b.putInt(PARCEL_EXTRA_CURRENT_RSSI, mCurrentRssi); b.putLong(PARCEL_EXTRA_FIRST_TIMESTAMP, mFirstTimestamp); b.putLong(PARCEL_EXTRA_CURRENT_TIMESTAMP, mCurrentTimestamp); b.putParcelable(PARCEL_EXTRA_BLUETOOTH_DEVICE, mDevice); b.putParcelable(PARCEL_EXTRA_DEVICE_SCANRECORD_STORE, mRecordStore); b.putSerializable(PARCEL_EXTRA_DEVICE_RSSI_LOG, (Serializable) mRssiLog); parcel.writeBundle(b); }
30. DonationsFragment#newInstance()
View license/** * Instantiate DonationsFragment. * * @param debug You can use BuildConfig.DEBUG to propagate the debug flag from your app to the Donations library * @param paypalEnabled Enable PayPal donations * @param paypalUser Your PayPal email address * @param paypalCurrencyCode Currency code like EUR. See here for other codes: * https://developer.paypal.com/webapps/developer/docs/classic/api/currency_codes/#id09A6G0U0GYK * @param paypalItemName Display item name on PayPal, like "Donation for NTPSync" * @param flattrEnabled Enable Flattr donations * @param flattrProjectUrl The project URL used on Flattr * @param flattrUrl The Flattr URL to your thing. NOTE: Enter without http:// * @return DonationsFragment */ public static DonationsFragment newInstance(boolean debug, boolean paypalEnabled, String paypalUser, String paypalCurrencyCode, String paypalItemName, boolean flattrEnabled, String flattrProjectUrl, String flattrUrl) { DonationsFragment donationsFragment = new DonationsFragment(); Bundle args = new Bundle(); args.putBoolean(ARG_DEBUG, debug); args.putBoolean(ARG_PAYPAL_ENABLED, paypalEnabled); args.putString(ARG_PAYPAL_USER, paypalUser); args.putString(ARG_PAYPAL_CURRENCY_CODE, paypalCurrencyCode); args.putString(ARG_PAYPAL_ITEM_NAME, paypalItemName); args.putBoolean(ARG_FLATTR_ENABLED, flattrEnabled); args.putString(ARG_FLATTR_PROJECT_URL, flattrProjectUrl); args.putString(ARG_FLATTR_URL, flattrUrl); donationsFragment.setArguments(args); return donationsFragment; }
31. HillshadeRendererParametersFragment#newInstance()
View licensepublic static HillshadeRendererParametersFragment newInstance(int code, double altitude, double azimuth, double zfactor, int slotType, double pixelSizeFactor, double pixelSizePower, double gamma) { HillshadeRendererParametersFragment fragment = new HillshadeRendererParametersFragment(); Bundle args = new Bundle(); args.putInt(KEY_INT, code); args.putDouble(KEY_ALTITUDE, altitude); args.putDouble(KEY_AZIMUTH, azimuth); args.putDouble(KEY_ZFACTOR, zfactor); args.putInt(KEY_SLOPE_TYPE, slotType); args.putDouble(KEY_PIXEL_SIZE_FACTOR, pixelSizeFactor); args.putDouble(KEY_PIXEL_SIZE_POWER, pixelSizePower); args.putDouble(KEY_GAMMA, gamma); fragment.setArguments(args); return fragment; }
32. ProfilePictureView#onSaveInstanceState()
View license/** * Some of the current state is returned as a Bundle to allow quick restoration * of the ProfilePictureView object in scenarios like orientation changes. * @return a Parcelable containing the current state */ @Override protected Parcelable onSaveInstanceState() { Parcelable superState = super.onSaveInstanceState(); Bundle instanceState = new Bundle(); instanceState.putParcelable(SUPER_STATE_KEY, superState); instanceState.putString(PROFILE_ID_KEY, profileId); instanceState.putInt(PRESET_SIZE_KEY, presetSizeType); instanceState.putBoolean(IS_CROPPED_KEY, isCropped); instanceState.putParcelable(BITMAP_KEY, imageContents); instanceState.putInt(BITMAP_WIDTH_KEY, queryWidth); instanceState.putInt(BITMAP_HEIGHT_KEY, queryHeight); instanceState.putBoolean(PENDING_REFRESH_KEY, lastRequest != null); return instanceState; }
33. TouchImageViewCustom#onSaveInstanceState()
View license@Override public Parcelable onSaveInstanceState() { Bundle bundle = new Bundle(); bundle.putParcelable("instanceState", super.onSaveInstanceState()); bundle.putFloat("saveScale", normalizedScale); bundle.putFloat("matchViewHeight", matchViewHeight); bundle.putFloat("matchViewWidth", matchViewWidth); bundle.putInt("viewWidth", viewWidth); bundle.putInt("viewHeight", viewHeight); matrix.getValues(m); bundle.putFloatArray("matrix", m); bundle.putBoolean("imageRendered", imageRenderedAtLeastOnce); return bundle; }
34. BootstrapProgressBar#onSaveInstanceState()
View license@Override public Parcelable onSaveInstanceState() { Bundle bundle = new Bundle(); bundle.putParcelable(TAG, super.onSaveInstanceState()); bundle.putInt(KEY_USER_PROGRESS, userProgress); bundle.putInt(KEY_DRAWN_PROGRESS, drawnProgress); bundle.putBoolean(KEY_STRIPED, striped); bundle.putBoolean(KEY_ANIMATED, animated); bundle.putBoolean(RoundableView.KEY, rounded); bundle.putFloat(BootstrapSizeView.KEY, bootstrapSize); bundle.putSerializable(BootstrapBrand.KEY, bootstrapBrand); return bundle; }
35. AppVersionInfo#writeToParcel()
View license@Override public void writeToParcel(final Parcel dest, final int flags) { final Bundle bundle = new Bundle(); bundle.putInt("versionCode", this.versionCode); bundle.putString("versionName", this.versionName); bundle.putString("releaseDate", this.releaseDate); bundle.putString("changelog", this.changelog); bundle.putString("downloadUrl", this.downloadUrl); bundle.putString("versionType", this.versionType); bundle.putString("packageName", this.packageName); bundle.putBoolean("forceUpdate", this.forceUpdate); dest.writeBundle(bundle); }
36. TouchImageView#onSaveInstanceState()
View license@Override public Parcelable onSaveInstanceState() { Bundle bundle = new Bundle(); bundle.putParcelable("instanceState", super.onSaveInstanceState()); bundle.putFloat("saveScale", normalizedScale); bundle.putFloat("matchViewHeight", matchViewHeight); bundle.putFloat("matchViewWidth", matchViewWidth); bundle.putInt("viewWidth", viewWidth); bundle.putInt("viewHeight", viewHeight); matrix.getValues(m); bundle.putFloatArray("matrix", m); bundle.putBoolean("imageRendered", imageRenderedAtLeastOnce); return bundle; }
37. TouchImageView#onSaveInstanceState()
View license@Override public Parcelable onSaveInstanceState() { Bundle bundle = new Bundle(); bundle.putParcelable("instanceState", super.onSaveInstanceState()); bundle.putFloat("saveScale", normalizedScale); bundle.putFloat("matchViewHeight", matchViewHeight); bundle.putFloat("matchViewWidth", matchViewWidth); bundle.putInt("viewWidth", viewWidth); bundle.putInt("viewHeight", viewHeight); matrix.getValues(m); bundle.putFloatArray("matrix", m); bundle.putBoolean("imageRendered", imageRenderedAtLeastOnce); return bundle; }
38. MusicVideoDetailsFragment#newInstance()
View license/** * Create a new instance of this, initialized to show the video musicVideoId */ @TargetApi(21) public static MusicVideoDetailsFragment newInstance(MusicVideoListFragment.ViewHolder vh) { MusicVideoDetailsFragment fragment = new MusicVideoDetailsFragment(); Bundle args = new Bundle(); args.putInt(BUNDLE_KEY_ID, vh.musicVideoId); args.putString(BUNDLE_KEY_TITLE, vh.musicVideoTitle); args.putString(BUNDLE_KEY_ALBUM, vh.album); args.putString(BUNDLE_KEY_ARTIST, vh.artist); args.putString(BUNDLE_KEY_GENRES, vh.genres); args.putString(BUNDLE_KEY_PLOT, vh.plot); args.putInt(BUNDLE_KEY_RUNTIME, vh.runtime); args.putInt(BUNDLE_KEY_YEAR, vh.year); if (Utils.isLollipopOrLater()) { args.putString(POSTER_TRANS_NAME, vh.artView.getTransitionName()); } fragment.setArguments(args); return fragment; }
39. TouchImageView#onSaveInstanceState()
View license@Override public Parcelable onSaveInstanceState() { Bundle bundle = new Bundle(); bundle.putParcelable("instanceState", super.onSaveInstanceState()); bundle.putFloat("saveScale", normalizedScale); bundle.putFloat("matchViewHeight", matchViewHeight); bundle.putFloat("matchViewWidth", matchViewWidth); bundle.putInt("viewWidth", viewWidth); bundle.putInt("viewHeight", viewHeight); matrix.getValues(m); bundle.putFloatArray("matrix", m); bundle.putBoolean("imageRendered", imageRenderedAtLeastOnce); return bundle; }
40. TouchImageView#onSaveInstanceState()
View license@Override public Parcelable onSaveInstanceState() { Bundle bundle = new Bundle(); bundle.putParcelable("instanceState", super.onSaveInstanceState()); bundle.putFloat("saveScale", normalizedScale); bundle.putFloat("matchViewHeight", matchViewHeight); bundle.putFloat("matchViewWidth", matchViewWidth); bundle.putInt("viewWidth", viewWidth); bundle.putInt("viewHeight", viewHeight); matrix.getValues(m); bundle.putFloatArray("matrix", m); bundle.putBoolean("imageRendered", imageRenderedAtLeastOnce); return bundle; }
41. ProfilePictureView#onSaveInstanceState()
View license/** * Some of the current state is returned as a Bundle to allow quick restoration * of the ProfilePictureView object in scenarios like orientation changes. * @return a Parcelable containing the current state */ @Override protected Parcelable onSaveInstanceState() { Parcelable superState = super.onSaveInstanceState(); Bundle instanceState = new Bundle(); instanceState.putParcelable(SUPER_STATE_KEY, superState); instanceState.putString(PROFILE_ID_KEY, profileId); instanceState.putInt(PRESET_SIZE_KEY, presetSizeType); instanceState.putBoolean(IS_CROPPED_KEY, isCropped); instanceState.putParcelable(BITMAP_KEY, imageContents); instanceState.putInt(BITMAP_WIDTH_KEY, queryWidth); instanceState.putInt(BITMAP_HEIGHT_KEY, queryHeight); instanceState.putBoolean(PENDING_REFRESH_KEY, lastRequest != null); return instanceState; }
42. TouchImageView#onSaveInstanceState()
View license@Override public Parcelable onSaveInstanceState() { Bundle bundle = new Bundle(); bundle.putParcelable("instanceState", super.onSaveInstanceState()); bundle.putFloat("saveScale", normalizedScale); bundle.putFloat("matchViewHeight", matchViewHeight); bundle.putFloat("matchViewWidth", matchViewWidth); bundle.putInt("viewWidth", viewWidth); bundle.putInt("viewHeight", viewHeight); matrix.getValues(m); bundle.putFloatArray("matrix", m); bundle.putBoolean("imageRendered", imageRenderedAtLeastOnce); return bundle; }
43. TouchImageView#onSaveInstanceState()
View license@Override public Parcelable onSaveInstanceState() { Bundle bundle = new Bundle(); bundle.putParcelable("instanceState", super.onSaveInstanceState()); bundle.putFloat("saveScale", normalizedScale); bundle.putFloat("matchViewHeight", matchViewHeight); bundle.putFloat("matchViewWidth", matchViewWidth); bundle.putInt("viewWidth", viewWidth); bundle.putInt("viewHeight", viewHeight); matrix.getValues(m); bundle.putFloatArray("matrix", m); bundle.putBoolean("imageRendered", imageRenderedAtLeastOnce); return bundle; }
44. TouchImageView#onSaveInstanceState()
View license@Override public Parcelable onSaveInstanceState() { Bundle bundle = new Bundle(); bundle.putParcelable("instanceState", super.onSaveInstanceState()); bundle.putFloat("saveScale", normalizedScale); bundle.putFloat("matchViewHeight", matchViewHeight); bundle.putFloat("matchViewWidth", matchViewWidth); bundle.putInt("viewWidth", viewWidth); bundle.putInt("viewHeight", viewHeight); matrix.getValues(m); bundle.putFloatArray("matrix", m); bundle.putBoolean("imageRendered", imageRenderedAtLeastOnce); return bundle; }
45. ImporterTest#testGetDataExportPreferences_withPreferences()
View licensepublic void testGetDataExportPreferences_withPreferences() { Bundle prefBundle = new Bundle(); prefBundle.putBoolean("bool", true); prefBundle.putInt("int", 9); prefBundle.putFloat("float", 3.14f); prefBundle.putString("string", "testing"); prefBundle.putLong("long", 0x123456DEADBEEFL); prefBundle.putStringArray("stringarray", new String[] { "1", "2", "3" }); Bundle bundle = new Bundle(); bundle.putBundle("preferences", prefBundle); mImporter.importFromBundle(bundle, null, mMockPreferences); verify(mMockPreferencesEditor).putBoolean("bool", true); verify(mMockPreferencesEditor).putInt("int", 9); verify(mMockPreferencesEditor).putFloat("float", 3.14f); verify(mMockPreferencesEditor).putString("string", "testing"); verify(mMockPreferencesEditor).putLong("long", 0x123456DEADBEEFL); verify(mMockPreferencesEditor).commit(); verifyNoMoreInteractions(mMockPreferencesEditor); }
46. TouchImageView#onSaveInstanceState()
View license@Override public Parcelable onSaveInstanceState() { Bundle bundle = new Bundle(); bundle.putParcelable("instanceState", super.onSaveInstanceState()); bundle.putFloat("saveScale", normalizedScale); bundle.putFloat("matchViewHeight", matchViewHeight); bundle.putFloat("matchViewWidth", matchViewWidth); bundle.putInt("viewWidth", viewWidth); bundle.putInt("viewHeight", viewHeight); matrix.getValues(m); bundle.putFloatArray("matrix", m); bundle.putBoolean("imageRendered", imageRenderedAtLeastOnce); return bundle; }
47. Artwork#toBundle()
View license/** * Serializes this artwork object to a {@link Bundle} representation. */ public Bundle toBundle() { Bundle bundle = new Bundle(); bundle.putString(KEY_COMPONENT_NAME, (mComponentName != null) ? mComponentName.flattenToShortString() : null); bundle.putString(KEY_IMAGE_URI, (mImageUri != null) ? mImageUri.toString() : null); bundle.putString(KEY_TITLE, mTitle); bundle.putString(KEY_BYLINE, mByline); bundle.putString(KEY_ATTRIBUTION, mAttribution); bundle.putString(KEY_TOKEN, mToken); bundle.putString(KEY_VIEW_INTENT, (mViewIntent != null) ? mViewIntent.toUri(Intent.URI_INTENT_SCHEME) : null); bundle.putString(KEY_META_FONT, mMetaFont); return bundle; }
48. TouchImageViewCustom#onSaveInstanceState()
View license@Override public Parcelable onSaveInstanceState() { Bundle bundle = new Bundle(); bundle.putParcelable("instanceState", super.onSaveInstanceState()); bundle.putFloat("saveScale", normalizedScale); bundle.putFloat("matchViewHeight", matchViewHeight); bundle.putFloat("matchViewWidth", matchViewWidth); bundle.putInt("viewWidth", viewWidth); bundle.putInt("viewHeight", viewHeight); matrix.getValues(m); bundle.putFloatArray("matrix", m); bundle.putBoolean("imageRendered", imageRenderedAtLeastOnce); return bundle; }
49. ParallaxWelcomeFragment#newInstance()
View licensepublic static ParallaxWelcomeFragment newInstance(@LayoutRes int layoutId, String title, String description, float startParallaxFactor, float endParallaxFactor, boolean parallaxRecursive, String headerTypefacePath, String descriptionTypefacePath) { Bundle args = new Bundle(); args.putInt(KEY_LAYOUT_ID, layoutId); args.putString(KEY_TITLE, title); args.putString(KEY_DESCRIPTION, description); args.putFloat(KEY_START_FACTOR, startParallaxFactor); args.putFloat(KEY_END_FACTOR, endParallaxFactor); args.putBoolean(KEY_PARALLAX_RECURSIVE, parallaxRecursive); args.putString(KEY_HEADER_TYPEFACE_PATH, headerTypefacePath); args.putString(KEY_DESCRIPTION_TYPEFACE_PATH, descriptionTypefacePath); ParallaxWelcomeFragment fragment = new ParallaxWelcomeFragment(); fragment.setArguments(args); return fragment; }
50. ThreadFragment#createDefault()
View licensepublic static ThreadFragment createDefault(final int forumId, final String forumTitle, final String parentForumTitle, final ArrayList<String> hierarchy) { final Bundle bundle = new Bundle(); // Internal use bundle.putBoolean(ADD_EXTRA_DECOR_ARGUMENT, true); bundle.putParcelable(THREAD_LOAD_STRATEGY_ARGUMENT, new DefaultThreadLoaderStrategy()); bundle.putParcelable(THREAD_CLICK_STRATEGY_ARGUMENT, new FirstThreadClickStrategy()); // From external bundle.putInt(FORUM_ID_ARGUMENT, forumId); bundle.putString(FORUM_TITLE_ARGUMENT, forumTitle); bundle.putString(PARENT_FORUM_TITLE_ARGUMENT, parentForumTitle); bundle.putStringArrayList(FORUM_HIERARCHY_ARGUMENT, hierarchy); final ThreadFragment threadFragment = new ThreadFragment(); threadFragment.setArguments(bundle); return threadFragment; }
51. GaugeView#onSaveInstanceState()
View license@Override protected Parcelable onSaveInstanceState() { final Parcelable superState = super.onSaveInstanceState(); final Bundle state = new Bundle(); state.putParcelable("superState", superState); state.putBoolean("needleInitialized", mNeedleInitialized); state.putFloat("needleVelocity", mNeedleVelocity); state.putFloat("needleAcceleration", mNeedleAcceleration); state.putLong("needleLastMoved", mNeedleLastMoved); state.putFloat("currentValue", mCurrentValue); state.putFloat("targetValue", mTargetValue); return state; }
52. CameraFragment#newPictureInstance()
View licensepublic static CameraFragment newPictureInstance(Uri output, boolean updateMediaStore, int quality, ZoomStyle zoomStyle, boolean facingExactMatch, boolean skipOrientationNormalization) { CameraFragment f = new CameraFragment(); Bundle args = new Bundle(); args.putParcelable(ARG_OUTPUT, output); args.putBoolean(ARG_UPDATE_MEDIA_STORE, updateMediaStore); args.putBoolean(ARG_SKIP_ORIENTATION_NORMALIZATION, skipOrientationNormalization); args.putInt(ARG_QUALITY, quality); args.putBoolean(ARG_IS_VIDEO, false); args.putSerializable(ARG_ZOOM_STYLE, zoomStyle); args.putBoolean(ARG_FACING_EXACT_MATCH, facingExactMatch); f.setArguments(args); return (f); }
53. CameraFragment#newVideoInstance()
View licensepublic static CameraFragment newVideoInstance(Uri output, boolean updateMediaStore, int quality, int sizeLimit, int durationLimit, boolean facingExactMatch, ChronoType chronoType) { CameraFragment f = new CameraFragment(); Bundle args = new Bundle(); args.putParcelable(ARG_OUTPUT, output); args.putBoolean(ARG_UPDATE_MEDIA_STORE, updateMediaStore); args.putBoolean(ARG_IS_VIDEO, true); args.putInt(ARG_QUALITY, quality); args.putInt(ARG_SIZE_LIMIT, sizeLimit); args.putInt(ARG_DURATION_LIMIT, durationLimit); args.putBoolean(ARG_FACING_EXACT_MATCH, facingExactMatch); if (durationLimit > 0 || chronoType != ChronoType.COUNT_DOWN) { args.putSerializable(ARG_CHRONOTYPE, chronoType); } f.setArguments(args); return (f); }
54. AuthorizationClient#newAuthorizationLoggingBundle()
View licensestatic Bundle newAuthorizationLoggingBundle(String authLoggerId) { // We want to log all parameters for all events, to ensure stability of columns across different event types. Bundle bundle = new Bundle(); bundle.putLong(EVENT_PARAM_TIMESTAMP, System.currentTimeMillis()); bundle.putString(EVENT_PARAM_AUTH_LOGGER_ID, authLoggerId); bundle.putString(EVENT_PARAM_METHOD, ""); bundle.putString(EVENT_PARAM_LOGIN_RESULT, ""); bundle.putString(EVENT_PARAM_ERROR_MESSAGE, ""); bundle.putString(EVENT_PARAM_ERROR_CODE, ""); bundle.putString(EVENT_PARAM_EXTRAS, ""); return bundle; }
55. AppLinkNavigation#buildAppLinkDataForNavigation()
View license/** * Creates a bundle containing the final, constructed App Link data to be used in navigation. */ private Bundle buildAppLinkDataForNavigation(Context context) { Bundle data = new Bundle(); Bundle refererAppLinkData = new Bundle(); if (context != null) { String refererAppPackage = context.getPackageName(); if (refererAppPackage != null) { refererAppLinkData.putString(KEY_NAME_REFERER_APP_LINK_PACKAGE, refererAppPackage); } ApplicationInfo appInfo = context.getApplicationInfo(); if (appInfo != null) { String refererAppName = context.getString(appInfo.labelRes); if (refererAppName != null) { refererAppLinkData.putString(KEY_NAME_REFERER_APP_LINK_APP_NAME, refererAppName); } } } data.putAll(getAppLinkData()); data.putString(AppLinks.KEY_NAME_TARGET, getAppLink().getSourceUrl().toString()); data.putString(KEY_NAME_VERSION, VERSION); data.putString(KEY_NAME_USER_AGENT, "Bolts Android " + Bolts.VERSION); data.putBundle(KEY_NAME_REFERER_APP_LINK, refererAppLinkData); data.putBundle(AppLinks.KEY_NAME_EXTRAS, getExtras()); return data; }
56. EditTextDialogFragment#newInstance()
View license/** * Create a new instance of a {@link EditTextDialogFragment} to ask the user to define the name of a {@link Palette}. * * @param requestCode the request code * @param titleResourceId the resource id of the title. * @param positiveButtonResourceId the resource id of the positive button. * @param negativeButtonResourceId the resource id of the negative button. * @param editTextHint the edit text hint. * @param editTextInitialText the initial text of the edit text. * @param allowEmptyString if true empty string will be allowed, otherwise a 'nope' animation will be played if the user tries to validate an empty string. * @return the newly created {@link EditTextDialogFragment}. */ public static EditTextDialogFragment newInstance(int requestCode, @StringRes int titleResourceId, @StringRes int positiveButtonResourceId, @StringRes int negativeButtonResourceId, String editTextHint, String editTextInitialText, boolean allowEmptyString) { final EditTextDialogFragment instance = new EditTextDialogFragment(); final Bundle args = new Bundle(); args.putInt(ARG_REQUEST_CODE, requestCode); args.putInt(ARG_TITLE_RESOURCE_ID, titleResourceId); args.putInt(ARG_POSITIVE_BUTTON_RESOURCE_ID, positiveButtonResourceId); args.putInt(ARG_NEGATIVE_BUTTON_RESOURCE_ID, negativeButtonResourceId); args.putString(ARG_EDIT_TEXT_HINT, editTextHint); args.putString(ARG_EDIT_TEXT_INITIAL_TEXT, editTextInitialText); args.putBoolean(ARG_ALLOW_EMPTY_STRING, allowEmptyString); instance.setArguments(args); return instance; }
57. AuthorizationClient#newAuthorizationLoggingBundle()
View licensestatic Bundle newAuthorizationLoggingBundle(String authLoggerId) { // We want to log all parameters for all events, to ensure stability of columns across different event types. Bundle bundle = new Bundle(); bundle.putLong(EVENT_PARAM_TIMESTAMP, System.currentTimeMillis()); bundle.putString(EVENT_PARAM_AUTH_LOGGER_ID, authLoggerId); bundle.putString(EVENT_PARAM_METHOD, ""); bundle.putString(EVENT_PARAM_LOGIN_RESULT, ""); bundle.putString(EVENT_PARAM_ERROR_MESSAGE, ""); bundle.putString(EVENT_PARAM_ERROR_CODE, ""); bundle.putString(EVENT_PARAM_EXTRAS, ""); return bundle; }
58. ArtistDetailsFragment#newInstance()
View license/** * Create a new instance of this, initialized to show tvshowId */ @TargetApi(21) public static ArtistDetailsFragment newInstance(ArtistListFragment.ViewHolder vh) { ArtistDetailsFragment fragment = new ArtistDetailsFragment(); Bundle args = new Bundle(); args.putInt(ArtistOverviewFragment.BUNDLE_KEY_ARTISTID, vh.artistId); args.putInt(AlbumListFragment.BUNDLE_KEY_ARTISTID, vh.artistId); args.putString(ArtistOverviewFragment.BUNDLE_KEY_TITLE, vh.artistName); args.putString(ArtistOverviewFragment.BUNDLE_KEY_FANART, vh.fanart); args.putString(ArtistOverviewFragment.BUNDLE_KEY_DESCRIPTION, vh.description); args.putString(ArtistOverviewFragment.BUNDLE_KEY_GENRE, vh.genres); args.putString(ArtistOverviewFragment.BUNDLE_KEY_POSTER, vh.poster); if (Utils.isLollipopOrLater()) { args.putString(ArtistOverviewFragment.POSTER_TRANS_NAME, vh.artView.getTransitionName()); } fragment.setArguments(args); return fragment; }
59. MovieDetailsFragment#newInstance()
View license/** * Create a new instance of this, initialized to show the movie movieId */ @TargetApi(21) public static MovieDetailsFragment newInstance(MovieListFragment.ViewHolder vh) { MovieDetailsFragment fragment = new MovieDetailsFragment(); Bundle args = new Bundle(); args.putInt(BUNDLE_KEY_MOVIEID, vh.movieId); args.putString(BUNDLE_KEY_MOVIETITLE, vh.movieTitle); args.putString(BUNDLE_KEY_MOVIEPLOT, vh.movieTagline); args.putString(BUNDLE_KEY_MOVIEGENRES, vh.movieGenres); args.putInt(BUNDLE_KEY_MOVIEYEAR, vh.movieYear); args.putInt(BUNDLE_KEY_MOVIERUNTIME, vh.movieRuntime); args.putDouble(BUNDLE_KEY_MOVIERATING, vh.movieRating); if (Utils.isLollipopOrLater()) { args.putString(POSTER_TRANS_NAME, vh.artView.getTransitionName()); } fragment.setArguments(args); return fragment; }
60. StoryRecyclerViewAdapter#saveState()
View license@Override public Bundle saveState() { Bundle savedState = super.saveState(); savedState.putParcelableArrayList(STATE_ITEMS, mItems); savedState.putParcelableArrayList(STATE_UPDATED, mUpdated); savedState.putStringArrayList(STATE_PROMOTED, mPromoted); savedState.putBoolean(STATE_SHOW_ALL, mShowAll); savedState.putBoolean(STATE_HIGHLIGHT_UPDATED, mHighlightUpdated); savedState.putInt(STATE_FAVORITE_REVISION, mFavoriteRevision); savedState.putString(STATE_USERNAME, mUsername); return savedState; }
61. SlideDateTimeDialogFragment#newInstance()
View license/** * <p>Return a new instance of {@code SlideDateTimeDialogFragment} with its bundle * filled with the incoming arguments.</p> * * <p>Called by {@link SlideDateTimePicker#show()}.</p> * * @param listener * @param initialDate * @param minDate * @param maxDate * @param isClientSpecified24HourTime * @param is24HourTime * @param theme * @param indicatorColor * @return */ public static SlideDateTimeDialogFragment newInstance(SlideDateTimeListener listener, Date initialDate, Date minDate, Date maxDate, boolean isClientSpecified24HourTime, boolean is24HourTime, int theme, int indicatorColor) { mListener = listener; // Create a new instance of SlideDateTimeDialogFragment SlideDateTimeDialogFragment dialogFragment = new SlideDateTimeDialogFragment(); // Store the arguments and attach the bundle to the fragment Bundle bundle = new Bundle(); bundle.putSerializable("initialDate", initialDate); bundle.putSerializable("minDate", minDate); bundle.putSerializable("maxDate", maxDate); bundle.putBoolean("isClientSpecified24HourTime", isClientSpecified24HourTime); bundle.putBoolean("is24HourTime", is24HourTime); bundle.putInt("theme", theme); bundle.putInt("indicatorColor", indicatorColor); dialogFragment.setArguments(bundle); // Return the fragment with its bundle return dialogFragment; }
62. AlbumDetailsFragment#newInstance()
View license/** * Create a new instance of this, initialized to show the album albumId */ @TargetApi(21) public static AlbumDetailsFragment newInstance(AlbumListFragment.ViewHolder vh) { AlbumDetailsFragment fragment = new AlbumDetailsFragment(); Bundle args = new Bundle(); args.putInt(BUNDLE_KEY_ALBUMID, vh.albumId); args.putString(BUNDLE_KEY_ALBUMTITLE, vh.albumTitle); args.putString(BUNDLE_KEY_ALBUMARTIST, vh.albumArtist); args.putString(BUNDLE_KEY_ALBUMGENRE, vh.albumGenre); args.putInt(BUNDLE_KEY_ALBUMYEAR, vh.albumYear); args.putDouble(BUNDLE_KEY_ALBUMRATING, vh.albumRating); if (Utils.isLollipopOrLater()) { args.putString(POSTER_TRANS_NAME, vh.artView.getTransitionName()); } fragment.setArguments(args); return fragment; }
63. FileDialogFragment#newInstance()
View license/** * Creates new instance of this file dialog fragment */ public static FileDialogFragment newInstance(Messenger messenger, String title, String message, String defaultFile, String checkboxText, int requestCode) { FileDialogFragment frag = new FileDialogFragment(); Bundle args = new Bundle(); args.putParcelable(ARG_MESSENGER, messenger); args.putString(ARG_TITLE, title); args.putString(ARG_MESSAGE, message); args.putString(ARG_DEFAULT_FILE, defaultFile); args.putString(ARG_CHECKBOX_TEXT, checkboxText); args.putInt(ARG_REQUEST_CODE, requestCode); frag.setArguments(args); return frag; }
64. PhotoPickerFragment#newInstance()
View licensepublic static PhotoPickerFragment newInstance(boolean showCamera, boolean showGif, boolean previewEnable, int column, int maxCount, ArrayList<String> originalPhotos) { Bundle args = new Bundle(); args.putBoolean(EXTRA_CAMERA, showCamera); args.putBoolean(EXTRA_GIF, showGif); args.putBoolean(EXTRA_PREVIEW_ENABLED, previewEnable); args.putInt(EXTRA_COLUMN, column); args.putInt(EXTRA_COUNT, maxCount); args.putStringArrayList(EXTRA_ORIGIN, originalPhotos); PhotoPickerFragment fragment = new PhotoPickerFragment(); fragment.setArguments(args); return fragment; }
65. PullToRefreshBase#onSaveInstanceState()
View license@Override protected final Parcelable onSaveInstanceState() { Bundle bundle = new Bundle(); // Let derivative classes get a chance to save state first, that way we // can make sure they don't overrite any of our values onPtrSaveInstanceState(bundle); bundle.putInt(STATE_STATE, mState.getIntValue()); bundle.putInt(STATE_MODE, mMode.getIntValue()); bundle.putInt(STATE_CURRENT_MODE, mCurrentMode.getIntValue()); bundle.putBoolean(STATE_SCROLLING_REFRESHING_ENABLED, mScrollingWhileRefreshingEnabled); bundle.putBoolean(STATE_SHOW_REFRESHING_VIEW, mShowViewWhileRefreshing); bundle.putParcelable(STATE_SUPER, super.onSaveInstanceState()); return bundle; }
66. PullToRefreshBase#onSaveInstanceState()
View license@Override protected final Parcelable onSaveInstanceState() { Bundle bundle = new Bundle(); // Let derivative classes get a chance to save state first, that way we // can make sure they don't overrite any of our values onPtrSaveInstanceState(bundle); bundle.putInt(STATE_STATE, mState.getIntValue()); bundle.putInt(STATE_MODE, mMode.getIntValue()); bundle.putInt(STATE_CURRENT_MODE, mCurrentMode.getIntValue()); bundle.putBoolean(STATE_SCROLLING_REFRESHING_ENABLED, mScrollingWhileRefreshingEnabled); bundle.putBoolean(STATE_SHOW_REFRESHING_VIEW, mShowViewWhileRefreshing); bundle.putParcelable(STATE_SUPER, super.onSaveInstanceState()); return bundle; }
67. LicensesDialogFragment#newInstance()
View licenseprivate static LicensesDialogFragment newInstance(final int rawNoticesResourceId, final boolean showFullLicenseText, final boolean includeOwnLicense, final int themeResourceId, final int dividerColor, final boolean useAppCompat) { final LicensesDialogFragment licensesDialogFragment = new LicensesDialogFragment(); final Bundle args = new Bundle(); args.putInt(ARGUMENT_NOTICES_XML_ID, rawNoticesResourceId); args.putBoolean(ARGUMENT_FULL_LICENSE_TEXT, showFullLicenseText); args.putBoolean(ARGUMENT_INCLUDE_OWN_LICENSE, includeOwnLicense); args.putInt(ARGUMENT_THEME_XML_ID, themeResourceId); args.putInt(ARGUMENT_DIVIDER_COLOR, dividerColor); args.putBoolean(ARGUMENT_USE_APPCOMPAT, useAppCompat); licensesDialogFragment.setArguments(args); return licensesDialogFragment; }
68. LicensesDialogFragment#newInstance()
View license// ========================================================================================================================== // Factory // ========================================================================================================================== private static LicensesDialogFragment newInstance(final Notices notices, final boolean showFullLicenseText, final boolean includeOwnLicense, final int themeResourceId, final int dividerColor, final boolean useAppCompat) { final LicensesDialogFragment licensesDialogFragment = new LicensesDialogFragment(); final Bundle args = new Bundle(); args.putParcelable(ARGUMENT_NOTICES, notices); args.putBoolean(ARGUMENT_FULL_LICENSE_TEXT, showFullLicenseText); args.putBoolean(ARGUMENT_INCLUDE_OWN_LICENSE, includeOwnLicense); args.putInt(ARGUMENT_THEME_XML_ID, themeResourceId); args.putInt(ARGUMENT_DIVIDER_COLOR, dividerColor); args.putBoolean(ARGUMENT_USE_APPCOMPAT, useAppCompat); licensesDialogFragment.setArguments(args); return licensesDialogFragment; }
69. PullToRefreshBase#onSaveInstanceState()
View license@Override protected final Parcelable onSaveInstanceState() { Bundle bundle = new Bundle(); // Let derivative classes get a chance to save state first, that way we // can make sure they don't overrite any of our values onPtrSaveInstanceState(bundle); bundle.putInt(STATE_STATE, mState.getIntValue()); bundle.putInt(STATE_MODE, mMode.getIntValue()); bundle.putInt(STATE_CURRENT_MODE, mCurrentMode.getIntValue()); bundle.putBoolean(STATE_SCROLLING_REFRESHING_ENABLED, mScrollingWhileRefreshingEnabled); bundle.putBoolean(STATE_SHOW_REFRESHING_VIEW, mShowViewWhileRefreshing); bundle.putParcelable(STATE_SUPER, super.onSaveInstanceState()); return bundle; }
70. RemoveFileDialogFragment#newInstance()
View license/** * Public factory method to create new RemoveFileDialogFragment instances. * * @param file File to remove. * @return Dialog ready to show. */ public static RemoveFileDialogFragment newInstance(OCFile file) { RemoveFileDialogFragment frag = new RemoveFileDialogFragment(); Bundle args = new Bundle(); int messageStringId = R.string.confirmation_remove_alert; int localRemoveButton = (!file.isFavorite() && (file.isFolder() || file.isDown())) ? R.string.confirmation_remove_local : -1; if (file.isFolder()) { messageStringId = R.string.confirmation_remove_folder_alert; } args.putInt(ARG_MESSAGE_RESOURCE_ID, messageStringId); args.putStringArray(ARG_MESSAGE_ARGUMENTS, new String[] { file.getFileName() }); args.putInt(ARG_POSITIVE_BTN_RES, R.string.common_yes); args.putInt(ARG_NEUTRAL_BTN_RES, R.string.common_no); args.putInt(ARG_NEGATIVE_BTN_RES, localRemoveButton); args.putParcelable(ARG_TARGET_FILE, file); frag.setArguments(args); return frag; }
71. ConfirmationDialogFragment#newInstance()
View license/** * Public factory method to create new ConfirmationDialogFragment instances. * * @param messageResId Resource id for a message to show in the dialog. * @param messageArguments Arguments to complete the message, if it's a format string. May be null. * @param titleResId Resource id for a text to show in the title. * 0 for default alert title, -1 for no title. * @param posBtn Resource id for the text of the positive button. -1 for no positive button. * @param neuBtn Resource id for the text of the neutral button. -1 for no neutral button. * @param negBtn Resource id for the text of the negative button. -1 for no negative button. * @return Dialog ready to show. */ public static ConfirmationDialogFragment newInstance(int messageResId, String[] messageArguments, int titleResId, int posBtn, int neuBtn, int negBtn) { if (messageResId == -1) { throw new IllegalStateException("Calling confirmation dialog without message resource"); } ConfirmationDialogFragment frag = new ConfirmationDialogFragment(); Bundle args = new Bundle(); args.putInt(ARG_MESSAGE_RESOURCE_ID, messageResId); args.putStringArray(ARG_MESSAGE_ARGUMENTS, messageArguments); args.putInt(ARG_TITLE_ID, titleResId); args.putInt(ARG_POSITIVE_BTN_RES, posBtn); args.putInt(ARG_NEUTRAL_BTN_RES, neuBtn); args.putInt(ARG_NEGATIVE_BTN_RES, negBtn); frag.setArguments(args); return frag; }
72. FileSourceBrowserFragment#newInstanceSmbFile()
View licensepublic static FileSourceBrowserFragment newInstanceSmbFile(String server, String user, String pass, String domain, boolean isMovie) { FileSourceBrowserFragment frag = new FileSourceBrowserFragment(); Bundle args = new Bundle(); args.putInt(TYPE, FileSource.SMB); args.putString(SERVER, server.replace("smb://", "")); args.putString(USER, user); args.putString(PASSWORD, pass); args.putString(DOMAIN, domain); args.putBoolean(MOVIE, isMovie); frag.setArguments(args); return frag; }
73. BasicWelcomeFragment#newInstance()
View licensepublic static BasicWelcomeFragment newInstance(@DrawableRes int drawableId, String title, String description, boolean showParallaxAnim, String headerTypefacePath, String descriptionTypefacePath) { Bundle args = new Bundle(); args.putInt(KEY_DRAWABLE_ID, drawableId); args.putString(KEY_TITLE, title); args.putString(KEY_DESCRIPTION, description); args.putBoolean(KEY_SHOW_ANIM, showParallaxAnim); args.putString(KEY_HEADER_TYPEFACE_PATH, headerTypefacePath); args.putString(KEY_DESCRIPTION_TYPEFACE_PATH, descriptionTypefacePath); BasicWelcomeFragment fragment = new BasicWelcomeFragment(); fragment.setArguments(args); return fragment; }
74. PullToRefreshBase#onSaveInstanceState()
View license@Override protected final Parcelable onSaveInstanceState() { Bundle bundle = new Bundle(); // Let derivative classes get a chance to save state first, that way we // can make sure they don't overrite any of our values onPtrSaveInstanceState(bundle); bundle.putInt(STATE_STATE, mState.getIntValue()); bundle.putInt(STATE_MODE, mMode.getIntValue()); bundle.putInt(STATE_CURRENT_MODE, mCurrentMode.getIntValue()); bundle.putBoolean(STATE_SCROLLING_REFRESHING_ENABLED, mScrollingWhileRefreshingEnabled); bundle.putBoolean(STATE_SHOW_REFRESHING_VIEW, mShowViewWhileRefreshing); bundle.putParcelable(STATE_SUPER, super.onSaveInstanceState()); return bundle; }
75. StretchParametersFragment#newInstance()
View licensepublic static StretchParametersFragment newInstance(int code, int stretchType, double stdDev, double minClip, double maxClip, double gamma) { StretchParametersFragment fragment = new StretchParametersFragment(); Bundle args = new Bundle(); args.putInt(KEY_INT, code); args.putInt(KEY_STRETCH_TYPE, stretchType); args.putDouble(KEY_STANDARD_DEVIATION, stdDev); args.putDouble(KEY_MIN_CLIP, minClip); args.putDouble(KEY_MAX_CLIP, maxClip); args.putDouble(KEY_GAMMA, gamma); fragment.setArguments(args); return fragment; }
76. AppIntroFragment#newInstance()
View licensepublic static AppIntroFragment newInstance(CharSequence title, CharSequence description, int imageDrawable, int bgColor, int titleColor, int descColor) { AppIntroFragment slide = new AppIntroFragment(); Bundle args = new Bundle(); args.putString(ARG_TITLE, title.toString()); args.putString(ARG_DESC, description.toString()); args.putInt(ARG_DRAWABLE, imageDrawable); args.putInt(ARG_BG_COLOR, bgColor); args.putInt(ARG_TITLE_COLOR, titleColor); args.putInt(ARG_DESC_COLOR, descColor); slide.setArguments(args); return slide; }
77. AppIntro2Fragment#newInstance()
View licensepublic static AppIntroFragment newInstance(CharSequence title, CharSequence description, int imageDrawable, int bgColor, int titleColor, int descColor) { AppIntroFragment slide = new AppIntroFragment(); Bundle args = new Bundle(); args.putString(ARG_TITLE, title.toString()); args.putString(ARG_DESC, description.toString()); args.putInt(ARG_DRAWABLE, imageDrawable); args.putInt(ARG_BG_COLOR, bgColor); args.putInt(ARG_TITLE_COLOR, titleColor); args.putInt(ARG_DESC_COLOR, descColor); slide.setArguments(args); return slide; }
78. BootstrapButton#onSaveInstanceState()
View license@Override public Parcelable onSaveInstanceState() { Bundle bundle = new Bundle(); bundle.putParcelable(TAG, super.onSaveInstanceState()); bundle.putBoolean(RoundableView.KEY, roundedCorners); bundle.putBoolean(OutlineableView.KEY, showOutline); bundle.putInt(KEY_INDEX, parentIndex); bundle.putFloat(BootstrapSizeView.KEY, bootstrapSize); bundle.putSerializable(KEY_MODE, buttonMode); if (bootstrapBadge != null) { bundle.putString(BadgeContainerView.KEY, bootstrapBadge.getBadgeText()); } return bundle; }
79. RemoveFileDialogFragment#newInstance()
View license/** * Public factory method to create new RemoveFileDialogFragment instances. * * @param file File to remove. * @return Dialog ready to show. */ public static RemoveFileDialogFragment newInstance(OCFile file) { RemoveFileDialogFragment frag = new RemoveFileDialogFragment(); Bundle args = new Bundle(); int messageStringId = R.string.confirmation_remove_alert; int localRemoveButton = (!file.isFavorite() && (file.isFolder() || file.isDown())) ? R.string.confirmation_remove_local : -1; if (file.isFolder()) { messageStringId = R.string.confirmation_remove_folder_alert; } args.putInt(ARG_MESSAGE_RESOURCE_ID, messageStringId); args.putStringArray(ARG_MESSAGE_ARGUMENTS, new String[] { file.getFileName() }); args.putInt(ARG_POSITIVE_BTN_RES, R.string.common_yes); args.putInt(ARG_NEUTRAL_BTN_RES, R.string.common_no); args.putInt(ARG_NEGATIVE_BTN_RES, localRemoveButton); args.putParcelable(ARG_TARGET_FILE, file); frag.setArguments(args); return frag; }
80. ConfirmationDialogFragment#newInstance()
View license/** * Public factory method to create new ConfirmationDialogFragment instances. * * @param messageResId Resource id for a message to show in the dialog. * @param messageArguments Arguments to complete the message, if it's a format string. May be null. * @param titleResId Resource id for a text to show in the title. * 0 for default alert title, -1 for no title. * @param posBtn Resource id for the text of the positive button. -1 for no positive button. * @param neuBtn Resource id for the text of the neutral button. -1 for no neutral button. * @param negBtn Resource id for the text of the negative button. -1 for no negative button. * @return Dialog ready to show. */ public static ConfirmationDialogFragment newInstance(int messageResId, String[] messageArguments, int titleResId, int posBtn, int neuBtn, int negBtn) { if (messageResId == -1) { throw new IllegalStateException("Calling confirmation dialog without message resource"); } ConfirmationDialogFragment frag = new ConfirmationDialogFragment(); Bundle args = new Bundle(); args.putInt(ARG_MESSAGE_RESOURCE_ID, messageResId); args.putStringArray(ARG_MESSAGE_ARGUMENTS, messageArguments); args.putInt(ARG_TITLE_ID, titleResId); args.putInt(ARG_POSITIVE_BTN_RES, posBtn); args.putInt(ARG_NEUTRAL_BTN_RES, neuBtn); args.putInt(ARG_NEGATIVE_BTN_RES, negBtn); frag.setArguments(args); return frag; }
81. BackupInfo#createInfo()
View license/** * Static method to create an INFO block based on the current environment. * * @param container The container being used (we want the version) * @param db Database * @param context Context (for package-related info) * * @return a new BackupInfo object */ public static BackupInfo createInfo(BackupContainer container, CatalogueDBAdapter db, Context context, int bookCount, int coverCount) { Bundle info = new Bundle(); info.putInt(INFO_ARCHVERSION, container.getVersion()); info.putInt(INFO_COMPATARCHIVER, 1); info.putString(INFO_CREATEDATE, Utils.toSqlDateTime(new Date())); info.putInt(INFO_NUMBOOKS, bookCount); info.putInt(INFO_NUMCOVERS, coverCount); try { // Get app info PackageManager manager = context.getPackageManager(); PackageInfo appInfo = manager.getPackageInfo(context.getPackageName(), 0); info.putString(INFO_APPPACKAGE, appInfo.packageName); info.putString(INFO_APPVERSIONNAME, appInfo.versionName); info.putInt(INFO_APPVERSIONCODE, appInfo.versionCode); } catch (Exception e1) { } info.putInt(INFO_SDK, Build.VERSION.SDK_INT); return new BackupInfo(info); }
82. MainActivityHelper#addSearchFragment()
View license/** * Adds a search fragment that can persist it's state on config change * @param fragmentManager fragmentManager * @param fragment current fragment * @param path current path * @param input query typed by user * @param openMode dunno * @param rootMode is root enabled * @param regex is regular expression search enabled * @param matches is matches enabled for patter matching */ public static void addSearchFragment(FragmentManager fragmentManager, Fragment fragment, String path, String input, int openMode, boolean rootMode, boolean regex, boolean matches) { Bundle args = new Bundle(); args.putString(SearchAsyncHelper.KEY_INPUT, input); args.putString(SearchAsyncHelper.KEY_PATH, path); args.putInt(SearchAsyncHelper.KEY_OPEN_MODE, openMode); args.putBoolean(SearchAsyncHelper.KEY_ROOT_MODE, rootMode); args.putBoolean(SearchAsyncHelper.KEY_REGEX, regex); args.putBoolean(SearchAsyncHelper.KEY_REGEX_MATCHES, matches); fragment.setArguments(args); fragmentManager.beginTransaction().add(fragment, MainActivity.TAG_ASYNC_HELPER).commit(); }
83. PullToRefreshBase#onSaveInstanceState()
View license@Override protected final Parcelable onSaveInstanceState() { Bundle bundle = new Bundle(); // Let derivative classes get a chance to save state first, that way we // can make sure they don't overrite any of our values onPtrSaveInstanceState(bundle); bundle.putInt(STATE_STATE, mState.getIntValue()); bundle.putInt(STATE_MODE, mMode.getIntValue()); bundle.putInt(STATE_CURRENT_MODE, mCurrentMode.getIntValue()); bundle.putBoolean(STATE_SCROLLING_REFRESHING_ENABLED, mScrollingWhileRefreshingEnabled); bundle.putBoolean(STATE_SHOW_REFRESHING_VIEW, mShowViewWhileRefreshing); bundle.putParcelable(STATE_SUPER, super.onSaveInstanceState()); return bundle; }
84. QQShareProxy#shareToQQ()
View licensepublic static void shareToQQ(Context context, String appId, String title, String summary, String url, String imageUrl, String appName, IUiListener listener) { Bundle params = new Bundle(); params.putInt(QQShare.SHARE_TO_QQ_KEY_TYPE, QQShare.SHARE_TO_QQ_TYPE_DEFAULT); params.putString(QQShare.SHARE_TO_QQ_TITLE, title); params.putString(QQShare.SHARE_TO_QQ_SUMMARY, summary); params.putString(QQShare.SHARE_TO_QQ_TARGET_URL, url); params.putString(QQShare.SHARE_TO_QQ_IMAGE_URL, imageUrl); params.putString(QQShare.SHARE_TO_QQ_APP_NAME, appName); Tencent tencent = getInstance(context, appId); tencent.shareToQQ((Activity) context, params, listener); }
85. PullToRefreshBase#onSaveInstanceState()
View license@Override protected final Parcelable onSaveInstanceState() { Bundle bundle = new Bundle(); // Let derivative classes get a chance to save state first, that way we // can make sure they don't overrite any of our values onPtrSaveInstanceState(bundle); bundle.putInt(STATE_STATE, mState.getIntValue()); bundle.putInt(STATE_MODE, mMode.getIntValue()); bundle.putInt(STATE_CURRENT_MODE, mCurrentMode.getIntValue()); bundle.putBoolean(STATE_SCROLLING_REFRESHING_ENABLED, mScrollingWhileRefreshingEnabled); bundle.putBoolean(STATE_SHOW_REFRESHING_VIEW, mShowViewWhileRefreshing); bundle.putParcelable(STATE_SUPER, super.onSaveInstanceState()); return bundle; }
86. BrowserAccessibilityManager#setAccessibilityEventKitKatAttributes()
View license@CalledByNative protected void setAccessibilityEventKitKatAttributes(AccessibilityEvent event, boolean canOpenPopup, boolean contentInvalid, boolean dismissable, boolean multiLine, int inputType, int liveRegion) { // Backwards compatibility for KitKat AccessibilityNodeInfo fields. Bundle bundle = getOrCreateBundleForAccessibilityEvent(event); bundle.putBoolean("AccessibilityNodeInfo.canOpenPopup", canOpenPopup); bundle.putBoolean("AccessibilityNodeInfo.contentInvalid", contentInvalid); bundle.putBoolean("AccessibilityNodeInfo.dismissable", dismissable); bundle.putBoolean("AccessibilityNodeInfo.multiLine", multiLine); bundle.putInt("AccessibilityNodeInfo.inputType", inputType); bundle.putInt("AccessibilityNodeInfo.liveRegion", liveRegion); }
87. MessageDialogFragment#newInstance()
View license/** * Constructor * * @param dialogId ID passed by caller. Can be 0, will be passed back in event * @param titleId Title to display * * @return Created fragment */ public static MessageDialogFragment newInstance(int dialogId, int titleId, String message, int buttonPositiveTextId, int buttonNegativeTextId, int buttonNeutralTextId) { MessageDialogFragment frag = new MessageDialogFragment(); Bundle args = new Bundle(); args.putInt("dialogId", dialogId); args.putInt("titleId", titleId); args.putString("message", message); args.putInt("buttonPositiveTextId", buttonPositiveTextId); args.putInt("buttonNegativeTextId", buttonNegativeTextId); args.putInt("buttonNeutralTextId", buttonNeutralTextId); frag.setArguments(args); return frag; }
88. DateFragment#newInstance()
View license/** * Return an instance of DateFragment with its bundle filled with the * constructor arguments. The values in the bundle are retrieved in * {@link #onCreateView()} below to properly initialize the DatePicker. * * @param theme * @param year * @param month * @param day * @param minDate * @param maxDate * @return an instance of DateFragment */ public static final DateFragment newInstance(int theme, int year, int month, int day, Date minDate, Date maxDate) { DateFragment f = new DateFragment(); Bundle b = new Bundle(); b.putInt("theme", theme); b.putInt("year", year); b.putInt("month", month); b.putInt("day", day); b.putSerializable("minDate", minDate); b.putSerializable("maxDate", maxDate); f.setArguments(b); return f; }
89. ImportKeysListFragment#newInstance()
View license/** * Visually consists of a list of keyrings with checkboxes to specify which are to be imported * Can immediately load keyrings specified by any of its parameters * * @param bytes byte data containing list of keyrings to be imported * @param dataUri file from which keyrings are to be imported * @param serverQuery query to search for on keyserver * @param nonInteractive if true, users will not be able to check/uncheck items in the list * @param keyserver if set, will perform search on specified keyserver. If null, falls back * to keyserver specified in user preferences * @return fragment with arguments set based on passed parameters */ public static ImportKeysListFragment newInstance(byte[] bytes, Uri dataUri, String serverQuery, boolean nonInteractive, String keyserver) { ImportKeysListFragment frag = new ImportKeysListFragment(); Bundle args = new Bundle(); args.putByteArray(ARG_BYTES, bytes); args.putParcelable(ARG_DATA_URI, dataUri); args.putString(ARG_SERVER_QUERY, serverQuery); args.putBoolean(ARG_NON_INTERACTIVE, nonInteractive); args.putString(ARG_KEYSERVER_URL, keyserver); frag.setArguments(args); return frag; }
90. PinCodeActivityDelegateTests#testIsValid_missingLanguage()
View licensepublic void testIsValid_missingLanguage() { final DigitsEventDetailsBuilder eventDetailsBuilder = new DigitsEventDetailsBuilder().withAuthStartTime(1L).withCountry("US"); final Bundle bundle = new Bundle(); bundle.putParcelable(DigitsClient.EXTRA_RESULT_RECEIVER, new ResultReceiver(null)); bundle.putParcelable(DigitsClient.EXTRA_EVENT_DETAILS_BUILDER, eventDetailsBuilder); bundle.putString(DigitsClient.EXTRA_PHONE, ""); bundle.putString(DigitsClient.EXTRA_REQUEST_ID, ""); bundle.putString(DigitsClient.EXTRA_USER_ID, ""); assertFalse(delegate.isValid(bundle)); }
91. CustomWebViewDialog#create()
View license/** * create a CustomWebViewDialog with a neutral button * @param dialogTitle * @param htmlFileName * @param accentColor * @param neutralText neutral button text * @param neutralListener click listener * @return */ public static CustomWebViewDialog create(String dialogTitle, String htmlFileName, int accentColor, String positiveText, DialogInterface.OnClickListener positiveListener, String neutralText, DialogInterface.OnClickListener neutralListener) { CustomWebViewDialog dialog = new CustomWebViewDialog(); Bundle args = new Bundle(); args.putString("dialogTitle", dialogTitle); args.putString("htmlFileName", htmlFileName); args.putInt("accentColor", accentColor); args.putString("positiveText", positiveText); dialog.setPositiveClickCallback(positiveListener); args.putString("neutralText", neutralText); dialog.setNeutralClickCallback(neutralListener); dialog.setArguments(args); return dialog; }
92. QQZoneShareHandler#shareImageText()
View licenseprivate void shareImageText(BaseShareParam params, ShareImage image) throws ShareException { if (TextUtils.isEmpty(params.getTitle()) || TextUtils.isEmpty(params.getTargetUrl())) { throw new InvalidParamException("Title or target url is empty or illegal"); } Bundle bundle = new Bundle(); bundle.putInt(QzoneShare.SHARE_TO_QZONE_KEY_TYPE, QzoneShare.SHARE_TO_QZONE_TYPE_IMAGE_TEXT); bundle.putString(QzoneShare.SHARE_TO_QQ_TITLE, params.getTitle()); bundle.putString(QzoneShare.SHARE_TO_QQ_SUMMARY, params.getContent()); bundle.putString(QzoneShare.SHARE_TO_QQ_TARGET_URL, params.getTargetUrl()); ArrayList<String> imageUrls = new ArrayList<>(); if (image != null) { if (image.isNetImage()) { imageUrls.add(image.getNetImageUrl()); } else if (image.isLocalImage()) { imageUrls.add(image.getLocalPath()); } } bundle.putStringArrayList(QzoneShare.SHARE_TO_QQ_IMAGE_URL, imageUrls); doShareToQQ((Activity) getContext(), bundle); }
93. AppLinkTest#testSimpleIntentWithAppLink()
View licensepublic void testSimpleIntentWithAppLink() throws Exception { Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.example.com")); Bundle appLinkData = new Bundle(); appLinkData.putString("target_url", "http://www.example2.com"); appLinkData.putInt("version", 1); Bundle extras = new Bundle(); extras.putString("foo", "bar"); appLinkData.putBundle("extras", extras); i.putExtra("al_applink_data", appLinkData); assertEquals(Uri.parse("http://www.example2.com"), AppLinks.getTargetUrl(i)); assertNotNull(AppLinks.getAppLinkData(i)); assertNotNull(AppLinks.getAppLinkExtras(i)); assertEquals("bar", AppLinks.getAppLinkExtras(i).getString("foo")); }
94. CustomTabsSession#setToolbarItem()
View license/** * Updates the visuals for toolbar items. Will only succeed if a custom tab created using this * session is in the foreground in browser and the given id is valid. * @param id The id for the item to update. * @param icon The new icon of the toolbar item. * @param description Content description of the toolbar item. * @return Whether the update succeeded. */ @Deprecated public boolean setToolbarItem(int id, @NonNull Bitmap icon, @NonNull String description) { Bundle bundle = new Bundle(); bundle.putInt(CustomTabsIntent.KEY_ID, id); bundle.putParcelable(CustomTabsIntent.KEY_ICON, icon); bundle.putString(CustomTabsIntent.KEY_DESCRIPTION, description); Bundle metaBundle = new Bundle(); metaBundle.putBundle(CustomTabsIntent.EXTRA_ACTION_BUTTON_BUNDLE, bundle); try { return mService.updateVisuals(mCallback, metaBundle); } catch (RemoteException e) { return false; } }
95. LoginCodeActivityDelegateTests#testIsValid()
View licensepublic void testIsValid() { final Bundle bundle = new Bundle(); final DigitsEventDetailsBuilder eventDetailsBuilder = new DigitsEventDetailsBuilder().withAuthStartTime(1L).withLanguage("lang").withCountry("US"); bundle.putParcelable(DigitsClient.EXTRA_RESULT_RECEIVER, new ResultReceiver(null)); bundle.putString(DigitsClient.EXTRA_PHONE, ""); bundle.putString(DigitsClient.EXTRA_REQUEST_ID, ""); bundle.putString(DigitsClient.EXTRA_USER_ID, ""); bundle.putParcelable(DigitsClient.EXTRA_EVENT_DETAILS_BUILDER, eventDetailsBuilder); assertTrue(delegate.isValid(bundle)); }
96. LoginCodeActivityDelegateTests#testIsValid_missingAuthStartTime()
View licensepublic void testIsValid_missingAuthStartTime() { final Bundle bundle = new Bundle(); final DigitsEventDetailsBuilder eventDetailsBuilder = new DigitsEventDetailsBuilder().withLanguage("lang").withCountry("US"); bundle.putParcelable(DigitsClient.EXTRA_RESULT_RECEIVER, new ResultReceiver(null)); bundle.putString(DigitsClient.EXTRA_PHONE, ""); bundle.putString(DigitsClient.EXTRA_REQUEST_ID, ""); bundle.putString(DigitsClient.EXTRA_USER_ID, ""); bundle.putParcelable(DigitsClient.EXTRA_EVENT_DETAILS_BUILDER, eventDetailsBuilder); assertFalse(delegate.isValid(bundle)); }
97. LoginCodeActivityDelegateTests#testIsValid_missingLanguage()
View licensepublic void testIsValid_missingLanguage() { final Bundle bundle = new Bundle(); final DigitsEventDetailsBuilder eventDetailsBuilder = new DigitsEventDetailsBuilder().withAuthStartTime(1L).withCountry("US"); bundle.putParcelable(DigitsClient.EXTRA_RESULT_RECEIVER, new ResultReceiver(null)); bundle.putString(DigitsClient.EXTRA_PHONE, ""); bundle.putString(DigitsClient.EXTRA_REQUEST_ID, ""); bundle.putString(DigitsClient.EXTRA_USER_ID, ""); bundle.putParcelable(DigitsClient.EXTRA_EVENT_DETAILS_BUILDER, eventDetailsBuilder); assertFalse(delegate.isValid(bundle)); }
98. LoginCodeActivityDelegateTests#testIsValid_missingCountry()
View licensepublic void testIsValid_missingCountry() { final Bundle bundle = new Bundle(); final DigitsEventDetailsBuilder eventDetailsBuilder = new DigitsEventDetailsBuilder().withAuthStartTime(1L).withLanguage("lang"); bundle.putParcelable(DigitsClient.EXTRA_RESULT_RECEIVER, new ResultReceiver(null)); bundle.putString(DigitsClient.EXTRA_PHONE, ""); bundle.putString(DigitsClient.EXTRA_REQUEST_ID, ""); bundle.putString(DigitsClient.EXTRA_USER_ID, ""); bundle.putParcelable(DigitsClient.EXTRA_EVENT_DETAILS_BUILDER, eventDetailsBuilder); assertFalse(delegate.isValid(bundle)); }
99. SmartLoginConfig#pack()
View licensepublic Bundle pack() { Bundle bundle = new Bundle(); if (appLogo != 0) { bundle.putInt(APPLOGO, appLogo); } bundle.putBoolean(FACEBOOKFLAG, isFacebookEnabled); bundle.putBoolean(GOOGLEFLAG, isGoogleEnabled); bundle.putString(FACEBOOKID, facebookAppId); bundle.putStringArrayList(FACEBOOKPERMISSIONS, facebookPermissions); bundle.putBoolean(CUSTOMLOGINFLAG, isCustomLoginEnabled); if (loginType != null) { bundle.putSerializable(CUSTOMLOGINTYPE, loginType); } return bundle; }
100. QQShareProxy#shareToQZone()
View licensepublic static void shareToQZone(Context context, String appId, String title, String summary, String url, String imageUrl, IUiListener listener) { Bundle params = new Bundle(); params.putInt(QzoneShare.SHARE_TO_QZONE_KEY_TYPE, QzoneShare.SHARE_TO_QZONE_TYPE_IMAGE_TEXT); params.putString(QzoneShare.SHARE_TO_QQ_TITLE, title); params.putString(QzoneShare.SHARE_TO_QQ_SUMMARY, summary); params.putString(QzoneShare.SHARE_TO_QQ_TARGET_URL, url); ArrayList<String> imgs = new ArrayList<String>(); imgs.add(imageUrl); params.putStringArrayList(QzoneShare.SHARE_TO_QQ_IMAGE_URL, imgs); Tencent tencent = getInstance(context, appId); tencent.shareToQzone((Activity) context, params, listener); }