本文整理汇总了Java中hirondelle.date4j.DateTime.today方法的典型用法代码示例。如果您正苦于以下问题:Java DateTime.today方法的具体用法?Java DateTime.today怎么用?Java DateTime.today使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hirondelle.date4j.DateTime
的用法示例。
在下文中一共展示了DateTime.today方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onNewIntent
import hirondelle.date4j.DateTime; //导入方法依赖的package包/类
@Override
protected void onNewIntent(Intent intent) {
if (intent.hasExtra(NotifySchedulingService.NOTIFICATION_WORN)) {
//TODO: save date in intent so that we can retrieve whether it still applies for the current date
DateTime utcDateTime = DateTime.today(TimeZone.getTimeZone("UTC"));
long utcDateLong = utcDateTime.getMilliseconds(TimeZone.getTimeZone("UTC"));
boolean isWorn = intent.getExtras().getBoolean(NotifySchedulingService.NOTIFICATION_WORN);
onUpdateWorn(utcDateLong, isWorn);
// cancel notification
NotificationManager notificationManager = (NotificationManager)
this.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.cancel(NotifySchedulingService.NOTIFICATION_ID);
}
super.onNewIntent(intent);
}
示例2: getToday
import hirondelle.date4j.DateTime; //导入方法依赖的package包/类
public static DateTime getToday() {
return DateTime.today(TimeZone.getDefault());
}
示例3: retrieveInitialArgs
import hirondelle.date4j.DateTime; //导入方法依赖的package包/类
protected void retrieveInitialArgs() {
// Get arguments
Bundle args = getArguments();
if (args != null) {
// Get month, year
month = args.getInt(MONTH, -1);
year = args.getInt(YEAR, -1);
// Get start day of Week. Default calendar first column is SUNDAY
startDayOfWeek = args.getInt(START_DAY_OF_WEEK, 1);
if (startDayOfWeek > 7) {
startDayOfWeek = startDayOfWeek % 7;
}
int orientation = getResources().getConfiguration().orientation;
if (orientation == Configuration.ORIENTATION_PORTRAIT) {
squareTextViewCell = args.getBoolean(SQUARE_TEXT_VIEW_CELL, true);
} else {
squareTextViewCell = args.getBoolean(SQUARE_TEXT_VIEW_CELL, false);
}
// Get disable dates
ArrayList<String> disableDateStrings = args
.getStringArrayList(DISABLE_DATES);
if (disableDateStrings != null && disableDateStrings.size() > 0) {
disableDates.clear();
for (String dateString : disableDateStrings) {
DateTime dt = CalendarHelper.getDateTimeFromString(
dateString, "yyyy-MM-dd");
disableDates.add(dt);
}
}
// Get selected dates
String selectedDateString = args
.getString(SELECTED_DATES);
if (selectedDateString != null ) {
clearSelectedDates();
selectedDate = CalendarHelper.getDateTimeFromString(
selectedDateString, "yyyy-MM-dd");
}
// Get min date and max date
String minDateTimeString = args.getString(MIN_DATE);
if (minDateTimeString != null) {
minDateTime = CalendarHelper.getDateTimeFromString(
minDateTimeString, null);
}
String maxDateTimeString = args.getString(MAX_DATE);
if (maxDateTimeString != null) {
maxDateTime = CalendarHelper.getDateTimeFromString(
maxDateTimeString, null);
}
// Get theme
themeResource = args.getInt(THEME_RESOURCE, R.style.CaldroidDefault);
}
if (month == -1 || year == -1) {
DateTime dateTime = DateTime.today(TimeZone.getDefault());
month = dateTime.getMonth();
year = dateTime.getYear();
}
}
示例4: retrieveInitialArgs
import hirondelle.date4j.DateTime; //导入方法依赖的package包/类
/**
* Retrieve initial arguments to the fragment Data can include: month, year,
* dialogTitle, showNavigationArrows,(String) disableDates, selectedDates,
* minDate, maxDate
*/
protected void retrieveInitialArgs(Bundle savedInstanceState) {
// Get arguments
Bundle args = getArguments();
if (args != null) {
// Get month, year
month = args.getInt(MONTH, -1);
year = args.getInt(YEAR, -1);
dialogTitle = args.getString(DIALOG_TITLE);
Dialog dialog = getDialog();
if (dialog != null) {
if (dialogTitle != null) {
dialog.setTitle(dialogTitle);
} else {
// Don't display title bar if user did not supply
// dialogTitle
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
}
}
// Get start day of Week. Default calendar first column is SUNDAY
startDayOfWeek = args.getInt(START_DAY_OF_WEEK, 1);
if (startDayOfWeek > 7) {
startDayOfWeek = startDayOfWeek % 7;
}
// Should show arrow
showNavigationArrows = args
.getBoolean(SHOW_NAVIGATION_ARROWS, true);
// Should enable swipe to change month
enableSwipe = args.getBoolean(ENABLE_SWIPE, true);
// Get sixWeeksInCalendar
sixWeeksInCalendar = args.getBoolean(SIX_WEEKS_IN_CALENDAR, true);
// Get clickable setting
enableClickOnDisabledDates = args.getBoolean(ENABLE_CLICK_ON_DISABLED_DATES, false);
// Get selected dates
ArrayList<String> selectedDateStrings = args.getStringArrayList(SELECTED_DATES);
if (selectedDateStrings != null && selectedDateStrings.size() > 0) {
for (String dateString : selectedDateStrings) {
DateTime dt = CalendarHelper.getDateTimeFromString(dateString, "yyyy-MM-dd");
selectedDates.add(dt);
}
}
// Get min date and max date
String minDateTimeString = args.getString(MIN_DATE);
if (minDateTimeString != null) {
minDateTime = CalendarHelper.getDateTimeFromString(
minDateTimeString, null);
}
String maxDateTimeString = args.getString(MAX_DATE);
if (maxDateTimeString != null) {
maxDateTime = CalendarHelper.getDateTimeFromString(
maxDateTimeString, null);
}
}
if (month == -1 || year == -1) {
DateTime dateTime = DateTime.today(TimeZone.getDefault());
month = dateTime.getMonth();
year = dateTime.getYear();
}
}
示例5: doInBackground
import hirondelle.date4j.DateTime; //导入方法依赖的package包/类
@Override
protected Boolean doInBackground(GenerateDataTaskParams... params) {
if (params != null && params.length > 0) {
taskParams = params[0];
}
deleteAllExistingData();
final List<Food> allFoods = Food.getAllFoods();
final int numDays = taskParams.getHistoryToGenerate();
final DateTime today = DateTime.today(TimeZone.getDefault());
DateTime current = today.minusDays(numDays);
int i = 0;
while (current.lteq(today)) {
createServingsForDay(allFoods, current);
publishProgress(++i, numDays);
current = current.plusDays(1);
}
return null;
}