use of com.android.calendar.event.AttendeesView in project Etar-Calendar by Etar-Group.
the class EventInfoFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
if (savedInstanceState != null) {
mIsDialog = savedInstanceState.getBoolean(BUNDLE_KEY_IS_DIALOG, false);
mWindowStyle = savedInstanceState.getInt(BUNDLE_KEY_WINDOW_STYLE, DIALOG_WINDOW_STYLE);
mDeleteDialogVisible = savedInstanceState.getBoolean(BUNDLE_KEY_DELETE_DIALOG_VISIBLE, false);
mCalendarColor = savedInstanceState.getInt(BUNDLE_KEY_CALENDAR_COLOR);
mCalendarColorInitialized = savedInstanceState.getBoolean(BUNDLE_KEY_CALENDAR_COLOR_INIT);
mOriginalColor = savedInstanceState.getInt(BUNDLE_KEY_ORIGINAL_COLOR);
mOriginalColorInitialized = savedInstanceState.getBoolean(BUNDLE_KEY_ORIGINAL_COLOR_INIT);
mCurrentColor = savedInstanceState.getInt(BUNDLE_KEY_CURRENT_COLOR);
mCurrentColorInitialized = savedInstanceState.getBoolean(BUNDLE_KEY_CURRENT_COLOR_INIT);
mCurrentColorKey = savedInstanceState.getString(BUNDLE_KEY_CURRENT_COLOR_KEY);
mTentativeUserSetResponse = savedInstanceState.getInt(BUNDLE_KEY_TENTATIVE_USER_RESPONSE, Attendees.ATTENDEE_STATUS_NONE);
if (mTentativeUserSetResponse != Attendees.ATTENDEE_STATUS_NONE && mEditResponseHelper != null) {
// If the edit response helper dialog is open, we'll need to
// know if either of the choices were selected.
mEditResponseHelper.setWhichEvents(savedInstanceState.getInt(BUNDLE_KEY_RESPONSE_WHICH_EVENTS, -1));
}
mUserSetResponse = savedInstanceState.getInt(BUNDLE_KEY_USER_SET_ATTENDEE_RESPONSE, Attendees.ATTENDEE_STATUS_NONE);
if (mUserSetResponse != Attendees.ATTENDEE_STATUS_NONE) {
// If the response was set by the user before a configuration
// change, we'll need to know which choice was selected.
mWhichEvents = savedInstanceState.getInt(BUNDLE_KEY_RESPONSE_WHICH_EVENTS, -1);
}
mReminders = Utils.readRemindersFromBundle(savedInstanceState);
}
if (mWindowStyle == DIALOG_WINDOW_STYLE) {
mView = inflater.inflate(R.layout.event_info_dialog, container, false);
} else {
mView = inflater.inflate(R.layout.event_info, container, false);
}
Toolbar myToolbar = (Toolbar) mView.findViewById(R.id.toolbar);
AppCompatActivity activity = (AppCompatActivity) getActivity();
if (myToolbar != null && activity != null) {
activity.setSupportActionBar(myToolbar);
activity.getSupportActionBar().setDisplayShowTitleEnabled(false);
myToolbar.setNavigationIcon(R.drawable.ic_arrow_back);
}
mScrollView = (ScrollView) mView.findViewById(R.id.event_info_scroll_view);
mLoadingMsgView = mView.findViewById(R.id.event_info_loading_msg);
mErrorMsgView = mView.findViewById(R.id.event_info_error_msg);
mTitle = (TextView) mView.findViewById(R.id.title);
mWhenDateTime = (TextView) mView.findViewById(R.id.when_datetime);
mWhere = (TextView) mView.findViewById(R.id.where);
mDesc = mView.findViewById(R.id.description);
mHeadlines = mView.findViewById(R.id.event_info_headline);
mLongAttendees = (AttendeesView) mView.findViewById(R.id.long_attendee_list);
mResponseRadioGroup = (RadioGroup) mView.findViewById(R.id.response_value);
if (mUri == null) {
// restore event ID from bundle
mEventId = savedInstanceState.getLong(BUNDLE_KEY_EVENT_ID);
mUri = ContentUris.withAppendedId(Events.CONTENT_URI, mEventId);
mStartMillis = savedInstanceState.getLong(BUNDLE_KEY_START_MILLIS);
mEndMillis = savedInstanceState.getLong(BUNDLE_KEY_END_MILLIS);
}
mAnimateAlpha = ObjectAnimator.ofFloat(mScrollView, "Alpha", 0, 1);
mAnimateAlpha.setDuration(FADE_IN_TIME);
mAnimateAlpha.addListener(new AnimatorListenerAdapter() {
int defLayerType;
@Override
public void onAnimationStart(Animator animation) {
// Use hardware layer for better performance during animation
defLayerType = mScrollView.getLayerType();
mScrollView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
// Ensure that the loading message is gone before showing the
// event info
mLoadingMsgView.removeCallbacks(mLoadingMsgAlphaUpdater);
mLoadingMsgView.setVisibility(View.GONE);
}
@Override
public void onAnimationCancel(Animator animation) {
mScrollView.setLayerType(defLayerType, null);
}
@Override
public void onAnimationEnd(Animator animation) {
mScrollView.setLayerType(defLayerType, null);
// Do not cross fade after the first time
mNoCrossFade = true;
}
});
mLoadingMsgView.setAlpha(0);
mScrollView.setAlpha(0);
mErrorMsgView.setVisibility(View.INVISIBLE);
mLoadingMsgView.postDelayed(mLoadingMsgAlphaUpdater, LOADING_MSG_DELAY);
// start loading the data
mHandler.startQuery(TOKEN_QUERY_EVENT, null, mUri, EVENT_PROJECTION, null, null, null);
View b = mView.findViewById(R.id.delete);
b.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (!mCanModifyCalendar) {
return;
}
mDeleteHelper = new DeleteEventHelper(mContext, mActivity, !mIsDialog && !mIsTabletConfig);
mDeleteHelper.setDeleteNotificationListener(EventInfoFragment.this);
mDeleteHelper.setOnDismissListener(createDeleteOnDismissListener());
mDeleteDialogVisible = true;
mDeleteHelper.delete(mStartMillis, mEndMillis, mEventId, -1, onDeleteRunnable);
}
});
b = mView.findViewById(R.id.change_color);
b.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (!mCanModifyCalendar) {
return;
}
showEventColorPickerDialog();
}
});
// Hide Edit/Delete buttons if in full screen mode on a phone
if (!mIsDialog && !mIsTabletConfig || mWindowStyle == EventInfoFragment.FULL_WINDOW_STYLE) {
mView.findViewById(R.id.event_info_buttons_container).setVisibility(View.GONE);
}
// Create a listener for the email guests button
emailAttendeesButton = (Button) mView.findViewById(R.id.email_attendees_button);
if (emailAttendeesButton != null) {
emailAttendeesButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
emailAttendees();
}
});
}
// Create a listener for the add reminder button
View reminderAddButton = mView.findViewById(R.id.reminder_add);
View.OnClickListener addReminderOnClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
addReminder();
mUserModifiedReminders = true;
}
};
reminderAddButton.setOnClickListener(addReminderOnClickListener);
// Set reminders variables
SharedPreferences prefs = GeneralPreferences.Companion.getSharedPreferences(mActivity);
String defaultReminderString = prefs.getString(GeneralPreferences.KEY_DEFAULT_REMINDER, GeneralPreferences.NO_REMINDER_STRING);
mDefaultReminderMinutes = Integer.parseInt(defaultReminderString);
prepareReminders();
return mView;
}
Aggregations