Search in sources :

Example 6 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 DayView method getSelectedTimeForAccessibility.

Time getSelectedTimeForAccessibility() {
    Time time = new Time();
    time.set(mBaseDate);
    time.setJulianDay(mSelectionDayForAccessibility);
    time.setHour(mSelectionHourForAccessibility);
    time.normalize();
    return time;
}
Also used : Time(com.android.calendarcommon2.Time)

Example 7 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 CalendarController method sendEventRelatedEventWithExtraWithTitleWithCalendarId.

/**
 * Helper for sending New/View/Edit/Delete events
 *
 * @param sender object of the caller
 * @param eventType one of {@link EventType}
 * @param eventId event id
 * @param startMillis start time
 * @param endMillis end time
 * @param x x coordinate in the activity space
 * @param y y coordinate in the activity space
 * @param extraLong default response value for the "simple event view" and all day indication.
 *        Use Attendees.ATTENDEE_STATUS_NONE for no response.
 * @param selectedMillis The time to specify as selected
 * @param title The title of the event
 * @param calendarId The id of the calendar which the event belongs to
 */
public void sendEventRelatedEventWithExtraWithTitleWithCalendarId(Object sender, long eventType, long eventId, long startMillis, long endMillis, int x, int y, long extraLong, long selectedMillis, String title, long calendarId) {
    EventInfo info = new EventInfo();
    info.eventType = eventType;
    if (eventType == EventType.EDIT_EVENT || eventType == EventType.VIEW_EVENT_DETAILS) {
        info.viewType = ViewType.CURRENT;
    }
    info.id = eventId;
    info.startTime = new Time(Utils.getTimeZone(mContext, mUpdateTimezone));
    info.startTime.set(startMillis);
    if (selectedMillis != -1) {
        info.selectedTime = new Time(Utils.getTimeZone(mContext, mUpdateTimezone));
        info.selectedTime.set(selectedMillis);
    } else {
        info.selectedTime = info.startTime;
    }
    info.endTime = new Time(Utils.getTimeZone(mContext, mUpdateTimezone));
    info.endTime.set(endMillis);
    info.x = x;
    info.y = y;
    info.extraLong = extraLong;
    info.eventTitle = title;
    info.calendarId = calendarId;
    this.sendEvent(sender, info);
}
Also used : Time(com.android.calendarcommon2.Time)

Example 8 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 DayView method initNextView.

private boolean initNextView(int deltaX) {
    // Change the view to the previous day or week
    DayView view = (DayView) mViewSwitcher.getNextView();
    Time date = view.mBaseDate;
    date.set(mBaseDate);
    boolean switchForward;
    if (deltaX > 0) {
        date.setDay(date.getDay() - mNumDays);
        view.setSelectedDay(mSelectionDay - mNumDays);
        switchForward = false;
    } else {
        date.setDay(date.getDay() + mNumDays);
        view.setSelectedDay(mSelectionDay + mNumDays);
        switchForward = true;
    }
    date.normalize();
    initView(view);
    view.layout(getLeft(), getTop(), getRight(), getBottom());
    view.reloadEvents();
    return switchForward;
}
Also used : Time(com.android.calendarcommon2.Time)

Example 9 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 AllInOneActivity method onCreate.

@Override
protected void onCreate(Bundle icicle) {
    setTheme(R.style.CalendarTheme_WithActionBarWallpaper);
    super.onCreate(icicle);
    dynamicTheme.onCreate(this);
    // This needs to be created before setContentView
    mController = CalendarController.getInstance(this);
    // Create notification channel
    AlertService.createChannels(this);
    // Check and ask for most needed permissions
    checkAppPermissions();
    // Get time from intent or icicle
    long timeMillis = -1;
    int viewType = -1;
    final Intent intent = getIntent();
    if (icicle != null) {
        timeMillis = icicle.getLong(BUNDLE_KEY_RESTORE_TIME);
        viewType = icicle.getInt(BUNDLE_KEY_RESTORE_VIEW, -1);
    } else {
        String action = intent.getAction();
        if (Intent.ACTION_VIEW.equals(action)) {
            // Open EventInfo later
            timeMillis = parseViewAction(intent);
        }
        if (timeMillis == -1) {
            timeMillis = Utils.timeFromIntentInMillis(intent);
        }
    }
    if (viewType == -1 || viewType > ViewType.MAX_VALUE) {
        viewType = Utils.getViewTypeFromIntentAndSharedPref(this);
    }
    mTimeZone = Utils.getTimeZone(this, mHomeTimeUpdater);
    Time t = new Time(mTimeZone);
    t.set(timeMillis);
    if (DEBUG) {
        if (icicle != null && intent != null) {
            Log.d(TAG, "both, icicle:" + icicle.toString() + "  intent:" + intent.toString());
        } else {
            Log.d(TAG, "not both, icicle:" + icicle + " intent:" + intent);
        }
    }
    Resources res = getResources();
    mHideString = res.getString(R.string.hide_controls);
    mShowString = res.getString(R.string.show_controls);
    mOrientation = res.getConfiguration().orientation;
    if (mOrientation == Configuration.ORIENTATION_LANDSCAPE) {
        mControlsAnimateWidth = (int) res.getDimension(R.dimen.calendar_controls_width);
        if (mControlsParams == null) {
            mControlsParams = new LayoutParams(mControlsAnimateWidth, 0);
        }
        mControlsParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
    } else {
        // Make sure width is in between allowed min and max width values
        mControlsAnimateWidth = Math.max(res.getDisplayMetrics().widthPixels * 45 / 100, (int) res.getDimension(R.dimen.min_portrait_calendar_controls_width));
        mControlsAnimateWidth = Math.min(mControlsAnimateWidth, (int) res.getDimension(R.dimen.max_portrait_calendar_controls_width));
    }
    mControlsAnimateHeight = (int) res.getDimension(R.dimen.calendar_controls_height);
    mHideControls = !Utils.getSharedPreference(this, GeneralPreferences.KEY_SHOW_CONTROLS, true);
    mIsMultipane = Utils.getConfigBool(this, R.bool.multiple_pane_config);
    mIsTabletConfig = Utils.getConfigBool(this, R.bool.tablet_config);
    mShowAgendaWithMonth = Utils.getConfigBool(this, R.bool.show_agenda_with_month);
    mShowCalendarControls = Utils.getConfigBool(this, R.bool.show_calendar_controls);
    mShowEventDetailsWithAgenda = Utils.getConfigBool(this, R.bool.show_event_details_with_agenda);
    mShowEventInfoFullScreenAgenda = Utils.getConfigBool(this, R.bool.agenda_show_event_info_full_screen);
    mShowEventInfoFullScreen = Utils.getConfigBool(this, R.bool.show_event_info_full_screen);
    mCalendarControlsAnimationTime = res.getInteger(R.integer.calendar_controls_animation_time);
    Utils.setAllowWeekForDetailView(mIsMultipane);
    // setContentView must be called before configureActionBar
    setContentView(R.layout.all_in_one_material);
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mNavigationView = (NavigationView) findViewById(R.id.navigation_view);
    mFab = (FloatingActionButton) findViewById(R.id.floating_action_button);
    if (mIsTabletConfig) {
        mDateRange = (TextView) findViewById(R.id.date_bar);
        mWeekTextView = (TextView) findViewById(R.id.week_num);
    } else {
        mDateRange = (TextView) getLayoutInflater().inflate(R.layout.date_range_title, null);
    }
    setupToolbar(viewType);
    setupNavDrawer();
    setupFloatingActionButton();
    mHomeTime = (TextView) findViewById(R.id.home_time);
    mMiniMonth = findViewById(R.id.mini_month);
    if (mIsTabletConfig && mOrientation == Configuration.ORIENTATION_PORTRAIT) {
        mMiniMonth.setLayoutParams(new RelativeLayout.LayoutParams(mControlsAnimateWidth, mControlsAnimateHeight));
    }
    mCalendarsList = findViewById(R.id.calendar_list);
    mMiniMonthContainer = findViewById(R.id.mini_month_container);
    mSecondaryPane = findViewById(R.id.secondary_pane);
    // Must register as the first activity because this activity can modify
    // the list of event handlers in it's handle method. This affects who
    // the rest of the handlers the controller dispatches to are.
    mController.registerFirstEventHandler(HANDLER_KEY, this);
    initFragments(timeMillis, viewType, icicle);
    // Listen for changes that would require this to be refreshed
    SharedPreferences prefs = GeneralPreferences.Companion.getSharedPreferences(this);
    prefs.registerOnSharedPreferenceChangeListener(this);
    mContentResolver = getContentResolver();
}
Also used : LayoutParams(android.widget.RelativeLayout.LayoutParams) SharedPreferences(android.content.SharedPreferences) RelativeLayout(android.widget.RelativeLayout) Intent(android.content.Intent) Time(com.android.calendarcommon2.Time) Resources(android.content.res.Resources) LayoutParams(android.widget.RelativeLayout.LayoutParams)

Example 10 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 DeleteEventHelper method deleteRepeatingEvent.

private void deleteRepeatingEvent(int which) {
    String rRule = mModel.mRrule;
    boolean allDay = mModel.mAllDay;
    long dtstart = mModel.mStart;
    // mCursor.getInt(mEventIndexId);
    long id = mModel.mId;
    // See mDeleteNormalDialogListener for more info on this
    boolean isLocal = mModel.mSyncAccountType.equals(CalendarContract.ACCOUNT_TYPE_LOCAL);
    Uri deleteContentUri = isLocal ? CalendarRepository.asLocalCalendarSyncAdapter(mModel.mSyncAccountName, Events.CONTENT_URI) : Events.CONTENT_URI;
    switch(which) {
        case DELETE_SELECTED:
            {
                // the start time of the recurrence.
                if (dtstart == mStartMillis) {
                // TODO
                }
                // Create a recurrence exception by creating a new event
                // with the status "cancelled".
                ContentValues values = new ContentValues();
                // The title might not be necessary, but it makes it easier
                // to find this entry in the database when there is a problem.
                String title = mModel.mTitle;
                values.put(Events.TITLE, title);
                String timezone = mModel.mTimezone;
                long calendarId = mModel.mCalendarId;
                values.put(Events.EVENT_TIMEZONE, timezone);
                values.put(Events.ALL_DAY, allDay ? 1 : 0);
                values.put(Events.ORIGINAL_ALL_DAY, allDay ? 1 : 0);
                values.put(Events.CALENDAR_ID, calendarId);
                values.put(Events.DTSTART, mStartMillis);
                values.put(Events.DTEND, mEndMillis);
                values.put(Events.ORIGINAL_SYNC_ID, mSyncId);
                values.put(Events.ORIGINAL_ID, id);
                values.put(Events.ORIGINAL_INSTANCE_TIME, mStartMillis);
                values.put(Events.STATUS, Events.STATUS_CANCELED);
                mService.startInsert(mService.getNextToken(), null, Events.CONTENT_URI, values, Utils.UNDO_DELAY);
                break;
            }
        case DELETE_ALL:
            {
                Uri uri = ContentUris.withAppendedId(deleteContentUri, id);
                mService.startDelete(mService.getNextToken(), null, uri, null, null, Utils.UNDO_DELAY);
                break;
            }
        case DELETE_ALL_FOLLOWING:
            {
                // following events, then delete them all.
                if (dtstart == mStartMillis) {
                    Uri uri = ContentUris.withAppendedId(deleteContentUri, id);
                    mService.startDelete(mService.getNextToken(), null, uri, null, null, Utils.UNDO_DELAY);
                    break;
                }
                // Modify the repeating event to end just before this event time
                EventRecurrence eventRecurrence = new EventRecurrence();
                eventRecurrence.parse(rRule);
                Time date = new Time();
                if (allDay) {
                    date.setTimezone(Time.TIMEZONE_UTC);
                }
                date.set(mStartMillis);
                date.setSecond(date.getSecond() - 1);
                date.normalize();
                // Google calendar seems to require the UNTIL string to be
                // in UTC.
                date.switchTimezone(Time.TIMEZONE_UTC);
                eventRecurrence.until = date.format2445();
                ContentValues values = new ContentValues();
                values.put(Events.DTSTART, dtstart);
                values.put(Events.RRULE, eventRecurrence.toString());
                Uri uri = ContentUris.withAppendedId(CalendarContract.Events.CONTENT_URI, id);
                mService.startUpdate(mService.getNextToken(), null, uri, values, null, null, Utils.UNDO_DELAY);
                break;
            }
    }
    if (mCallback != null) {
        mCallback.run();
    }
    if (mExitWhenDone) {
        mParent.finish();
    }
}
Also used : ContentValues(android.content.ContentValues) EventRecurrence(com.android.calendarcommon2.EventRecurrence) Time(com.android.calendarcommon2.Time) Uri(android.net.Uri)

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