Java Code Examples for android.os.bundle#getBooleanArray()
The following examples show how to use
android.os.bundle#getBooleanArray() .
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: OutlineListView.java From mOrgAnd with GNU General Public License v2.0 | 6 votes |
public void loadState(Bundle savedInstanceState) { long[] state = savedInstanceState.getLongArray(OUTLINE_NODES); ArrayList<Integer> levels = savedInstanceState.getIntegerArrayList(OUTLINE_LEVELS); boolean[] expanded = savedInstanceState.getBooleanArray(OUTLINE_EXPANDED); if(state != null) { try { this.adapter.setState(state, levels, expanded); } catch (IllegalStateException ex) { this.adapter.init(); } } int checkedPos= savedInstanceState.getInt(OUTLINE_CHECKED_POS, 0); setItemChecked(checkedPos, true); int scrollPos = savedInstanceState.getInt(OUTLINE_SCROLL_POS, 0); setSelection(scrollPos); }
Example 2
Source File: OverlayPinchImageView.java From Augendiagnose with GNU General Public License v2.0 | 6 votes |
@Override protected final void onRestoreInstanceState(final Parcelable state) { Parcelable enhancedState = state; if (state instanceof Bundle) { Bundle bundle = (Bundle) state; this.mOverlayX = bundle.getFloat("mOverlayX"); this.mOverlayY = bundle.getFloat("mOverlayY"); this.mOverlayScaleFactor = bundle.getFloat("mOverlayScaleFactor"); mLastOverlayScaleFactor = mOverlayScaleFactor; this.mPupilOverlayX = bundle.getFloat("mPupilOverlayX"); this.mPupilOverlayY = bundle.getFloat("mPupilOverlayY"); this.mPupilOverlayScaleFactor = bundle.getFloat("mPupilOverlayScaleFactor"); mLastPupilOverlayScaleFactor = mPupilOverlayScaleFactor; this.mShowOverlay = bundle.getBooleanArray("mShowOverlay"); this.mLocked = bundle.getBoolean("mLocked"); this.mPinchMode = (PinchMode) bundle.getSerializable("mPinchMode"); this.mBrightness = bundle.getFloat("mBrightness"); this.mContrast = bundle.getFloat("mContrast"); this.mSaturation = bundle.getFloat("mSaturation"); this.mColorTemperature = bundle.getFloat("mColorTemperature"); this.mOverlayColor = bundle.getInt("mOverlayColor"); this.mMetadata = bundle.getParcelable("mMetadata"); enhancedState = bundle.getParcelable("instanceState"); } super.onRestoreInstanceState(enhancedState); }
Example 3
Source File: AutohideFragment.java From Dashchan with Apache License 2.0 | 6 votes |
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { Collection<String> chanNames = ChanManager.getInstance().getAvailableChanNames(); this.chanNames = new ArrayList<>(chanNames); String[] items = new String[this.chanNames.size()]; for (int i = 0; i < this.chanNames.size(); i++) { items[i] = ChanConfiguration.get(this.chanNames.get(i)).getTitle(); } boolean[] checkedItems = savedInstanceState != null ? savedInstanceState .getBooleanArray(EXTRA_CHECKED) : null; // size != length means some chans were added or deleted while configuration was changing (very rare case) if (checkedItems == null || this.chanNames.size() != checkedItems.length) { ArrayList<String> selected = getArguments().getStringArrayList(EXTRA_SELECTED); checkedItems = new boolean[items.length]; for (int i = 0; i < this.chanNames.size(); i++) { checkedItems[i] = selected.contains(this.chanNames.get(i)); } } this.checkedItems = checkedItems; return new AlertDialog.Builder(getActivity()).setMultiChoiceItems(items, checkedItems, this) .setNegativeButton(android.R.string.cancel, null) .setPositiveButton(android.R.string.ok, this).create(); }
Example 4
Source File: ForegroundManager.java From Dashchan with Apache License 2.0 | 6 votes |
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); PendingData pendingData = getPendingData(true); if (pendingData == null) { return; } ensureArrays(); boolean[] selected = savedInstanceState != null ? savedInstanceState.getBooleanArray(EXTRA_SELECTED) : null; if (selected == null) { selected = getArguments().getBooleanArray(EXTRA_SELECTED); } if (selected != null && selected.length == this.selected.length) { System.arraycopy(selected, 0, this.selected, 0, selected.length); } for (int i = 0; i < this.selected.length; i++) { updateSelection(i); } }
Example 5
Source File: VerticalStepperFormView.java From VerticalStepperForm with Apache License 2.0 | 6 votes |
@Override public void onRestoreInstanceState(Parcelable state) { if (state instanceof Bundle) { Bundle bundle = (Bundle) state; boolean formCompleted = bundle.getBoolean("formCompleted"); String[] errorMessages = bundle.getStringArray("errorMessages"); String[] buttonTexts = bundle.getStringArray("buttonTexts"); String[] subtitles = bundle.getStringArray("subtitles"); String[] titles = bundle.getStringArray("titles"); boolean[] completedSteps = bundle.getBooleanArray("completedSteps"); int positionToOpen = bundle.getInt("openStep"); state = bundle.getParcelable("superState"); restoreFromState( positionToOpen, completedSteps, titles, subtitles, buttonTexts, errorMessages, formCompleted); } super.onRestoreInstanceState(state); }
Example 6
Source File: ShadowActivity.java From RxPermission with Apache License 2.0 | 5 votes |
@Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (savedInstanceState == null) { handleIntent(getIntent()); } else { shouldShowRequestPermissionRationale = savedInstanceState.getBooleanArray(SAVE_RATIONALE); } }
Example 7
Source File: ContentsFragment.java From Dashchan with Apache License 2.0 | 5 votes |
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { checkedItems = savedInstanceState != null ? savedInstanceState.getBooleanArray(EXTRA_CHECKED_ITEMS) : null; if (checkedItems == null) { checkedItems = new boolean[] {true, true, true, false}; } String[] items = getResources().getStringArray(R.array.preference_clear_cache_choices); AlertDialog dialog = new AlertDialog.Builder(getActivity()) .setTitle(getString(R.string.preference_clear_cache)) .setMultiChoiceItems(items, checkedItems, this) .setNegativeButton(android.R.string.cancel, null).setPositiveButton(android.R.string.ok, this) .create(); dialog.setOnShowListener(this); return dialog; }
Example 8
Source File: RandomContentController.java From CodePolitan with Apache License 2.0 | 5 votes |
@Override public void loadState(Bundle bundle) { pageFlags = bundle.getBooleanArray("pageFlags"); if (pageFlags == null) { pageFlags = new boolean[26]; } count = bundle.getInt("count", 0); randomArticles = bundle.getParcelableArrayList("random_articles"); if (randomArticles != null) { presenter.showRandomArticles(randomArticles); } else { presenter.showError(new Throwable(ErrorEvent.LOAD_STATE_RANDOM_ARTICLES)); } category = bundle.getParcelable("random_category"); if (category != null) { presenter.showRandomCategory(category); } else { presenter.showError(new Throwable(ErrorEvent.LOAD_STATE_RANDOM_CATEGORY)); } tag = bundle.getParcelable("random_tag"); if (tag != null) { presenter.showRandomTag(tag); } else { presenter.showError(new Throwable(ErrorEvent.LOAD_STATE_RANDOM_TAG)); } }
Example 9
Source File: NewAlarmFormActivity.java From VerticalStepperForm with Apache License 2.0 | 5 votes |
@Override public void onRestoreInstanceState(Bundle savedInstanceState) { if(savedInstanceState.containsKey(STATE_TITLE)) { String title = savedInstanceState.getString(STATE_TITLE); nameStep.restoreStepData(title); } if(savedInstanceState.containsKey(STATE_DESCRIPTION)) { String description = savedInstanceState.getString(STATE_DESCRIPTION); descriptionStep.restoreStepData(description); } if(savedInstanceState.containsKey(STATE_TIME_HOUR) && savedInstanceState.containsKey(STATE_TIME_MINUTES)) { int hour = savedInstanceState.getInt(STATE_TIME_HOUR); int minutes = savedInstanceState.getInt(STATE_TIME_MINUTES); AlarmTimeStep.TimeHolder time = new AlarmTimeStep.TimeHolder(hour, minutes); timeStep.restoreStepData(time); } if(savedInstanceState.containsKey(STATE_WEEK_DAYS)) { boolean[] alarmDays = savedInstanceState.getBooleanArray(STATE_WEEK_DAYS); daysStep.restoreStepData(alarmDays); } // IMPORTANT: The call to super method must be here at the end super.onRestoreInstanceState(savedInstanceState); }
Example 10
Source File: LovelyChoiceDialog.java From LovelyDialog with Apache License 2.0 | 5 votes |
@Override void restoreState(Bundle savedState) { super.restoreState(savedState); if (isMultiChoiceList()) { boolean[] checkedStates = savedState.getBooleanArray(KEY_ITEM_CHECKED_STATES); if (checkedStates == null) { return; } for (int index = 0; index < checkedStates.length; index++) { choicesList.setItemChecked(index, checkedStates[index]); } } }
Example 11
Source File: ToggleTranslateQuizView.java From android-topeka with Apache License 2.0 | 5 votes |
@Override public void setUserInput(Bundle savedInput) { if (savedInput == null) { return; } mAnswers = savedInput.getBooleanArray(KEY_ANSWERS); if (mAnswers == null) { initAnswerSpace(); return; } ListAdapter adapter = mListView.getAdapter(); for (int i = 0; i < mAnswers.length; i++) { mListView.performItemClick(mListView.getChildAt(i), i, adapter.getItemId(i)); } }
Example 12
Source File: MultiSelectQuizView.java From android-topeka with Apache License 2.0 | 5 votes |
@Override public void setUserInput(Bundle savedInput) { if (savedInput == null) { return; } final boolean[] answers = savedInput.getBooleanArray(KEY_ANSWER); if (null == answers) { return; } for (int i = 0; i < answers.length; i++) { mListView.setItemChecked(i, answers[i]); } }
Example 13
Source File: SelectItemQuizView.java From android-topeka with Apache License 2.0 | 5 votes |
@Override public void setUserInput(Bundle savedInput) { if (savedInput == null) { return; } mAnswers = savedInput.getBooleanArray(KEY_ANSWERS); if (mAnswers == null) { return; } final ListAdapter adapter = mListView.getAdapter(); for (int i = 0; i < mAnswers.length; i++) { mListView.performItemClick(mListView.getChildAt(i), i, adapter.getItemId(i)); } }
Example 14
Source File: FlatGroupingList.java From OmegaRecyclerView with MIT License | 5 votes |
public void onRestoreInstanceState(Bundle savedInstanceState) { if (savedInstanceState == null || !savedInstanceState.containsKey(KEY_STATES)) { return; } mExpandStates = savedInstanceState.getBooleanArray(KEY_STATES); updateIndexes(); }
Example 15
Source File: TransitionCompat.java From AndroidStudyDemo with GNU General Public License v2.0 | 4 votes |
/** * @param activity * @param layoutResId * @param background */ public static void startTransition(final Activity activity, final int layoutResId) { if (isPlaying) { return; } Bundle bundle = activity.getIntent().getExtras(); if (bundle == null) { Log.w(TAG, "ActivityOptions's Bundle is null"); return; } isEnter = true; mListener = new TransitionCompat().new MyTransitionListener(); mBundle = bundle; mAnimationType = bundle.getInt(ActivityOptionsCompatICS.KEY_ANIM_TYPE, ActivityOptionsCompatICS.ANIM_NONE); mIsVerticalScreen = bundle.getBoolean(ActivityOptionsCompatICS.KEY_IS_VERTICAL_SCREEN); /** * 根据type的不同开始执行不同的动画效果 */ switch (mAnimationType) { case ActivityOptionsCompatICS.ANIM_SCALE_UP: mIsInTheScreen = bundle.getBoolean(ActivityOptionsCompatICS.KEY_IS_IN_THE_SCREEN); mWidth = bundle.getInt(ActivityOptionsCompatICS.KEY_ANIM_WIDTH); mHeight = bundle.getInt(ActivityOptionsCompatICS.KEY_ANIM_HEIGHT); mStartX = bundle.getInt(ActivityOptionsCompatICS.KEY_ANIM_START_X); mStartY = bundle.getInt(ActivityOptionsCompatICS.KEY_ANIM_START_Y); //开始执行动画,这里的tue表示是开始状态 scaleUpAnimation(activity, true); break; case ActivityOptionsCompatICS.ANIM_THUMBNAIL_SCALE_UP: mIsStartFullScreen = bundle.getBoolean(ActivityOptionsCompatICS.KEY_IS_START_FULL_SCREEN); mThumbnail = (Bitmap) bundle.getParcelable(ActivityOptionsCompatICS.KEY_ANIM_THUMBNAIL); mIsInTheScreen = bundle.getBoolean(ActivityOptionsCompatICS.KEY_IS_IN_THE_SCREEN); mWidth = bundle.getInt(ActivityOptionsCompatICS.KEY_ANIM_WIDTH); mHeight = bundle.getInt(ActivityOptionsCompatICS.KEY_ANIM_HEIGHT); mStartX = bundle.getInt(ActivityOptionsCompatICS.KEY_ANIM_START_X); mStartY = bundle.getInt(ActivityOptionsCompatICS.KEY_ANIM_START_Y); //开始执行动画,这里的tue表示是开始状态 thumbnailScaleUpAnimation(activity, true); break; case ActivityOptionsCompatICS.ANIM_SCENE_TRANSITION: mIsStartFullScreen = bundle.getBoolean(ActivityOptionsCompatICS.KEY_IS_START_FULL_SCREEN); mIsInTheScreenArr = bundle.getBooleanArray(ActivityOptionsCompatICS.kEY_IS_IN_THE_SCREEN_ARR); mSharedElementIds = bundle.getIntegerArrayList(ActivityOptionsCompatICS.kEY_SHARED_ELEMENT_ID_LIST); mSharedElementBounds = bundle.getParcelableArrayList(ActivityOptionsCompatICS.kEY_SHARED_ELEMENT_BOUNDS_LIST); mLayoutResId = layoutResId; //开始执行动画,这里的tue表示是开始状态 sceneTransitionAnimation(activity, layoutResId, true); break; case ActivityOptionsCompatICS.ANIM_NONE: break; default: break; } //执行场景进入的动画 if (mTransitionAnims != null) { mTransitionAnims.setAnimsInterpolator(mInterpolator); mTransitionAnims.setAnimsStartDelay(mStartDelay); mTransitionAnims.setAnimsDuration(mAnimTime); mTransitionAnims.addListener(mListener); mTransitionAnims.playScreenEnterAnims(); } mTransitionAnims = null; //起始完成后就用不到bundle了,为了避免干扰,这里置空 mBundle = null; }
Example 16
Source File: TransitionCompat.java From nono-android with GNU General Public License v3.0 | 4 votes |
/** * @param activity * @param layoutResId * @param background */ public static void startTransition(final Activity activity, final int layoutResId) { if (isPlaying) { return; } Bundle bundle = activity.getIntent().getExtras(); if (bundle == null) { Log.w(TAG, "ActivityOptions's Bundle is null"); return; } isEnter = true; mListener = new TransitionCompat().new MyTransitionListener(); mBundle = bundle; mAnimationType = bundle.getInt(ActivityOptionsCompatICS.KEY_ANIM_TYPE, ActivityOptionsCompatICS.ANIM_NONE); mIsVerticalScreen = bundle.getBoolean(ActivityOptionsCompatICS.KEY_IS_VERTICAL_SCREEN); /** * 根据type的不同开始执行不同的动画效果 */ switch (mAnimationType) { case ActivityOptionsCompatICS.ANIM_SCALE_UP: mIsInTheScreen = bundle.getBoolean(ActivityOptionsCompatICS.KEY_IS_IN_THE_SCREEN); mWidth = bundle.getInt(ActivityOptionsCompatICS.KEY_ANIM_WIDTH); mHeight = bundle.getInt(ActivityOptionsCompatICS.KEY_ANIM_HEIGHT); mStartX = bundle.getInt(ActivityOptionsCompatICS.KEY_ANIM_START_X); mStartY = bundle.getInt(ActivityOptionsCompatICS.KEY_ANIM_START_Y); //开始执行动画,这里的tue表示是开始状态 scaleUpAnimation(activity, true); break; case ActivityOptionsCompatICS.ANIM_THUMBNAIL_SCALE_UP: mIsStartFullScreen = bundle.getBoolean(ActivityOptionsCompatICS.KEY_IS_START_FULL_SCREEN); mThumbnail = (Bitmap) bundle.getParcelable(ActivityOptionsCompatICS.KEY_ANIM_THUMBNAIL); mIsInTheScreen = bundle.getBoolean(ActivityOptionsCompatICS.KEY_IS_IN_THE_SCREEN); mWidth = bundle.getInt(ActivityOptionsCompatICS.KEY_ANIM_WIDTH); mHeight = bundle.getInt(ActivityOptionsCompatICS.KEY_ANIM_HEIGHT); mStartX = bundle.getInt(ActivityOptionsCompatICS.KEY_ANIM_START_X); mStartY = bundle.getInt(ActivityOptionsCompatICS.KEY_ANIM_START_Y); //开始执行动画,这里的tue表示是开始状态 thumbnailScaleUpAnimation(activity, true); break; case ActivityOptionsCompatICS.ANIM_SCENE_TRANSITION: mIsStartFullScreen = bundle.getBoolean(ActivityOptionsCompatICS.KEY_IS_START_FULL_SCREEN); mIsInTheScreenArr = bundle.getBooleanArray(ActivityOptionsCompatICS.kEY_IS_IN_THE_SCREEN_ARR); mSharedElementIds = bundle.getIntegerArrayList(ActivityOptionsCompatICS.kEY_SHARED_ELEMENT_ID_LIST); mSharedElementBounds = bundle.getParcelableArrayList(ActivityOptionsCompatICS.kEY_SHARED_ELEMENT_BOUNDS_LIST); mLayoutResId = layoutResId; //开始执行动画,这里的tue表示是开始状态 sceneTransitionAnimation(activity, layoutResId, true); break; case ActivityOptionsCompatICS.ANIM_NONE: break; default: break; } //执行场景进入的动画 if (mTransitionAnims != null) { mTransitionAnims.setAnimsInterpolator(mInterpolator); mTransitionAnims.setAnimsStartDelay(mStartDelay); mTransitionAnims.setAnimsDuration(mAnimTime); mTransitionAnims.addListener(mListener); mTransitionAnims.playScreenEnterAnims(); } mTransitionAnims = null; //起始完成后就用不到bundle了,为了避免干扰,这里置空 mBundle = null; }
Example 17
Source File: TransitionCompat.java From ActivityOptionsICS with Eclipse Public License 1.0 | 4 votes |
/** * @param activity * @param layoutResId * @param background */ public static void startTransition(final Activity activity, final int layoutResId) { if (isPlaying) { return; } Bundle bundle = activity.getIntent().getExtras(); if (bundle == null) { Log.w(TAG, "ActivityOptions's Bundle is null"); return; } isEnter = true; mListener = new TransitionCompat().new MyTransitionListener(); mBundle = bundle; mAnimationType = bundle.getInt(ActivityOptionsCompatICS.KEY_ANIM_TYPE, ActivityOptionsCompatICS.ANIM_NONE); mIsVerticalScreen = bundle.getBoolean(ActivityOptionsCompatICS.KEY_IS_VERTICAL_SCREEN); /** * 根据type的不同开始执行不同的动画效果 */ switch (mAnimationType) { case ActivityOptionsCompatICS.ANIM_SCALE_UP: mIsInTheScreen = bundle.getBoolean(ActivityOptionsCompatICS.KEY_IS_IN_THE_SCREEN); mWidth = bundle.getInt(ActivityOptionsCompatICS.KEY_ANIM_WIDTH); mHeight = bundle.getInt(ActivityOptionsCompatICS.KEY_ANIM_HEIGHT); mStartX = bundle.getInt(ActivityOptionsCompatICS.KEY_ANIM_START_X); mStartY = bundle.getInt(ActivityOptionsCompatICS.KEY_ANIM_START_Y); //开始执行动画,这里的tue表示是开始状态 scaleUpAnimation(activity, true); break; case ActivityOptionsCompatICS.ANIM_THUMBNAIL_SCALE_UP: mIsStartFullScreen = bundle.getBoolean(ActivityOptionsCompatICS.KEY_IS_START_FULL_SCREEN); mThumbnail = (Bitmap) bundle.getParcelable(ActivityOptionsCompatICS.KEY_ANIM_THUMBNAIL); mIsInTheScreen = bundle.getBoolean(ActivityOptionsCompatICS.KEY_IS_IN_THE_SCREEN); mWidth = bundle.getInt(ActivityOptionsCompatICS.KEY_ANIM_WIDTH); mHeight = bundle.getInt(ActivityOptionsCompatICS.KEY_ANIM_HEIGHT); mStartX = bundle.getInt(ActivityOptionsCompatICS.KEY_ANIM_START_X); mStartY = bundle.getInt(ActivityOptionsCompatICS.KEY_ANIM_START_Y); //开始执行动画,这里的tue表示是开始状态 thumbnailScaleUpAnimation(activity, true); break; case ActivityOptionsCompatICS.ANIM_SCENE_TRANSITION: mIsStartFullScreen = bundle.getBoolean(ActivityOptionsCompatICS.KEY_IS_START_FULL_SCREEN); mIsInTheScreenArr = bundle.getBooleanArray(ActivityOptionsCompatICS.kEY_IS_IN_THE_SCREEN_ARR); mSharedElementIds = bundle.getIntegerArrayList(ActivityOptionsCompatICS.kEY_SHARED_ELEMENT_ID_LIST); mSharedElementBounds = bundle.getParcelableArrayList(ActivityOptionsCompatICS.kEY_SHARED_ELEMENT_BOUNDS_LIST); mLayoutResId = layoutResId; //开始执行动画,这里的tue表示是开始状态 sceneTransitionAnimation(activity, layoutResId, true); break; case ActivityOptionsCompatICS.ANIM_NONE: break; default: break; } //执行场景进入的动画 if (mTransitionAnims != null) { mTransitionAnims.setAnimsInterpolator(mInterpolator); mTransitionAnims.setAnimsStartDelay(mStartDelay); mTransitionAnims.setAnimsDuration(mAnimTime); mTransitionAnims.addListener(mListener); mTransitionAnims.playScreenEnterAnims(); } mTransitionAnims = null; //起始完成后就用不到bundle了,为了避免干扰,这里置空 mBundle = null; }
Example 18
Source File: InjectionHelper.java From android-state with Eclipse Public License 1.0 | 4 votes |
public boolean[] getBooleanArray(Bundle state, String key) { return state.getBooleanArray(key + mBaseKey); }
Example 19
Source File: ExpandableRecyclerViewAdapter.java From expandable-recycler-view with MIT License | 3 votes |
/** * Fetches the expandable state map from the saved instance state {@link Bundle} * and restores the expanded states of all of the list items. * <p> * Should be called from {@link Activity#onRestoreInstanceState(Bundle)} in * the {@link Activity} that hosts the RecyclerView that this * {@link ExpandableRecyclerViewAdapter} is attached to. * <p> * * @param savedInstanceState The {@code Bundle} from which the expanded * state map is loaded */ public void onRestoreInstanceState(Bundle savedInstanceState) { if (savedInstanceState == null || !savedInstanceState.containsKey(EXPAND_STATE_MAP)) { return; } expandableList.expandedGroupIndexes = savedInstanceState.getBooleanArray(EXPAND_STATE_MAP); notifyDataSetChanged(); }