List of usage examples for android.os Bundle getIntegerArrayList
@Override
@Nullable
public ArrayList<Integer> getIntegerArrayList(@Nullable String key)
From source file:com.piusvelte.cloudset.android.CloudSetMain.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(getApplicationContext()); setContentView(R.layout.activity_main); final ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); sectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); viewPager = (ViewPager) findViewById(R.id.pager); viewPager.setAdapter(sectionsPagerAdapter); viewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override/*from w ww . ja v a 2s . c o m*/ public void onPageSelected(int position) { actionBar.setSelectedNavigationItem(position); } }); for (int i = 0; i < sectionsPagerAdapter.getCount(); i++) { actionBar.addTab(actionBar.newTab().setText(sectionsPagerAdapter.getPageTitle(i)).setTabListener(this)); } SharedPreferences sp = getSharedPreferences(getString(R.string.app_name), MODE_PRIVATE); account = sp.getString(PREFERENCE_ACCOUNT_NAME, null); deviceId = sp.getLong(PREFERENCE_DEVICE_ID, INVALID_DEVICE_ID); setCurrentTab(); // create the loader for registration, deregistration, and loading // devices LoaderManager loaderManager = getSupportLoaderManager(); loaderManager.initLoader(0, null, this); if (savedInstanceState != null && savedInstanceState.containsKey(EXTRA_LOADER_IDS)) { loaderIds = savedInstanceState.getIntegerArrayList(EXTRA_LOADER_IDS); } else { loaderIds = new ArrayList<Integer>(); } for (int i = 0, s = loaderIds.size(); i < s; i++) { // reconnect to additional loaders for deregistering additional // devices loaderManager.initLoader(loaderIds.get(i), null, this); } }
From source file:com.android.mail.ui.FolderListFragment.java
/** * Set the instance variables from the arguments provided here. * @param args bundle of arguments with keys named ARG_* *///from w ww .ja va2 s. c o m private void setInstanceFromBundle(Bundle args) { if (args == null) { return; } mParentFolder = args.getParcelable(ARG_PARENT_FOLDER); final String folderUri = args.getString(ARG_FOLDER_LIST_URI); if (folderUri != null) { mFolderListUri = Uri.parse(folderUri); } mExcludedFolderTypes = args.getIntegerArrayList(ARG_EXCLUDED_FOLDER_TYPES); }
From source file:org.proninyaroslav.libretorrent.fragments.DetailTorrentTrackersFragment.java
@Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); if (activity == null) { activity = (AppCompatActivity) getActivity(); }//from w w w .j a va 2 s .c o m trackersList = (RecyclerView) activity.findViewById(R.id.tracker_list); if (trackersList != null) { layoutManager = new LinearLayoutManager(activity); trackersList.setLayoutManager(layoutManager); /* * A RecyclerView by default creates another copy of the ViewHolder in order to * fade the views into each other. This causes the problem because the old ViewHolder gets * the payload but then the new one doesn't. So needs to explicitly tell it to reuse the old one. */ DefaultItemAnimator animator = new DefaultItemAnimator() { @Override public boolean canReuseUpdatedViewHolder(RecyclerView.ViewHolder viewHolder) { return true; } }; trackersList.setItemAnimator(animator); trackersList.addItemDecoration(new RecyclerViewDividerDecoration(activity.getApplicationContext(), R.drawable.torrent_list_divider)); adapter = new TrackerListAdapter(trackers, activity, R.layout.item_trackers_list, this); trackersList.setAdapter(adapter); } if (savedInstanceState != null) { selectedTrackers = savedInstanceState.getStringArrayList(TAG_SELECTED_TRACKERS); if (savedInstanceState.getBoolean(TAG_IN_ACTION_MODE, false)) { actionMode = activity.startActionMode(actionModeCallback); adapter.setSelectedItems(savedInstanceState.getIntegerArrayList(TAG_SELECTABLE_ADAPTER)); actionMode.setTitle(String.valueOf(adapter.getSelectedItemCount())); } } }
From source file:com.binomed.showtime.android.screen.results.tablet.CineShowTimeResultsTabletActivity.java
@Override protected void onPreRestoreBundle(Bundle savedInstanceState) { if (savedInstanceState != null) { boolean saved = savedInstanceState.getBoolean(ParamIntent.BUNDLE_SAVE, false); if (saved) { // Restore results getModelActivity().setNearResp((NearResp) savedInstanceState.getParcelable(ParamIntent.NEAR_RESP)); intentResult = new Intent(); getModelActivity().setForceResearch( savedInstanceState.getBoolean(ParamIntent.ACTIVITY_SEARCH_FORCE_REQUEST, false)); intentResult.putExtra(ParamIntent.ACTIVITY_SEARCH_FORCE_REQUEST, getModelActivity().isForceResearch()); getModelActivity().setCityName(savedInstanceState.getString(ParamIntent.ACTIVITY_SEARCH_CITY)); intentResult.putExtra(ParamIntent.ACTIVITY_SEARCH_CITY, getModelActivity().getCityName()); getModelActivity()//www . j a va 2 s.c om .setMovieName(savedInstanceState.getString(ParamIntent.ACTIVITY_SEARCH_MOVIE_NAME)); intentResult.putExtra(ParamIntent.ACTIVITY_SEARCH_MOVIE_NAME, getModelActivity().getMovieName()); intentResult.putExtra(ParamIntent.ACTIVITY_SEARCH_THEATER_ID, savedInstanceState.getString(ParamIntent.ACTIVITY_SEARCH_THEATER_ID)); getModelActivity().setDay(savedInstanceState.getInt(ParamIntent.ACTIVITY_SEARCH_DAY, 0)); intentResult.putExtra(ParamIntent.ACTIVITY_SEARCH_DAY, getModelActivity().getDay()); ArrayList<Integer> expandGroup = savedInstanceState .getIntegerArrayList(ParamIntent.ACTIVITY_SEARCH_GROUP_EXPAND); getModelActivity().setGroupExpanded(new HashSet<Integer>(expandGroup)); intentResult.putIntegerArrayListExtra(ParamIntent.ACTIVITY_SEARCH_GROUP_EXPAND, expandGroup); // We manage expand Groups if ((expandGroup != null) && (expandGroup.size() > 0) && (getModelActivity().getNearResp() .getTheaterList().size() < expandGroup.get(expandGroup.size() - 1))) { movieList = new ArrayList<MovieBean>(); theater = getModelActivity().getNearResp().getTheaterList() .get(expandGroup.get(expandGroup.size() - 1)); for (String movieId : theater.getMovieMap().keySet()) { movieList.add(getModelActivity().getNearResp().getMapMovies().get(movieId)); } } Double latitude = savedInstanceState.getDouble(ParamIntent.ACTIVITY_SEARCH_LATITUDE, 0); Double longitude = savedInstanceState.getDouble(ParamIntent.ACTIVITY_SEARCH_LONGITUDE, 0); if ((latitude != 0) && (longitude != 0)) { intentResult.putExtra(ParamIntent.ACTIVITY_SEARCH_LATITUDE, latitude); intentResult.putExtra(ParamIntent.ACTIVITY_SEARCH_LONGITUDE, longitude); } // Restore movie MovieBean movie = savedInstanceState.getParcelable(ParamIntent.MOVIE); if (movie != null) { TheaterBean theater = savedInstanceState.getParcelable(ParamIntent.THEATER); latitude = savedInstanceState.getDouble(ParamIntent.ACTIVITY_MOVIE_LATITUDE, -1); longitude = savedInstanceState.getDouble(ParamIntent.ACTIVITY_MOVIE_LONGITUDE, -1); intentStartMovieActivity = new Intent(this, CineShowTimeMovieActivity.class); intentStartMovieActivity.putExtra(ParamIntent.MOVIE_ID, movie.getId()); intentStartMovieActivity.putExtra(ParamIntent.MOVIE, movie); intentStartMovieActivity.putExtra(ParamIntent.THEATER_ID, theater.getId()); intentStartMovieActivity.putExtra(ParamIntent.THEATER, theater); intentStartMovieActivity.putExtra(ParamIntent.ACTIVITY_MOVIE_LATITUDE, latitude != -1 ? latitude : null); intentStartMovieActivity.putExtra(ParamIntent.ACTIVITY_MOVIE_LONGITUDE, longitude != -1 ? longitude : null); StringBuilder place = new StringBuilder(); if (theater != null) { if (theater.getPlace() != null) { if ((theater.getPlace().getCityName() != null // ) && (theater.getPlace().getCityName().length() > 0)) { place.append(theater.getPlace().getCityName()); } if ((theater.getPlace().getPostalCityNumber() != null // ) && (theater.getPlace().getPostalCityNumber().length() > 0)) { place.append(" ").append(theater.getPlace().getPostalCityNumber()); } if ((theater.getPlace().getCountryNameCode() != null // ) && (theater.getPlace().getCountryNameCode().length() > 0 // ) && (place.length() > 0)) { place.append(", ").append(theater.getPlace().getCountryNameCode()); //$NON-NLS-1$ } if (place.length() == 0) { place.append(theater.getPlace().getSearchQuery()); } } } intentStartMovieActivity.putExtra(ParamIntent.ACTIVITY_MOVIE_NEAR, place.toString()); Fragment fragmentRecycle = getSupportFragmentManager().findFragmentById(R.id.fragmentInfo); if ((fragmentRecycle != null) && (fragmentRecycle.getClass() == CineShowTimeMovieFragment.class)) { fragmentMovie = (CineShowTimeMovieFragment) fragmentRecycle; } else { fragmentMovie = new CineShowTimeMovieFragment(); } if ((fragmentRecycle != null) && !fragmentMovie.equals(fragmentRecycle)) { getSupportFragmentManager().beginTransaction().replace(R.id.fragmentInfo, fragmentMovie) .commit(); } } } } }
From source file:de.da_sense.moses.client.DetailFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mThisInstance = this; if (container == null) { return null; } else {//from ww w . j av a 2s. c o m container.setBackgroundColor(getResources().getColor(android.R.color.background_light)); // get the arguments final String appname; String description; String startDate, endDate, apkVersion; ArrayList<Integer> sensors; // if this gets started as a fragment if (savedInstanceState == null) { Log.d(LOG_TAG, "savedInstance == null"); savedInstanceState = getArguments(); Log.d(LOG_TAG, "NOW savedInstance = " + savedInstanceState); } // supposed to show a placeholder? String placeholder = savedInstanceState.getString("de.da_sense.moses.client.placeholder"); if (placeholder != null && placeholder.equals("yes")) { // inflate the placeholder Log.d(LOG_TAG, "onCreateView about to inflate PLACEHOLDER"); mDetailFragmentView = inflater.inflate(R.layout.app_info_placeholder, container, false); } else { // normal display of details // retrieve the arguments mIndex = savedInstanceState.getInt("de.da_sense.moses.client.index"); mBelongsTo = savedInstanceState.getInt(WelcomeActivity.KEY_BELONGS_TO); appname = savedInstanceState.getString("de.da_sense.moses.client.appname"); description = savedInstanceState.getString("de.da_sense.moses.client.description"); sensors = savedInstanceState.getIntegerArrayList("de.da_sense.moses.client.sensors"); mAPKID = savedInstanceState.getString(ExternalApplication.KEY_APK_ID); apkVersion = savedInstanceState.getString("de.da_sense.moses.client.apkVersion"); startDate = savedInstanceState.getString("de.da_sense.moses.client.startDate"); endDate = savedInstanceState.getString("de.da_sense.moses.client.endDate"); Log.d(LOG_TAG, "\nretrieved index = " + mIndex + "\nretrieved belongsTo = " + mBelongsTo + "\nretrieved appname = " + appname + "\nretireved description = " + description + "\nretireved sensors = " + sensors + "\nretireved apkid = " + mAPKID + "\nretireved startDate = " + startDate + "\nretireved endDate = " + endDate + "\nretireved apkVersion = " + apkVersion); if (appname != null) { // inflate the detail view Log.d(LOG_TAG, "onCreateView about to inflate View"); mDetailFragmentView = inflater.inflate(R.layout.app_info, container, false); // insert app name TextView t = (TextView) mDetailFragmentView.findViewById(R.id.usname); t.setText(appname); // insert description t = (TextView) mDetailFragmentView.findViewById(R.id.description); t.setMovementMethod(ScrollingMovementMethod.getInstance()); t.setText(description); t = (TextView) mDetailFragmentView.findViewById(R.id.tv_us_startdate); t.setText(startDate); t = (TextView) mDetailFragmentView.findViewById(R.id.tv_us_enddate); t.setText(endDate); t = (TextView) mDetailFragmentView.findViewById(R.id.tv_us_apkversion); t.setText(apkVersion); } else { Log.e(LOG_TAG, "User study's informations are missing"); return null; } } return mDetailFragmentView; } }
From source file:com.github.chenxiaolong.dualbootpatcher.switcher.RomDetailActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_rom_detail); Intent intent = getIntent();/* w w w. ja va 2 s .c om*/ mRomInfo = intent.getParcelableExtra(EXTRA_ROM_INFO); mBootedRomInfo = intent.getParcelableExtra(EXTRA_BOOTED_ROM_INFO); mActiveRomId = intent.getStringExtra(EXTRA_ACTIVE_ROM_ID); if (savedInstanceState != null) { mTaskIdCacheWallpaper = savedInstanceState.getInt(EXTRA_STATE_TASK_ID_CACHE_WALLPAPER); mTaskIdSwitchRom = savedInstanceState.getInt(EXTRA_STATE_TASK_ID_SWITCH_ROM); mTaskIdSetKernel = savedInstanceState.getInt(EXTRA_STATE_TASK_ID_SET_KERNEL); mTaskIdUpdateRamdisk = savedInstanceState.getInt(EXTRA_STATE_TASK_ID_UPDATE_RAMDISK); mTaskIdWipeRom = savedInstanceState.getInt(EXTRA_STATE_TASK_ID_WIPE_ROM); mTaskIdCreateLauncher = savedInstanceState.getInt(EXTRA_STATE_TASK_ID_CREATE_LAUNCHER); mTaskIdGetRomDetails = savedInstanceState.getInt(EXTRA_STATE_TASK_ID_GET_ROM_DETAILS); mTaskIdsToRemove = savedInstanceState.getIntegerArrayList(EXTRA_STATE_TASK_IDS_TO_REMOVE); mResultIntent = savedInstanceState.getParcelable(EXTRA_STATE_RESULT_INTENT); setResult(RESULT_OK, mResultIntent); mBackupTargets = savedInstanceState.getStringArray(EXTRA_STATE_BACKUP_TARGETS); } final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); mCoordinator = (CoordinatorLayout) findViewById(R.id.coordinator); mCollapsing = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar); mWallpaper = (ImageView) findViewById(R.id.wallpaper); mFab = (FloatingActionButton) findViewById(R.id.fab); mRV = (RecyclerView) findViewById(R.id.main_rv); mFab.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { switchRom(false); } }); updateTitle(); updateMbtoolStatus(); initializeRecyclerView(); populateRomCardItem(); populateInfoItems(); populateActionItems(); }
From source file:com.amaze.filemanager.fragments.Main.java
void retrieveFromSavedInstance(final Bundle savedInstanceState) { Bundle b = new Bundle(); String cur = savedInstanceState.getString("CURRENT_PATH"); if (cur != null) { b.putInt("index", savedInstanceState.getInt("index")); b.putInt("top", savedInstanceState.getInt("top")); scrolls.put(cur, b);// w w w.jav a 2 s . c o m openMode = savedInstanceState.getInt("openMode", 0); if (openMode == 1) smbPath = savedInstanceState.getString("SmbPath"); LIST_ELEMENTS = savedInstanceState.getParcelableArrayList("list"); folder_count = savedInstanceState.getInt("folder_count", 0); file_count = savedInstanceState.getInt("file_count", 0); results = savedInstanceState.getBoolean("results"); adapter = (Recycleradapter) savedInstanceState.getParcelable("adapter"); createViews(LIST_ELEMENTS, true, (CURRENT_PATH), openMode, true, !IS_LIST); if (savedInstanceState.getBoolean("selection")) { for (int i : savedInstanceState.getIntegerArrayList("position")) { adapter.toggleChecked(i); } } } }
From source file:com.filemanager.free.fragments.Main.java
void retrieveFromSavedInstance(final Bundle savedInstanceState) { Bundle b = new Bundle(); String cur = savedInstanceState.getString("CURRENT_PATH"); if (cur != null) { b.putInt("index", savedInstanceState.getInt("index")); b.putInt("top", savedInstanceState.getInt("top")); scrolls.put(cur, b);/*w w w .ja va 2 s . com*/ openMode = savedInstanceState.getInt("openMode", 0); if (openMode == 1) smbPath = savedInstanceState.getString("SmbPath"); LIST_ELEMENTS = savedInstanceState.getParcelableArrayList("list"); CURRENT_PATH = cur; folder_count = savedInstanceState.getInt("folder_count", 0); file_count = savedInstanceState.getInt("file_count", 0); results = savedInstanceState.getBoolean("results"); MAIN_ACTIVITY.updatePath(CURRENT_PATH, results, openMode, folder_count, file_count); createViews(LIST_ELEMENTS, true, (CURRENT_PATH), openMode, results, !IS_LIST); if (savedInstanceState.getBoolean("selection")) { for (int i : savedInstanceState.getIntegerArrayList("position")) { adapter.toggleChecked(i); } } } }
From source file:org.thialfihar.android.apg.ui.EditKeyActivity.java
/** * Handle intent action to create new key * * @param intent//from w ww . j a v a 2 s . c om */ private void handleActionCreateKey(Intent intent) { Bundle extras = intent.getExtras(); mCurrentPassphrase = ""; mIsBrandNewKeyring = true; if (extras != null) { // if userId is given, prefill the fields if (extras.containsKey(EXTRA_USER_IDS)) { Log.d(Constants.TAG, "UserIds are given!"); mUserIds.add(extras.getString(EXTRA_USER_IDS)); } // if no passphrase is given if (extras.containsKey(EXTRA_NO_PASSPHRASE)) { boolean noPassphrase = extras.getBoolean(EXTRA_NO_PASSPHRASE); if (noPassphrase) { // check "no passphrase" checkbox and remove button mNoPassphrase.setChecked(true); mChangePassphrase.setVisibility(View.GONE); } } // generate key if (extras.containsKey(EXTRA_GENERATE_DEFAULT_KEYS)) { boolean generateDefaultKeys = extras.getBoolean(EXTRA_GENERATE_DEFAULT_KEYS); if (generateDefaultKeys) { // Send all information needed to service generate keys in other thread final Intent serviceIntent = new Intent(this, ApgIntentService.class); serviceIntent.setAction(ApgIntentService.ACTION_GENERATE_DEFAULT_RSA_KEYS); // fill values for this action Bundle data = new Bundle(); data.putString(ApgIntentService.GENERATE_KEY_SYMMETRIC_PASSPHRASE, mCurrentPassphrase); serviceIntent.putExtra(ApgIntentService.EXTRA_DATA, data); // Message is received after generating is done in ApgIntentService ApgIntentServiceHandler saveHandler = new ApgIntentServiceHandler(this, getResources().getQuantityString(R.plurals.progress_generating, 1), ProgressDialog.STYLE_HORIZONTAL, true, new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { // Stop key generation on cancel stopService(serviceIntent); EditKeyActivity.this.setResult(Activity.RESULT_CANCELED); EditKeyActivity.this.finish(); } }) { @Override public void handleMessage(Message message) { // handle messages by standard ApgIntentServiceHandler first super.handleMessage(message); if (message.arg1 == ApgIntentServiceHandler.MESSAGE_OKAY) { // get new key from data bundle returned from service Bundle data = message.getData(); ArrayList<PGPSecretKey> newKeys = PgpConversionHelper.BytesToPGPSecretKeyList( data.getByteArray(ApgIntentService.RESULT_NEW_KEY)); ArrayList<Integer> keyUsageFlags = data .getIntegerArrayList(ApgIntentService.RESULT_KEY_USAGES); if (newKeys.size() == keyUsageFlags.size()) { for (int i = 0; i < newKeys.size(); ++i) { mKeys.add(newKeys.get(i)); mKeysUsages.add(keyUsageFlags.get(i)); } } buildLayout(true); } } }; // Create a new Messenger for the communication back Messenger messenger = new Messenger(saveHandler); serviceIntent.putExtra(ApgIntentService.EXTRA_MESSENGER, messenger); saveHandler.showProgressDialog(this); // start service with intent startService(serviceIntent); } } } else { buildLayout(false); } }
From source file:com.igniva.filemanager.fragments.Main.java
void retrieveFromSavedInstance(final Bundle savedInstanceState) { Bundle b = new Bundle(); String cur = savedInstanceState.getString("CURRENT_PATH"); if (cur != null) { b.putInt("index", savedInstanceState.getInt("index")); b.putInt("top", savedInstanceState.getInt("top")); scrolls.put(cur, b);/*from ww w . j a va2 s. c o m*/ openMode = savedInstanceState.getInt("openMode", 0); if (openMode == 1) smbPath = savedInstanceState.getString("SmbPath"); LIST_ELEMENTS = savedInstanceState.getParcelableArrayList("list"); CURRENT_PATH = cur; folder_count = savedInstanceState.getInt("folder_count", 0); file_count = savedInstanceState.getInt("file_count", 0); results = savedInstanceState.getBoolean("results"); MAIN_ACTIVITY.updatePath(CURRENT_PATH, results, openMode, folder_count, file_count); createViews(LIST_ELEMENTS, true, (CURRENT_PATH), openMode, results, !IS_LIST); if (savedInstanceState.getBoolean("selection")) { for (int i : savedInstanceState.getIntegerArrayList("position")) { adapter.toggleChecked(i, null); } } } }