Search in sources :

Example 11 with org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Time

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;
}
Also used : Time(com.android.calendarcommon2.Time)

Example 12 with org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Time

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;
}
Also used : Time(com.android.calendarcommon2.Time)

Example 13 with org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Time

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();
}
Also used : Time(com.android.calendarcommon2.Time)

Example 14 with org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Time

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));
    }
}
Also used : Calendar(java.util.Calendar) Time(com.android.calendarcommon2.Time)

Example 15 with org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Time

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);
}
Also used : Time(com.android.calendarcommon2.Time)

Aggregations

Time (com.android.calendarcommon2.Time)178 Paint (android.graphics.Paint)20 ArrayList (java.util.ArrayList)15 Time (org.bouncycastle.asn1.x509.Time)15 Intent (android.content.Intent)12 Uri (android.net.Uri)12 TextPaint (android.text.TextPaint)12 TextView (android.widget.TextView)12 Resources (android.content.res.Resources)10 ContentValues (android.content.ContentValues)8 Context (android.content.Context)8 Cursor (android.database.Cursor)8 View (android.view.View)8 AccessibilityEvent (android.view.accessibility.AccessibilityEvent)8 EventRecurrence (com.android.calendarcommon2.EventRecurrence)8 DERSequence (org.bouncycastle.asn1.DERSequence)8 Date (java.util.Date)7 ASN1EncodableVector (org.bouncycastle.asn1.ASN1EncodableVector)7 MotionEvent (android.view.MotionEvent)6 Calendar (java.util.Calendar)5