List of usage examples for android.os Bundle getParcelableArrayList
@Nullable public <T extends Parcelable> ArrayList<T> getParcelableArrayList(@Nullable String key)
From source file:com.ayuget.redface.ui.fragment.PrivateMessageListFragment.java
@Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); if (savedInstanceState != null) { displayedPrivateMessages = savedInstanceState.getParcelableArrayList(ARG_PRIVATE_MESSAGES_LIST); if (displayedPrivateMessages != null) { Log.d(LOG_TAG, String.format("Restored %d private messages", displayedPrivateMessages.size())); pmAdapter.replaceWith(displayedPrivateMessages); showPrivateMessages();//from w w w.ja v a2s.c om } } }
From source file:com.rubengees.introduction.IntroductionActivity.java
private void getFieldsFromBundle() { Bundle bundle = getIntent().getExtras(); if (bundle == null) { bundle = new Bundle(); }//from w ww . j a v a 2 s . c o m slides = bundle.getParcelableArrayList(BUNDLE_SLIDES); style = (Style) bundle.getSerializable(BUNDLE_STYLE); orientation = bundle.getInt(BUNDLE_ORIENTATION, ORIENTATION_BOTH); showPreviousButton = bundle.getBoolean(BUNDLE_SHOW_PREVIOUS_BUTTON, true); showIndicator = bundle.getBoolean(BUNDLE_SHOW_INDICATOR, true); skipText = bundle.getString(BUNDLE_SKIP_STRING); allowBackPress = bundle.getBoolean(BUNDLE_ALLOW_BACK_PRESS, false); if (slides == null) { slides = new ArrayList<>(); } if (skipText == null) { int skipResource = bundle.getInt(BUNDLE_SKIP_RESOURCE, 0); if (skipResource != 0) { skipText = this.getString(skipResource); } } }
From source file:org.openmrs.mobile.activities.formdisplay.FormDisplayActivity.java
private void attachPresenterToFragment(Fragment fragment) { if (fragment instanceof FormDisplayPageFragment) { Bundle bundle = getIntent().getExtras(); String valueRef = null;// w w w . jav a 2 s . com ArrayList<FormFieldsWrapper> formFieldsWrappers = null; if (bundle != null) { valueRef = (String) bundle.get(ApplicationConstants.BundleKeys.VALUEREFERENCE); formFieldsWrappers = bundle .getParcelableArrayList(ApplicationConstants.BundleKeys.FORM_FIELDS_LIST_BUNDLE); } Form form = FormService.getForm(valueRef); List<Page> pageList = form.getPages(); for (Page page : pageList) { if (formFieldsWrappers != null) { new FormDisplayPagePresenter((FormDisplayPageFragment) fragment, page, formFieldsWrappers.get(pageList.indexOf(page))); } else { new FormDisplayPagePresenter((FormDisplayPageFragment) fragment, pageList.get(getFragmentNumber(fragment))); } } } }
From source file:nz.ac.otago.psyanlab.common.designer.program.stage.StageActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Window window = getWindow();/*from w w w . j a v a 2s. c o m*/ window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); window.addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); window.clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); requestWindowFeature(Window.FEATURE_NO_TITLE); Bundle extras = getIntent().getExtras(); if (extras != null) { if (extras.containsKey(Args.EXPERIMENT_PROPS)) { mProps = extras.getParcelableArrayList(Args.EXPERIMENT_PROPS); } mOrientation = extras.getInt(Args.STAGE_ORIENTATION, getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE ? Scene.ORIENTATION_LANDSCAPE : Scene.ORIENTATION_PORTRAIT); mSpecifiedWidth = extras.getInt(Args.STAGE_WIDTH, -1); mSpecifiedHeight = extras.getInt(Args.STAGE_HEIGHT, -1); } else { mProps = new ArrayList<PropIdPair>(); } refreshStage(); mPropAdapter = new PropAdapter(this, mProps); View view = getLayoutInflater().inflate(R.layout.activity_stage, null); mStage = (StageView) view.findViewById(R.id.stage); mStage.setNativeWidth(mSpecifiedWidth); mStage.setNativeHeight(mSpecifiedHeight); mStage.setAdapter(mPropAdapter); mStage.setOnItemClickListener(mPropClickListener); mStage.setOnStageClickListener(2, mSelectClickListener); mStage.setOnStageClickListener(1, mAddClickListener); mStage.setOnStageClickListener(3, mAddClickListener); mStage.forceMultiTouchWhenEmpty(3); mStage.setOnStageClickListener(4, mPropertiesClickListener); mStage.exemptMultiTouchFromEmptyCondition(4); setContentView(view); }
From source file:com.example.android.popularmovies.ui.MoviesFragment.java
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); if (savedInstanceState != null) { mMovieSort = savedInstanceState.getString(MOVIE_SORT); if (savedInstanceState.containsKey(MOVIE_DATA)) { List<Movie> movies = savedInstanceState.getParcelableArrayList(MOVIE_DATA); mAdapter.add(movies);//from w w w . ja v a 2 s.com // For listening content updates for tow pane mode if (mMovieSort.equals(getString(R.string.pref_sort_favorites))) { getLoaderManager().initLoader(CURSOR_LOADER_ID, null, this); } } } else { // Fetch Movies only if savedInstanceState == null fetchMovies(mMovieSort); } }
From source file:com.burhan.udacity.popularmovies.ui.fragment.MoviesFragment.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); mSubscriptions = new CompositeSubscription(); mSelectedPosition = savedInstanceState != null ? savedInstanceState.getInt(STATE_SELECTED_POSITION, -1) : -1;/*from www. ja v a2 s . co m*/ List<Movie> restoredMovies = savedInstanceState != null ? savedInstanceState.getParcelableArrayList(STATE_MOVIES) : new ArrayList<>(); mMoviesAdapter = new MoviesAdapter(this, restoredMovies); mMoviesAdapter.setListener(this); initSwipeRefreshLayout(); initRecyclerView(); }
From source file:com.ushahidi.android.ui.fragment.ListDeploymentFragment.java
private void swipeToDeleteUndo() { mListViewTouchListener = new SwipeDismissRecyclerViewTouchListener(mDeploymentRecyclerView, new SwipeDismissRecyclerViewTouchListener.DismissCallbacks() { @Override//w w w .jav a 2s . c o m public boolean canDismiss(int position) { return true; } @Override public void onDismiss(RecyclerView listView, int[] reverseSortedPositions) { isDismissToDelete = true; mInteractiveToast .setInteractiveToastListener(new InteractiveToast.InteractiveToastListener() { @Override public void onPressed(Parcelable token) { Bundle b = (Bundle) token; final ArrayList<DeploymentRecyclerView.DeploymentParcelable> items = b .getParcelableArrayList(INTERACTIVE_TOAST_BUNDLE_KEY); if (!items.isEmpty()) { for (DeploymentRecyclerView.DeploymentParcelable deploymentModel : items) { mRecyclerViewAdapter.addItem(deploymentModel.getDeploymentModel(), deploymentModel.getPosition()); } items.clear(); } } }); mInteractiveToast.setOnHideListener(new InteractiveToast.OnHideListener() { @Override public void onHide(Parcelable token) { Bundle b = (Bundle) token; final ArrayList<DeploymentParcelable> items = b .getParcelableArrayList(INTERACTIVE_TOAST_BUNDLE_KEY); if (!items.isEmpty()) { for (DeploymentParcelable deploymentModel : items) { if (deploymentModel.getDeploymentModel() .getStatus() == DeploymentModel.Status.ACTIVATED) { mPrefs.getActiveDeploymentUrl().delete(); } mDeleteDeploymentPresenter .deleteDeployment(deploymentModel.getDeploymentModel()); } items.clear(); } } }); ArrayList<DeploymentParcelable> items = new ArrayList<>(); if (reverseSortedPositions.length > 0) { for (int i : reverseSortedPositions) { DeploymentParcelable parcelable = new DeploymentParcelable( mRecyclerViewAdapter.getItem(i), i); items.add(parcelable); mRecyclerViewAdapter.removeItem(mRecyclerViewAdapter.getItem(i)); } } // Stores the selected models into a bundle for later reuse. Bundle b = new Bundle(); b.putParcelableArrayList(INTERACTIVE_TOAST_BUNDLE_KEY, items); mInteractiveToast.show(getString(R.string.items_deleted, reverseSortedPositions.length), getString(R.string.undo), R.drawable.ic_undo, b); } }); }
From source file:org.cvasilak.jboss.mobile.admin.fragments.ConfigurationViewFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d(TAG, "@onCreate()"); application = (JBossAdminApplication) getActivity().getApplication(); // restore state in case of a configuration change (eg orientation) if (savedInstanceState != null) { confMetrics = savedInstanceState.getParcelableArrayList("confMetrics"); }//from ww w . ja v a2s . c o m MergeAdapter adapter = new MergeAdapter(); TextView sectionHeader; // Section: Server Information sectionHeader = new TextView(getActivity()); sectionHeader.setBackgroundColor(Color.DKGRAY); sectionHeader.setPadding(15, 10, 0, 10); sectionHeader.setText("Server Information"); adapter.addView(sectionHeader); if (confMetrics == null) { confMetrics = new ArrayList<Metric>(); confMetrics.add(new Metric("Code Name", "release-codename")); confMetrics.add(new Metric("Release Version", "release-version")); confMetrics.add(new Metric("Server State", "server-state")); } MetricsAdapter confMetricsAdapter = new MetricsAdapter(getSherlockActivity(), confMetrics); adapter.addAdapter(confMetricsAdapter); // Section: Server Configuration sectionHeader = new TextView(getActivity()); sectionHeader.setBackgroundColor(Color.DKGRAY); sectionHeader.setPadding(15, 10, 0, 10); sectionHeader.setText("Server Configuration"); adapter.addView(sectionHeader); adapter.addAdapter(new ArrayAdapter<String>(getActivity(), android.R.layout.simple_list_item_1, new String[] { "Extensions", "Properties" })); setListAdapter(adapter); // inform runtime that we have an action button (refresh) setHasOptionsMenu(true); // refresh only if the fragment is created // for the first time (no previous state) if (savedInstanceState == null) refresh(); }
From source file:org.kiwix.kiwixmobile.ZimFileSelectActivity.java
@Override protected void onRestoreInstanceState(Bundle savedInstanceState) { // Get the rescanned data, if available. Create an Adapter for the ListView and display the list if (savedInstanceState.getParcelableArrayList("rescanData") != null) { ArrayList<DataModel> data = savedInstanceState.getParcelableArrayList("rescanData"); mRescanAdapter = new RescanDataAdapter(ZimFileSelectActivity.this, 0, data); mZimFileList.setAdapter(mRescanAdapter); }/*from w ww . ja v a2s . co m*/ super.onRestoreInstanceState(savedInstanceState); }
From source file:ar.com.martineo14.spotifystreamer2.ui.fragment.SearchArtistFragment.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); listView = (ListView) view.findViewById(R.id.list_artist); searchView = (SearchView) view.findViewById(R.id.search_artist); if (savedInstanceState != null) { artistNameSearch = savedInstanceState.getString(Constants.ARTIST_NAME); artistResultModel = savedInstanceState.getParcelableArrayList(Constants.ARTIST_MODEL_RESULT); if (artistResultModel != null) { artistAdapter = new ArtistListAdapter(getActivity(), artistResultModel); listView.setAdapter(artistAdapter); } else {/*from w w w . j a v a 2 s . c om*/ searchView.setQuery(artistNameSearch, false); updateArtistList(); } } searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { artistNameSearch = query; updateArtistList(); return false; } @Override public boolean onQueryTextChange(String newText) { return false; } }); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) { ArtistModel artist = artistAdapter.getItem(position); ((SearchCallback) getActivity()).onItemSelected(artist); mPosition = position; } }); }