List of usage examples for android.text.format DateUtils formatDateTime
public static String formatDateTime(Context context, long millis, int flags)
From source file:org.que.activities.fragments.CalendarBookedFragment.java
@Override public boolean setViewValue(View view, Cursor cursor, int columnIndex) { // This helps the adapter assign and format the data from the cursor to the view. The cases are for // the row IDs which point to the appropriate textviews. long time = 0; String formattedTime = null;//from ww w. j a v a 2 s. c o m switch (columnIndex) { case 2: //Start Time time = cursor.getLong(columnIndex); formattedTime = DateUtils.formatDateTime(getActivity(), time, DateUtils.FORMAT_SHOW_TIME); ((TextView) view).setText(formattedTime); break; case 3://End Time time = cursor.getLong(columnIndex); formattedTime = DateUtils.formatDateTime(getActivity(), time, DateUtils.FORMAT_SHOW_TIME); ((TextView) view).setText(formattedTime); break; case 5: //Location ((TextView) view).setText(cursor.getString(columnIndex + 1)); break; default: return (false); } return true; }
From source file:org.jraf.android.bikey.app.ride.detail.RideDetailActivity.java
private void loadData() { new TaskFragment(new Task<RideDetailActivity>() { private String mName; private Date mCreatedDate; private long mDuration; private float mDistance; private float mAverageMovingSpeed; private float mMaxSpeed; private Date mFirstActivatedDate; private Long mMovingDuration; private Float mAverageCadence; private float mMaxCadence; private List<LatLng> mLatLngArray; private float[] mSpeedArray; private float[] mCadenceArray; private float mMinHeartRate; private float mMaxHeartRate; private Float mAverageHeartRate; private float[] mHeartRateArray; @Override/*from www . ja va 2s.c om*/ protected void doInBackground() throws Throwable { RideManager rideManager = RideManager.get(); Uri rideUri = getActivity().mRideUri; RideCursor rideCursor = rideManager.query(rideUri); mName = rideCursor.getName(); mCreatedDate = rideCursor.getCreatedDate(); mFirstActivatedDate = rideCursor.getFirstActivatedDate(); mDuration = rideCursor.getDuration(); mDistance = rideCursor.getDistance(); rideCursor.close(); LogManager logManager = LogManager.get(); mAverageMovingSpeed = logManager.getAverageMovingSpeed(rideUri); mMaxSpeed = logManager.getMaxSpeed(rideUri); mMovingDuration = logManager.getMovingDuration(rideUri); mAverageCadence = logManager.getAverageCadence(rideUri); mMaxCadence = logManager.getMaxCadence(rideUri); mMinHeartRate = logManager.getMinHeartRate(rideUri); mMaxHeartRate = logManager.getMaxHeartRate(rideUri); mAverageHeartRate = logManager.getAverageHeartRate(rideUri); mLatLngArray = logManager.getLatLngArray(rideUri, POINTS_TO_GRAPH); List<Float> speedList = logManager.getSpeedArray(rideUri, POINTS_TO_GRAPH); mSpeedArray = CollectionUtil.unwrap(speedList.toArray(new Float[speedList.size()])); mSpeedArray = MathUtil.getMovingAverage(mSpeedArray, mSpeedArray.length / 10); List<Float> cadenceList = logManager.getCadenceArray(rideUri, POINTS_TO_GRAPH); mCadenceArray = CollectionUtil.unwrap(cadenceList.toArray(new Float[cadenceList.size()])); mCadenceArray = MathUtil.getMovingAverage(mCadenceArray, mCadenceArray.length / 10); List<Float> heartRateList = logManager.getHeartRateArray(rideUri, POINTS_TO_GRAPH); mHeartRateArray = CollectionUtil.unwrap(heartRateList.toArray(new Float[heartRateList.size()])); mHeartRateArray = MathUtil.getMovingAverage(mHeartRateArray, mHeartRateArray.length / 10); } @Override protected void onPostExecuteOk() { RideDetailActivity a = getActivity(); if (mName != null) a.setTitle(mName); a.mTxtDateTimeDate.setText(DateUtils.formatDateTime(a, mCreatedDate.getTime(), DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_WEEKDAY | DateUtils.FORMAT_SHOW_YEAR)); if (mLatLngArray.isEmpty()) { // Special case: we have no points. Show empty screen. a.mConMap.setVisibility(View.GONE); a.mConDetailedInfo.setVisibility(View.GONE); a.mTxtEmpty.setVisibility(View.VISIBLE); return; } if (mFirstActivatedDate != null) { a.mTxtDateTimeStart.setText( DateUtils.formatDateTime(a, mFirstActivatedDate.getTime(), DateUtils.FORMAT_SHOW_TIME)); a.mTxtDateTimeFinish.setText(DateUtils.formatDateTime(a, mFirstActivatedDate.getTime() + mDuration, DateUtils.FORMAT_SHOW_TIME)); } if (mMovingDuration != null) a.mTxtDurationMoving.setText(DateTimeUtil.formatDuration(a, mMovingDuration.longValue())); a.mTxtDurationTotal.setText(DateTimeUtil.formatDuration(a, mDuration)); a.mTxtDistanceTotal.setText(UnitUtil.formatDistance(mDistance, true, .85f, false)); a.mTxtSpeedAverage.setText(UnitUtil.formatSpeed(mAverageMovingSpeed, true, .85f, false)); a.mTxtSpeedMax.setText(UnitUtil.formatSpeed(mMaxSpeed, true, .85f, false)); // Cadence if (mAverageCadence == null) { a.mTxtCadenceSectionTitle.setVisibility(View.GONE); a.mTxtCadenceAverage.setVisibility(View.GONE); a.mTxtCadenceMax.setVisibility(View.GONE); a.mGrpCadence.setVisibility(View.GONE); } else { a.mTxtCadenceSectionTitle.setVisibility(View.VISIBLE); a.mTxtCadenceAverage.setVisibility(View.VISIBLE); a.mTxtCadenceAverage.setText(UnitUtil.formatCadence(mAverageCadence, true)); a.mTxtCadenceMax.setVisibility(View.VISIBLE); a.mTxtCadenceMax.setText(UnitUtil.formatCadence(mMaxCadence, true)); a.mGrpCadence.setVisibility(View.VISIBLE); a.mGrpCadence.setColor(0, a.getResources().getColor(R.color.graph_line)); a.mGrpCadence.setValues(0, mCadenceArray); } // Map if (mLatLngArray.size() > 0) { PolylineOptions polylineOptions = new PolylineOptions().addAll(mLatLngArray); polylineOptions.color(getResources().getColor(R.color.map_polyline)); a.getMap().addPolyline(polylineOptions); // Calculate bounds LatLngBounds bounds = new LatLngBounds(mLatLngArray.get(0), mLatLngArray.get(0)); for (LatLng latLng : mLatLngArray) { bounds = bounds.including(latLng); } int padding = getResources().getDimensionPixelSize(R.dimen.ride_detail_map_padding); a.getMap().moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, padding)); a.mConMap.setVisibility(View.VISIBLE); } // Speed graph a.mGrpSpeed.setColor(0, a.getResources().getColor(R.color.graph_line)); a.mGrpSpeed.setValues(0, mSpeedArray); // Heart rate if (mAverageHeartRate == null) { a.mTxtHeartRateSectionTitle.setVisibility(View.GONE); a.mTxtHeartRateAverage.setVisibility(View.GONE); a.mTxtHeartRateMin.setVisibility(View.GONE); a.mTxtHeartRateMax.setVisibility(View.GONE); a.mGrpHeartRate.setVisibility(View.GONE); } else { a.mTxtHeartRateSectionTitle.setVisibility(View.VISIBLE); a.mTxtHeartRateAverage.setVisibility(View.VISIBLE); a.mTxtHeartRateAverage.setText(UnitUtil.formatHeartRate(mAverageHeartRate.intValue(), true)); a.mTxtHeartRateMin.setVisibility(View.VISIBLE); a.mTxtHeartRateMin.setText(UnitUtil.formatHeartRate((int) mMinHeartRate, true)); a.mTxtHeartRateMax.setVisibility(View.VISIBLE); a.mTxtHeartRateMax.setText(UnitUtil.formatHeartRate((int) mMaxHeartRate, true)); a.mGrpHeartRate.setVisibility(View.VISIBLE); a.mGrpHeartRate.setColor(0, a.getResources().getColor(R.color.graph_line)); a.mGrpHeartRate.setValues(0, mHeartRateArray); } } }).execute(getSupportFragmentManager()); }
From source file:org.onebusaway.android.ui.ArrivalsListAdapterStyleB.java
@Override protected void initView(final View view, CombinedArrivalInfoStyleB combinedArrivalInfoStyleB) { final ArrivalInfo stopInfo = combinedArrivalInfoStyleB.getArrivalInfoList().get(0); final ObaArrivalInfo arrivalInfo = stopInfo.getInfo(); final Context context = getContext(); LayoutInflater inflater = LayoutInflater.from(context); TextView routeName = (TextView) view.findViewById(R.id.routeName); TextView destination = (TextView) view.findViewById(R.id.routeDestination); // TableLayout that we will fill with TableRows of arrival times TableLayout arrivalTimesLayout = (TableLayout) view.findViewById(R.id.arrivalTimeLayout); arrivalTimesLayout.removeAllViews(); Resources r = view.getResources(); ImageButton starBtn = (ImageButton) view.findViewById(R.id.route_star); starBtn.setColorFilter(r.getColor(R.color.theme_primary)); ImageButton mapImageBtn = (ImageButton) view.findViewById(R.id.mapImageBtn); mapImageBtn.setColorFilter(r.getColor(R.color.theme_primary)); ImageButton routeMoreInfo = (ImageButton) view.findViewById(R.id.route_more_info); routeMoreInfo.setColorFilter(r.getColor(R.color.switch_thumb_normal_material_dark)); starBtn.setImageResource(// w ww . j a v a 2s. co m stopInfo.isRouteAndHeadsignFavorite() ? R.drawable.focus_star_on : R.drawable.focus_star_off); starBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // Show dialog for setting route favorite RouteFavoriteDialogFragment dialog = new RouteFavoriteDialogFragment.Builder( stopInfo.getInfo().getRouteId(), stopInfo.getInfo().getHeadsign()) .setRouteShortName(stopInfo.getInfo().getShortName()) .setRouteLongName(stopInfo.getInfo().getRouteLongName()) .setStopId(stopInfo.getInfo().getStopId()) .setFavorite(!stopInfo.isRouteAndHeadsignFavorite()).build(); dialog.setCallback(new RouteFavoriteDialogFragment.Callback() { @Override public void onSelectionComplete(boolean savedFavorite) { if (savedFavorite) { mFragment.refreshLocal(); } } }); dialog.show(mFragment.getFragmentManager(), RouteFavoriteDialogFragment.TAG); } }); // Setup map mapImageBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mFragment.showRouteOnMap(stopInfo); } }); // Setup more routeMoreInfo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mFragment.showListItemMenu(view, stopInfo); } }); routeName.setText(arrivalInfo.getShortName()); destination.setText(MyTextUtils.toTitleCase(arrivalInfo.getHeadsign())); // Loop through the arrival times and create the TableRows that contains the data for (int i = 0; i < combinedArrivalInfoStyleB.getArrivalInfoList().size(); i++) { final ArrivalInfo arrivalRow = combinedArrivalInfoStyleB.getArrivalInfoList().get(i); final ObaArrivalInfo tempArrivalInfo = arrivalRow.getInfo(); long scheduledTime = tempArrivalInfo.getScheduledArrivalTime(); // Create a new row to be added final TableRow tr = (TableRow) inflater.inflate(R.layout.arrivals_list_tr_template_style_b, null); // Layout and views to inflate from XML templates RelativeLayout layout; TextView scheduleView, estimatedView, statusView; View divider; if (i == 0) { // Use larger styled layout/view for next arrival time layout = (RelativeLayout) inflater.inflate(R.layout.arrivals_list_rl_template_style_b_large, null); scheduleView = (TextView) inflater .inflate(R.layout.arrivals_list_tv_template_style_b_schedule_large, null); estimatedView = (TextView) inflater .inflate(R.layout.arrivals_list_tv_template_style_b_estimated_large, null); statusView = (TextView) inflater.inflate(R.layout.arrivals_list_tv_template_style_b_status_large, null); } else { // Use smaller styled layout/view for further out times layout = (RelativeLayout) inflater.inflate(R.layout.arrivals_list_rl_template_style_b_small, null); scheduleView = (TextView) inflater .inflate(R.layout.arrivals_list_tv_template_style_b_schedule_small, null); estimatedView = (TextView) inflater .inflate(R.layout.arrivals_list_tv_template_style_b_estimated_small, null); statusView = (TextView) inflater.inflate(R.layout.arrivals_list_tv_template_style_b_status_small, null); } // Set arrival times and status in views scheduleView.setText(DateUtils.formatDateTime(context, scheduledTime, DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_NO_NOON | DateUtils.FORMAT_NO_MIDNIGHT)); if (arrivalRow.getPredicted()) { long eta = arrivalRow.getEta(); if (eta == 0) { estimatedView.setText(R.string.stop_info_eta_now); } else { estimatedView.setText(eta + " min"); } } else { estimatedView.setText(R.string.stop_info_eta_unknown); } statusView.setText(arrivalRow.getStatusText()); int colorCode = arrivalRow.getColor(); statusView.setBackgroundResource(R.drawable.round_corners_style_b_status); GradientDrawable d = (GradientDrawable) statusView.getBackground(); d.setColor(context.getResources().getColor(colorCode)); int alpha; if (i == 0) { // Set next arrival alpha = (int) (1.0f * 255); // X percent transparency } else { // Set smaller rows alpha = (int) (.35f * 255); // X percent transparency } d.setAlpha(alpha); // Set padding on status view int pSides = UIUtils.dpToPixels(context, 5); int pTopBottom = UIUtils.dpToPixels(context, 2); statusView.setPadding(pSides, pTopBottom, pSides, pTopBottom); // Add TextViews to layout layout.addView(scheduleView); layout.addView(statusView); layout.addView(estimatedView); // Make sure the TextViews align left/center/right of parent relative layout RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) scheduleView.getLayoutParams(); params1.addRule(RelativeLayout.ALIGN_PARENT_LEFT); params1.addRule(RelativeLayout.CENTER_VERTICAL); scheduleView.setLayoutParams(params1); RelativeLayout.LayoutParams params2 = (RelativeLayout.LayoutParams) statusView.getLayoutParams(); params2.addRule(RelativeLayout.CENTER_IN_PARENT); // Give status view a little extra margin int p = UIUtils.dpToPixels(context, 3); params2.setMargins(p, p, p, p); statusView.setLayoutParams(params2); RelativeLayout.LayoutParams params3 = (RelativeLayout.LayoutParams) estimatedView.getLayoutParams(); params3.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); params3.addRule(RelativeLayout.CENTER_VERTICAL); estimatedView.setLayoutParams(params3); // Add layout to TableRow tr.addView(layout); // Add the divider, if its not the first row if (i != 0) { int dividerHeight = UIUtils.dpToPixels(context, 1); divider = inflater.inflate(R.layout.arrivals_list_divider_template_style_b, null); divider.setLayoutParams( new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, dividerHeight)); arrivalTimesLayout.addView(divider); } // Add click listener tr.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mFragment.showListItemMenu(tr, arrivalRow); } }); // Add TableRow to container layout arrivalTimesLayout.addView(tr, new TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.MATCH_PARENT)); } // Show or hide reminder for this trip ContentValues values = null; if (mTripsForStop != null) { values = mTripsForStop.getValues(arrivalInfo.getTripId()); } if (values != null) { String reminderName = values.getAsString(ObaContract.Trips.NAME); TextView reminder = (TextView) view.findViewById(R.id.reminder); if (reminderName.length() == 0) { reminderName = context.getString(R.string.trip_info_noname); } reminder.setText(reminderName); Drawable d = reminder.getCompoundDrawables()[0]; d = DrawableCompat.wrap(d); DrawableCompat.setTint(d.mutate(), view.getResources().getColor(R.color.theme_primary)); reminder.setCompoundDrawables(d, null, null, null); reminder.setVisibility(View.VISIBLE); } else { // Explicitly set reminder to invisible because we might be reusing // this view. View reminder = view.findViewById(R.id.reminder); reminder.setVisibility(View.GONE); } }
From source file:com.android.dialer.calllog.PhoneCallDetailsHelper.java
/** * Get the granular version of the call date/time of the call. The result is always in the form * 'DATE at TIME'. The date value changes based on when the call was created. * * If created today, DATE is 'Today'//from w w w .j a va 2 s.co m * If created this year, DATE is 'MMM dd' * Otherwise, DATE is 'MMM dd, yyyy' * * TIME is the localized time format, e.g. 'hh:mm a' or 'HH:mm' * * @param details Call details to use * @return String representing when the call occurred */ public CharSequence getGranularDateTime(PhoneCallDetails details) { return mResources.getString(R.string.voicemailCallLogDateTimeFormat, getGranularDate(details.date), DateUtils.formatDateTime(mContext, details.date, DateUtils.FORMAT_SHOW_TIME)); }
From source file:com.android.dialer.calllog.PhoneCallDetailsHelper.java
/** * Get the granular version of the call date. See {@link #getGranularDateTime(PhoneCallDetails)} */// w ww. ja v a 2 s .co m private String getGranularDate(long date) { if (DateUtils.isToday(date)) { return mResources.getString(R.string.voicemailCallLogToday); } return DateUtils.formatDateTime(mContext, date, DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_ABBREV_MONTH | (shouldShowYear(date) ? DateUtils.FORMAT_SHOW_YEAR : DateUtils.FORMAT_NO_YEAR)); }
From source file:org.jraf.android.piclabel.app.form.FormActivity.java
private String parseExifDateTime(String s) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy':'MM':'dd' 'HH':'mm':'ss", Locale.US); Date date;//ww w . j a va 2 s.c o m try { date = sdf.parse(s); } catch (ParseException e) { Log.e(TAG, "decodeExifDateTime Could not parse " + s, e); return null; } return DateUtils.formatDateTime(this, date.getTime(), DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_WEEKDAY | DateUtils.FORMAT_SHOW_YEAR); }
From source file:org.onebusaway.android.ui.TripDetailsListFragment.java
private void setUpHeader() { ObaTripStatus status = mTripInfo.getStatus(); ObaReferences refs = mTripInfo.getRefs(); Context context = getActivity(); String tripId = mTripInfo.getId(); ObaTrip trip = refs.getTrip(tripId); ObaRoute route = refs.getRoute(trip.getRouteId()); TextView shortName = (TextView) getView().findViewById(R.id.short_name); shortName.setText(route.getShortName()); TextView longName = (TextView) getView().findViewById(R.id.long_name); longName.setText(trip.getHeadsign()); TextView agency = (TextView) getView().findViewById(R.id.agency); agency.setText(refs.getAgency(route.getAgencyId()).getName()); TextView vehicleView = (TextView) getView().findViewById(R.id.vehicle); TextView vehicleDeviation = (TextView) getView().findViewById(R.id.status); ViewGroup realtime = (ViewGroup) getView().findViewById(R.id.eta_realtime_indicator); realtime.setVisibility(View.GONE); ViewGroup statusLayout = (ViewGroup) getView().findViewById(R.id.status_layout); if (status == null) { // Show schedule info only vehicleView.setText(null);//from w ww.ja v a 2 s. c o m vehicleView.setVisibility(View.GONE); vehicleDeviation.setText(context.getString(R.string.trip_details_scheduled_data)); return; } if (!TextUtils.isEmpty(status.getVehicleId())) { // Show vehicle info vehicleView.setText(context.getString(R.string.trip_details_vehicle, status.getVehicleId())); vehicleView.setVisibility(View.VISIBLE); } else { vehicleView.setVisibility(View.GONE); } // Set status color in header statusLayout.setBackgroundResource(R.drawable.round_corners_style_b_header_status); GradientDrawable d = (GradientDrawable) statusLayout.getBackground(); int statusColor; if (!status.isPredicted()) { // We have only schedule info, but the bus position can still be interpolated vehicleDeviation.setText(context.getString(R.string.trip_details_scheduled_data)); statusColor = R.color.stop_info_scheduled_time; d.setColor(getResources().getColor(statusColor)); return; } /** * We have real-time info */ realtime.setVisibility(View.VISIBLE); long deviation = status.getScheduleDeviation(); long deviationMin = TimeUnit.SECONDS.toMinutes(status.getScheduleDeviation()); long minutes = Math.abs(deviation) / 60; long seconds = Math.abs(deviation) % 60; String lastUpdate = DateUtils.formatDateTime(getActivity(), status.getLastUpdateTime(), DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_NO_NOON | DateUtils.FORMAT_NO_MIDNIGHT); statusColor = ArrivalInfo.computeColorFromDeviation(deviationMin); if (statusColor != R.color.stop_info_ontime) { // Show early/late/scheduled color d.setColor(getResources().getColor(statusColor)); } else { // For on-time, use header default color d.setColor(getResources().getColor(R.color.theme_primary)); } if (deviation >= 0) { if (deviation < 60) { vehicleDeviation .setText(context.getString(R.string.trip_details_real_time_sec_late, seconds, lastUpdate)); } else { vehicleDeviation.setText(context.getString(R.string.trip_details_real_time_min_sec_late, minutes, seconds, lastUpdate)); } } else { if (deviation > -60) { vehicleDeviation .setText(context.getString(R.string.trip_details_real_time_sec_early, seconds, lastUpdate)); } else { vehicleDeviation.setText(context.getString(R.string.trip_details_real_time_min_sec_early, minutes, seconds, lastUpdate)); } } }
From source file:com.abc.driver.MainActivity.java
public void initFHorders() { mFHorderLv = (PullToRefreshListView) findViewById(R.id.huoyun_lv); mFHorderLv.setMode(Mode.BOTH);//from w w w .j ava 2 s. com mFHorderMore = (ViewGroup) LayoutInflater.from(MainActivity.this).inflate(R.layout.more_list, null); mFHorderMore.setVisibility(View.GONE); mFHolderMoreTv = (TextView) mFHorderMore.getChildAt(0); // mFHorderLv.addFooterView(mFHorderMore); mFHorderLv.setOnItemClickListener(mFHorderDetailListener); mFHorderLv.setAdapter(mFHorderTypes.nHorderAdapter); // Set a listener to be invoked when the list should be refreshed. mFHorderLv.setOnRefreshListener(new OnRefreshListener2<ListView>() { @Override public void onPullDownToRefresh(PullToRefreshBase<ListView> refreshView) { isForceRefreshFH = true; String label = DateUtils.formatDateTime(getApplicationContext(), System.currentTimeMillis(), DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_ABBREV_ALL); refreshView.getLoadingLayoutProxy().setLastUpdatedLabel(label);// // mHorderTypes[mCurrRadioIdx] = new HorderType(mCurrRadioIdx); mFHorderDownLoadTask = new FHorderDownLoadTask(); mFHorderDownLoadTask.execute(CellSiteConstants.NORMAL_OPERATION); } @Override public void onPullUpToRefresh(PullToRefreshBase<ListView> refreshView) { isForceRefreshFH = true; // mHorderTypes[mCurrRadioIdx] = new HorderType(mCurrRadioIdx); String label = DateUtils.formatDateTime(getApplicationContext(), System.currentTimeMillis(), DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_ABBREV_ALL); refreshView.getLoadingLayoutProxy().setLastUpdatedLabel(label);// mFHorderDownLoadTask = new FHorderDownLoadTask(); mFHorderDownLoadTask.execute(CellSiteConstants.NORMAL_OPERATION); } }); }
From source file:hide.com.android.datetimepicker.date.DatePickerDialog.java
private void setCurrentView(final int viewIndex) { long millis = mCalendar.getTimeInMillis(); switch (viewIndex) { case MONTH_AND_DAY_VIEW: ObjectAnimator pulseAnimator = startAnimator(mMonthAndDayView, 0.9f, 1.05f); mDayPickerView.onDateChanged();/*from www.ja v a2 s. com*/ if (mCurrentView != viewIndex) { mMonthAndDayView.setSelected(true); mYearView.setSelected(false); mAnimator.setDisplayedChild(MONTH_AND_DAY_VIEW); mCurrentView = viewIndex; } if (pulseAnimator != null) { pulseAnimator.start(); } int flags = DateUtils.FORMAT_SHOW_DATE; String dayString = DateUtils.formatDateTime(getActivity(), millis, flags); mAnimator.setContentDescription(mDayPickerDescription + ": " + dayString); Utils.tryAccessibilityAnnounce(mAnimator, mSelectDay); break; case YEAR_VIEW: pulseAnimator = startAnimator(mYearView, 0.85f, 1.1f); mYearPickerView.onDateChanged(); if (mCurrentView != viewIndex) { mMonthAndDayView.setSelected(false); mYearView.setSelected(true); mAnimator.setDisplayedChild(YEAR_VIEW); mCurrentView = viewIndex; } if (pulseAnimator != null) { pulseAnimator.start(); } CharSequence yearString = YEAR_FORMAT.format(millis); mAnimator.setContentDescription(mYearPickerDescription + ": " + yearString); Utils.tryAccessibilityAnnounce(mAnimator, mSelectYear); break; } }
From source file:com.android.datetimepicker.date.DatePickerDialog.java
private void setCurrentView(final int viewIndex) { long millis = mCalendar.getTimeInMillis(); switch (viewIndex) { case MONTH_AND_DAY_VIEW: ObjectAnimator pulseAnimator = Utils.getPulseAnimator(mMonthAndDayView, 0.9f, 1.05f); if (mDelayAnimation) { pulseAnimator.setStartDelay(ANIMATION_DELAY); mDelayAnimation = false;/*from ww w.j av a 2 s . com*/ } mDayPickerView.onDateChanged(); if (mCurrentView != viewIndex) { mMonthAndDayView.setSelected(true); mYearView.setSelected(false); mAnimator.setDisplayedChild(MONTH_AND_DAY_VIEW); mCurrentView = viewIndex; } pulseAnimator.start(); int flags = DateUtils.FORMAT_SHOW_DATE; String dayString = DateUtils.formatDateTime(getActivity(), millis, flags); mAnimator.setContentDescription(mDayPickerDescription + ": " + dayString); Utils.tryAccessibilityAnnounce(mAnimator, mSelectDay); break; case YEAR_VIEW: pulseAnimator = Utils.getPulseAnimator(mYearView, 0.85f, 1.1f); if (mDelayAnimation) { pulseAnimator.setStartDelay(ANIMATION_DELAY); mDelayAnimation = false; } mYearPickerView.onDateChanged(); if (mCurrentView != viewIndex) { mMonthAndDayView.setSelected(false); mYearView.setSelected(true); mAnimator.setDisplayedChild(YEAR_VIEW); mCurrentView = viewIndex; } pulseAnimator.start(); CharSequence yearString = YEAR_FORMAT.format(millis); mAnimator.setContentDescription(mYearPickerDescription + ": " + yearString); Utils.tryAccessibilityAnnounce(mAnimator, mSelectYear); break; } }