本文整理汇总了Java中com.prolificinteractive.materialcalendarview.CalendarDay类的典型用法代码示例。如果您正苦于以下问题:Java CalendarDay类的具体用法?Java CalendarDay怎么用?Java CalendarDay使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CalendarDay类属于com.prolificinteractive.materialcalendarview包,在下文中一共展示了CalendarDay类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initEventAndData
import com.prolificinteractive.materialcalendarview.CalendarDay; //导入依赖的package包/类
@Override
protected void initEventAndData() {
setToolBar(mToolbar, "选择日期");
mCalender.state().edit()
.setFirstDayOfWeek(Calendar.WEDNESDAY)
.setMinimumDate(CalendarDay.from(2013, 5, 20))
.setMaximumDate(CalendarDay.from(DateUtil.getCurrentYear(), DateUtil.getCurrentMonth(), DateUtil.getCurrentDay()))
.setCalendarDisplayMode(CalendarMode.MONTHS)
.commit();
mCalender.setOnDateChangedListener(new OnDateSelectedListener() {
@Override
public void onDateSelected(@NonNull MaterialCalendarView widget, @NonNull CalendarDay date, boolean selected) {
mDate = date;
}
});
}
示例2: doInBackground
import com.prolificinteractive.materialcalendarview.CalendarDay; //导入依赖的package包/类
@Override
protected List<CalendarDay> doInBackground(@NonNull Void... voids) {
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.MONTH, -2);
ArrayList<CalendarDay> dates = new ArrayList<>();
for (int i = 0; i < 30; i++) {
CalendarDay day = CalendarDay.from(calendar);
dates.add(day);
calendar.add(Calendar.DATE, 5);
}
return dates;
}
示例3: onRetrieveDeadlineDays
import com.prolificinteractive.materialcalendarview.CalendarDay; //导入依赖的package包/类
@Override
public void onRetrieveDeadlineDays(final ScheduleDeadlineDaysModel model) {
swipeRefreshLayout.setRefreshing(false);
if (slidingUpPanelLayout.getPanelState() != SlidingUpPanelLayout.PanelState.EXPANDED) {
titleSlidingUpPanel.setText(new SimpleDateFormat("MMMM yyyy").format(date.getTime()));
}
materialCalendarView.addDecorator(new DayViewDecorator() {
@Override
public boolean shouldDecorate(CalendarDay day) {
return day.getMonth() == model.month && model.getDays().contains(day.getDay());
}
@Override
public void decorate(DayViewFacade view) {
view.addSpan(new ForegroundColorSpan(ContextCompat.getColor(getContext(), android.R.color.white)));
view.setSelectionDrawable(ContextCompat.getDrawable(getContext(), R.drawable.round));
}
});
}
示例4: onClick
import com.prolificinteractive.materialcalendarview.CalendarDay; //导入依赖的package包/类
public void onClick(View v) {
PeriodActivity.this.dialog.dismiss();
if (v.getTag() != null) {
CalendarDay day = (CalendarDay) v.getTag();
RecordApi.deleteMcRecords(PeriodActivity.this.activity, day.getYear() +
SocializeConstants.OP_DIVIDER_MINUS + (day.getMonth() + 1) +
SocializeConstants.OP_DIVIDER_MINUS + day.getDay(), new JsonCallback
(PeriodActivity.this.activity) {
public void ok(JSONObject object) {
super.ok(object);
if (!PeriodActivity.this.isFinishing()) {
PeriodActivity.this.getMcStatus(PeriodActivity.this
.getCurrentYearMonth());
PeriodActivity.this.setResult(-1);
}
}
});
}
}
示例5: recordMc
import com.prolificinteractive.materialcalendarview.CalendarDay; //导入依赖的package包/类
private void recordMc(String action, CalendarDay day) {
if (day != null) {
JsonParams params = new JsonParams();
params.put("record_on", day.toString());
if (McLatest.ACTION_START.equals(action)) {
params.put("mc_status", "1");
} else if (McLatest.ACTION_END.equals(action)) {
params.put("mc_status", "2");
}
RecordApi.postMcRecords(this.activity, params, new JsonCallback(this.activity) {
public void ok(JSONObject object) {
super.ok(object);
if (!PeriodActivity.this.isFinishing()) {
PeriodActivity.this.getMcStatus(PeriodActivity.this.getCurrentYearMonth());
PeriodActivity.this.setResult(-1);
EventBus.getDefault().post(new PeriodEvent());
}
}
});
}
}
示例6: call
import com.prolificinteractive.materialcalendarview.CalendarDay; //导入依赖的package包/类
@Override
@UiThread
public void call(final Subscriber<? super YearMonth> subscriber) {
checkUiThread();
calendarView.setOnMonthChangedListener(new OnMonthChangedListener() {
@Override
public void onMonthChanged(MaterialCalendarView widget, CalendarDay date) {
if (!subscriber.isUnsubscribed()) {
subscriber.onNext(DateHelper.calendarDayToYearMonth(date));
}
}
});
subscriber.add(new MainThreadSubscription() {
@Override
protected void onUnsubscribe() {
calendarView.setOnMonthChangedListener(null);
}
});
}
示例7: call
import com.prolificinteractive.materialcalendarview.CalendarDay; //导入依赖的package包/类
@Override
@UiThread
public void call(final Subscriber<? super List<LocalDate>> subscriber) {
checkUiThread();
calendarView.setOnRangeSelectedListener(new OnRangeSelectedListener() {
@Override
public void onRangeSelected(@NonNull MaterialCalendarView widget, @NonNull List<CalendarDay> dates) {
if (!subscriber.isUnsubscribed()) {
subscriber.onNext(DateHelper.calendarDaysToLocalDates(dates));
}
}
});
subscriber.add(new MainThreadSubscription() {
@Override
protected void onUnsubscribe() {
calendarView.setOnRangeSelectedListener(null);
}
});
}
示例8: call
import com.prolificinteractive.materialcalendarview.CalendarDay; //导入依赖的package包/类
@Override
@UiThread
public void call(final Subscriber<? super LocalDate> subscriber) {
checkUiThread();
calendarView.setOnDateChangedListener(new OnDateSelectedListener() {
@Override
public void onDateSelected(@NonNull MaterialCalendarView widget, @NonNull CalendarDay date, boolean selected) {
if (!subscriber.isUnsubscribed()) {
subscriber.onNext(DateHelper.calendarDayToLocalDate(date));
}
}
});
subscriber.add(new MainThreadSubscription() {
@Override
protected void onUnsubscribe() {
calendarView.setOnDateChangedListener(null);
}
});
}
示例9: onDateSelected
import com.prolificinteractive.materialcalendarview.CalendarDay; //导入依赖的package包/类
@Override
public void onDateSelected(@NonNull MaterialCalendarView widget, @NonNull CalendarDay date, boolean selected) {
@SuppressLint("SimpleDateFormat") SimpleDateFormat df = new SimpleDateFormat("yyyy/MM/dd");
Calendar calendar = date.getCalendar();
WritableMap event = Arguments.createMap();
event.putString("date", df.format(calendar.getTime()));
event.putBoolean("selected", selected);
ReactContext reactContext = (ReactContext) getContext();
reactContext
.getJSModule(RCTEventEmitter.class)
.receiveEvent(
getId(),
"topDateChange",
event
);
}
示例10: setEventsDates
import com.prolificinteractive.materialcalendarview.CalendarDay; //导入依赖的package包/类
@ReactProp(name = "eventsDates")
public void setEventsDates(ReactMaterialCalendarView view, ReadableArray dates) throws ParseException {
ArrayList<CalendarDay> decorated = new ArrayList<CalendarDay>();
for (int i = 0; i < dates.size(); i++) {
String type = dates.getType(i).name();
if("String".equals(type) && dates.getString(i).matches(DATE_REGEX)){
Date date = dateFormat.parse(dates.getString(i));
decorated.add(CalendarDay.from(date));
} else {
throw new JSApplicationIllegalArgumentException("Invalid date format: " + dates.getString(i));
}
}
if (decorated.size() > 0) {
view.getEvents().setDates(decorated);
}
}
开发者ID:NuclleaR,项目名称:react-native-material-calendarview,代码行数:17,代码来源:ReactMaterialCalendarViewManager.java
示例11: setCalendarData
import com.prolificinteractive.materialcalendarview.CalendarDay; //导入依赖的package包/类
public void setCalendarData(TreeSet<EventFlexibleItem> calendarData) {
this.calendarData = calendarData;
List<EventFlexibleItem> itemsToAdd = new ArrayList<>();
final int numCalendarItems = preferenceValues[EVENTS_PREFERENCE_VALUES_INDEX];
Iterator<EventFlexibleItem> calendarDataIterator = this.calendarData.iterator();
CalendarDay today = CalendarDay.today();
while (calendarDataIterator.hasNext() && itemsToAdd.size() < numCalendarItems) {
EventFlexibleItem currentItem = calendarDataIterator.next();
if (!currentItem.getCalendarDay().isBefore(today)) {
itemsToAdd.add(currentItem);
}
}
if (homeCalendarEventAdapter.getItemCount() != 0)
homeCalendarEventAdapter.clear();
homeCalendarEventAdapter.updateDataSet(new ArrayList<>(itemsToAdd), true);
updatePinnedContent();
}
示例12: updatePinnedContent
import com.prolificinteractive.materialcalendarview.CalendarDay; //导入依赖的package包/类
private void updatePinnedContent() {
if (pinnedUIDs.size() == 0)
homePinnedHeader.setVisibility(View.GONE);
else if (preferenceValues[PINNED_PREFERENCE_VALUES_INDEX] != 0)
homePinnedHeader.setVisibility(View.VISIBLE);
//There is definitely stuff to display now
List<EventFlexibleItem> items = new ArrayList<>(calendarData);
final CalendarDay today = CalendarDay.today();
//noinspection ResultOfMethodCallIgnored
Iterators.removeIf(items.iterator(), input ->
input == null
|| !pinnedUIDs.contains(input.vEvent.getUid().getValue())
|| input.getCalendarDay().isBefore(today));
homeCalendarPinnedAdapter.updateDataSet(
new ArrayList<FlexibleHasCalendarDay>(items)
.subList(0, Math.min(items.size(), preferenceValues[PINNED_PREFERENCE_VALUES_INDEX])),
true);
}
示例13: containsEventsOnDate
import com.prolificinteractive.materialcalendarview.CalendarDay; //导入依赖的package包/类
private boolean containsEventsOnDate(CalendarDay calendarDay, int toFind, boolean useGreaterThan) {
int numPresent = 0;
for (EventFlexibleItem item : calendarData)
if (calendarDay.isAfter(item.getCalendarDay()))
continue;
else if (calendarDay.equals(item.getCalendarDay())) {
numPresent += item.dataSources.size();
if (numPresent > toFind)
return useGreaterThan;
} else if (calendarDay.isBefore(item.getCalendarDay())) {
break;
}
if (useGreaterThan)
return numPresent > toFind;
else
return numPresent == toFind;
}
示例14: onDateClickedMoveMonth
import com.prolificinteractive.materialcalendarview.CalendarDay; //导入依赖的package包/类
public void onDateClickedMoveMonth(@NonNull final CalendarDay selectedDate, boolean shouldCheck) {
CalendarDay currentDate = getCurrentDate();
final int selectedMonth = selectedDate.getMonth();
final int selectedYear = selectedDate.getYear();
CalendarMode calendarMode = getCalendarMode();
while (calendarMode == CalendarMode.MONTHS && allowClickDaysOutsideCurrentMonth() && (currentDate.getMonth() != selectedMonth || currentDate.getYear() != selectedYear)) {
if (currentDate.isAfter(selectedDate)) {
goToPrevious();
} else if (currentDate.isBefore(selectedDate)) {
goToNext();
}
currentDate = getCurrentDate();
}
onDateClicked(selectedDate, shouldCheck);
}
示例15: initEventAndData
import com.prolificinteractive.materialcalendarview.CalendarDay; //导入依赖的package包/类
@Override
protected void initEventAndData() {
currentDate = DateUtil.getTomorrowDate();
mAdapter = new DailyAdapter(mContext,mList);
mAdapter.setOnItemClickListener(new DailyAdapter.OnItemClickListener() {
@Override
public void onItemClick(int position,View shareView) {
mPresenter.insertReadToDB(mList.get(position).getId());
mAdapter.setReadState(position,true);
if(mAdapter.getIsBefore()) {
mAdapter.notifyItemChanged(position + 1);
} else {
mAdapter.notifyItemChanged(position + 2);
}
Intent intent = new Intent();
intent.setClass(mContext, ZhihuDetailActivity.class);
intent.putExtra("id",mList.get(position).getId());
ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(mActivity, shareView, "shareView");
mContext.startActivity(intent,options.toBundle());
}
});
swipeRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
if(currentDate.equals(DateUtil.getTomorrowDate())) {
mPresenter.getDailyData();
} else {
int year = Integer.valueOf(currentDate.substring(0,4));
int month = Integer.valueOf(currentDate.substring(4,6));
int day = Integer.valueOf(currentDate.substring(6,8));
CalendarDay date = CalendarDay.from(year, month - 1, day);
RxBus.getDefault().post(date);
}
}
});
rvDailyList.setLayoutManager(new LinearLayoutManager(mContext));
rvDailyList.setAdapter(mAdapter);
ivProgress.start();
mPresenter.getDailyData();
}