List of usage examples for android.os Bundle getParcelableArrayList
@Nullable public <T extends Parcelable> ArrayList<T> getParcelableArrayList(@Nullable String key)
From source file:com.google.samples.apps.gameloopmanager.TestLoopsActivity.java
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_test_loops); getSupportActionBar().setDisplayHomeAsUpEnabled(true); launchAllButton = (Button) findViewById(R.id.run_all); launchAllButton.setOnClickListener(new OnClickListener() { @Override/*from ww w .j av a 2 s. c o m*/ public void onClick(View v) { startLoopFromUi(); } }); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); timeout = prefs.getLong(TIMEOUT, 3 * 60 * 1000); if (savedInstanceState != null) { checkedScenarios.addAll(savedInstanceState.getIntegerArrayList(CHECKED_SCENARIOS)); List<TestLoopGroup> savedTestLoopGroups = savedInstanceState.getParcelableArrayList(TEST_LOOP_GROUPS); testLoopGroups.addAll(savedTestLoopGroups); updateTestLoopButton(); } resolveInfo = getIntent().getParcelableExtra("resolveInfo"); adapter = new TestLoopGroupAdapter(this, checkedScenarios, testLoopGroups); expandableListView = (ExpandableListView) findViewById(R.id.test_loop_list); expandableListView.setAdapter(adapter); expandableListView.setOnChildClickListener(new OnChildClickListener() { @Override public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) { if (childPosition == 0) { CheckBox checkBox = (CheckBox) v; if (checkBox.isChecked()) { for (int item : adapter.getGroup(groupPosition).getLoops()) { checkedScenarios.remove(item); } } else { for (int item : adapter.getGroup(groupPosition).getLoops()) { checkedScenarios.add(item); } } } else { Integer data = adapter.getChild(groupPosition, childPosition - 1); if (!checkedScenarios.remove(data)) { checkedScenarios.add(data); } } adapter.notifyDataSetChanged(); updateTestLoopButton(); return true; } }); }
From source file:org.openhab.habdroid.ui.activity.ContentController.java
/** * Restore instance state previously saved by onSaveInstanceState * To be called from the onRestoreInstanceState or onCreate callbacks of the activity * * @param state Bundle including previously saved state *//* w w w .j av a 2 s.co m*/ public void onRestoreInstanceState(Bundle state) { mCurrentSitemap = state.getParcelable("controllerSitemap"); if (mCurrentSitemap != null) { mSitemapFragment = (OpenHABWidgetListFragment) mFm.getFragment(state, "sitemapFragment"); if (mSitemapFragment == null) { mSitemapFragment = makeSitemapFragment(mCurrentSitemap); } } Fragment progressFragment = mFm.getFragment(state, "progressFragment"); if (progressFragment != null) { mDefaultProgressFragment = progressFragment; } ArrayList<OpenHABLinkedPage> oldStack = state.getParcelableArrayList("controllerPages"); mPageStack.clear(); for (OpenHABLinkedPage page : oldStack) { OpenHABWidgetListFragment f = (OpenHABWidgetListFragment) mFm.getFragment(state, "pageFragment-" + page.link()); mPageStack.add(Pair.create(page, f != null ? f : makePageFragment(page))); } mTemporaryPage = mFm.getFragment(state, "temporaryPage"); }
From source file:com.bb.hbx.activitiy.InsurancePlanActivity.java
@Override public void initView() { setSupportActionBar(toolbar);/* w w w . j av a 2s. co m*/ getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowTitleEnabled(false); Intent intent = getIntent(); Bundle bundle = intent.getExtras(); insurerId = bundle.getString("insurerId"); serialId = bundle.getString("serialId"); city = bundle.getString("city"); licenseNo = bundle.getString("licenseNo"); insureName = bundle.getString("insureName"); driveName = bundle.getString("driveName"); idNo = bundle.getString("idNo"); mobile = bundle.getString("mobile"); carExtras = bundle.getString("carExtras"); carPrice = bundle.getString("carPrice"); modelCode = bundle.getString("modelCode"); int size = bundle.getInt("size", -1); for (int i = 0; i < size; i++) { //???? List<ComCarPropsBean.PlanListBean.SyxListBean> syxList = bundle.getParcelableArrayList("syxList" + i); for (int j = 0; j < syxList.size(); j++) { List<ComCarPropsBean.PlanListBean.SyxListBean.AmountListBeanXXX> amountList = bundle .getParcelableArrayList("amountList" + i + j); syxList.get(j).setAmountList(amountList); } //???? List<ComCarPropsBean.PlanListBean.JqxListBean> jqxList = bundle.getParcelableArrayList("jqxList" + i); for (int j = 0; j < jqxList.size(); j++) { List<ComCarPropsBean.PlanListBean.JqxListBean.AmountListBeanX> amountJqxList = bundle .getParcelableArrayList("amountJqxList" + i + j); jqxList.get(j).setAmountList(amountJqxList); } //???? List<ComCarPropsBean.PlanListBean.FjxListBean> fjxList = bundle.getParcelableArrayList("fjxList" + i); for (int j = 0; j < fjxList.size(); j++) { List<ComCarPropsBean.PlanListBean.FjxListBean.AmountListBean> amountFjxList = bundle .getParcelableArrayList("amountFjxList" + i + j); fjxList.get(j).setAmountList(amountFjxList); } //???? List<ComCarPropsBean.PlanListBean.QtxListBean> qtxList = bundle.getParcelableArrayList("qtxList" + i); for (int j = 0; j < qtxList.size(); j++) { List<ComCarPropsBean.PlanListBean.QtxListBean.AmountListBeanXX> amountQtxList = bundle .getParcelableArrayList("amountQtxList" + i + j); qtxList.get(j).setAmountList(amountQtxList); } ComCarPropsBean.PlanListBean planListBean = new ComCarPropsBean.PlanListBean(); // planListBean.setSyxList(syxList); planListBean.setFjxList(fjxList); planListBean.setQtxList(qtxList); planListBean.setJqxList(jqxList); planList.add(planListBean); } for (int i = 0; i < planList.size(); i++) { /*Item item = new BannerBean(); mlist.add(item);*/ ImageView dotView = new ImageView(mContext); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(10, 10); lp.leftMargin = 10; dotView.setLayoutParams(lp); dotView.setBackgroundResource(R.drawable.dot_selected); dotList.add(dotView); lin_add.addView(dotView); if (i == 0) {//---------2 dotList.get(i).setAlpha(1); } else { dotList.get(i).setAlpha(0.38f); } } //mCardAdapter = new CardPagerAdapter(this, mlist); mCardAdapter = new CardPagerAdapter(this, planList); mCardShadowTransformer = new ShadowTransformer(vp_tb, mCardAdapter); mCardShadowTransformer.setCanAlpha(true); mCardAdapter.setTransformer(mCardShadowTransformer); vp_tb.setAdapter(mCardAdapter); mCardAdapter.setPager(vp_tb); vp_tb.setPageTransformer(false, mCardShadowTransformer); mCardShadowTransformer.setAlpha(0.6f, true); mCardShadowTransformer.setScale(0.1f, true); //vp_tb.setCurrentItem(2);--------------- //vp_tb.setCurrentItem(10000 / 2 - 10000 / 2 % 3); if (planList.size() > 0) { vp_tb.setCurrentItem(0); getPlanPrice(0); } vp_tb.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageSelected(int position) { dotList.get(prePosition).setAlpha(0.38f); /*dotList.get(position%3).setAlpha(1); prePosition=position%3;*/ dotList.get(position).setAlpha(1); prePosition = position; //? getPlanPrice(position); } @Override public void onPageScrollStateChanged(int state) { } }); }
From source file:de.msal.shoutemo.ui.onlineusers.OnlineUsersFragment.java
@Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_onlineusers, container, false); mSwipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.onlineusers_swipe); mSwipeRefreshLayout.setColorSchemeResources(R.color.autemo_pink, R.color.autemo_yellow_bright, R.color.autemo_green_secondary, R.color.autemo_blue); mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override/*from w w w. j a va 2 s .c o m*/ public void onRefresh() { refreshTriggeredBySwipe = true; new GetOnlineUsersTask().execute(); } }); mAdapter = new OnlineUsersAdapter(getActivity(), new LinkedList<Author>()); mListView = (ListView) view.findViewById(android.R.id.list); mListView.setOnItemClickListener(new OnlineUseresClickListener()); if (savedInstanceState != null) { mTitle = savedInstanceState.getCharSequence(INSTANCESTATE_TITLE); mAuthors = savedInstanceState.getParcelableArrayList(INSTANCESTATE_AUTHORS); mAdapter.addAll(mAuthors); mListView.setAdapter(mAdapter); } else { new GetOnlineUsersTask().execute(); } mCallback.setTitle(mTitle); return view; }
From source file:com.silentcircle.contacts.group.GroupEditorFragment.java
private void onRestoreInstanceState(Bundle state) { mAction = state.getString(KEY_ACTION); mGroupUri = state.getParcelable(KEY_GROUP_URI); mGroupId = state.getLong(KEY_GROUP_ID); mStatus = (Status) state.getSerializable(KEY_STATUS); mGroupNameIsReadOnly = state.getBoolean(KEY_GROUP_NAME_IS_READ_ONLY); mOriginalGroupName = state.getString(KEY_ORIGINAL_GROUP_NAME); mListMembersToAdd = state.getParcelableArrayList(KEY_MEMBERS_TO_ADD); mListMembersToRemove = state.getParcelableArrayList(KEY_MEMBERS_TO_REMOVE); mListToDisplay = state.getParcelableArrayList(KEY_MEMBERS_TO_DISPLAY); }
From source file:de.uni_koblenz_landau.apow.EncounterListFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.encounter_list_fragment, container, false); // Create UI references. mListView = (ListView) view.findViewById(R.id.encounter_list_fragment_listview); mListView.setEmptyView(view.findViewById(android.R.id.empty)); mListView.getEmptyView().setVisibility(ListView.GONE); mListView.setOnItemClickListener(new OnItemClickListener() { @Override// ww w . j a v a 2s .com public void onItemClick(AdapterView<?> parent, View view, int position, long id) { ListViewItem item = (ListViewItem) parent.getItemAtPosition(position); Intent intent = new Intent(getActivity(), ObsListActivity.class); intent.putExtra(ObsListFragment.ARG_ENCOUNTER_ID, (int) id); intent.putExtra(ObsListFragment.ARG_TITLE, item.getField2()); getActivity().startActivity(intent); } }); // Restore UI from saved instance or load data. if (savedInstanceState != null) { mEncounters = savedInstanceState.getParcelableArrayList(ARG_ENCOUNTERS); EncounterAdapter adapter = new EncounterAdapter(this.getActivity(), mEncounters); mListView.setAdapter(adapter); } else { loadEncounters(); } return view; }
From source file:layout.FragmentBoardItemList.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // cargamos la instancia si esta guardada if (savedInstanceState != null) { recentPostMode = savedInstanceState.getBoolean(RECENT_POST_MODE); currentBoard = savedInstanceState.getParcelable(ARG_CURRENTBOARD); currentThread = savedInstanceState.getParcelable(ARG_CURRENT_THREAD); boardItems = savedInstanceState.getParcelableArrayList(SAVED_BOARDITEMS); }/* w w w . j av a 2s . co m*/ // Aplicacin del Tema settings = PreferenceManager.getDefaultSharedPreferences(this.getContext()); int themeResId = tm.getCurrentThemeId(); Context context = new ContextThemeWrapper(getActivity(), themeResId); LayoutInflater localInflater = inflater.cloneInContext(context); View v = localInflater.inflate(R.layout.fragment_fragment_thread_list, container, false); themedContext = v; this.rootView = (ViewGroup) v; // Seteamos los controles que son guardados globalmente listViewBoardItems = (ListView) v.findViewById(R.id.lvThreadList); // barThreadProcess = (ProgressBar)rootView.findViewById(R.id.barThreadProcess); layoutThreadProcess = (LinearLayout) rootView.findViewById(R.id.layoutThreadProcess); txtThreadProcess = (TextView) rootView.findViewById(R.id.txtThreadError); this.loadingBar = (ProgressBar) rootView.findViewById(R.id.progressBar); // Agregamos color al divider del listview ColorDrawable cd = new ColorDrawable(tm.getMarginColor()); listViewBoardItems.setDivider(cd); listViewBoardItems.setDividerHeight(1); // registramos los menus del listview registerForContextMenu(listViewBoardItems); // Creamos los dos adaptadores y los seteamos dependiendo del modo del fragmento listViewAdapter = new ThreadListAdapter(v.getContext(), boardItems, tm); recentPostAdapter = new RecentPostAdapter(v.getContext(), boardItems); if (recentPostMode) { listViewBoardItems.setAdapter(recentPostAdapter); } else { listViewBoardItems.setAdapter(listViewAdapter); } if (!imMainFragment) { listViewAdapter.listThreads = true; } listViewBoardItems.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { if (imMainFragment && !recentPostMode) { BoardItem bi = listViewAdapter.getItem(position); mListener.showThread(currentBoard, bi); } else if (imMainFragment && recentPostMode) { BoardItem bi = boardItems.get(position); mListener.showThread(bi.getParentBoard(), bi); } } }); listViewBoardItems.setOnScrollListener(new AbsListView.OnScrollListener() { private int lastFirstVisibleItem = 0; @Override public void onScrollStateChanged(AbsListView view, int scrollState) { } @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { if (lastFirstVisibleItem < firstVisibleItem) { // Scrolling down mListener.hideActionButton(); } else if (lastFirstVisibleItem > firstVisibleItem) { // Scrolling Up mListener.showActionButton(); } lastFirstVisibleItem = firstVisibleItem; for (int i = firstVisibleItem; i < firstVisibleItem + visibleItemCount; i++) { if (!recentPostMode) { BoardItem bi = listViewAdapter.getItem(i); if (!bi.getThumb().isEmpty() && bi.getThumbBitmap() == null && !bi.downloadingThumb) { getThumbnail(bi); } } } if (totalItemCount == firstVisibleItem + visibleItemCount && !loadingMoreThreads && imMainFragment && totalItemCount != 0 && !recentPostMode) { loadingMoreThreads = true; currentOffset += 10; System.out.println("[Scroll] loading more threads! currentThreadCount " + totalItemCount); getThreadList(currentOffset); // TODO: Offset incorrecto } } }); hideProgressBar(); if (boardItems.isEmpty()) { if (currentBoard == null && currentThread == null && imMainFragment) { loadRecentPost(); } else { updateBoardItems(currentBoard, currentThread); } } else { listViewAdapter.notifyDataSetChanged(); recentPostAdapter.notifyDataSetChanged(); } return v; }
From source file:com.igniva.filemanager.fragments.AppsList.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setRetainInstance(true);//from w w w . jav a 2s .c om mainActivity = (MainActivity) getActivity(); mainActivity.setActionBarTitle(utils.getString(getActivity(), R.string.apps)); mainActivity.floatingActionButton.hideMenuButton(true); mainActivity.buttonBarFrame.setVisibility(View.GONE); mainActivity.supportInvalidateOptionsMenu(); vl = getListView(); Sp = PreferenceManager.getDefaultSharedPreferences(getActivity()); getSortModes(); ListView vl = getListView(); int theme = Integer.parseInt(Sp.getString("theme", "0")); theme1 = theme == 2 ? PreferenceUtils.hourOfDay() : theme; vl.setDivider(null); if (theme1 == 1) getActivity().getWindow().getDecorView() .setBackgroundColor(getResources().getColor(R.color.holo_dark_background)); if (savedInstanceState == null) loadlist(false); else { c = savedInstanceState.getParcelableArrayList("c"); a = savedInstanceState.getParcelableArrayList("list"); adapter = new AppsAdapter(getActivity(), R.layout.rowlayout, a, app, c); setListAdapter(adapter); vl.setSelectionFromTop(savedInstanceState.getInt("index"), savedInstanceState.getInt("top")); vl.setSelectionFromTop(savedInstanceState.getInt("index"), savedInstanceState.getInt("top")); } setHasOptionsMenu(true); }
From source file:com.lloydtorres.stately.telegrams.TelegramsFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mView = inflater.inflate(R.layout.content_message_board, container, false); telegrams = new ArrayList<Telegram>(); folders = new ArrayList<TelegramFolder>(); TelegramFolder activeFolder = new TelegramFolder(); activeFolder.name = "Inbox"; activeFolder.value = "inbox"; folders.add(activeFolder);// www .j av a2 s. c o m selectedFolder = 0; uniqueEnforcer = new HashSet<Integer>(); // Restore state if (savedInstanceState != null) { pastOffset = savedInstanceState.getInt(KEY_PAST_OFFSET, 0); telegrams = savedInstanceState.getParcelableArrayList(KEY_TELEGRAMS); folders = savedInstanceState.getParcelableArrayList(KEY_FOLDERS); selectedFolder = savedInstanceState.getInt(KEY_ACTIVE, 0); rebuildUniqueEnforcer(); } toolbar = (Toolbar) mView.findViewById(R.id.message_board_toolbar); toolbar.setTitle(getString(R.string.menu_telegrams)); if (mActivity != null && mActivity instanceof IToolbarActivity) { ((IToolbarActivity) mActivity).setToolbar(toolbar); } // Set up refresher to reload data on refresh mSwipeRefreshLayout = (SwipyRefreshLayout) mView.findViewById(R.id.message_board_refresher); mSwipeRefreshLayout.setColorSchemeResources(RaraHelper.getThemeRefreshColours(getContext())); mSwipeRefreshLayout.setOnRefreshListener(new SwipyRefreshLayout.OnRefreshListener() { @Override public void onRefresh(SwipyRefreshLayoutDirection direction) { if (direction.equals(SwipyRefreshLayoutDirection.TOP)) { queryTelegrams(0, SCAN_FORWARD, false); } else { queryTelegrams(pastOffset, SCAN_BACKWARD, false); } } }); // Setup recyclerview mRecyclerView = (RecyclerView) mView.findViewById(R.id.message_board_recycler); mRecyclerView.setHasFixedSize(true); mLayoutManager = new LinearLayoutManager(getActivity()); mRecyclerView.setLayoutManager(mLayoutManager); startQueryTelegrams(SCAN_FORWARD); return mView; }
From source file:com.amaze.filemanager.fragments.AppsList.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setRetainInstance(true);/* w w w . ja v a2 s . co m*/ mainActivity = (MainActivity) getActivity(); mainActivity.setActionBarTitle(utils.getString(getActivity(), R.string.apps)); mainActivity.floatingActionButton.hideMenuButton(true); mainActivity.buttonBarFrame.setVisibility(View.GONE); mainActivity.supportInvalidateOptionsMenu(); fabSkin = mainActivity.fabskin; vl = getListView(); Sp = PreferenceManager.getDefaultSharedPreferences(getActivity()); getSortModes(); ListView vl = getListView(); int theme = Integer.parseInt(Sp.getString("theme", "0")); theme1 = theme == 2 ? PreferenceUtils.hourOfDay() : theme; vl.setDivider(null); if (theme1 == 1) getActivity().getWindow().getDecorView() .setBackgroundColor(getResources().getColor(R.color.holo_dark_background)); if (savedInstanceState == null) loadlist(false); else { c = savedInstanceState.getParcelableArrayList("c"); a = savedInstanceState.getParcelableArrayList("list"); adapter = new AppsAdapter(getActivity(), R.layout.rowlayout, a, app, c); setListAdapter(adapter); vl.setSelectionFromTop(savedInstanceState.getInt("index"), savedInstanceState.getInt("top")); } }