本文整理汇总了Java中hirondelle.date4j.DateTime.getMonth方法的典型用法代码示例。如果您正苦于以下问题:Java DateTime.getMonth方法的具体用法?Java DateTime.getMonth怎么用?Java DateTime.getMonth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hirondelle.date4j.DateTime
的用法示例。
在下文中一共展示了DateTime.getMonth方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getEvent
import hirondelle.date4j.DateTime; //导入方法依赖的package包/类
/**
* Formatting string representation for a course
* @param i
* @return
*/
private String getEvent(int i) {
DateTime start = agendas.get(i).getStartDate();
DateTime end = agendas.get(i).getEndDate();
String summary = agendas.get(i).getTrimmedTitle() + " ";
//Gives time two digit representation
summary += start.getDay() + ".";
summary += start.getMonth() + " ";
summary += String.format("%02d",start.getHour()) + ":";
summary += String.format("%02d",start.getMinute()) + "-";
summary += String.format("%02d",end.getHour()) + ":";
summary += String.format("%02d",end.getMinute());
return summary;
}
示例2: updateDateAndTimePickers
import hirondelle.date4j.DateTime; //导入方法依赖的package包/类
private void updateDateAndTimePickers(DateTime dateTime) {
time.setCurrentHour(dateTime.getHour());
time.setCurrentMinute(dateTime.getMinute());
if (pickersAreInitialized) {
date.updateDate(dateTime.getYear(), dateTime.getMonth() - 1, dateTime.getDay());
} else {
time.setOnTimeChangedListener(this);
date.init(dateTime.getYear(), dateTime.getMonth() - 1, dateTime.getDay(), this);
pickersAreInitialized = true;
// manually set the variables once:
selectedHour = dateTime.getHour();
selectedMinute = dateTime.getMinute();
selectedYear = dateTime.getYear();
selectedMonth = dateTime.getMonth() - 1;
selectedDay = dateTime.getDay();
setWeekday();
}
}
示例3: setDate
import hirondelle.date4j.DateTime; //导入方法依赖的package包/类
private void setDate(DateTime dateTime) {
this.date = Long.valueOf(getDateString(dateTime));
this.year = dateTime.getYear();
this.month = dateTime.getMonth();
this.day = dateTime.getDay();
}
示例4: setCalendarDateTime
import hirondelle.date4j.DateTime; //导入方法依赖的package包/类
public void setCalendarDateTime(DateTime dateTime) {
month = dateTime.getMonth();
year = dateTime.getYear();
// Notify listener
if (caldroidListener != null) {
caldroidListener.onChangeMonth(month, year);
}
refreshView();
}
示例5: convertDateTimeToDate
import hirondelle.date4j.DateTime; //导入方法依赖的package包/类
public static Date convertDateTimeToDate(DateTime dateTime) {
int year = dateTime.getYear();
int datetimeMonth = dateTime.getMonth();
int day = dateTime.getDay();
Calendar calendar = Calendar.getInstance();
calendar.clear();
// datetimeMonth start at 1. Need to minus 1 to get javaMonth
calendar.set(year, datetimeMonth - 1, day);
return calendar.getTime();
}
示例6: getInfo
import hirondelle.date4j.DateTime; //导入方法依赖的package包/类
private String getInfo(DateTime date) {
int month = date.getMonth();
int day = date.getDay();
int year = date.getYear();
String stringDate = month + "/" + day + "/" + year;
edu.uillinois.wseemann.uicombatschedule.utils.Date obj = (edu.uillinois.wseemann.uicombatschedule.utils.Date) extraData.get(stringDate);
if (obj != null) {
return obj.getInfo();
}
return null;
}
示例7: setCalendarDateTime
import hirondelle.date4j.DateTime; //导入方法依赖的package包/类
public void setCalendarDateTime(DateTime dateTime) {
month = dateTime.getMonth();
year = dateTime.getYear();
// Notify listener
if (caldroidListener != null) {
caldroidListener.onChangeMonth(month, year);
}
refreshView();
}
示例8: convertDateTimeToDate
import hirondelle.date4j.DateTime; //导入方法依赖的package包/类
public static Date convertDateTimeToDate(DateTime dateTime) {
int year = dateTime.getYear();
int datetimeMonth = dateTime.getMonth();
int day = dateTime.getDay();
Calendar calendar = Calendar.getInstance();
calendar.clear();
// datetimeMonth start at 1. Need to minus 1 to get javaMonth
calendar.set(year, datetimeMonth - 1, day);
return calendar.getTime();
}
示例9: 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();
}
}
示例10: setAdapterDateTime
import hirondelle.date4j.DateTime; //导入方法依赖的package包/类
public void setAdapterDateTime(DateTime dateTime) {
this.month = dateTime.getMonth();
this.year = dateTime.getYear();
this.datetimeList = CalendarHelper.getFullWeeks(this.month, this.year,
startDayOfWeek);
}
开发者ID:maheswaranapk,项目名称:Andorid-Material-Drop-Down-Date-Picker,代码行数:7,代码来源:CaldroidGridAdapter.java
示例11: 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
示例12: 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();
}
}
示例13: setAdapterDateTime
import hirondelle.date4j.DateTime; //导入方法依赖的package包/类
public void setAdapterDateTime(DateTime dateTime) {
this.month = dateTime.getMonth();
this.year = dateTime.getYear();
this.datetimeList = CalendarHelper.getFullWeeks(this.month, this.year,
startDayOfWeek, sixWeeksInCalendar);
}
示例14: 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);
}
示例15: setAdapterDateTime
import hirondelle.date4j.DateTime; //导入方法依赖的package包/类
public void setAdapterDateTime(DateTime dateTime) {
this.month = dateTime.getMonth();
this.year = dateTime.getYear();
this.datetimeList = CalendarHelper.getFullWeeks(this.month, this.year,
startDayOfWeek);
}