use of org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Time in project android_packages_apps_Etar by LineageOS.
the class CalendarToolbarHandler method buildWeekDate.
private String buildWeekDate() {
// Calculate the start of the week, taking into account the "first day of the week"
// setting.
Time t = new Time(mTimeZone);
t.set(mMilliTime);
int firstDayOfWeek = Utils.getFirstDayOfWeek(mContext);
int dayOfWeek = t.getWeekDay();
int diff = dayOfWeek - firstDayOfWeek;
if (diff != 0) {
if (diff < 0) {
diff += 7;
}
t.setDay(t.getDay() - diff);
t.normalize();
}
long weekStartTime = t.toMillis();
// The end of the week is 6 days after the start of the week
long weekEndTime = weekStartTime + DateUtils.WEEK_IN_MILLIS - DateUtils.DAY_IN_MILLIS;
// If week start and end is in 2 different months, use short months names
Time t1 = new Time(mTimeZone);
t.set(weekEndTime);
int flags = DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_NO_YEAR;
if (t.getMonth() != t1.getMonth()) {
flags |= DateUtils.FORMAT_ABBREV_MONTH;
}
mStringBuilder.setLength(0);
String date = DateUtils.formatDateRange(mContext, mFormatter, weekStartTime, weekEndTime, flags, mTimeZone).toString();
return date;
}
use of org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Time in project android_packages_apps_Etar by LineageOS.
the class CalendarToolbarHandler method buildDayOfWeek.
// Builds a string with the day of the week and the word yesterday/today/tomorrow
// before it if applicable.
private String buildDayOfWeek() {
Time t = new Time(mTimeZone);
t.set(mMilliTime);
long julianDay = Time.getJulianDay(mMilliTime, t.getGmtOffset());
String dayOfWeek;
mStringBuilder.setLength(0);
if (julianDay == mTodayJulianDay) {
dayOfWeek = mContext.getString(R.string.agenda_today, DateUtils.formatDateRange(mContext, mFormatter, mMilliTime, mMilliTime, DateUtils.FORMAT_SHOW_WEEKDAY, mTimeZone).toString());
} else if (julianDay == mTodayJulianDay - 1) {
dayOfWeek = mContext.getString(R.string.agenda_yesterday, DateUtils.formatDateRange(mContext, mFormatter, mMilliTime, mMilliTime, DateUtils.FORMAT_SHOW_WEEKDAY, mTimeZone).toString());
} else if (julianDay == mTodayJulianDay + 1) {
dayOfWeek = mContext.getString(R.string.agenda_tomorrow, DateUtils.formatDateRange(mContext, mFormatter, mMilliTime, mMilliTime, DateUtils.FORMAT_SHOW_WEEKDAY, mTimeZone).toString());
} else {
dayOfWeek = DateUtils.formatDateRange(mContext, mFormatter, mMilliTime, mMilliTime, DateUtils.FORMAT_SHOW_WEEKDAY, mTimeZone).toString();
}
return dayOfWeek;
}
use of org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Time in project android_packages_apps_Etar by LineageOS.
the class CalendarViewAdapter method buildDayOfWeek.
// Builds a string with the day of the week and the word yesterday/today/tomorrow
// before it if applicable.
private String buildDayOfWeek() {
Time t = new Time(mTimeZone);
t.set(mMilliTime);
long julianDay = Time.getJulianDay(mMilliTime, t.getGmtOffset());
String dayOfWeek = null;
mStringBuilder.setLength(0);
if (julianDay == mTodayJulianDay) {
dayOfWeek = mContext.getString(R.string.agenda_today, DateUtils.formatDateRange(mContext, mFormatter, mMilliTime, mMilliTime, DateUtils.FORMAT_SHOW_WEEKDAY, mTimeZone).toString());
} else if (julianDay == mTodayJulianDay - 1) {
dayOfWeek = mContext.getString(R.string.agenda_yesterday, DateUtils.formatDateRange(mContext, mFormatter, mMilliTime, mMilliTime, DateUtils.FORMAT_SHOW_WEEKDAY, mTimeZone).toString());
} else if (julianDay == mTodayJulianDay + 1) {
dayOfWeek = mContext.getString(R.string.agenda_tomorrow, DateUtils.formatDateRange(mContext, mFormatter, mMilliTime, mMilliTime, DateUtils.FORMAT_SHOW_WEEKDAY, mTimeZone).toString());
} else {
dayOfWeek = DateUtils.formatDateRange(mContext, mFormatter, mMilliTime, mMilliTime, DateUtils.FORMAT_SHOW_WEEKDAY, mTimeZone).toString();
}
return dayOfWeek.toUpperCase();
}
use of org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Time in project android_packages_apps_Etar by LineageOS.
the class CalendarViewAdapter method buildLunarInfo.
private void buildLunarInfo() {
if (mLunarLoader == null || TextUtils.isEmpty(mTimeZone))
return;
Time time = new Time(mTimeZone);
if (time != null) {
// The the current month.
time.set(mMilliTime);
// As the first day of previous month;
Calendar from = Calendar.getInstance();
from.set(time.getYear(), time.getMonth() - 1, 1);
// Get the last day of next month.
Calendar to = Calendar.getInstance();
to.set(Calendar.YEAR, time.getYear());
to.set(Calendar.MONTH, time.getMonth() + 1);
to.set(Calendar.DAY_OF_MONTH, to.getMaximum(Calendar.DAY_OF_MONTH));
// Call LunarUtils to load the info.
mLunarLoader.load(from.get(Calendar.YEAR), from.get(Calendar.MONTH), from.get(Calendar.DAY_OF_MONTH), to.get(Calendar.YEAR), to.get(Calendar.MONTH), to.get(Calendar.DAY_OF_MONTH));
}
}
use of org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Time in project android_packages_apps_Etar by LineageOS.
the class CalendarViewAdapter method setMidnightHandler.
// Sets a thread to run 1 second after midnight and update the current date
// This is used to display correctly the date of yesterday/today/tomorrow
private void setMidnightHandler() {
mMidnightHandler.removeCallbacks(mTimeUpdater);
// Set the time updater to run at 1 second after midnight
long now = System.currentTimeMillis();
Time time = new Time(mTimeZone);
time.set(now);
long runInMillis = (24 * 3600 - time.getHour() * 3600 - time.getMinute() * 60 - time.getSecond() + 1) * 1000;
mMidnightHandler.postDelayed(mTimeUpdater, runInMillis);
}
Aggregations