Java Code Examples for android.os.bundle#getParcelable()
The following examples show how to use
android.os.bundle#getParcelable() .
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 aws-mobile-self-paced-labs-samples with Apache License 2.0 | 6 votes |
/** * If the passed in state is a Bundle, an attempt is made to restore from it. * @param state a Parcelable containing the current state */ @Override protected void onRestoreInstanceState(Parcelable state) { if (state.getClass() != Bundle.class) { super.onRestoreInstanceState(state); } else { Bundle instanceState = (Bundle)state; super.onRestoreInstanceState(instanceState.getParcelable(SUPER_STATE_KEY)); profileId = instanceState.getString(PROFILE_ID_KEY); presetSizeType = instanceState.getInt(PRESET_SIZE_KEY); isCropped = instanceState.getBoolean(IS_CROPPED_KEY); queryWidth = instanceState.getInt(BITMAP_WIDTH_KEY); queryHeight = instanceState.getInt(BITMAP_HEIGHT_KEY); setImageBitmap((Bitmap)instanceState.getParcelable(BITMAP_KEY)); if (instanceState.getBoolean(PENDING_REFRESH_KEY)) { refreshImage(true); } } }
Example 2
Source File: CircularSeekBar.java From OmniList with GNU Affero General Public License v3.0 | 6 votes |
@Override protected void onRestoreInstanceState(Parcelable state) { Bundle savedState = (Bundle) state; Parcelable superState = savedState.getParcelable("PARENT"); super.onRestoreInstanceState(superState); mMax = savedState.getInt("MAX"); mProgress = savedState.getInt("PROGRESS"); mCircleColor = savedState.getInt("mCircleColor"); mCircleProgressColor = savedState.getInt("mCircleProgressColor"); mPointerColor = savedState.getInt("mPointerColor"); mPointerHaloColor = savedState.getInt("mPointerHaloColor"); mPointerHaloColorOnTouch = savedState.getInt("mPointerHaloColorOnTouch"); mPointerAlpha = savedState.getInt("mPointerAlpha"); mPointerAlphaOnTouch = savedState.getInt("mPointerAlphaOnTouch"); lockEnabled = savedState.getBoolean("lockEnabled"); initPaints(); recalculateAll(); }
Example 3
Source File: PullToRefreshBase.java From bmob-android-demo-paging with GNU General Public License v3.0 | 6 votes |
@Override protected final void onRestoreInstanceState(Parcelable state) { if (state instanceof Bundle) { Bundle bundle = (Bundle) state; setMode(Mode.mapIntToValue(bundle.getInt(STATE_MODE, 0))); mCurrentMode = Mode.mapIntToValue(bundle.getInt(STATE_CURRENT_MODE, 0)); mScrollingWhileRefreshingEnabled = bundle.getBoolean(STATE_SCROLLING_REFRESHING_ENABLED, false); mShowViewWhileRefreshing = bundle.getBoolean(STATE_SHOW_REFRESHING_VIEW, true); // Let super Restore Itself super.onRestoreInstanceState(bundle.getParcelable(STATE_SUPER)); State viewState = State.mapIntToValue(bundle.getInt(STATE_STATE, 0)); if (viewState == State.REFRESHING || viewState == State.MANUAL_REFRESHING) { setState(viewState, true); } // Now let derivative classes restore their state onPtrRestoreInstanceState(bundle); return; } super.onRestoreInstanceState(state); }
Example 4
Source File: ConnectionFragment.java From octoandroid with GNU General Public License v3.0 | 6 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_connection, container, false); setUnbinder(ButterKnife.bind(this, view)); setActionBarTitle("Status"); mRefreshLayout.setOnRefreshListener(this); // ProgressBar doesn't show on top of CardView in Lollipop+ builds if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { mConnectProgressBar.setTranslationZ(mProgressZTranslation); } if (savedInstanceState != null && savedInstanceState.getParcelable(CONNECT_MODEL_KEY) != null) { mConnectModel = savedInstanceState.getParcelable(CONNECT_MODEL_KEY); updateUi(mConnectModel); } setEnableInputViews(false); return view; }
Example 5
Source File: AndroidAuthenticator.java From SimplifyReader with Apache License 2.0 | 6 votes |
@SuppressWarnings("deprecation") @Override public String getAuthToken() throws AuthFailureError { AccountManagerFuture<Bundle> future = mAccountManager.getAuthToken(mAccount, mAuthTokenType, mNotifyAuthFailure, null, null); Bundle result; try { result = future.getResult(); } catch (Exception e) { throw new AuthFailureError("Error while retrieving auth token", e); } String authToken = null; if (future.isDone() && !future.isCancelled()) { if (result.containsKey(AccountManager.KEY_INTENT)) { Intent intent = result.getParcelable(AccountManager.KEY_INTENT); throw new AuthFailureError(intent); } authToken = result.getString(AccountManager.KEY_AUTHTOKEN); } if (authToken == null) { throw new AuthFailureError("Got null auth token for type: " + mAuthTokenType); } return authToken; }
Example 6
Source File: ClickFragment.java From ud867 with MIT License | 6 votes |
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_click, container, false); if (null != savedInstanceState) { mClickCounter = savedInstanceState.getParcelable(CLICK_COUNT_TAG); } else { mClickCounter = new ClickCounter(); } mTextView = (TextView) rootView.findViewById(R.id.click_count_text_view); displayClickCount(); Button button = (Button) rootView.findViewById(R.id.click_button); button.setOnClickListener(mListener); return rootView; }
Example 7
Source File: PullToRefreshBase.java From Alibaba-Android-Certification with MIT License | 5 votes |
@Override protected final void onRestoreInstanceState(Parcelable state) { try { if (state instanceof Bundle) { Bundle bundle = (Bundle) state; setMode(Mode.mapIntToValue(bundle.getInt(STATE_MODE, 0))); mCurrentMode = Mode.mapIntToValue(bundle.getInt(STATE_CURRENT_MODE, 0)); mScrollingWhileRefreshingEnabled = bundle.getBoolean(STATE_SCROLLING_REFRESHING_ENABLED, false); mShowViewWhileRefreshing = bundle.getBoolean(STATE_SHOW_REFRESHING_VIEW, true); // Let super Restore Itself super.onRestoreInstanceState(bundle.getParcelable(STATE_SUPER)); State viewState = State.mapIntToValue(bundle.getInt(STATE_STATE, 0)); if (viewState == State.REFRESHING || viewState == State.MANUAL_REFRESHING) { setState(viewState, true); } // Now let derivative classes restore their state onPtrRestoreInstanceState(bundle); return; } super.onRestoreInstanceState(state); } catch (Exception e) { e.printStackTrace(); } }
Example 8
Source File: ItemSelectionSupport.java From UltimateAndroid with Apache License 2.0 | 5 votes |
public void onRestoreInstanceState(Bundle state) { mChoiceMode = ChoiceMode.values()[state.getInt(STATE_KEY_CHOICE_MODE)]; mCheckedStates = state.getParcelable(STATE_KEY_CHECKED_STATES); mCheckedIdStates = state.getParcelable(STATE_KEY_CHECKED_ID_STATES); mCheckedCount = state.getInt(STATE_KEY_CHECKED_COUNT); // TODO confirm ids here }
Example 9
Source File: UserTimelineFragment.java From xifan with Apache License 2.0 | 5 votes |
@Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle bundle = getArguments(); if (bundle != null) { mUser = bundle.getParcelable(ProfileActivity.BUNDLE_USER); } if (isVisible) { getUserTimeline(false); } isPrepared = true; }
Example 10
Source File: ColorPicker.java From px-android with MIT License | 5 votes |
@Override protected void onRestoreInstanceState(Parcelable state) { if (state instanceof Bundle) { Bundle bundle = (Bundle) state; colorHSV = bundle.getFloatArray("color"); super.onRestoreInstanceState(bundle.getParcelable("super")); } else { super.onRestoreInstanceState(state); } }
Example 11
Source File: FolloweeListPresenter.java From Protein with Apache License 2.0 | 5 votes |
@Override public void onRestoreInstanceState(@NonNull Bundle savedInstanceState) { user = savedInstanceState.getParcelable(STATE_USER); firstPageFollowees = savedInstanceState.getParcelableArrayList(STATE_FIRST_PAGE_DATA); if (firstPageFollowees == null) { firstPageFollowees = new ArrayList<>(); } setNextPageUrl(savedInstanceState.getString(STATE_NEXT_PAGE_URL)); }
Example 12
Source File: HeaderImageView.java From Nimingban with Apache License 2.0 | 5 votes |
@Override protected void onRestoreInstanceState(Parcelable state) { Bundle saved = (Bundle) state; Uri uri = saved.getParcelable(KEY_IMAGE_UNI_FILE_URI); if (uri != null) { UniFile file = UniFile.fromUri(getContext(), uri); if (file != null && file.exists()) { setImageFile(file); } } super.onRestoreInstanceState(saved.getParcelable(KEY_SUPER)); }
Example 13
Source File: ActivityResultFragment.java From InlineActivityResult with MIT License | 5 votes |
private void loadArguments() { Bundle arguments = getArguments(); if (arguments != null) { this.request = arguments.getParcelable(INTENT_TO_START); } }
Example 14
Source File: ItemSelectionSupport.java From MultiView with Apache License 2.0 | 5 votes |
public void onRestoreInstanceState(Bundle state) { mChoiceMode = ChoiceMode.values()[state.getInt(STATE_KEY_CHOICE_MODE)]; mCheckedStates = state.getParcelable(STATE_KEY_CHECKED_STATES); mCheckedIdStates = state.getParcelable(STATE_KEY_CHECKED_ID_STATES); mCheckedCount = state.getInt(STATE_KEY_CHECKED_COUNT); // TODO confirm ids here }
Example 15
Source File: CommonTabLayout.java From FlycoTabLayout with MIT License | 5 votes |
@Override protected void onRestoreInstanceState(Parcelable state) { if (state instanceof Bundle) { Bundle bundle = (Bundle) state; mCurrentTab = bundle.getInt("mCurrentTab"); state = bundle.getParcelable("instanceState"); if (mCurrentTab != 0 && mTabsContainer.getChildCount() > 0) { updateTabSelection(mCurrentTab); } } super.onRestoreInstanceState(state); }
Example 16
Source File: ConversationFragment.java From Conversations with GNU General Public License v3.0 | 5 votes |
private List<Uri> extractUris(final Bundle extras) { final List<Uri> uris = extras.getParcelableArrayList(Intent.EXTRA_STREAM); if (uris != null) { return uris; } final Uri uri = extras.getParcelable(Intent.EXTRA_STREAM); if (uri != null) { return Collections.singletonList(uri); } else { return null; } }
Example 17
Source File: SetupWizardFragment.java From island with Apache License 2.0 | 5 votes |
@Override public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { final SetupViewModel vm; if (savedInstanceState == null) { final Bundle args = getArguments(); vm = args != null ? args.getParcelable(null) : null; } else vm = savedInstanceState.getParcelable(EXTRA_VIEW_MODEL); if (vm == null) { mViewModel = new SetupViewModel(); // Initial view - "Welcome" mViewModel.button_next.set(R.string.setup_accept); // "Accept" button for device-admin privilege consent, required by Google Play developer policy. } else mViewModel = vm; mContainerViewId = container.getId(); final SetupWizardBinding binding = SetupWizardBinding.inflate(inflater, container, false); binding.setSetup(mViewModel); final View view = binding.getRoot(); final SetupWizardLayout layout = view.findViewById(R.id.setup_wizard_layout); layout.requireScrollToBottom(); final NavigationBar nav_bar = layout.getNavigationBar(); nav_bar.setNavigationBarListener(this); setButtonText(nav_bar.getBackButton(), mViewModel.button_back); setButtonText(nav_bar.getNextButton(), mViewModel.button_next.get()); // mViewModel.button_back.addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() { @Override public void onPropertyChanged(final Observable observable, final int i) { // setButtonText(button_back, mViewModel.button_back); // }}); mViewModel.button_next.addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() { @Override public void onPropertyChanged(final Observable observable, final int i) { setButtonText(nav_bar.getNextButton(), mViewModel.button_next.get()); }}); return view; }
Example 18
Source File: ValueBar.java From nono-android with GNU General Public License v3.0 | 5 votes |
@Override protected void onRestoreInstanceState(Parcelable state) { Bundle savedState = (Bundle) state; Parcelable superState = savedState.getParcelable(STATE_PARENT); super.onRestoreInstanceState(superState); setColor(Color.HSVToColor(savedState.getFloatArray(STATE_COLOR))); setValue(savedState.getFloat(STATE_VALUE)); }
Example 19
Source File: SyncActivityTooManyDeletes.java From android_9.0.0_r45 with Apache License 2.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle extras = getIntent().getExtras(); if (extras == null) { finish(); return; } mNumDeletes = extras.getLong("numDeletes"); mAccount = (Account) extras.getParcelable("account"); mAuthority = extras.getString("authority"); mProvider = extras.getString("provider"); // the order of these must match up with the constants for position used in onItemClick CharSequence[] options = new CharSequence[]{ getResources().getText(R.string.sync_really_delete), getResources().getText(R.string.sync_undo_deletes), getResources().getText(R.string.sync_do_nothing) }; ListAdapter adapter = new ArrayAdapter<CharSequence>(this, android.R.layout.simple_list_item_1, android.R.id.text1, options); ListView listView = new ListView(this); listView.setAdapter(adapter); listView.setItemsCanFocus(true); listView.setOnItemClickListener(this); TextView textView = new TextView(this); CharSequence tooManyDeletesDescFormat = getResources().getText(R.string.sync_too_many_deletes_desc); textView.setText(String.format(tooManyDeletesDescFormat.toString(), mNumDeletes, mProvider, mAccount.name)); final LinearLayout ll = new LinearLayout(this); ll.setOrientation(LinearLayout.VERTICAL); final LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT, 0); ll.addView(textView, lp); ll.addView(listView, lp); // TODO: consider displaying the icon of the account type // AuthenticatorDescription[] descs = AccountManager.get(this).getAuthenticatorTypes(); // for (AuthenticatorDescription desc : descs) { // if (desc.type.equals(mAccount.type)) { // try { // final Context authContext = createPackageContext(desc.packageName, 0); // ImageView imageView = new ImageView(this); // imageView.setImageDrawable(authContext.getDrawable(desc.iconId)); // ll.addView(imageView, lp); // } catch (PackageManager.NameNotFoundException e) { // } // break; // } // } setContentView(ll); }
Example 20
Source File: GroupActivity.java From Klyph with MIT License | 4 votes |
@Override protected boolean hasCachedData(Bundle savedInstanceState) { return savedInstanceState != null && savedInstanceState.getParcelable("group") != null; }