Java Code Examples for android.os.bundle#putBoolean()

The following examples show how to use android.os.bundle#putBoolean() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProfilePictureView.java    From platform-friends-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * 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;
}
 
Example 2
Source File: RNPushNotification.java    From react-native-push-notification-CE with MIT License 6 votes vote down vote up
@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);
}
 
Example 3
Source File: PullToRefreshBase.java    From NetEasyNews with GNU General Public License v3.0 6 votes vote down vote up
@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;
}
 
Example 4
Source File: NumberProgressBar.java    From okhttp-OkGo with Apache License 2.0 6 votes vote down vote up
@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;
}
 
Example 5
Source File: ArticleCollectFragment.java    From tysq-android with GNU General Public License v3.0 5 votes vote down vote up
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;
}
 
Example 6
Source File: MainActivity.java    From hacker-news-android with Apache License 2.0 5 votes vote down vote up
@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    if (mDetailsContainer != null) {
        outState.putBoolean(DETAILS_CONTAINER_VISIBLE, mDetailsContainer.getVisibility() == View.VISIBLE);
    }
}
 
Example 7
Source File: FileExplorerFragment.java    From rcloneExplorer with MIT License 5 votes vote down vote up
@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);
    }
}
 
Example 8
Source File: CameraXFlashToggleView.java    From mollyim-android with GNU General Public License v3.0 5 votes vote down vote up
@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;
}
 
Example 9
Source File: HaloLocationFragment.java    From arcusandroid with Apache License 2.0 5 votes vote down vote up
@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;
}
 
Example 10
Source File: Authenticator.java    From react-native-account-manager with MIT License 5 votes vote down vote up
@Override
public Bundle hasFeatures(AccountAuthenticatorResponse response, Account account, String[] features)
{
    final Bundle result = new Bundle();
    result.putBoolean(AccountManager.KEY_BOOLEAN_RESULT, false);
    return result;
}
 
Example 11
Source File: MainActivity.java    From Android-Developer-Fundamentals-Version-2 with GNU General Public License v3.0 5 votes vote down vote up
@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());
        }
    }
 
Example 12
Source File: SpeakEasyProtocol.java    From android-test with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 13
Source File: TabBarFragment.java    From AndroidNavigation with MIT License 5 votes vote down vote up
@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);
    }
}
 
Example 14
Source File: AppHelpFragment.java    From Android-nRF-Toolbox with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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;
}
 
Example 15
Source File: InstallFromListActivity.java    From commcare-android with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example 16
Source File: TouchImageViewCustom.java    From Cirrus_depricated with GNU General Public License v2.0 5 votes vote down vote up
@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;
}
 
Example 17
Source File: MainActivity.java    From openwebnet-android with MIT License 4 votes vote down vote up
@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putString(STATE_TITLE, getSupportActionBar().getTitle().toString());
    outState.putBoolean(STATE_FAB_MENU, floatingActionButtonMain.isShown());
}
 
Example 18
Source File: FriendPickerFragment.java    From Abelana-Android with Apache License 2.0 4 votes vote down vote up
void saveSettingsToBundle(Bundle outState) {
    super.saveSettingsToBundle(outState);

    outState.putString(USER_ID_BUNDLE_KEY, userId);
    outState.putBoolean(MULTI_SELECT_BUNDLE_KEY, multiSelect);
}
 
Example 19
Source File: MainActivity.java    From SocketIO_Chat_APP with MIT License 4 votes vote down vote up
@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putBoolean("hasConnection", hasConnection);
}
 
Example 20
Source File: SlidingActivityHelper.java    From quickmark with MIT License 2 votes vote down vote up
/**
 * 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());
}