List of usage examples for android.os Bundle getIntegerArrayList
@Override
@Nullable
public ArrayList<Integer> getIntegerArrayList(@Nullable String key)
From source file:com.example.android.pantry.scanner.BarcodeScannerActivity.java
@Override protected void onCreate(Bundle state) { super.onCreate(state); if (state != null) { mFlash = state.getBoolean(FLASH_STATE, false); mAutoFocus = state.getBoolean(AUTO_FOCUS_STATE, true); mSelectedIndices = state.getIntegerArrayList(SELECTED_FORMATS); mCameraId = state.getInt(CAMERA_ID, -1); } else {// ww w . j a v a 2 s . c o m mFlash = false; mAutoFocus = true; mSelectedIndices = null; mCameraId = -1; } setContentView(R.layout.activity_simple_scanner); setupToolbar(); ViewGroup contentFrame = (ViewGroup) findViewById(R.id.content_frame); mScannerView = new ZXingScannerView(this); setupFormats(); contentFrame.addView(mScannerView); }
From source file:com.kaliturin.blacklist.fragments.AddOrEditContactFragment.java
private void addRowsToNumbersList(Bundle data) { if (data == null) { return;// w ww.j a v a2 s . c o m } // get numbers and types from parameters ArrayList<String> numbers = data.getStringArrayList(CONTACT_NUMBERS); ArrayList<Integer> types = data.getIntegerArrayList(CONTACT_NUMBER_TYPES); if (numbers != null && types != null && numbers.size() == types.size()) { // get the set of unique pairs of numbers/types form the current view Set<Pair<String, Integer>> numbers2TypeSet = getNumber2TypePairs(); for (int i = 0; i < numbers.size(); i++) { String number = numbers.get(i); int type = types.get(i); // add to View only rows with unique pair of number/type if (numbers2TypeSet.add(new Pair<>(number, type))) { addRowToNumbersList(number, type); } } } }
From source file:com.chute.android.photopickerplus.ui.activity.ServicesActivity.java
private void retrieveValuesFromBundle(Bundle savedInstanceState) { accountItemPositions = savedInstanceState != null ? savedInstanceState.getIntegerArrayList(Constants.KEY_SELECTED_ACCOUNTS_ITEMS) : null;/*w ww .j a va 2 s .c o m*/ imageItemPositions = savedInstanceState != null ? savedInstanceState.getIntegerArrayList(Constants.KEY_SELECTED_IMAGES_ITEMS) : null; videoItemPositions = savedInstanceState != null ? savedInstanceState.getIntegerArrayList(Constants.KEY_SELECTED_VIDEOS_ITEMS) : null; folderId = savedInstanceState != null ? savedInstanceState.getString(Constants.KEY_FOLDER_ID) : null; account = (AccountModel) (savedInstanceState != null ? savedInstanceState.getParcelable(Constants.KEY_ACCOUNT) : null); photoFilterType = savedInstanceState != null ? savedInstanceState.getInt(Constants.KEY_PHOTO_FILTER_TYPE) : 0; }
From source file:com.flexible.flexibleadapter.SelectableAdapter.java
/** * Restores the previous state of the selection on the items. * * @param savedInstanceState Previous state * @since 1.0.0/* www . j a va 2 s . c o m*/ */ public void onRestoreInstanceState(Bundle savedInstanceState) { mSelectedPositions.addAll(savedInstanceState.getIntegerArrayList(TAG)); if (DEBUG && getSelectedItemCount() > 0) Log.d(TAG, "Restore selection " + mSelectedPositions); }
From source file:com.piusvelte.cloudset.android.ActionsFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); adapter = new ActionsAdapter(getActivity(), actions); setListAdapter(adapter);//from w ww. j a va 2 s . co m LoaderManager loaderManager = getLoaderManager(); // attach the first loader for populating the publications loaderManager.initLoader(0, null, this); if (savedInstanceState != null && savedInstanceState.containsKey(EXTRA_LOADER_IDS)) { loaderIds = savedInstanceState.getIntegerArrayList(EXTRA_LOADER_IDS); } else { loaderIds = new ArrayList<Integer>(); } // attach additional tasks for updating devices for (int i = 0, s = loaderIds.size(); i < s; i++) { loaderManager.initLoader(loaderIds.get(i), null, this); } }
From source file:com.github.mguidi.asyncop.AsyncOpHelper.java
/** * @param context/* w w w .ja v a 2 s. c o m*/ * @param savedInstanceState * @param callback */ public AsyncOpHelper(Context context, Bundle savedInstanceState, AsyncOpCallback callback) { mContext = context.getApplicationContext(); mAsyncOpCallback = callback; if (savedInstanceState == null) { mIdHelper = UUID.randomUUID().toString(); mNextIdRequest = 0; mPendingRequests = new ArrayList<Integer>(); mMapPendingRequestsAction = new Bundle(); } else { mIdHelper = savedInstanceState.getString(SAVED_ID_HELPER); mNextIdRequest = savedInstanceState.getInt(SAVED_ID_REQUEST); mPendingRequests = savedInstanceState.getIntegerArrayList(SAVED_PENDING_REQUESTS); mMapPendingRequestsAction = savedInstanceState.getBundle(SAVED_MAP_PENDING_REQUESTS_ACTION); } }
From source file:com.keylesspalace.tusky.activity.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); pageHistory = new Stack<>(); if (savedInstanceState != null) { List<Integer> restoredHistory = savedInstanceState.getIntegerArrayList("pageHistory"); if (restoredHistory != null) { pageHistory.addAll(restoredHistory); }/*from w w w .j av a2 s. c o m*/ } ButterKnife.bind(this); floatingBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getApplicationContext(), ComposeActivity.class); startActivity(intent); } }); setupDrawer(); setupSearchView(); /* Fetch user info while we're doing other things. This has to be after setting up the * drawer, though, because its callback touches the header in the drawer. */ fetchUserInfo(); // Setup the tabs and timeline pager. TimelinePagerAdapter adapter = new TimelinePagerAdapter(getSupportFragmentManager()); String[] pageTitles = { getString(R.string.title_public_local), getString(R.string.title_public_federated), getString(R.string.title_home), getString(R.string.title_notifications), }; adapter.setPageTitles(pageTitles); int pageMargin = getResources().getDimensionPixelSize(R.dimen.tab_page_margin); viewPager.setPageMargin(pageMargin); Drawable pageMarginDrawable = ThemeUtils.getDrawable(this, R.attr.tab_page_margin_drawable, R.drawable.tab_page_margin_dark); viewPager.setPageMarginDrawable(pageMarginDrawable); viewPager.setAdapter(adapter); tabLayout.setupWithViewPager(viewPager); tabLayout.getTabAt(2).setIcon(R.drawable.ic_local_24dp); tabLayout.getTabAt(3).setIcon(R.drawable.ic_public_24dp); tabLayout.getTabAt(0).setIcon(R.drawable.ic_home_24dp); tabLayout.getTabAt(1).setIcon(R.drawable.ic_notifications_24dp); tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { @Override public void onTabSelected(TabLayout.Tab tab) { viewPager.setCurrentItem(tab.getPosition()); if (pageHistory.isEmpty()) { pageHistory.push(0); } if (pageHistory.contains(tab.getPosition())) { pageHistory.remove(pageHistory.indexOf(tab.getPosition())); } pageHistory.push(tab.getPosition()); tintTab(tab, true); } @Override public void onTabUnselected(TabLayout.Tab tab) { tintTab(tab, false); } @Override public void onTabReselected(TabLayout.Tab tab) { } }); Intent intent = getIntent(); int tabSelected = 0; if (intent != null) { int tabPosition = intent.getIntExtra("tab_position", 0); if (tabPosition != 0) { TabLayout.Tab tab = tabLayout.getTabAt(tabPosition); if (tab != null) { tab.select(); tabSelected = tabPosition; } } } for (int i = 0; i < 4; i++) { tintTab(tabLayout.getTabAt(i), i == tabSelected); } // Setup push notifications if (arePushNotificationsEnabled()) enablePushNotifications(); }
From source file:com.example.linhdq.test.documents.viewing.grid.DocumentGridActivity.java
@Override protected void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); ArrayList<Integer> selection = savedInstanceState.getIntegerArrayList(SAVE_STATE_KEY); mDocumentAdapter.setSelectedDocumentIds(selection); }
From source file:net.maa123.tatuky.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); pageHistory = new Stack<>(); if (savedInstanceState != null) { List<Integer> restoredHistory = savedInstanceState.getIntegerArrayList("pageHistory"); if (restoredHistory != null) { pageHistory.addAll(restoredHistory); }//from ww w . j a va 2 s . co m } ButterKnife.bind(this); floatingBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getApplicationContext(), ComposeActivity.class); startActivityForResult(intent, COMPOSE_RESULT); } }); setupDrawer(); setupSearchView(); /* Fetch user info while we're doing other things. This has to be after setting up the * drawer, though, because its callback touches the header in the drawer. */ fetchUserInfo(); // Setup the tabs and timeline pager. TimelinePagerAdapter adapter = new TimelinePagerAdapter(getSupportFragmentManager()); int pageMargin = getResources().getDimensionPixelSize(R.dimen.tab_page_margin); viewPager.setPageMargin(pageMargin); Drawable pageMarginDrawable = ThemeUtils.getDrawable(this, R.attr.tab_page_margin_drawable, R.drawable.tab_page_margin_dark); viewPager.setPageMarginDrawable(pageMarginDrawable); viewPager.setAdapter(adapter); tabLayout.setupWithViewPager(viewPager); int[] tabIcons = { R.drawable.ic_home_24dp, R.drawable.ic_notifications_24dp, R.drawable.ic_local_24dp, R.drawable.ic_public_24dp, }; String[] pageTitles = { getString(R.string.title_home), getString(R.string.title_notifications), getString(R.string.title_public_local), getString(R.string.title_public_federated), }; for (int i = 0; i < 4; i++) { TabLayout.Tab tab = tabLayout.getTabAt(i); tab.setIcon(tabIcons[i]); tab.setContentDescription(pageTitles[i]); } tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { @Override public void onTabSelected(TabLayout.Tab tab) { viewPager.setCurrentItem(tab.getPosition()); if (pageHistory.isEmpty()) { pageHistory.push(0); } if (pageHistory.contains(tab.getPosition())) { pageHistory.remove(pageHistory.indexOf(tab.getPosition())); } pageHistory.push(tab.getPosition()); tintTab(tab, true); } @Override public void onTabUnselected(TabLayout.Tab tab) { tintTab(tab, false); } @Override public void onTabReselected(TabLayout.Tab tab) { } }); Intent intent = getIntent(); int tabSelected = 0; if (intent != null) { int tabPosition = intent.getIntExtra("tab_position", 0); if (tabPosition != 0) { TabLayout.Tab tab = tabLayout.getTabAt(tabPosition); if (tab != null) { tab.select(); tabSelected = tabPosition; } } } for (int i = 0; i < 4; i++) { tintTab(tabLayout.getTabAt(i), i == tabSelected); } // Setup push notifications if (arePushNotificationsEnabled()) { enablePushNotifications(); } else { disablePushNotifications(); } composeButton = floatingBtn; }
From source file:com.fbartnitzek.tasteemall.filter.EntityFilterTabFragment.java
@Nullable @Override/*from ww w . j av a 2 s . c o m*/ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_filter_entity_tab, container, false); Bundle bundle = getArguments(); if (bundle == null) { bundle = savedInstanceState; } if (bundle == null) { throw new RuntimeException("neither args nor savedInstance - should never happen..."); } mBaseEntity = bundle.getString(BASE_ENTITY); mName = bundle.getString(NAME, "no name"); mEntityArguments = DatabaseContract.ATTRIBUTES.get(mBaseEntity); mPosition = bundle.getInt(ADAPTER_POSITION, 0); ((TextView) rootView.findViewById(R.id.name)).setText(this.mName); // TODO: restore from json... if (bundle.containsKey(LIST_SELECTED)) { mSelected.clear(); mSelected.addAll(bundle.getIntegerArrayList(LIST_SELECTED)); } mAttributesRecycler = (RecyclerView) rootView.findViewById(R.id.recyclerview_attributes); mAttributesRecycler.setLayoutManager(new LinearLayoutManager(getActivity())); mAttributeAdapter = new AttributeAdapter(mEntityArguments, this, getContext(), mSelected); mAttributesRecycler.setAdapter(mAttributeAdapter); return rootView; }