本文整理汇总了Java中hirondelle.date4j.DateTime.lt方法的典型用法代码示例。如果您正苦于以下问题:Java DateTime.lt方法的具体用法?Java DateTime.lt怎么用?Java DateTime.lt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hirondelle.date4j.DateTime
的用法示例。
在下文中一共展示了DateTime.lt方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setSelectedDates
import hirondelle.date4j.DateTime; //导入方法依赖的package包/类
public void setSelectedDates(Date fromDate, Date toDate) {
// Ensure fromDate is before toDate
if (fromDate == null || toDate == null || fromDate.after(toDate)) {
return;
}
clearSelectedDates();
DateTime fromDateTime = CalendarHelper.convertDateToDateTime(fromDate);
DateTime toDateTime = CalendarHelper.convertDateToDateTime(toDate);
DateTime dateTime = fromDateTime;
while (dateTime.lt(toDateTime)) {
selectedDate = dateTime;
}
}
示例2: check
import hirondelle.date4j.DateTime; //导入方法依赖的package包/类
@Override
public boolean check(SharedPreferences prefs) {
String beginString = prefs.getString(Key.AUTO_PAUSE_BEGIN.getName(), null);
if (beginString == null || beginString.trim().length() == 0) {
return false;
}
beginString = DateTimeUtil.refineTime(beginString);
DateTime begin = DateTimeUtil.parseTimeForToday(beginString);
String endString = prefs.getString(Key.AUTO_PAUSE_END.getName(), null);
if (endString == null || endString.trim().length() == 0) {
return false;
}
endString = DateTimeUtil.refineTime(endString);
DateTime end = DateTimeUtil.parseTimeForToday(endString);
try {
// the actual parsing of begin and end takes place here as this is the first access to fields
return begin.lt(end);
} catch (Exception e) {
return false;
}
}
示例3: setSelectedDates
import hirondelle.date4j.DateTime; //导入方法依赖的package包/类
/**
* Select the dates from fromDate to toDate. By default the background color
* is holo_blue_light, and the text color is black. You can customize the
* background by changing CaldroidFragment.selectedBackgroundDrawable, and
* change the text color CaldroidFragment.selectedTextColor before call this
* method. This method does not refresh view, need to call refreshView()
*
* @param fromDate
* @param toDate
*/
public void setSelectedDates(Date fromDate, Date toDate) {
// Ensure fromDate is before toDate
if (fromDate == null || toDate == null || fromDate.after(toDate)) {
return;
}
selectedDates.clear();
DateTime fromDateTime = CalendarHelper.convertDateToDateTime(fromDate);
DateTime toDateTime = CalendarHelper.convertDateToDateTime(toDate);
DateTime dateTime = fromDateTime;
while (dateTime.lt(toDateTime)) {
selectedDates.add(dateTime);
dateTime = dateTime.plusDays(1);
}
selectedDates.add(toDateTime);
}
示例4: 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;
}
示例5: 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);
}
}
示例6: isAutoPauseTheoreticallyApplicable
import hirondelle.date4j.DateTime; //导入方法依赖的package包/类
private boolean isAutoPauseTheoreticallyApplicable(DateTime dateTime) {
DateTime begin = getAutoPauseBegin(dateTime);
DateTime end = getAutoPauseEnd(dateTime);
if (begin.lt(end)) {
Event lastEventBeforeBegin = dao.getLastEventBefore(begin);
Event lastEventBeforeEnd = dao.getLastEventBefore(end);
// is clocked in before begin
return lastEventBeforeBegin != null && lastEventBeforeBegin.getType().equals(TypeEnum.CLOCK_IN.getValue())
// no event is in auto-pause interval
&& lastEventBeforeBegin.getId().equals(lastEventBeforeEnd.getId());
} else {
// begin is equal to end or (even worse) begin is after end => no auto-pause
return false;
}
}
示例7: 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
示例8: isInFuture
import hirondelle.date4j.DateTime; //导入方法依赖的package包/类
/**
* Determines if the given {@link DateTime} is in the future.
*/
public static boolean isInFuture(DateTime dateTime) {
DateTime now = getCurrentDateTime();
return now.lt(dateTime);
}
示例9: 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);
}
示例10: 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);
}