use of com.android.calendar.EmailAddressAdapter in project Etar-Calendar by Etar-Group.
the class EditEventView method initMultiAutoCompleteTextView.
// From com.google.android.gm.ComposeActivity
private MultiAutoCompleteTextView initMultiAutoCompleteTextView(RecipientEditTextView list) {
if (ChipsUtil.supportsChipsUi()) {
mAddressAdapter = new RecipientAdapter(mActivity);
list.setAdapter((BaseRecipientAdapter) mAddressAdapter);
list.setOnFocusListShrinkRecipients(false);
} else {
mAddressAdapter = new EmailAddressAdapter(mActivity);
list.setAdapter((EmailAddressAdapter) mAddressAdapter);
}
list.setTokenizer(new Rfc822Tokenizer());
list.setValidator(mEmailValidator);
// NOTE: assumes no other filters are set
list.setFilters(sRecipientFilters);
return list;
}
use of com.android.calendar.EmailAddressAdapter in project Etar-Calendar by Etar-Group.
the class EditEventView method setModel.
/**
* Fill in the view with the contents of the given event model. This allows
* an edit view to be initialized before the event has been loaded. Passing
* in null for the model will display a loading screen. A non-null model
* will fill in the view's fields with the data contained in the model.
*
* @param model The event model to pull the data from
*/
public void setModel(CalendarEventModel model) {
mModel = model;
// Need to close the autocomplete adapter to prevent leaking cursors.
if (mAddressAdapter != null && mAddressAdapter instanceof EmailAddressAdapter) {
((EmailAddressAdapter) mAddressAdapter).close();
mAddressAdapter = null;
}
if (model == null) {
// Display loading screen
mLoadingMessage.setVisibility(View.VISIBLE);
mScrollView.setVisibility(View.GONE);
return;
}
boolean canRespond = EditEventHelper.canRespond(model);
long begin = model.mStart;
long end = model.mEnd;
// this will be UTC for all day events
mTimezone = model.mTimezone;
// Set up the starting times
if (begin > 0) {
mStartTime.timezone = mTimezone;
mStartTime.set(begin);
mStartTime.normalize(true);
}
if (end > 0) {
mEndTime.timezone = mTimezone;
mEndTime.set(end);
mEndTime.normalize(true);
}
mRrule = model.mRrule;
if (!TextUtils.isEmpty(mRrule)) {
mEventRecurrence.parse(mRrule);
}
if (mEventRecurrence.startDate == null) {
mEventRecurrence.startDate = mStartTime;
}
// validator
if (!model.mHasAttendeeData) {
mAttendeesGroup.setVisibility(View.GONE);
}
mAllDayCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
setAllDayViewsVisibility(isChecked);
}
});
boolean prevAllDay = mAllDayCheckBox.isChecked();
// default to false. Let setAllDayViewsVisibility update it as needed
mAllDay = false;
if (model.mAllDay) {
mAllDayCheckBox.setChecked(true);
// put things back in local time for all day events
mTimezone = Utils.getTimeZone(mActivity, null);
mStartTime.timezone = mTimezone;
mEndTime.timezone = mTimezone;
mEndTime.normalize(true);
} else {
mAllDayCheckBox.setChecked(false);
}
// doesn't get called
if (prevAllDay == mAllDayCheckBox.isChecked()) {
setAllDayViewsVisibility(prevAllDay);
}
populateTimezone(mStartTime.normalize(true));
SharedPreferences prefs = GeneralPreferences.getSharedPreferences(mActivity);
String defaultReminderString = prefs.getString(GeneralPreferences.KEY_DEFAULT_REMINDER, GeneralPreferences.NO_REMINDER_STRING);
mDefaultReminderMinutes = Integer.parseInt(defaultReminderString);
prepareReminders();
prepareAvailability();
prepareAccess();
View reminderAddButton = mView.findViewById(R.id.reminder_add);
View.OnClickListener addReminderOnClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
addReminder();
}
};
reminderAddButton.setOnClickListener(addReminderOnClickListener);
if (!mIsMultipane) {
mView.findViewById(R.id.is_all_day_label).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mAllDayCheckBox.setChecked(!mAllDayCheckBox.isChecked());
}
});
}
if (model.mTitle != null) {
mTitleTextView.setTextKeepState(model.mTitle);
}
if (model.mIsOrganizer || TextUtils.isEmpty(model.mOrganizer) || model.mOrganizer.endsWith(GOOGLE_SECONDARY_CALENDAR)) {
mView.findViewById(R.id.organizer_label).setVisibility(View.GONE);
mView.findViewById(R.id.organizer).setVisibility(View.GONE);
mOrganizerGroup.setVisibility(View.GONE);
} else {
((TextView) mView.findViewById(R.id.organizer)).setText(model.mOrganizerDisplayName);
}
if (model.mLocation != null) {
mLocationTextView.setTextKeepState(model.mLocation);
}
if (model.mDescription != null) {
mDescriptionTextView.setTextKeepState(model.mDescription);
}
int availIndex = mAvailabilityValues.indexOf(model.mAvailability);
if (availIndex != -1) {
mAvailabilitySpinner.setSelection(availIndex);
}
mAccessLevelSpinner.setSelection(model.mAccessLevel);
View responseLabel = mView.findViewById(R.id.response_label);
if (canRespond) {
int buttonToCheck = EventInfoFragment.findButtonIdForResponse(model.mSelfAttendeeStatus);
// -1 clear all radio buttons
mResponseRadioGroup.check(buttonToCheck);
mResponseRadioGroup.setVisibility(View.VISIBLE);
responseLabel.setVisibility(View.VISIBLE);
} else {
responseLabel.setVisibility(View.GONE);
mResponseRadioGroup.setVisibility(View.GONE);
mResponseGroup.setVisibility(View.GONE);
}
if (model.mUri != null) {
// This is an existing event so hide the calendar spinner
// since we can't change the calendar.
View calendarGroup = mView.findViewById(R.id.calendar_selector_group);
calendarGroup.setVisibility(View.GONE);
TextView tv = (TextView) mView.findViewById(R.id.calendar_textview);
tv.setText(model.mCalendarDisplayName);
tv = (TextView) mView.findViewById(R.id.calendar_textview_secondary);
if (tv != null) {
tv.setText(model.mOwnerAccount);
}
} else {
View calendarGroup = mView.findViewById(R.id.calendar_group);
calendarGroup.setVisibility(View.GONE);
}
if (model.isEventColorInitialized()) {
updateHeadlineColor(model, model.getEventColor());
}
populateWhen();
populateRepeats();
updateAttendees(model.mAttendeesList);
updateView();
mScrollView.setVisibility(View.VISIBLE);
mLoadingMessage.setVisibility(View.GONE);
sendAccessibilityEvent();
}
Aggregations