List of usage examples for android.os Bundle getSerializable
@Override
@Nullable
public Serializable getSerializable(@Nullable String key)
From source file:eu.e43.impeller.activity.MainActivity.java
@Override protected void onCreateEx(Bundle savedInstanceState) { PreferenceManager.setDefaultValues(this, R.xml.pref_general, false); PreferenceManager.setDefaultValues(this, R.xml.pref_data_sync, false); setContentView(R.layout.activity_main); m_toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(m_toolbar);/*from w ww .ja v a2 s . c o m*/ m_toolbar.inflateMenu(R.menu.main); m_drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); m_drawerFragment = (DrawerFragment) getSupportFragmentManager().findFragmentById(R.id.navigation_drawer); m_drawerToggle = new ActionBarDrawerToggle(this, m_drawerLayout, R.string.drawer_open, R.string.drawer_close); m_drawerLayout.setDrawerListener(m_drawerToggle); m_isTablet = "two_pane".equals(findViewById(R.id.main_activity).getTag()); Log.v(TAG, "isTwoPane? " + (m_isTablet ? "YES" : "NO")); if (savedInstanceState == null) { getSupportActionBar().hide(); getSupportFragmentManager().beginTransaction().add(R.id.feed_fragment, new SplashFragment()) .setTransition(FragmentTransaction.TRANSIT_NONE).commit(); } else { m_feedFragment = (FeedFragment) getSupportFragmentManager().getFragment(savedInstanceState, "feedFragment"); m_objectFragment = (ObjectContainerFragment) getSupportFragmentManager().getFragment(savedInstanceState, "objectFragment"); setDisplayMode((Mode) savedInstanceState.getSerializable("displayMode")); Log.i(TAG, "Restoring in display mode " + m_displayMode.toString()); } }
From source file:com.wizardsofm.deskclock.timer.TimerFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View view = inflater.inflate(com.wizardsofm.deskclock.R.layout.timer_fragment, container, false); mAdapter = new TimerPagerAdapter(getChildFragmentManager()); mViewPager = (ViewPager) view.findViewById(com.wizardsofm.deskclock.R.id.vertical_view_pager); mViewPager.setAdapter(mAdapter);//from w w w . j av a 2 s . com mViewPager.addOnPageChangeListener(mTimerPageChangeListener); mTimersView = view.findViewById(com.wizardsofm.deskclock.R.id.timer_view); mCreateTimerView = (TimerSetupView) view.findViewById(com.wizardsofm.deskclock.R.id.timer_setup); mCreateTimerView.setFabContainer(this); mPageIndicators = new ImageView[] { (ImageView) view.findViewById(com.wizardsofm.deskclock.R.id.page_indicator0), (ImageView) view.findViewById(com.wizardsofm.deskclock.R.id.page_indicator1), (ImageView) view.findViewById(com.wizardsofm.deskclock.R.id.page_indicator2), (ImageView) view.findViewById(com.wizardsofm.deskclock.R.id.page_indicator3) }; DataModel.getDataModel().addTimerListener(mAdapter); DataModel.getDataModel().addTimerListener(mTimerWatcher); // If timer setup state is present, retrieve it to be later honored. if (savedInstanceState != null) { mTimerSetupState = savedInstanceState.getSerializable(KEY_TIMER_SETUP_STATE); } return view; }
From source file:com.kncwallet.wallet.ui.SendCoinsFragment.java
private void initStateFromIntentExtras(@Nonnull final Bundle extras) { final String address = extras.getString(SendCoinsFragment.INTENT_EXTRA_ADDRESS); final String addressLabel = extras.getString(SendCoinsFragment.INTENT_EXTRA_ADDRESS_LABEL); final BigInteger amount = (BigInteger) extras.getSerializable(SendCoinsFragment.INTENT_EXTRA_AMOUNT); final String bluetoothMac = extras.getString(SendCoinsFragment.INTENT_EXTRA_BLUETOOTH_MAC); update(address, addressLabel, amount, bluetoothMac); }
From source file:com.hotstar.player.adplayer.player.PlayerFragment.java
/** * Called from main activity.//from w w w.j av a 2 s . c o m */ protected void onFragmentRestoreInstanceState(Bundle savedInstanceState) { AdVideoApplication.logger.i(LOG_TAG + "#onRestoreInstanceState", "Restoring activity state."); lastKnownTime = savedInstanceState.getLong(CURRENT_PLAYER_POSITION, -1); AdVideoApplication.logger.i(LOG_TAG + "#onRestoreInstanceState", "Restored saved current player time: " + lastKnownTime); savedPlayerState = (MediaPlayer.PlayerState) savedInstanceState.getSerializable(CURRENT_PLAYER_STATE); AdVideoApplication.logger.d(LOG_TAG + "#onRestoreInstanceState", "Retrieved saved player state: " + savedPlayerState); isRestored = true; }
From source file:ac.robinson.bettertogether.ConnectionSetupActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_connection_setup); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar);//from ww w .j a v a 2 s. c o m mBarcodeScannerView = (CompoundBarcodeView) findViewById(R.id.barcode_scanner); mCreateHotspotView = (LinearLayout) findViewById(R.id.create_hotspot_view); mPluginViewAdapter = new PluginAdapter(ConnectionSetupActivity.this, ConnectionSetupActivity.this); mPluginView = (RecyclerView) findViewById(R.id.plugin_view); mPluginView.setLayoutManager( new LinearLayoutManager(ConnectionSetupActivity.this, LinearLayoutManager.HORIZONTAL, false)); mPluginView.setHasFixedSize(true); mPluginView.setAdapter(mPluginViewAdapter); new GravitySnapHelper(Gravity.START, false, mPluginViewAdapter).attachToRecyclerView(mPluginView); mQRView = (ImageView) findViewById(R.id.qr_image); mFooterText = (TextView) findViewById(R.id.footer_text); mConnectionProgressView = (LinearLayout) findViewById(R.id.connecting_hotspot_progress_indicator); mConnectionProgressUpdate = (TextView) findViewById(R.id.connecting_hotspot_progress_update_text); mConnectionMode = ConnectionMode.SCANNING; if (savedInstanceState != null) { mConnectionMode = (ConnectionMode) savedInstanceState.getSerializable("mConnectionMode"); } String existingHotspot = getIntent().getStringExtra(RECONNECT_EXISTING_HOTSPOT); if (existingHotspot != null) { setHotspotUrl(existingHotspot); mConnectionMode = ConnectionMode.CONNECTION_INITIATED_CLIENT; // reconnect to existing hotspot if requested } initialiseCaptureManager(savedInstanceState); switch (mConnectionMode) { case CONNECTION_INITIATED_HOTSPOT: setupHotspotUI(); break; case CONNECTION_INITIATED_CLIENT: setupClientUI(); break; case SCANNING: break; // nothing to do default: break; } updatePluginList(); }
From source file:com.waz.zclient.newreg.fragments.SignUpPhotoFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_sign_up_photo, container, false); initContainer = ViewUtils.getView(view, R.id.fl__photo_container); progressContainer = ViewUtils.getView(view, R.id.ll__init_photo__loading_container); progressView = ViewUtils.getView(view, R.id.pv__init_photo__loading); progressContainer.setVisibility(View.VISIBLE); initImage = ViewUtils.getView(view, R.id.iv__init_photo); final ImageView vignetteOverlay = ViewUtils.getView(view, R.id.iv_background_vignette_overlay); vignetteOverlay.setImageBitmap(BitmapUtils.getVignetteBitmap(getResources())); chooseOwnButton = ViewUtils.getView(view, R.id.zb__choose_own_picture); chooseOwnButton.setIsFilled(true);/*from www .j a va 2 s . c om*/ chooseOwnButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { showChooseSourceDialog(); } }); keepButton = ViewUtils.getView(view, R.id.zb__keep_picture); keepButton.setIsFilled(false); keepButton.setEnabled(false); keepButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { handleSelectedBitmap(getContainer().getUnsplashImageAsset(), AddedPhotoEvent.PhotoSource.UNSPLASH); } }); if (savedInstanceState == null) { registrationType = (RegistrationType) getArguments().getSerializable(ARGUMENT_REGISTRATION_TYPE); } else { registrationType = (RegistrationType) savedInstanceState.getSerializable(ARGUMENT_REGISTRATION_TYPE); cameraRevealed = savedInstanceState.getBoolean(SAVED_INSTANCE_CAMERA_REVEALED); isImageLoaded = savedInstanceState.getBoolean(SAVED_INSTANCE_IMAGE_LOADED); if (savedInstanceState.getBoolean(SAVED_INSTANCE_DIALOG)) { showChooseSourceDialog(); } if (cameraRevealed) { initContainer.setVisibility(View.GONE); initImage.setVisibility(View.GONE); } } final int darkenColor = ColorUtils.injectAlpha( ResourceUtils.getResourceFloat(getResources(), R.dimen.background_solid_black_overlay_opacity), Color.BLACK); initImage.setColorFilter(darkenColor, PorterDuff.Mode.DARKEN); vignetteOverlay.setColorFilter(darkenColor, PorterDuff.Mode.DARKEN); if (!isImageLoaded) { initImage.setAlpha(0f); initImage.setVisibility(View.GONE); } final int displayWidth = ViewUtils.getOrientationDependentDisplayWidth(getActivity()); if (unsplashImageLoadHandle != null) { unsplashImageLoadHandle.cancel(); unsplashImageLoadHandle = null; } unsplashImageLoadHandle = getContainer().getUnsplashImageAsset().getSingleBitmap(displayWidth, this); return view; }
From source file:de.uni_koblenz_landau.apow.PatientDetailShowFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.patient_detail_show_fragment, container, false); // Create UI references. mDeleteDialog = (DeleteDialogFragment) getFragmentManager().findFragmentByTag(DELETE_DIALOG_ID); if (mDeleteDialog != null) { mDeleteDialog.setListener(this); }//from ww w . ja v a 2 s . c o m mIdentifierView = (TextView) view.findViewById(R.id.patient_detail_show_identifier); mNameView = (TextView) view.findViewById(R.id.patient_detail_show_name); mGenderView = (TextView) view.findViewById(R.id.patient_detail_show_gender); mBirthdateView = (TextView) view.findViewById(R.id.patient_detail_show_birthdate); mAddress1View = (TextView) view.findViewById(R.id.patient_detail_show_address_address1); mAddress2View = (TextView) view.findViewById(R.id.patient_detail_show_address_address2); mCityVillageView = (TextView) view.findViewById(R.id.patient_detail_show_address_cityvillage); mCountyDistrictView = (TextView) view.findViewById(R.id.patient_detail_show_address_district); mStateProvinceView = (TextView) view.findViewById(R.id.patient_detail_show_address_region); mCountryView = (TextView) view.findViewById(R.id.patient_detail_show_address_country); mLongitudeView = (TextView) view.findViewById(R.id.patient_detail_show_address_longitude); mLatitudeView = (TextView) view.findViewById(R.id.patient_detail_show_address_latitude); mDeathdateView = (TextView) view.findViewById(R.id.patient_detail_show_deathdate); mDeadLayout = (LinearLayout) view.findViewById(R.id.patient_detail_show_dead_group); // Restore UI from saved instance or load data. if (savedInstanceState != null) { mPatient = (Patient) savedInstanceState.getSerializable(ARG_PATIENT); patientToInput(); } else { loadPatient(); } return view; }
From source file:com.androidinspain.deskclock.timer.TimerFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View view = inflater.inflate(com.androidinspain.deskclock.R.layout.timer_fragment, container, false); mAdapter = new TimerPagerAdapter(getFragmentManager()); mViewPager = (ViewPager) view.findViewById(com.androidinspain.deskclock.R.id.vertical_view_pager); mViewPager.setAdapter(mAdapter);//w w w. j ava2 s. c o m mViewPager.addOnPageChangeListener(mTimerPageChangeListener); mTimersView = view.findViewById(com.androidinspain.deskclock.R.id.timer_view); mCreateTimerView = (TimerSetupView) view.findViewById(com.androidinspain.deskclock.R.id.timer_setup); mCreateTimerView.setFabContainer(this); mPageIndicators = new ImageView[] { (ImageView) view.findViewById(com.androidinspain.deskclock.R.id.page_indicator0), (ImageView) view.findViewById(com.androidinspain.deskclock.R.id.page_indicator1), (ImageView) view.findViewById(com.androidinspain.deskclock.R.id.page_indicator2), (ImageView) view.findViewById(com.androidinspain.deskclock.R.id.page_indicator3) }; DataModel.getDataModel().addTimerListener(mAdapter); DataModel.getDataModel().addTimerListener(mTimerWatcher); // If timer setup state is present, retrieve it to be later honored. if (savedInstanceState != null) { mTimerSetupState = savedInstanceState.getSerializable(KEY_TIMER_SETUP_STATE); } return view; }
From source file:com.ovrhere.android.careerstack.ui.MainActivity.java
@SuppressWarnings("unchecked") @Override/*from ww w. ja v a2s . c o m*/ protected void onCreate(Bundle savedInstanceState) { setThemeByIntent(); super.onCreate(savedInstanceState); getSupportFragmentManager().addOnBackStackChangedListener(this); if (PreferenceUtils.isFirstRun(this)) { PreferenceUtils.setToDefault(this); } prefs = PreferenceUtils.getPreferences(this); //checks and, if necessary, restarts activity for theme checkThemePref(); setContentView(R.layout.activity_main); tabletMessage = (TextView) findViewById(R.id.careerstack_main_text_job_description_message); if (savedInstanceState == null) { loadFragment(new MainFragment(), TAG_MAIN_FRAG, false); actionBarTitle = getString(R.string.app_name); } else { try { currSearchBarState = savedInstanceState.getBundle(KEY_CURRENT_SEARCH_BAR_STATE); if (savedInstanceState.getStringArrayList(KEY_FRAG_TAG_TACK) != null) { fragTagStack.addAll(savedInstanceState.getStringArrayList(KEY_FRAG_TAG_TACK)); } if (savedInstanceState.getString(KEY_ACTIONBAR_TITLE) != null) { actionBarTitle = savedInstanceState.getString(KEY_ACTIONBAR_TITLE); } reattachLastFragment(); if (savedInstanceState.getSerializable(KEY_FRAG_SAVED_STATES) != null) { try { fragSavedStates.putAll((Map<? extends String, ? extends Bundle>) savedInstanceState .getSerializable(KEY_FRAG_SAVED_STATES)); } catch (ClassCastException e) { } } } catch (Exception e) { if (DEBUG) { Log.e(CLASS_NAME, "Should not be having an error here: " + e); e.printStackTrace(); } } } getSupportActionBar().setTitle(actionBarTitle); }
From source file:dev.memento.MainActivity.java
@Override protected void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); if (Log.LOG)/* www. j a v a2 s .c om*/ Log.d(LOG_TAG, "-- onRestoreInstanceState"); mWebview.restoreState(savedInstanceState); mDateChosen = (SimpleDateTime) savedInstanceState.getSerializable("mDateChosen"); mDateDisplayed = (SimpleDateTime) savedInstanceState.getSerializable("mDateDisplayed"); mOriginalUrl = savedInstanceState.getString("mOriginalUrl"); mPageTitle = savedInstanceState.getString("mPageTitle"); mMementos = (MementoList) savedInstanceState.getSerializable("mMementos"); if (mMementos != null) { mCurrentMemento = mMementos.getCurrent(); mFirstMemento = mMementos.getFirst(); mLastMemento = mMementos.getLast(); } // Only enable buttons if viewing Mementos if (!mToday.equalsDate(mDateDisplayed)) { mNowButton.setEnabled(true); setEnableForNextPrevButtons(); } }