List of usage examples for android.os Bundle setClassLoader
@Override public void setClassLoader(ClassLoader loader)
From source file:com.example.newfragmentstatepageradapter.NewFragmentStatePagerAdapter.java
@Override public void restoreState(Parcelable state, ClassLoader loader) { if (state != null) { Bundle bundle = (Bundle) state; bundle.setClassLoader(loader); mItemIds = bundle.getLongArray("itemids"); if (mItemIds == null) { mItemIds = new long[] {}; }/*from ww w. jav a 2 s. com*/ Parcelable[] fss = bundle.getParcelableArray("states"); mSavedState.clear(); mFragments.clear(); if (fss != null) { for (int i = 0; i < fss.length; i++) { mSavedState.add((Fragment.SavedState) fss[i]); } } Iterable<String> keys = bundle.keySet(); for (String key : keys) { if (key.startsWith("f")) { int index = Integer.parseInt(key.substring(1)); Fragment f = mFragmentManager.getFragment(bundle, key); if (f != null) { while (mFragments.size() <= index) { mFragments.add(null); } f.setMenuVisibility(false); mFragments.set(index, f); } else { Log.w(TAG, "Bad fragment at key " + key); } } } } }
From source file:istat.android.freedev.pagers.adapters.abs.AbsPagerStateAdapter.java
@Override public void restoreState(Parcelable state, ClassLoader loader) { if (state != null) { Bundle bundle = (Bundle) state; bundle.setClassLoader(loader); Parcelable[] fss = bundle.getParcelableArray("states"); mSavedState.clear();/*from w w w . j a va 2 s . c o m*/ mFragments.clear(); if (fss != null) { for (int i = 0; i < fss.length; i++) { mSavedState.add((Fragment.SavedState) fss[i]); } } Iterable<String> keys = bundle.keySet(); for (String key : keys) { if (key.startsWith("f")) { int index = Integer.parseInt(key.substring(1)); Fragment f = mFragmentManager.getFragment(bundle, key); if (f != null) { while (mFragments.size() <= index) { mFragments.add(null); } f.setMenuVisibility(false); mFragments.set(index, f); } else { //Log.w(TAG, "Bad fragment at key " + key); } } } } }
From source file:com.commonsware.cwac.pager.ArrayPagerAdapter.java
@Override public void restoreState(Parcelable state, ClassLoader loader) { if (state != null) { Bundle b = (Bundle) state; b.setClassLoader(getClass().getClassLoader()); entries = ((Bundle) state).getParcelableArrayList(KEY_DESCRIPTORS); notifyDataSetChanged();/*from w w w. ja v a 2 s. co m*/ } }
From source file:com.kevinread.sortablefragmentpager.SortableFragmentStatePagerAdapter.java
@Override public void restoreState(Parcelable state, ClassLoader loader) { if (state != null) { Bundle bundle = (Bundle) state; bundle.setClassLoader(loader); mItemIds = bundle.getLongArray("itemids"); if (mItemIds == null) { mItemIds = new long[] {}; }/*from w w w .java 2 s . co m*/ Parcelable[] fss = bundle.getParcelableArray("states"); mSavedState.clear(); mFragments.clear(); if (fss != null) { for (int i = 0; i < fss.length; i++) { mSavedState.add((Fragment.SavedState) fss[i]); } } Iterable<String> keys = bundle.keySet(); for (String key : keys) { if (key.startsWith("f")) { int index = Integer.parseInt(key.substring(1)); Fragment f = mFragmentManager.getFragment(bundle, key); if (f != null) { while (mFragments.size() <= index) { mFragments.add(null); } f.setMenuVisibility(false); mFragments.set(index, f); } else { Log.w(TAG, "Bad fragment at key " + key); } } } checkForIdChanges(); } }
From source file:com.github.paradam.infinitepager.InfiniteFragmentStatePagerAdapter.java
@Override public void restoreState(Parcelable state, ClassLoader loader) { if (state != null) { Bundle bundle = (Bundle) state; bundle.setClassLoader(loader); Parcelable[] fss = bundle.getParcelableArray("states"); mSavedState.clear();/*from w w w. java 2 s . co m*/ mFragments.clear(); if (fss != null) { for (Parcelable ss : fss) { mSavedState.add((Fragment.SavedState) ss); } } int currentPrimaryItem = bundle.getInt("currentPrimaryItem"); Iterable<String> keys = bundle.keySet(); for (String key : keys) { if (key.startsWith("f")) { int index = Integer.parseInt(key.substring(1)); Fragment f = null; try { f = mFragmentManager.getFragment(bundle, key); } catch (Exception e) { e.printStackTrace(); } if (f != null) { while (mFragments.size() <= index) { mFragments.add(null); } FragmentCompat.setMenuVisibility(f, index == currentPrimaryItem); FragmentCompat.setUserVisibleHint(f, index == currentPrimaryItem); mFragments.set(index, f); } else { Log.w(TAG, "Bad fragment at key " + key); } } } } }
From source file:com.dsi.ant.antplus.pluginsampler.geocache.Dialog_GeoDeviceDetails.java
/** * Launches the dialog to program the device. */// ww w. j a v a2s. c o m public void showProgramDevice() { //Show the programming dialog Dialog_GeoProgramDevice programDialog = new Dialog_GeoProgramDevice(geoPcc, deviceData, new ResultReceiver(null) { @Override protected void onReceiveResult(int resultCode, Bundle resultData) { if (resultCode == 0) //Succesful programming { //Update our current info resultData.setClassLoader(this.getClass().getClassLoader()); ProgrammableGeocacheDeviceData progdData = ((GeocacheDeviceData) resultData .getParcelable( GeocacheDeviceData.KEY_DEFAULT_GEOCACHEDEVICEDATAKEY)).programmableData; if (progdData.identificationString != null) deviceData.programmableData.identificationString = progdData.identificationString; if (progdData.PIN != null) deviceData.programmableData.PIN = progdData.PIN; if (progdData.latitude != null) deviceData.programmableData.latitude = progdData.latitude; if (progdData.longitude != null) deviceData.programmableData.longitude = progdData.longitude; if (progdData.hintString != null) deviceData.programmableData.hintString = progdData.hintString; if (progdData.lastVisitTimestamp != null) deviceData.programmableData.lastVisitTimestamp = progdData.lastVisitTimestamp; if (progdData.numberOfVisits != null) deviceData.programmableData.numberOfVisits = progdData.numberOfVisits; getActivity().runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(getActivity(), "Programming Successful", Toast.LENGTH_SHORT) .show(); refreshData(); } }); } else if (resultCode == -1) //Device communication failure, device was removed from list and data is now invalid, bail to scan list { getActivity().runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(getActivity(), "Device Communication Failure, dropped from list", Toast.LENGTH_SHORT).show(); dismiss(); } }); } } }); programDialog.show(getFragmentManager(), "ProgramDeviceDialog"); }
From source file:pl.poznan.put.cs.ify.app.MainActivity.java
@Override public void onActiveRecipesListReceiverd(Bundle data) { data.setClassLoader(getClassLoader()); ArrayList<ActiveRecipeInfo> activeRecipeInfos = data.getParcelableArrayList(YRecipesService.Recipe_INFOS); getActiveRecipesFrag().updateData(activeRecipeInfos); }
From source file:com.github.paradam.support.v4.infinitepager.InfiniteFragmentStatePagerAdapter.java
@Override public void restoreState(Parcelable state, ClassLoader loader) { if (state != null) { Bundle bundle = (Bundle) state; bundle.setClassLoader(loader); Parcelable[] fss = bundle.getParcelableArray("states"); mSavedState.clear();/*from ww w.j a va2 s.c o m*/ mFragments.clear(); if (fss != null) { for (Parcelable ss : fss) { mSavedState.add((Fragment.SavedState) ss); } } int currentPrimaryItem = bundle.getInt("currentPrimaryItem"); Iterable<String> keys = bundle.keySet(); for (String key : keys) { if (key.startsWith("f")) { int index = Integer.parseInt(key.substring(1)); Fragment f = null; try { f = mFragmentManager.getFragment(bundle, key); } catch (Exception e) { Log.e(TAG, e.getMessage(), e); } if (f != null) { while (mFragments.size() <= index) { mFragments.add(null); } f.setMenuVisibility(currentPrimaryItem == index); f.setUserVisibleHint(currentPrimaryItem == index); mFragments.set(index, f); } else { Log.w(TAG, "Bad fragment at key " + key); } } } } }
From source file:com.chen.mail.browse.ConversationPagerAdapter.java
@Override public void restoreState(Parcelable state, ClassLoader loader) { super.restoreState(state, loader); if (state != null) { Bundle b = (Bundle) state; b.setClassLoader(loader); final boolean detached = b.getBoolean(BUNDLE_DETACHED_MODE); setDetachedMode(detached);//from w w w.j a v a2 s . c o m } LogUtils.d(LOG_TAG, "OUT PagerAdapter.restoreState. this=%s", this); }
From source file:com.docd.purefm.ui.fragments.BrowserFragment.java
public void restoreManualState(final Bundle state) { if (state != null) { state.setClassLoader(BrowserFragment.class.getClassLoader()); final BrowserFragment.SavedState savedState = state.getParcelable(STATE_BROWSER); if (savedState != null) { if (savedState.mBrowserState != null) { if (mBrowser != null) { mBrowser.restoreState(savedState.mBrowserState); } else { mBrowserInitialState = savedState.mBrowserState; }//from w w w . j a va 2 s . com } mPrevId = savedState.mPrevId; } } }