List of usage examples for android.os Bundle putParcelable
public void putParcelable(@Nullable String key, @Nullable Parcelable value)
From source file:com.artemchep.horario.ui.fragments.details.MooDetailsFragment.java
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putParcelable(EXTRA_MODEL, mModel); }
From source file:fr.cph.chicago.adapter.SearchAdapter.java
@Override public final View getView(final int position, View convertView, final ViewGroup parent) { LayoutInflater vi = (LayoutInflater) ChicagoTracker.getAppContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = vi.inflate(R.layout.list_search, null); TextView rounteName = (TextView) convertView.findViewById(R.id.station_name); if (position < mTrains.size()) { final Station station = (Station) getItem(position); Set<TrainLine> lines = station.getLines(); rounteName.setText(station.getName()); LinearLayout stationColorView = (LinearLayout) convertView.findViewById(R.id.station_color); int indice = 0; for (TrainLine tl : lines) { TextView textView = new TextView(mContext); textView.setBackgroundColor(tl.getColor()); textView.setText(" "); textView.setTextSize(mContext.getResources().getDimension(R.dimen.activity_list_station_colors)); stationColorView.addView(textView); if (indice != lines.size()) { textView = new TextView(mContext); textView.setText(""); textView.setPadding(0, 0, (int) mContext.getResources().getDimension(R.dimen.activity_list_station_colors_space), 0);//from ww w.jav a2 s . c o m textView.setTextSize( mContext.getResources().getDimension(R.dimen.activity_list_station_colors)); stationColorView.addView(textView); } indice++; } convertView.setOnClickListener( new FavoritesTrainOnClickListener(mActivity, mContainer, station.getId(), lines)); } else if (position < mTrains.size() + mBuses.size()) { final BusRoute busRoute = (BusRoute) getItem(position); TextView type = (TextView) convertView.findViewById(R.id.train_bus_type); type.setText("B"); rounteName.setText(busRoute.getId() + " " + busRoute.getName()); final TextView loadingTextView = (TextView) convertView.findViewById(R.id.loading_text_view); convertView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loadingTextView.setVisibility(LinearLayout.VISIBLE); mActivity.startRefreshAnimation(); new DirectionAsyncTask().execute(busRoute, loadingTextView); } }); } else { final BikeStation bikeStation = (BikeStation) getItem(position); TextView type = (TextView) convertView.findViewById(R.id.train_bus_type); type.setText("D"); rounteName.setText(bikeStation.getName()); convertView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(ChicagoTracker.getAppContext(), BikeStationActivity.class); Bundle extras = new Bundle(); extras.putParcelable("station", bikeStation); intent.putExtras(extras); mActivity.startActivity(intent); mActivity.overridePendingTransition(R.anim.slide_in, R.anim.slide_out); } }); } return convertView; }
From source file:ca.ualberta.cmput301w14t08.geochan.fragments.PostFragment.java
/** * Handles the return from the camera activity * /* w ww. ja v a 2s . c o m*/ * @param requestCode Type of activity requested * @param resultCode Code indicating activity success/failure * @param data Image data associated with the camera activity */ public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == Activity.RESULT_OK) { if (requestCode == ImageHelper.REQUEST_CAMERA) { Bitmap imageBitmap = null; try { imageBitmap = BitmapFactory.decodeStream( getActivity().getContentResolver().openInputStream(Uri.fromFile(imageFile))); } catch (FileNotFoundException e) { Toaster.toastShort("Error. Could not load image."); } Bitmap squareBitmap = ThumbnailUtils.extractThumbnail(imageBitmap, 100, 100); image = scaleImage(imageBitmap); imageThumb = squareBitmap; Bundle bundle = getArguments(); bundle.putParcelable("IMAGE_THUMB", imageThumb); bundle.putParcelable("IMAGE_FULL", image); } else if (requestCode == ImageHelper.REQUEST_GALLERY) { Bitmap imageBitmap = null; try { imageBitmap = MediaStore.Images.Media.getBitmap(getActivity().getContentResolver(), data.getData()); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } Bitmap squareBitmap = ThumbnailUtils.extractThumbnail(imageBitmap, 100, 100); image = scaleImage(imageBitmap); imageThumb = squareBitmap; Bundle bundle = getArguments(); bundle.putParcelable("IMAGE_THUMB", imageThumb); bundle.putParcelable("IMAGE_FULL", image); } } }
From source file:com.bb.hbx.activitiy.InsurancePlanActivity.java
@Override public void onClick(View v) { switch (v.getId()) { case R.id.commit_tv: Bundle bundle = new Bundle(); bundle.putParcelable("GetCarInsCalcBean", getCarInsCalcBean); bundle.putParcelableArrayList("benefitList", (ArrayList<? extends Parcelable>) benefitTotalList); if (getCarInsCalcBean == null) { showTip("??"); return; }// w ww. jav a2s.com bundle.putString("insurerId", insurerId); bundle.putString("serialId", serialId); bundle.putString("licenseNo", licenseNo); bundle.putString("driveName", driveName); bundle.putString("idNo", idNo); bundle.putString("mobile", mobile); bundle.putString("insureName", insureName); bundle.putString("city", city); bundle.putString("carExtras", carExtrasForPay); bundle.putString("carPrice", getCarInsCalcBean.getTotalPreium()); AppManager.getInstance().showActivity(CarOrderConfirmActivity.class, bundle); break; default: break; } }
From source file:net.openid.appauth.AuthorizationManagementActivity.java
@Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putBoolean(KEY_AUTHORIZATION_STARTED, mAuthorizationStarted); outState.putParcelable(KEY_AUTH_INTENT, mAuthIntent); outState.putString(KEY_AUTH_REQUEST, mAuthRequest.jsonSerializeString()); outState.putParcelable(KEY_COMPLETE_INTENT, mCompleteIntent); outState.putParcelable(KEY_CANCEL_INTENT, mCancelIntent); }
From source file:bander.notepad.NoteEditAppCompat.java
@Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putParcelable(ORIGINAL_NOTE, mOriginalNote); }
From source file:com.binary_machinery.avalonschedule.view.schedule.SchedulePagerAdapter.java
@Override public Fragment getItem(int position) { long from = getWeekBeginning(position).getTimeInMillis(); long to = getWeekEnd(position).getTimeInMillis(); Map<Integer, ScheduleRecord> recordsByWeekday = new HashMap<>(7); for (ScheduleRecord record : m_records) { long time = record.date.getTime(); if (from <= time && time <= to) { Calendar c = Calendar.getInstance(); c.setTime(record.date);// ww w .j a v a 2 s. co m recordsByWeekday.put(c.get(Calendar.DAY_OF_WEEK), record); } } Calendar calendar = getWeekBeginning(position); for (int i = Calendar.SUNDAY; i <= Calendar.SATURDAY; ++i) { if (!recordsByWeekday.containsKey(i)) { ScheduleRecord stubRecord = new ScheduleRecord(); calendar.set(Calendar.DAY_OF_WEEK, i); stubRecord.date = calendar.getTime(); stubRecord.weekday = m_context.getResources().getStringArray(R.array.weekdays)[i - 1]; recordsByWeekday.put(i, stubRecord); } } Fragment fragment = new SchedulePageFragment(); Bundle args = new Bundle(); for (Map.Entry<Integer, ScheduleRecord> entry : recordsByWeekday.entrySet()) { int weekdayIdx = entry.getKey(); ScheduleRecord record = entry.getValue(); String key = SchedulePageFragment.ARG_DAY + weekdayIdx; args.putParcelable(key, record); } fragment.setArguments(args); return fragment; }
From source file:cn.njmeter.njmeter.widget.spinner.NiceSpinner.java
@Override public Parcelable onSaveInstanceState() { Bundle bundle = new Bundle(); bundle.putParcelable(INSTANCE_STATE, super.onSaveInstanceState()); bundle.putInt(SELECTED_INDEX, selectedIndex); bundle.putBoolean(IS_ARROW_HIDDEN, isArrowHidden); bundle.putInt(ARROW_DRAWABLE_RES_ID, arrowDrawableResId); if (popupWindow != null) { bundle.putBoolean(IS_POPUP_SHOWING, popupWindow.isShowing()); }/*from w ww .j ava2s . c o m*/ return bundle; }
From source file:dtu.ds.warnme.app.activity.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap(); map.setMapType(GoogleMap.MAP_TYPE_NORMAL); map.setMyLocationEnabled(true);//from w w w.j av a 2s .c o m map.getUiSettings().setAllGesturesEnabled(true); map.getUiSettings().setCompassEnabled(true); locationSource = new FollowMeLocationSource(this, getApplicationContext(), map); locationSource.getBestAvailableProvider(); map.setLocationSource(locationSource); buttonReport = (Button) findViewById(R.id.button_report); buttonReport.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { buttonReport.setEnabled(false); FragmentTransaction ft = getFragmentManager().beginTransaction(); Fragment prev = getFragmentManager().findFragmentByTag(ReportDialog.class.getName()); if (prev != null) { ft.remove(prev); } ft.addToBackStack(null); Bundle args = new Bundle(); args.putParcelable(KEY_CURRENT_LOCATION, locationSource.getCurrentLocation()); ReportDialog reportDialog = new ReportDialog(); reportDialog.setArguments(args); reportDialog.show(ft, ReportDialog.class.getName()); } }); verifyLogin(); }
From source file:com.application.treasurehunt.ScanQRCodeActivity.java
@Override public void onSaveInstanceState(Bundle savedInstanceState) { savedInstanceState.putParcelable("lastLocation", mLastLocation); savedInstanceState.putBoolean("mLocationServicesChecked", mLocationServicesChecked); super.onSaveInstanceState(savedInstanceState); }