本文整理汇总了Java中hirondelle.date4j.DateTime.gt方法的典型用法代码示例。如果您正苦于以下问题:Java DateTime.gt方法的具体用法?Java DateTime.gt怎么用?Java DateTime.gt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hirondelle.date4j.DateTime
的用法示例。
在下文中一共展示了DateTime.gt方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDateItemLongClickListener
import hirondelle.date4j.DateTime; //导入方法依赖的package包/类
/**
* Callback to listener when date is valid (not disable, not outside of
* min/max date)
*
* @return
*/
private OnItemLongClickListener getDateItemLongClickListener() {
dateItemLongClickListener = new OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view,
int position, long id) {
DateTime dateTime = dateInMonthsList.get(position);
if (caldroidListener != null) {
if ((minDateTime != null && dateTime.lt(minDateTime))
|| (maxDateTime != null && dateTime.gt(maxDateTime))
|| (disableDates != null && disableDates
.indexOf(dateTime) != -1)) {
return false;
}
Date date = CalendarHelper.convertDateTimeToDate(dateTime);
caldroidListener.onLongClickDate(date, view);
}
return true;
}
};
return dateItemLongClickListener;
}
示例2: onDateChanged
import hirondelle.date4j.DateTime; //导入方法依赖的package包/类
@Override
public void onDateChanged(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
if (noDateChangedReaction) {
Logger.debug("date not changed - infinite loop protection");
} else {
selectedYear = year;
selectedMonth = monthOfYear;
selectedDay = dayOfMonth;
// restrict date range to the week we are editing right now
DateTime newDate = getCurrentlySetDateAndTime();
try {
noDateChangedReaction = true;
if (newDate.lt(weekStart)) {
date.updateDate(weekStart.getYear(), weekStart.getMonth() - 1, weekStart.getDay());
selectedYear = weekStart.getYear();
selectedMonth = weekStart.getMonth() - 1;
selectedDay = weekStart.getDay();
Toast.makeText(this,
"adjusted date to match first day of week - the event has to stay in the current week",
Toast.LENGTH_LONG).show();
} else if (newDate.gt(weekEnd)) {
date.updateDate(weekEnd.getYear(), weekEnd.getMonth() - 1, weekEnd.getDay());
selectedYear = weekEnd.getYear();
selectedMonth = weekEnd.getMonth() - 1;
selectedDay = weekEnd.getDay();
Toast.makeText(this,
"adjusted date to match last day of week - the event has to stay in the current week",
Toast.LENGTH_LONG).show();
}
} finally {
noDateChangedReaction = false;
}
setWeekday();
Logger.debug("date changed to {0}-{1}-{2}", year, monthOfYear, dayOfMonth);
}
}
示例3: isAutoPauseApplicable
import hirondelle.date4j.DateTime; //导入方法依赖的package包/类
/**
* Determines if the auto-pause can be applied to the given day.
*/
public boolean isAutoPauseApplicable(DateTime dateTime) {
DateTime end = getAutoPauseEnd(dateTime);
// auto-pause is theoretically applicable
return isAutoPauseTheoreticallyApplicable(dateTime)
// given time is after auto-pause end, so auto-pause should really be applied
&& dateTime.gt(end);
}
示例4: customizeTextView
import hirondelle.date4j.DateTime; //导入方法依赖的package包/类
/**
* Customize colors of text and background based on states of the cell
* (disabled, active, selected, etc)
* <p/>
* To be used only in getView method
*
* @param position
* @param cellView
*/
protected void customizeTextView(int position, CellView cellView) {
// Get the padding of cell so that it can be restored later
// int topPadding = cellView.getPaddingTop();
// int leftPadding = cellView.getPaddingLeft();
// int bottomPadding = cellView.getPaddingBottom();
// int rightPadding = cellView.getPaddingRight();
// Get dateTime of this cell
DateTime dateTime = this.datetimeList.get(position);
cellView.resetCustomStates();
resetCustomResources(cellView);
if (dateTime.equals(getToday())) {
cellView.addCustomState(CellView.STATE_TODAY);
}
// Set color of the dates in previous / next month
if (dateTime.getMonth() != month) {
cellView.addCustomState(CellView.STATE_PREV_NEXT_MONTH);
}
// Customize for disabled dates and date outside min/max dates
if ((minDateTime != null && dateTime.lt(minDateTime))
|| (maxDateTime != null && dateTime.gt(maxDateTime))
|| (disableDates != null && disableDatesMap
.containsKey(dateTime))) {
cellView.addCustomState(CellView.STATE_DISABLED);
}
// Customize for selected dates
if (selectedDates != null && selectedDatesMap.containsKey(dateTime)) {
cellView.addCustomState(CellView.STATE_SELECTED);
}
cellView.refreshDrawableState();
// Set text
cellView.setText("" + dateTime.getDay());
// Set custom color if required
setCustomResources(dateTime, cellView, cellView);
// Somehow after setBackgroundResource, the padding collapse.
// This is to recover the padding
// cellView.setPadding(leftPadding, topPadding, rightPadding,
// bottomPadding);
}
开发者ID:maheswaranapk,项目名称:Andorid-Material-Drop-Down-Date-Picker,代码行数:59,代码来源:CaldroidGridAdapter.java
示例5: isInPast
import hirondelle.date4j.DateTime; //导入方法依赖的package包/类
/**
* Determines if the given {@link DateTime} is in the past.
*/
public static boolean isInPast(DateTime dateTime) {
DateTime now = getCurrentDateTime();
return now.gt(dateTime);
}
示例6: customizeTextView
import hirondelle.date4j.DateTime; //导入方法依赖的package包/类
/**
* Customize colors of text and background based on states of the cell
* (disabled, active, selected, etc)
*
* To be used only in getView method
*
* @param position
* @param cellView
*/
protected void customizeTextView(int position, TextView cellView) {
cellView.setTextColor(Color.BLACK);
// Get dateTime of this cell
DateTime dateTime = this.datetimeList.get(position);
// Set color of the dates in previous / next month
if (dateTime.getMonth() != month) {
cellView.setTextColor(resources
.getColor(R.color.caldroid_darker_gray));
}
boolean shouldResetDiabledView = false;
boolean shouldResetSelectedView = false;
// Customize for disabled dates and date outside min/max dates
if ((minDateTime != null && dateTime.lt(minDateTime)) || (maxDateTime != null && dateTime.gt(maxDateTime))) {
cellView.setTextColor(CaldroidFragment.disabledTextColor);
if (CaldroidFragment.disabledBackgroundDrawable == -1) {
cellView.setBackgroundResource(R.drawable.disable_cell);
} else {
cellView.setBackgroundResource(CaldroidFragment.disabledBackgroundDrawable);
}
if (dateTime.equals(getToday())) {
cellView.setBackgroundResource(R.drawable.today_border_grey);
}
} else {
shouldResetDiabledView = true;
}
// Customize for selected dates
if (selectedDates != null && selectedDatesMap.containsKey(dateTime)) {
if (CaldroidFragment.selectedBackgroundDrawable != -1) {
cellView.setBackgroundResource(CaldroidFragment.selectedBackgroundDrawable);
} else {
cellView.setBackgroundColor(resources.getColor(R.color.caldroid_sky_blue));
}
cellView.setTextColor(CaldroidFragment.selectedTextColor);
} else {
shouldResetSelectedView = true;
}
if (shouldResetDiabledView && shouldResetSelectedView) {
// Customize for today
if (dateTime.equals(getToday())) {
cellView.setBackgroundResource(R.drawable.today_without_border_selector);
} else {
cellView.setBackgroundResource(R.drawable.cell_bg);
}
}
cellView.setText("" + dateTime.getDay());
// Set custom color if required
setCustomResources(dateTime, cellView);
}
示例7: customizeTextView
import hirondelle.date4j.DateTime; //导入方法依赖的package包/类
/**
* Customize colors of text and background based on states of the cell
* (disabled, active, selected, etc)
*
* To be used only in getView method
*
* @param position
* @param cellView
*/
protected void customizeTextView(int position, TextView cellView) {
cellView.setTextColor(Color.BLACK);
// Get dateTime of this cell
DateTime dateTime = this.datetimeList.get(position);
// Set color of the dates in previous / next month
if (dateTime.getMonth() != month) {
cellView.setTextColor(resources
.getColor(R.color.caldroid_darker_gray));
}
boolean shouldResetDiabledView = false;
boolean shouldResetSelectedView = false;
// Customize for disabled dates and date outside min/max dates
if ((minDateTime != null && dateTime.lt(minDateTime))
|| (maxDateTime != null && dateTime.gt(maxDateTime))
|| (disableDates != null && disableDatesMap
.containsKey(dateTime))) {
cellView.setTextColor(CaldroidFragment.disabledTextColor);
if (CaldroidFragment.disabledBackgroundDrawable == -1) {
cellView.setBackgroundResource(R.drawable.disable_cell);
} else {
cellView.setBackgroundResource(CaldroidFragment.disabledBackgroundDrawable);
}
if (dateTime.equals(getToday())) {
cellView.setBackgroundResource(R.drawable.red_border_gray_bg);
}
} else {
shouldResetDiabledView = true;
}
// Customize for selected dates
if (selectedDates != null && selectedDatesMap.containsKey(dateTime)) {
if (CaldroidFragment.selectedBackgroundDrawable != -1) {
cellView.setBackgroundResource(CaldroidFragment.selectedBackgroundDrawable);
} else {
cellView.setBackgroundColor(resources
.getColor(R.color.caldroid_sky_blue));
}
cellView.setTextColor(CaldroidFragment.selectedTextColor);
} else {
shouldResetSelectedView = true;
}
if (shouldResetDiabledView && shouldResetSelectedView) {
// Customize for today
if (dateTime.equals(getToday())) {
cellView.setBackgroundResource(R.drawable.red_border);
} else {
cellView.setBackgroundResource(R.drawable.cell_bg);
}
}
cellView.setText("" + dateTime.getDay());
// Set custom color if required
setCustomResources(dateTime, cellView);
}
示例8: isDateInWeek
import hirondelle.date4j.DateTime; //导入方法依赖的package包/类
/**
* Check if a date is in a specific week.
*
* @param date
* the date to check
* @param week
* the referenced week
* @return {@code true} if the date is inside the week, {@code false} otherwise
*/
public static boolean isDateInWeek(DateTime date, Week week) {
DateTime weekStart = DateTimeUtil.stringToDateTime(week.getStart());
DateTime weekEnd = weekStart.plusDays(7);
return weekStart.lteq(date) && weekEnd.gt(date);
}