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

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

源代码1 项目: Huochexing12306   文件: MultiChoiceFragment.java
private static void show(FragmentManager fm, int requestCode, String title, CharSequence csPositive, CharSequence csNagative, String[] items, boolean hasDefaultSelect, boolean[] selectedIndexes){
	MultiChoiceFragment dialog = new MultiChoiceFragment();
	Bundle args = new Bundle();
	args.putString(ARG_TITLE, title);
	args.putStringArray(ARG_ITEMS, items);
	if (!hasDefaultSelect){
		boolean[] bs = new boolean[args.getStringArray(ARG_ITEMS).length];
		for(int i=0; i<bs.length; i++){
			bs[i] = false;
		}
		args.putBooleanArray(ARG_SELECTED_INDEXES, bs);
	}else{
		args.putBooleanArray(ARG_SELECTED_INDEXES, selectedIndexes);
	}
	args.putInt(ARG_REQUEST_CODE, requestCode);
	args.putCharSequence(ARG_POSITIVE_TEXT, csPositive);
	args.putCharSequence(ARG_NAGATIVE_TEXT, csNagative);
	dialog.setArguments(args);
	dialog.setCancelable(false);
	dialog.show(fm, TAG);
}
 
源代码2 项目: Augendiagnose   文件: OverlayPinchImageView.java
@NonNull
@Override
protected final Parcelable onSaveInstanceState() {
	Bundle bundle = new Bundle();
	bundle.putParcelable("instanceState", super.onSaveInstanceState());
	bundle.putFloat("mOverlayX", this.mOverlayX);
	bundle.putFloat("mOverlayY", this.mOverlayY);
	bundle.putFloat("mOverlayScaleFactor", this.mOverlayScaleFactor);
	bundle.putFloat("mPupilOverlayX", this.mPupilOverlayX);
	bundle.putFloat("mPupilOverlayY", this.mPupilOverlayY);
	bundle.putFloat("mPupilOverlayScaleFactor", this.mPupilOverlayScaleFactor);
	bundle.putBooleanArray("mShowOverlay", this.mShowOverlay);
	bundle.putBoolean("mLocked", this.mLocked);
	bundle.putSerializable("mPinchMode", mPinchMode);
	bundle.putFloat("mBrightness", this.mBrightness);
	bundle.putFloat("mContrast", this.mContrast);
	bundle.putFloat("mSaturation", this.mSaturation);
	bundle.putFloat("mColorTemperature", this.mColorTemperature);
	bundle.putInt("mOverlayColor", mOverlayColor);
	bundle.putParcelable("mMetadata", mMetadata);
	return bundle;
}
 
@Override
public Parcelable onSaveInstanceState() {
    Bundle bundle = new Bundle();
    bundle.putParcelable(KEY_INSTANCE_STATE, super.onSaveInstanceState());
    bundle.putBooleanArray(KEY_BUTTON_STATES, getStates());
    return bundle;
}
 
源代码4 项目: iBeebo   文件: ManageGroupDialog.java
@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putParcelable("group", group);
    outState.putString("uid", uid);
    outState.putStringArray("valueArray", valueArray);
    outState.putBooleanArray("selectedArray", selectedArray);
    outState.putStringArrayList("currentList", currentList);
    outState.putStringArrayList("addList", addList);
    outState.putStringArrayList("removeList", removeList);
}
 
源代码5 项目: iBeebo   文件: ManageGroupDialog.java
@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putParcelable("group", group);
    outState.putString("uid", uid);
    outState.putStringArray("valueArray", valueArray);
    outState.putBooleanArray("selectedArray", selectedArray);
    outState.putStringArrayList("currentList", currentList);
    outState.putStringArrayList("addList", addList);
    outState.putStringArrayList("removeList", removeList);
}
 
源代码6 项目: android-topeka   文件: MultiSelectQuizView.java
@Override
public Bundle getUserInput() {
    Bundle bundle = new Bundle();
    boolean[] bundleableAnswer = getBundleableAnswer();
    bundle.putBooleanArray(KEY_ANSWER, bundleableAnswer);
    return bundle;
}
 
源代码7 项目: mOrgAnd   文件: OutlineListView.java
public void saveState(Bundle outState) {
    outState.putLongArray(OUTLINE_NODES, adapter.getNodeState());
    outState.putIntegerArrayList(OUTLINE_LEVELS, adapter.getLevelState());
    outState.putBooleanArray(OUTLINE_EXPANDED, adapter.getExpandedState());
    outState.putInt(OUTLINE_CHECKED_POS, getCheckedItemPosition());
    outState.putInt(OUTLINE_SCROLL_POS, getFirstVisiblePosition());
}
 
@Override
public void onSaveInstanceState(Bundle savedInstanceState) {

    savedInstanceState.putString(STATE_TITLE, nameStep.getStepData());
    savedInstanceState.putString(STATE_DESCRIPTION, descriptionStep.getStepData());
    savedInstanceState.putInt(STATE_TIME_HOUR, timeStep.getStepData().hour);
    savedInstanceState.putInt(STATE_TIME_MINUTES, timeStep.getStepData().minutes);
    savedInstanceState.putBooleanArray(STATE_WEEK_DAYS, daysStep.getStepData());

    // IMPORTANT: The call to super method must be here at the end
    super.onSaveInstanceState(savedInstanceState);
}
 
@Override
public Parcelable onSaveInstanceState() {
    Bundle bundle = new Bundle();

    boolean[] completedSteps = new boolean[stepHelpers.size()];
    String[] titles = new String[stepHelpers.size()];
    String[] subtitles = new String[stepHelpers.size()];
    String[] buttonTexts = new String[stepHelpers.size()];
    String[] errorMessages = new String[stepHelpers.size()];
    for (int i = 0; i < completedSteps.length; i++) {
        StepHelper stepHelper = stepHelpers.get(i);
        completedSteps[i] = stepHelper.getStepInstance().isCompleted();
        titles[i] = stepHelper.getStepInstance().getTitle();
        subtitles[i] = stepHelper.getStepInstance().getSubtitle();
        buttonTexts[i] = stepHelper.getStepInstance().getNextButtonText();
        if (!stepHelper.getStepInstance().isCompleted()) {
            errorMessages[i] = stepHelper.getStepInstance().getErrorMessage();
        }
    }

    bundle.putParcelable("superState", super.onSaveInstanceState());
    bundle.putInt("openStep", this.getOpenStepPosition());
    bundle.putBooleanArray("completedSteps", completedSteps);
    bundle.putStringArray("titles", titles);
    bundle.putStringArray("subtitles", subtitles);
    bundle.putStringArray("buttonTexts", buttonTexts);
    bundle.putStringArray("errorMessages", errorMessages);
    bundle.putBoolean("formCompleted", formCompleted);

    return bundle;
}
 
源代码10 项目: Dashchan   文件: ForegroundManager.java
@Override
public void onSaveInstanceState(Bundle outState) {
	super.onSaveInstanceState(outState);
	outState.putBooleanArray(EXTRA_SELECTED, selected);
}
 
源代码11 项目: android-state   文件: InjectionHelper.java
public void putBooleanArray(Bundle state, String key, boolean[] x) {
    state.putBooleanArray(key + mBaseKey, x);
}
 
源代码12 项目: IPCInvoker   文件: ParameterHelper.java
public static void put(Bundle bundle, String key, Object value) {
        if (value instanceof Integer) {
            bundle.putInt(key, (Integer) value);
        } else if (value instanceof Float) {
            bundle.putFloat(key, (Float) value);
        } else if (value instanceof Character) {
            bundle.putChar(key, (Character) value);
        } else if (value instanceof CharSequence) {
            bundle.putCharSequence(key, (CharSequence) value);
        } else if (value instanceof Long) {
            bundle.putLong(key, (Long) value);
        } else if (value instanceof Short) {
            bundle.putShort(key, (Short) value);
        } else if (value instanceof Byte) {
            bundle.putByte(key, (Byte) value);
        } else if (value instanceof Boolean) {
            bundle.putBoolean(key, (Boolean) value);
        } else if (value instanceof Double) {
            bundle.putDouble(key, (Double) value);
        } else if (value instanceof Parcelable) {
            bundle.putParcelable(key, (Parcelable) value);
        } else if (value instanceof Bundle) {
            bundle.putBundle(key, (Bundle) value);
        } else if (value instanceof int[]) {
            bundle.putIntArray(key, (int[]) value);
        } else if (value instanceof byte[]) {
            bundle.putByteArray(key, (byte[]) value);
        } else if (value instanceof float[]) {
            bundle.putFloatArray(key, (float[]) value);
        } else if (value instanceof double[]) {
            bundle.putDoubleArray(key, (double[]) value);
        } else if (value instanceof boolean[]) {
            bundle.putBooleanArray(key, (boolean[]) value);
        } else if (value instanceof long[]) {
            bundle.putLongArray(key, (long[]) value);
        } else if (value instanceof Parcelable[]) {
            bundle.putParcelableArray(key, (Parcelable[]) value);
        } else if (value instanceof short[]) {
            bundle.putShortArray(key, (short[]) value);
        } else if (value instanceof String[]) {
            bundle.putStringArray(key, (String[]) value);
        } else {
//            bundle.putString(key, String.valueOf(value));
        }
    }
 
源代码13 项目: AndroidCommons   文件: InstanceStateManager.java
@SuppressWarnings("unchecked")
private static void setBundleValue(@NonNull Field field, @NonNull Object obj,
        @NonNull Bundle bundle, @NonNull String key, boolean isGson)
        throws IllegalAccessException {

    if (isGson) {
        bundle.putString(key, GsonHelper.toJson(field.get(obj)));
        return;
    }

    Class<?> type = field.getType();
    Type[] genericTypes = null;
    if (field.getGenericType() instanceof ParameterizedType) {
        genericTypes = ((ParameterizedType) field.getGenericType()).getActualTypeArguments();
    }

    if (type.equals(Boolean.TYPE)) {
        bundle.putBoolean(key, field.getBoolean(obj));

    } else if (type.equals(boolean[].class)) {
        bundle.putBooleanArray(key, (boolean[]) field.get(obj));

    } else if (type.equals(Bundle.class)) {
        bundle.putBundle(key, (Bundle) field.get(obj));

    } else if (type.equals(Byte.TYPE)) {
        bundle.putByte(key, field.getByte(obj));

    } else if (type.equals(byte[].class)) {
        bundle.putByteArray(key, (byte[]) field.get(obj));

    } else if (type.equals(Character.TYPE)) {
        bundle.putChar(key, field.getChar(obj));

    } else if (type.equals(char[].class)) {
        bundle.putCharArray(key, (char[]) field.get(obj));

    } else if (type.equals(CharSequence.class)) {
        bundle.putCharSequence(key, (CharSequence) field.get(obj));

    } else if (type.equals(CharSequence[].class)) {
        bundle.putCharSequenceArray(key, (CharSequence[]) field.get(obj));

    } else if (type.equals(Double.TYPE)) {
        bundle.putDouble(key, field.getDouble(obj));

    } else if (type.equals(double[].class)) {
        bundle.putDoubleArray(key, (double[]) field.get(obj));

    } else if (type.equals(Float.TYPE)) {
        bundle.putFloat(key, field.getFloat(obj));

    } else if (type.equals(float[].class)) {
        bundle.putFloatArray(key, (float[]) field.get(obj));

    } else if (type.equals(Integer.TYPE)) {
        bundle.putInt(key, field.getInt(obj));

    } else if (type.equals(int[].class)) {
        bundle.putIntArray(key, (int[]) field.get(obj));

    } else if (type.equals(Long.TYPE)) {
        bundle.putLong(key, field.getLong(obj));

    } else if (type.equals(long[].class)) {
        bundle.putLongArray(key, (long[]) field.get(obj));

    } else if (type.equals(Short.TYPE)) {
        bundle.putShort(key, field.getShort(obj));

    } else if (type.equals(short[].class)) {
        bundle.putShortArray(key, (short[]) field.get(obj));

    } else if (type.equals(String.class)) {
        bundle.putString(key, (String) field.get(obj));

    } else if (type.equals(String[].class)) {
        bundle.putStringArray(key, (String[]) field.get(obj));

    } else if (Parcelable.class.isAssignableFrom(type)) {
        bundle.putParcelable(key, (Parcelable) field.get(obj));

    } else if (type.equals(ArrayList.class)
            && genericTypes != null
            && genericTypes[0] instanceof Class
            && Parcelable.class.isAssignableFrom((Class<?>) genericTypes[0])) {
        bundle.putParcelableArrayList(key, (ArrayList<? extends Parcelable>) field.get(obj));

    } else if (type.isArray() && Parcelable.class.isAssignableFrom(type.getComponentType())) {
        bundle.putParcelableArray(key, (Parcelable[]) field.get(obj));

    } else if (Serializable.class.isAssignableFrom(type)) {
        bundle.putSerializable(key, (Serializable) field.get(obj));

    } else {
        throw new RuntimeException("Unsupported field type: " + field.getName()
                + ", " + type.getName());
    }
}
 
源代码14 项目: RxPermission   文件: ShadowActivity.java
@Override protected void onSaveInstanceState(final Bundle outState) {
  outState.putBooleanArray(SAVE_RATIONALE, shouldShowRequestPermissionRationale);
  super.onSaveInstanceState(outState);
}
 
源代码15 项目: FreezeYou   文件: Query.java
@Override
public Bundle call(String method, String arg, Bundle extras) {
    Context context = getContext();
    Bundle bundle = new Bundle();
    if (method != null && extras != null) {
        String queryPkg = extras.getString("packageName");
        switch (method) {
            case QUERY_MODE:
                if (context != null && DevicePolicyManagerUtils.isDeviceOwner(getContext())) {
                    bundle.putString("currentMode", "dpm");
                } else if (FUFUtils.checkRootPermission()) {
                    bundle.putString("currentMode", "root");
                } else {
                    bundle.putString("currentMode", "unavailable");
                }
                return bundle;
            case QUERY_FREEZE_STATUS:
                if (context == null) {
                    bundle.putInt("status", -1);
                } else if (queryPkg == null) {
                    bundle.putInt("status", -2);
                } else {
                    if (ApplicationInfoUtils.getApplicationInfoFromPkgName(queryPkg, context) == null) {
                        bundle.putInt("status", 998);
                    } else {
                        boolean dpmFrozen = FUFUtils.checkMRootFrozen(context, queryPkg);
                        boolean rootFrozen = FUFUtils.checkRootFrozen(context, queryPkg, null);
                        if (dpmFrozen && rootFrozen) {
                            bundle.putInt("status", 3);
                        } else if (dpmFrozen) {
                            bundle.putInt("status", 2);
                        } else if (rootFrozen) {
                            bundle.putInt("status", 1);
                        } else {
                            bundle.putInt("status", 0);
                        }
                    }
                }
                return bundle;
            case QUERY_IF_CAN_INSTALL_APPLICATIONS_STATUS:
                if (context == null) {
                    bundle.putBooleanArray("status", new boolean[]{false, false, false, false}); // 可用状态、installActivityEnabled、hasRootPerm、hasDpmPerm
                } else {
                    boolean installActivityEnabled, hasRootPerm, hasDpmPerm;
                    switch (context.getPackageManager().getComponentEnabledSetting(
                            new ComponentName(context, "cf.playhi.freezeyou.InstallPackagesActivity"))) {
                        case android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_ENABLED:
                            installActivityEnabled = true;
                            break;
                        case android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DEFAULT:
                        case android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED:
                        case android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED:
                        case android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED_USER:
                        default:
                            installActivityEnabled = false;
                            break;
                    }
                    hasDpmPerm = DevicePolicyManagerUtils.isDeviceOwner(context);
                    hasRootPerm = FUFUtils.checkRootPermission();
                    bundle.putBooleanArray(
                            "status",
                            new boolean[]{
                                    installActivityEnabled && (hasDpmPerm || hasRootPerm),
                                    installActivityEnabled,
                                    hasRootPerm,
                                    hasDpmPerm
                            }
                    );
                }
                return bundle;
            default:
                break;
        }
    }
    return bundle;
}
 
源代码16 项目: nono-android   文件: ActivityOptionsCompatICS.java
/**
 * 将各种坐标和参数放入bundle中传递
 * 
    * Returns the created options as a Bundle, which can be passed to
    * {@link android.content.Context#startActivity(android.content.Intent, android.os.Bundle)
    * Context.startActivity(Intent, Bundle)} and related methods.
    * Note that the returned Bundle is still owned by the ActivityOptions
    * object; you must not modify it, but can supply it to the startActivity
    * methods that take an options Bundle.
    */
public Bundle toBundle() {
	if (mAnimationType == ANIM_DEFAULT) {
           return null;
       }
	Bundle bundle = new Bundle();
       bundle.putInt(KEY_ANIM_TYPE, mAnimationType);
       switch (mAnimationType) {
       
           case ANIM_CUSTOM:
           	bundle.putInt(KEY_ANIM_ENTER_RES_ID, mCustomEnterResId);
               bundle.putInt(KEY_ANIM_EXIT_RES_ID, mCustomExitResId);
               break;
               
           case ANIM_SCALE_UP:
       		bundle.putBoolean(KEY_IS_VERTICAL_SCREEN, mIsVerticalScreen);
       		bundle.putBoolean(KEY_IS_IN_THE_SCREEN, mIsInTheScreen);
       		
       		bundle.putInt(KEY_ANIM_WIDTH, mWidth);
       		bundle.putInt(KEY_ANIM_HEIGHT, mHeight);
       		bundle.putInt(KEY_ANIM_START_X, mStartX);
       		bundle.putInt(KEY_ANIM_START_Y, mStartY);
               break;
               
           case ANIM_THUMBNAIL_SCALE_UP:
           	bundle.putBoolean(KEY_IS_START_FULL_SCREEN, mIsStartFullScreen);
           	bundle.putBoolean(KEY_IS_VERTICAL_SCREEN, mIsVerticalScreen);
       		bundle.putBoolean(KEY_IS_IN_THE_SCREEN, mIsInTheScreen);
               bundle.putParcelable(KEY_ANIM_THUMBNAIL, mThumbnail);
               bundle.putInt(KEY_ANIM_START_X, mStartX);
               bundle.putInt(KEY_ANIM_START_Y, mStartY);
               bundle.putInt(KEY_ANIM_WIDTH, mWidth);
               bundle.putInt(KEY_ANIM_HEIGHT, mHeight);
               break;
               
           case ANIM_SCENE_TRANSITION:
       		bundle.putBoolean(KEY_IS_VERTICAL_SCREEN, mIsVerticalScreen);
       		bundle.putBoolean(KEY_IS_START_FULL_SCREEN, mIsStartFullScreen);
       		
       		bundle.putBooleanArray(kEY_IS_IN_THE_SCREEN_ARR, mIsInTheScreenArr);
       		bundle.putIntegerArrayList(kEY_SHARED_ELEMENT_ID_LIST, mSharedElementIds);
       		bundle.putParcelableArrayList(kEY_SHARED_ELEMENT_BOUNDS_LIST, mSharedElementBounds);
               break;
       }

	return bundle;
}
 
源代码17 项目: smartcard-reader   文件: GroupEditActivity.java
@Override
public void onSaveInstanceState(Bundle outState) {
    GroupItem groupItem = mGrpAdapter.getGroup(0);
    outState.putBooleanArray("member_array", groupItem.member);
}
 
源代码18 项目: AlarmOn   文件: ActivityAlarmSettings.java
@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);

    outState.putBoolean(SETTINGS_VIBRATE_KEY, settings.getVibrate());

    outState.putInt(SETTINGS_SNOOZE_KEY, settings.getSnoozeMinutes());

    if (originalInfo != null && info != null) {
        final AlarmTime infoTime = info.getTime();

        outState.putInt(SETTINGS_TIME_HOUR_OF_DAY_KEY,
                infoTime.calendar().get(Calendar.HOUR_OF_DAY));

        outState.putInt(SETTINGS_TIME_MINUTE_KEY,
                infoTime.calendar().get(Calendar.MINUTE));

        outState.putInt(SETTINGS_TIME_SECOND_KEY,
                infoTime.calendar().get(Calendar.SECOND));

        outState.putString(SETTINGS_NAME_KEY, info.getName());

        outState.putBooleanArray(SETTINGS_DAYS_OF_WEEK_KEY,
                info.getTime().getDaysOfWeek().bitmask());
    }

    outState.putParcelable(SETTINGS_TONE_URI_KEY, settings.getTone());

    outState.putString(SETTINGS_TONE_NAME_KEY, settings.getToneName());

    outState.putInt(SETTINGS_VOLUME_START_PERCENT_KEY,
            settings.getVolumeStartPercent());

    outState.putInt(SETTINGS_VOLUME_END_PERCENT_KEY,
            settings.getVolumeEndPercent());

    outState.putInt(SETTINGS_VOLUME_CHANGE_TIME_SEC_KEY,
            settings.getVolumeChangeTimeSec());
}
 
源代码19 项目: lyra   文件: BooleanArrayCoder.java
/**
 * Write a field's value into the saved state {@link Bundle}.
 *
 * @param state      {@link Bundle} used to save the state
 * @param key        key retrieved from {@code fieldDeclaringClass#fieldName}
 * @param fieldValue value of field
 */
@Override
public void serialize(@NonNull Bundle state, @NonNull String key, @NonNull boolean[] fieldValue) {
    state.putBooleanArray(key, fieldValue);
}
 
/**
 * Stores the expanded state map across state loss.
 * <p>
 * Should be called from whatever {@link Activity} that hosts the RecyclerView that {@link
 * ExpandableRecyclerViewAdapter} is attached to.
 * <p>
 * This will make sure to add the expanded state map as an extra to the
 * instance state bundle to be used in {@link #onRestoreInstanceState(Bundle)}.
 *
 * @param savedInstanceState The {@code Bundle} into which to store the
 * expanded state map
 */
public void onSaveInstanceState(Bundle savedInstanceState) {
  savedInstanceState.putBooleanArray(EXPAND_STATE_MAP, expandableList.expandedGroupIndexes);
}