use of ve.com.abicelis.remindy.enums.DateFormat in project Remindy by abicelis.
the class OneTimeReminderDetailFragment method onCreateView.
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_detail_reminder_one_time, container, false);
mContainer = (LinearLayout) rootView.findViewById(R.id.fragment_reminder_one_time_container);
mDateIcon = (ImageView) rootView.findViewById(R.id.fragment_reminder_one_time_date_icon);
mDate = (TextView) rootView.findViewById(R.id.fragment_reminder_one_time_date);
mTime = (TextView) rootView.findViewById(R.id.fragment_reminder_one_time_time);
DateFormat df = SharedPreferenceUtil.getDateFormat(getActivity());
mDate.setText(df.formatCalendar(mReminder.getDate()));
mTime.setText(mReminder.getTime().toString());
return rootView;
}
use of ve.com.abicelis.remindy.enums.DateFormat in project Remindy by abicelis.
the class RepeatingReminderDetailFragment method onCreateView.
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_detail_reminder_repeating, container, false);
mContainer = (LinearLayout) rootView.findViewById(R.id.fragment_reminder_repeating_container);
mDateIcon = (ImageView) rootView.findViewById(R.id.fragment_reminder_repeating_date_icon);
mDate = (TextView) rootView.findViewById(R.id.fragment_reminder_repeating_date);
mTime = (TextView) rootView.findViewById(R.id.fragment_reminder_repeating_time);
mRepeat = (TextView) rootView.findViewById(R.id.fragment_reminder_repeating_repeat);
mNext = (TextView) rootView.findViewById(R.id.fragment_reminder_repeating_next);
mNextContainer = (LinearLayout) rootView.findViewById(R.id.fragment_reminder_repeating_next_container);
DateFormat df = SharedPreferenceUtil.getDateFormat(getActivity());
mDate.setText(df.formatCalendar(mReminder.getDate()));
mTime.setText(mReminder.getTime().toString());
mRepeat.setText(mReminder.getRepeatText(getActivity()));
if (!TaskUtil.checkIfOverdue(mReminder)) {
mNextContainer.setVisibility(View.VISIBLE);
mNext.setText(df.formatCalendar(TaskUtil.getRepeatingReminderNextCalendar(mReminder)));
}
return rootView;
}
use of ve.com.abicelis.remindy.enums.DateFormat in project Remindy by abicelis.
the class ProgrammedOneTimeTaskViewHolder method setData.
public void setData(HomeAdapter adapter, Fragment fragment, Task current, int position, boolean isSelected, boolean nextItemIsATask) {
mAdapter = adapter;
mFragment = fragment;
mCurrent = current;
mReminderPosition = position;
mCategoryIcon.setImageResource(mCurrent.getCategory().getIconRes());
mContainer.setBackgroundColor((isSelected ? ContextCompat.getColor(fragment.getActivity(), R.color.gray_300) : Color.TRANSPARENT));
mAttachmentList.setColorFilter(ContextCompat.getColor(mFragment.getActivity(), (hasAttachmentsOfType(AttachmentType.LIST) ? R.color.icons_enabled : R.color.icons_disabled)));
mAttachmentLink.setColorFilter(ContextCompat.getColor(mFragment.getActivity(), (hasAttachmentsOfType(AttachmentType.LINK) ? R.color.icons_enabled : R.color.icons_disabled)));
mAttachmentAudio.setColorFilter(ContextCompat.getColor(mFragment.getActivity(), (hasAttachmentsOfType(AttachmentType.AUDIO) ? R.color.icons_enabled : R.color.icons_disabled)));
mAttachmentImage.setColorFilter(ContextCompat.getColor(mFragment.getActivity(), (hasAttachmentsOfType(AttachmentType.IMAGE) ? R.color.icons_enabled : R.color.icons_disabled)));
mAttachmentText.setColorFilter(ContextCompat.getColor(mFragment.getActivity(), (hasAttachmentsOfType(AttachmentType.TEXT) ? R.color.icons_enabled : R.color.icons_disabled)));
mTitle.setText(mCurrent.getTitle());
if (!mCurrent.getDescription().isEmpty())
mDescription.setText(mCurrent.getDescription());
else
mDescription.setText("");
if (current.getReminderType() == ReminderType.ONE_TIME && current.getReminder() != null) {
DateFormat df = SharedPreferenceUtil.getDateFormat(mFragment.getActivity());
mDate.setText(df.formatCalendar(((OneTimeReminder) current.getReminder()).getDate()));
mTime.setText(((OneTimeReminder) current.getReminder()).getTime().toString());
} else {
mDate.setText("-");
mTime.setText("-");
}
mItemDecoration.setVisibility(nextItemIsATask ? View.VISIBLE : View.INVISIBLE);
}
use of ve.com.abicelis.remindy.enums.DateFormat in project Remindy by abicelis.
the class SharedPreferenceUtil method getDateFormat.
public static DateFormat getDateFormat(Context context) {
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
String dfPref = preferences.getString(context.getResources().getString(R.string.settings_date_format_key), null);
DateFormat pref;
try {
pref = DateFormat.valueOf(dfPref);
} catch (Exception e) {
pref = null;
}
if (pref == null) {
Log.d("SharedPreferenceUtil", "getDateFormat() found null, setting PRETTY_DATE");
DateFormat df = DateFormat.PRETTY_DATE;
setDateFormat(df, context);
return df;
} else
return pref;
}
use of ve.com.abicelis.remindy.enums.DateFormat in project Remindy by abicelis.
the class RepeatingReminder method getRepeatText.
public String getRepeatText(Context context) {
String result = context.getResources().getString(R.string.fragment_edit_repeating_reminder_repeat_interval_every) + " ";
switch(getRepeatType()) {
case DAILY:
result += getRepeatInterval() + " " + context.getResources().getString(R.string.fragment_edit_repeating_reminder_repeat_interval_days);
break;
case WEEKLY:
result += getRepeatInterval() + " " + context.getResources().getString(R.string.fragment_edit_repeating_reminder_repeat_interval_weeks);
break;
case MONTHLY:
result += getRepeatInterval() + " " + context.getResources().getString(R.string.fragment_edit_repeating_reminder_repeat_interval_months);
break;
case YEARLY:
result += getRepeatInterval() + " " + context.getResources().getString(R.string.fragment_edit_repeating_reminder_repeat_interval_years);
break;
}
result += ", ";
switch(getRepeatEndType()) {
case FOREVER:
result += context.getResources().getString(R.string.reminder_repeat_end_type_forever);
break;
case FOR_X_EVENTS:
result += context.getResources().getString(R.string.fragment_edit_repeating_reminder_repeat_end_for_x_events_1) + " " + getRepeatEndNumberOfEvents() + " " + context.getResources().getString(R.string.fragment_edit_repeating_reminder_repeat_end_for_x_events_2);
break;
case UNTIL_DATE:
DateFormat df = SharedPreferenceUtil.getDateFormat(context);
result += context.getResources().getString(R.string.fragment_edit_repeating_reminder_repeat_end_until_date) + " " + df.formatCalendar(getRepeatEndDate());
break;
}
return result;
}
Aggregations