android.os.Bundle#putBoolean ( )源码实例Demo

下面列出了android.os.Bundle#putBoolean ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

/**
 * 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;
}
 
源代码2 项目: NetEasyNews   文件: PullToRefreshBase.java
@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;
}
 
源代码3 项目: okhttp-OkGo   文件: NumberProgressBar.java
@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;
}
 
@ReactMethod
public void getInitialNotification(Promise promise) {
    WritableMap params = Arguments.createMap();
    Activity activity = getCurrentActivity();
   
    if (activity != null) {
        Intent intent = activity.getIntent();
        Bundle bundle = getNotificationBundle(intent);
        if (bundle != null) {
            bundle.putBoolean("foreground", false);
            String bundleString = mJsDelivery.convertJSON(bundle);
            params.putString("dataJSON", bundleString);
        }
    }
    promise.resolve(params);
}
 
源代码5 项目: Cirrus_depricated   文件: TouchImageViewCustom.java
@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;
}
 
@Override
protected void onSaveInstanceState(Bundle savedInstanceState) {
    super.onSaveInstanceState(savedInstanceState);
    savedInstanceState.putBoolean(REQUESTED_FROM_INDIA_KEY, requestedFromIndia);
    savedInstanceState.putBoolean(REQUESTED_FROM_PROD_KEY, requestedFromProd);
    savedInstanceState.putString(ERROR_MESSAGE_KEY, errorMessage);
    savedInstanceState.putBoolean(AUTH_MODE_KEY, inMobileUserAuthMode);
}
 
源代码7 项目: Android-nRF-Toolbox   文件: AppHelpFragment.java
public static AppHelpFragment getInstance(final int aboutResId, final boolean appendVersion) {
	final AppHelpFragment fragment = new AppHelpFragment();

	final Bundle args = new Bundle();
	args.putInt(ARG_TEXT, aboutResId);
	args.putBoolean(ARG_VERSION, appendVersion);
	fragment.setArguments(args);

	return fragment;
}
 
源代码8 项目: AndroidNavigation   文件: TabBarFragment.java
@Override
public void onSaveInstanceState(@NonNull Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putStringArrayList(SAVED_FRAGMENT_TAGS, fragmentTags);
    outState.putInt(SAVED_SELECTED_INDEX, selectedIndex);
    outState.putBoolean(SAVED_BOTTOM_BAR_HIDDEN, tabBarHidden);
    if (tabBarProvider != null) {
        outState.putString(SAVED_TAB_BAR_PROVIDER_CLASS_NAME, tabBarProvider.getClass().getName());
        tabBarProvider.onSaveInstanceState(outState);
    }
}
 
源代码9 项目: android-test   文件: SpeakEasyProtocol.java
/**
 * Encodes a publish result into a bundle.
 *
 * @param published if the IBinder has been published.
 * @param error a message to tell the caller about how broken things are.
 * @return a bundle
 * @throws NullPointerException if not published and error is null.
 */
public static Bundle asBundle(String key, boolean published, String error) {
  Bundle b = new Bundle();
  b.putInt(TYPE_KEY, PUBLISH_RESULT_TYPE);
  checkNotNull(key);
  b.putString(KEY_KEY, key);

  if (!published) {
    checkNotNull(error);
    b.putString(ERROR_KEY, error);
  }
  b.putBoolean(PUBLISHED_KEY, published);
  return b;
}
 
@Override
    protected void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
//        check if the reply header text is visible
        if(mReplyHeadTextView.getVisibility() == View.VISIBLE){
//           put this in the saved instance bundle with key - reply_visible
            outState.putBoolean("reply_visible", true);
            outState.putString("reply_text", mReplyTextView.getText().toString());
        }
    }
 
源代码11 项目: mollyim-android   文件: CameraXFlashToggleView.java
@Override
protected Parcelable onSaveInstanceState() {
  Parcelable parentState = super.onSaveInstanceState();
  Bundle     bundle      = new Bundle();

  bundle.putParcelable(STATE_PARENT, parentState);
  bundle.putInt(STATE_FLASH_INDEX, flashIndex);
  bundle.putBoolean(STATE_SUPPORT_AUTO, supportsFlashModeAuto);
  return bundle;
}
 
源代码12 项目: rcloneExplorer   文件: FileExplorerFragment.java
@Override
public void onSaveInstanceState(@NonNull Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putString(SAVED_PATH, directoryObject.getCurrentPath());
    ArrayList<FileItem> content = new ArrayList<>(directoryObject.getDirectoryContent());
    outState.putParcelableArrayList(SAVED_CONTENT, content);
    outState.putBoolean(SAVED_SEARCH_MODE, isSearchMode);
    outState.putParcelable(SAVED_RENAME_ITEM, renameItem);
    outState.putBoolean(SAVED_START_AT_BOOT, startAtRoot);
    outState.putInt(SAVED_SYNC_DIRECTION, syncDirection);
    if (isSearchMode) {
        outState.putString(SAVED_SEARCH_STRING, searchString);
    }
    if (recyclerViewAdapter.isInSelectMode()) {
        outState.putParcelableArrayList(SAVED_SELECTED_ITEMS, new ArrayList<>(recyclerViewAdapter.getSelectedItems()));
    }
    if (isInMoveMode) {
        outState.putBoolean(SAVED_IS_IN_MOVE_MODE, true);
        outState.putParcelableArrayList(SAVED_SELECTED_ITEMS, new ArrayList<>(moveList));
    }
    if (downloadList != null && !downloadList.isEmpty()) {
        outState.putParcelableArrayList(SAVED_DOWNLOAD_LIST, new ArrayList<>(downloadList));
    }
    if (moveStartPath != null) {
        outState.putString(SAVED_MOVE_START_PATH, moveStartPath);
    }
    if (syncRemotePath != null) {
        outState.putString(SAVED_SYNC_REMOTE_PATH, syncRemotePath);
    }
}
 
源代码13 项目: tysq-android   文件: ArticleCollectFragment.java
public static ArticleCollectFragment newInstance(int userId,
                                                 boolean isNeedHeader,
                                                 boolean isNeedRefresh,
                                                 boolean isNeedSwipe) {
    Bundle args = new Bundle();
    args.putInt(USER_ID, userId);
    args.putBoolean(IS_NEED_HEADER, isNeedHeader);
    args.putBoolean(IS_NEED_REFRESH, isNeedRefresh);
    args.putBoolean(IS_NEED_SWIPE, isNeedSwipe);

    ArticleCollectFragment fragment = new ArticleCollectFragment();
    fragment.setArguments(args);
    return fragment;
}
 
源代码14 项目: hacker-news-android   文件: MainActivity.java
@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    if (mDetailsContainer != null) {
        outState.putBoolean(DETAILS_CONTAINER_VISIBLE, mDetailsContainer.getVisibility() == View.VISIBLE);
    }
}
 
源代码15 项目: arcusandroid   文件: HaloLocationFragment.java
@NonNull
public static HaloLocationFragment newInstance (String deviceAddress, boolean isEditMode) {
    HaloLocationFragment fragment = new HaloLocationFragment();

    Bundle bundle = new Bundle();
    bundle.putString(DEVICE_ADDRESS, deviceAddress);
    bundle.putBoolean(EDIT_MODE, isEditMode);
    fragment.setArguments(bundle);

    return fragment;
}
 
@Override
public Bundle hasFeatures(AccountAuthenticatorResponse response, Account account, String[] features)
{
    final Bundle result = new Bundle();
    result.putBoolean(AccountManager.KEY_BOOLEAN_RESULT, false);
    return result;
}
 
源代码17 项目: openwebnet-android   文件: MainActivity.java
@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putString(STATE_TITLE, getSupportActionBar().getTitle().toString());
    outState.putBoolean(STATE_FAB_MENU, floatingActionButtonMain.isShown());
}
 
源代码18 项目: SocketIO_Chat_APP   文件: MainActivity.java
@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putBoolean("hasConnection", hasConnection);
}
 
源代码19 项目: Abelana-Android   文件: FriendPickerFragment.java
void saveSettingsToBundle(Bundle outState) {
    super.saveSettingsToBundle(outState);

    outState.putString(USER_ID_BUNDLE_KEY, userId);
    outState.putBoolean(MULTI_SELECT_BUNDLE_KEY, multiSelect);
}
 
源代码20 项目: quickmark   文件: SlidingActivityHelper.java
/**
 * Called to retrieve per-instance state from an activity before being killed so that the state can be
 * restored in onCreate(Bundle) or onRestoreInstanceState(Bundle) (the Bundle populated by this method
 * will be passed to both). 
 *
 * @param outState Bundle in which to place your saved state.
 */
public void onSaveInstanceState(Bundle outState) {
	outState.putBoolean("SlidingActivityHelper.open", mSlidingMenu.isMenuShowing());
	outState.putBoolean("SlidingActivityHelper.secondary", mSlidingMenu.isSecondaryMenuShowing());
}