List of usage examples for java.util Calendar JUNE
int JUNE
To view the source code for java.util Calendar JUNE.
Click Source Link
From source file:com.appeaser.sublimepickerlibrary.utilities.SUtils.java
public static int getDaysInMonth(int month, int year) { switch (month) { case Calendar.JANUARY: case Calendar.MARCH: case Calendar.MAY: case Calendar.JULY: case Calendar.AUGUST: case Calendar.OCTOBER: case Calendar.DECEMBER: return 31; case Calendar.APRIL: case Calendar.JUNE: case Calendar.SEPTEMBER: case Calendar.NOVEMBER: return 30; case Calendar.FEBRUARY: // This is not correct. See isLeapYear(int) above //return (year % 4 == 0) ? 29 : 28; return isLeapYear(year) ? 29 : 28; default:/*w w w . ja v a 2 s. c o m*/ throw new IllegalArgumentException("Invalid Month"); } }
From source file:com.evolveum.midpoint.report.BasicReportTest.java
private Calendar create_2013_06_01_00_00_Calendar() { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.YEAR, 2013); calendar.set(Calendar.MONTH, Calendar.JUNE); calendar.set(Calendar.DAY_OF_MONTH, 1); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); return calendar; }
From source file:gbc.jtimecalc.AbstractTimeDifferenceCalculatorTest.java
public void shouldReturn1BusinessMonth20BusinessDaysWithoutTailingZeroes() { Calendar end = prepareCalendar(2011, Calendar.JULY, 31, 0, 0, 0, 0); // 31.07.2011 00:00:00.0 setEndTime(end.getTimeInMillis());/*from w w w. j av a 2 s .com*/ Calendar start = (Calendar) end.clone(); start.set(Calendar.MONTH, Calendar.JUNE); start.set(Calendar.DAY_OF_MONTH, 10); setStartTime(start.getTimeInMillis()); expectedValue = messages.get("1BusinessMonth20BusinessDays"); }
From source file:com.tr4android.support.extension.picker.date.SimpleMonthView.java
private static int getDaysInMonth(int month, int year) { switch (month) { case Calendar.JANUARY: case Calendar.MARCH: case Calendar.MAY: case Calendar.JULY: case Calendar.AUGUST: case Calendar.OCTOBER: case Calendar.DECEMBER: return 31; case Calendar.APRIL: case Calendar.JUNE: case Calendar.SEPTEMBER: case Calendar.NOVEMBER: return 30; case Calendar.FEBRUARY: return (year % 4 == 0) ? 29 : 28; default://w w w . j a v a 2 s . c om throw new IllegalArgumentException("Invalid Month"); } }
From source file:org.anhonesteffort.flock.ServerTestsFragment.java
private void startTests() { asyncTask = new AsyncTask<String, Void, Bundle>() { private TextView currentTest; private ImageView testErrorImage; private ProgressBar progressBar; private int progress = 0; @Override//from w w w .j ava 2 s.co m protected void onPreExecute() { Log.d(TAG, "startTests()"); currentTest = (TextView) getView().findViewById(R.id.text_current_test); testErrorImage = (ImageView) getView().findViewById(R.id.image_current_test_failed); progressBar = (ProgressBar) getView().findViewById(R.id.progress_server_tests); currentTest.setText(R.string.tests_not_yet_started); testErrorImage.setVisibility(View.GONE); progressBar.setMax(9); progressBar.setProgress(0); } private void handleCardDavTestCurrentUserPrincipal(Bundle result, DavAccount testAccount) { try { CardDavStore cardDavStore = DavAccountHelper.getCardDavStore(getActivity(), testAccount); Optional<String> currentUserPrincipal = cardDavStore.getCurrentUserPrincipal(); if (currentUserPrincipal.isPresent()) result.putInt(ErrorToaster.KEY_STATUS_CODE, ErrorToaster.CODE_SUCCESS); else result.putInt(ErrorToaster.KEY_STATUS_CODE, CODE_ERROR_CARDDAV_CURRENT_USER_PRINCIPAL); } catch (DavException e) { if (e.getErrorCode() == DavServletResponse.SC_UNAUTHORIZED) result.putInt(ErrorToaster.KEY_STATUS_CODE, ErrorToaster.CODE_UNAUTHORIZED); else result.putInt(ErrorToaster.KEY_STATUS_CODE, CODE_ERROR_CARDDAV_CURRENT_USER_PRINCIPAL); } catch (SSLException e) { ErrorToaster.handleBundleError(e, result); } catch (IOException e) { ErrorToaster.handleBundleError(e, result); } } private void handleCalDavTestCurrentUserPrincipal(Bundle result, DavAccount testAccount) { try { CalDavStore calDavStore = DavAccountHelper.getCalDavStore(getActivity(), testAccount); Optional<String> currentUserPrincipal = calDavStore.getCurrentUserPrincipal(); if (currentUserPrincipal.isPresent()) result.putInt(ErrorToaster.KEY_STATUS_CODE, ErrorToaster.CODE_SUCCESS); else result.putInt(ErrorToaster.KEY_STATUS_CODE, CODE_ERROR_CALDAV_CURRENT_USER_PRINCIPAL); } catch (DavException e) { Log.d(TAG, e.toString()); if (e.getErrorCode() == DavServletResponse.SC_UNAUTHORIZED) result.putInt(ErrorToaster.KEY_STATUS_CODE, ErrorToaster.CODE_UNAUTHORIZED); else result.putInt(ErrorToaster.KEY_STATUS_CODE, CODE_ERROR_CALDAV_CURRENT_USER_PRINCIPAL); } catch (SSLException e) { ErrorToaster.handleBundleError(e, result); } catch (IOException e) { ErrorToaster.handleBundleError(e, result); } } private void handleCardDavTestAddressbookHomeset(Bundle result, DavAccount testAccount) { try { CardDavStore cardDavStore = DavAccountHelper.getCardDavStore(getActivity(), testAccount); Optional<String> addressbookHomeset = cardDavStore.getAddressbookHomeSet(); if (addressbookHomeset.isPresent()) result.putInt(ErrorToaster.KEY_STATUS_CODE, ErrorToaster.CODE_SUCCESS); else result.putInt(ErrorToaster.KEY_STATUS_CODE, CODE_ERROR_CARDDAV_ADDRESSBOOK_HOMESET); } catch (DavException e) { Log.d(TAG, e.toString()); result.putInt(ErrorToaster.KEY_STATUS_CODE, CODE_ERROR_CARDDAV_ADDRESSBOOK_HOMESET); } catch (PropertyParseException e) { Log.d(TAG, e.toString()); result.putInt(ErrorToaster.KEY_STATUS_CODE, CODE_ERROR_CARDDAV_ADDRESSBOOK_HOMESET); } catch (SSLException e) { ErrorToaster.handleBundleError(e, result); } catch (IOException e) { ErrorToaster.handleBundleError(e, result); } } private void handleCalDavTestCalendarHomeset(Bundle result, DavAccount testAccount) { try { CalDavStore calDavStore = DavAccountHelper.getCalDavStore(getActivity(), testAccount); Optional<String> calendarHomeset = calDavStore.getCalendarHomeSet(); if (calendarHomeset.isPresent()) result.putInt(ErrorToaster.KEY_STATUS_CODE, ErrorToaster.CODE_SUCCESS); else result.putInt(ErrorToaster.KEY_STATUS_CODE, CODE_ERROR_CALDAV_CALENDAR_HOMESET); } catch (DavException e) { Log.d(TAG, e.toString()); result.putInt(ErrorToaster.KEY_STATUS_CODE, CODE_ERROR_CALDAV_CALENDAR_HOMESET); } catch (PropertyParseException e) { Log.d(TAG, e.toString()); result.putInt(ErrorToaster.KEY_STATUS_CODE, CODE_ERROR_CALDAV_CALENDAR_HOMESET); } catch (SSLException e) { ErrorToaster.handleBundleError(e, result); } catch (IOException e) { ErrorToaster.handleBundleError(e, result); } } private void handleCalDavTestCreateDeleteCollection(Bundle result, DavAccount testAccount) { try { CalDavStore calDavStore = DavAccountHelper.getCalDavStore(getActivity(), testAccount); Optional<String> calendarHomeset = calDavStore.getCalendarHomeSet(); if (!calendarHomeset.isPresent()) { result.putInt(ErrorToaster.KEY_STATUS_CODE, CODE_ERROR_CALDAV_CALENDAR_HOMESET); return; } String tempCollectionPath = calendarHomeset.get().concat("delete-me/"); calDavStore.addCollection(tempCollectionPath); Optional<CalDavCollection> tempCollection = calDavStore.getCollection(tempCollectionPath); if (!tempCollection.isPresent()) { result.putInt(ErrorToaster.KEY_STATUS_CODE, CODE_ERROR_CALDAV_CREATE_DELETE_COLLECTION); return; } calDavStore.removeCollection(tempCollectionPath); tempCollection = calDavStore.getCollection(tempCollectionPath); if (tempCollection.isPresent()) result.putInt(ErrorToaster.KEY_STATUS_CODE, CODE_ERROR_CALDAV_CREATE_DELETE_COLLECTION); else result.putInt(ErrorToaster.KEY_STATUS_CODE, ErrorToaster.CODE_SUCCESS); } catch (DavException e) { Log.d(TAG, e.toString()); result.putInt(ErrorToaster.KEY_STATUS_CODE, CODE_ERROR_CALDAV_CREATE_DELETE_COLLECTION); } catch (PropertyParseException e) { Log.d(TAG, e.toString()); result.putInt(ErrorToaster.KEY_STATUS_CODE, CODE_ERROR_CALDAV_CREATE_DELETE_COLLECTION); } catch (SSLException e) { ErrorToaster.handleBundleError(e, result); } catch (IOException e) { ErrorToaster.handleBundleError(e, result); } } private void handleCalDavTestCreateEditCollectionProperties(Bundle result, DavAccount testAccount) { final String TEMP_DISPLAY_NAME = "TEMP DISPLAY NAME"; try { CalDavStore calDavStore = DavAccountHelper.getCalDavStore(getActivity(), testAccount); Optional<String> calendarHomeset = calDavStore.getCalendarHomeSet(); if (!calendarHomeset.isPresent()) { result.putInt(ErrorToaster.KEY_STATUS_CODE, CODE_ERROR_CALDAV_CALENDAR_HOMESET); return; } String tempCollectionPath = calendarHomeset.get().concat("delete-me/"); calDavStore.addCollection(tempCollectionPath); Optional<CalDavCollection> tempCollection = calDavStore.getCollection(tempCollectionPath); if (!tempCollection.isPresent()) { result.putInt(ErrorToaster.KEY_STATUS_CODE, CODE_ERROR_CALDAV_CREATE_DELETE_COLLECTION); return; } tempCollection.get().setDisplayName(TEMP_DISPLAY_NAME); if (!tempCollection.get().getDisplayName().isPresent() || !tempCollection.get().getDisplayName().get().equals(TEMP_DISPLAY_NAME)) { result.putInt(ErrorToaster.KEY_STATUS_CODE, CODE_ERROR_CALDAV_CREATE_EDIT_COLLECTION_PROPERTIES); return; } final DavPropertyName TEST_PROP_NAME = DavPropertyName.create("X-TEST-XPROPERTIES", OwsWebDav.NAMESPACE); final String TEST_PROP_VALUE = "TEST PROPERTY VALUE"; DavPropertySet setProps = new DavPropertySet(); DavPropertyNameSet fetchPropNames = new DavPropertyNameSet(); setProps.add(new DefaultDavProperty<String>(TEST_PROP_NAME, TEST_PROP_VALUE)); fetchPropNames.add(TEST_PROP_NAME); tempCollection.get().patchProperties(setProps, new DavPropertyNameSet()); tempCollection.get().fetchProperties(fetchPropNames); Optional<String> gotTestProp = tempCollection.get().getProperty(TEST_PROP_NAME, String.class); if (!gotTestProp.isPresent() || !gotTestProp.get().equals(TEST_PROP_VALUE)) { result.putInt(ErrorToaster.KEY_STATUS_CODE, CODE_ERROR_CALDAV_CREATE_EDIT_COLLECTION_PROPERTIES); return; } calDavStore.removeCollection(tempCollectionPath); result.putInt(ErrorToaster.KEY_STATUS_CODE, ErrorToaster.CODE_SUCCESS); } catch (DavException e) { Log.d(TAG, e.toString()); result.putInt(ErrorToaster.KEY_STATUS_CODE, CODE_ERROR_CALDAV_CREATE_EDIT_COLLECTION_PROPERTIES); } catch (PropertyParseException e) { Log.d(TAG, e.toString()); result.putInt(ErrorToaster.KEY_STATUS_CODE, CODE_ERROR_CALDAV_CREATE_EDIT_COLLECTION_PROPERTIES); } catch (SSLException e) { ErrorToaster.handleBundleError(e, result); } catch (IOException e) { ErrorToaster.handleBundleError(e, result); } } private void handleCardDavTestCreateDeleteContacts(Bundle result, DavAccount testAccount) { try { CardDavStore cardDavStore = DavAccountHelper.getCardDavStore(getActivity(), testAccount); List<CardDavCollection> collections = cardDavStore.getCollections(); if (collections.size() == 0) { result.putInt(ErrorToaster.KEY_STATUS_CODE, CODE_ERROR_CARDDAV_CREATE_DELETE_CONTACTS); return; } CardDavCollection testCollection = collections.get(0); final StructuredName structuredName = new StructuredName(); structuredName.setFamily("Strangelove"); structuredName.setGiven("?"); structuredName.addPrefix("Dr"); structuredName.addSuffix(""); VCard putVCard = new VCard(); putVCard.setVersion(VCardVersion.V3_0); putVCard.setUid(new Uid(UUID.randomUUID().toString())); putVCard.setStructuredName(structuredName); putVCard.setFormattedName("you need this too"); final String EXTENDED_PROPERTY_NAME = "X-EXTENDED-PROPERTY-NAME"; final String EXTENDED_PROPERTY_VALUE = "THIS IS A LINE LONG ENOUGH TO BE SPLIT IN TWO BY THE VCARD FOLDING NONSENSE WHY DOES THIS EXIST?!?!??!?!?!?!?!??"; putVCard.setExtendedProperty(EXTENDED_PROPERTY_NAME, EXTENDED_PROPERTY_VALUE); testCollection.addComponent(putVCard); Optional<ComponentETagPair<VCard>> gotVCard = testCollection .getComponent(putVCard.getUid().getValue()); if (!gotVCard.isPresent()) { result.putInt(ErrorToaster.KEY_STATUS_CODE, CODE_ERROR_CARDDAV_CREATE_DELETE_CONTACTS); return; } if (!gotVCard.get().getComponent().getStructuredName().getFamily() .equals(structuredName.getFamily())) { result.putInt(ErrorToaster.KEY_STATUS_CODE, CODE_ERROR_CARDDAV_CREATE_DELETE_CONTACTS); return; } if (gotVCard.get().getComponent().getExtendedProperty(EXTENDED_PROPERTY_NAME) == null || !gotVCard.get().getComponent().getExtendedProperty(EXTENDED_PROPERTY_NAME).getValue() .equals(EXTENDED_PROPERTY_VALUE)) { result.putInt(ErrorToaster.KEY_STATUS_CODE, CODE_ERROR_CARDDAV_CREATE_DELETE_CONTACTS); return; } testCollection.removeComponent(putVCard.getUid().getValue()); if (testCollection.getComponent(putVCard.getUid().getValue()).isPresent()) result.putInt(ErrorToaster.KEY_STATUS_CODE, CODE_ERROR_CARDDAV_CREATE_DELETE_CONTACTS); else result.putInt(ErrorToaster.KEY_STATUS_CODE, ErrorToaster.CODE_SUCCESS); } catch (DavException e) { Log.d(TAG, e.toString()); result.putInt(ErrorToaster.KEY_STATUS_CODE, CODE_ERROR_CARDDAV_CREATE_DELETE_CONTACTS); } catch (PropertyParseException e) { Log.d(TAG, e.toString()); result.putInt(ErrorToaster.KEY_STATUS_CODE, CODE_ERROR_CARDDAV_CREATE_DELETE_CONTACTS); } catch (InvalidComponentException e) { Log.d(TAG, e.toString()); result.putInt(ErrorToaster.KEY_STATUS_CODE, CODE_ERROR_CARDDAV_CREATE_DELETE_CONTACTS); } catch (SSLException e) { ErrorToaster.handleBundleError(e, result); } catch (IOException e) { ErrorToaster.handleBundleError(e, result); } } private void handleCalDavTestCreateDeleteEvents(Bundle result, DavAccount testAccount) { try { CalDavStore calDavStore = DavAccountHelper.getCalDavStore(getActivity(), testAccount); Optional<String> calendarHomeset = calDavStore.getCalendarHomeSet(); if (!calendarHomeset.isPresent()) { result.putInt(ErrorToaster.KEY_STATUS_CODE, CODE_ERROR_CALDAV_CALENDAR_HOMESET); return; } String tempCollectionPath = calendarHomeset.get().concat("delete-me/"); calDavStore.addCollection(tempCollectionPath); Optional<CalDavCollection> tempCollection = calDavStore.getCollection(tempCollectionPath); if (!tempCollection.isPresent()) { result.putInt(ErrorToaster.KEY_STATUS_CODE, CODE_ERROR_CALDAV_CREATE_DELETE_COLLECTION); return; } Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.MONTH, Calendar.JUNE); calendar.set(Calendar.DAY_OF_MONTH, 5); net.fortuna.ical4j.model.Calendar putCalendar = new net.fortuna.ical4j.model.Calendar(); putCalendar.getProperties().add(Version.VERSION_2_0); putCalendar.getProperties().add(CalScale.GREGORIAN); Date putStartDate = new Date(calendar.getTime()); Date putEndDate = new Date(putStartDate.getTime() + (1000 * 60 * 60 * 24)); VEvent vEventPut = new VEvent(putStartDate, putEndDate, "Delete Me!"); vEventPut.getProperties() .add(new net.fortuna.ical4j.model.property.Uid(UUID.randomUUID().toString())); vEventPut.getProperties().add(new Description( "THIS IS A LINE LONG ENOUGH TO BE SPLIT IN TWO BY THE ICAL FOLDING NONSENSE WHY DOES THIS EXIST?!?!??!?!?!?!?!??")); putCalendar.getComponents().add(vEventPut); tempCollection.get().addComponent(putCalendar); Optional<ComponentETagPair<net.fortuna.ical4j.model.Calendar>> gotCalendar = tempCollection .get().getComponent(Calendars.getUid(putCalendar).getValue()); if (!gotCalendar.isPresent()) { result.putInt(ErrorToaster.KEY_STATUS_CODE, CODE_ERROR_CALDAV_CREATE_DELETE_EVENTS); return; } VEvent vEventGot = (VEvent) gotCalendar.get().getComponent().getComponent(VEvent.VEVENT); if (vEventGot == null || !vEventGot.getSummary().getValue().equals(vEventPut.getSummary().getValue())) { result.putInt(ErrorToaster.KEY_STATUS_CODE, CODE_ERROR_CALDAV_CREATE_DELETE_EVENTS); return; } tempCollection.get().removeComponent(Calendars.getUid(putCalendar).getValue()); gotCalendar = tempCollection.get().getComponent(Calendars.getUid(putCalendar).getValue()); if (gotCalendar.isPresent()) { result.putInt(ErrorToaster.KEY_STATUS_CODE, CODE_ERROR_CALDAV_CREATE_DELETE_EVENTS); return; } calDavStore.removeCollection(tempCollectionPath); result.putInt(ErrorToaster.KEY_STATUS_CODE, ErrorToaster.CODE_SUCCESS); } catch (DavException e) { Log.d(TAG, e.toString()); result.putInt(ErrorToaster.KEY_STATUS_CODE, CODE_ERROR_CALDAV_CREATE_DELETE_EVENTS); } catch (PropertyParseException e) { Log.d(TAG, e.toString()); result.putInt(ErrorToaster.KEY_STATUS_CODE, CODE_ERROR_CALDAV_CREATE_DELETE_EVENTS); } catch (InvalidComponentException e) { Log.d(TAG, e.toString()); result.putInt(ErrorToaster.KEY_STATUS_CODE, CODE_ERROR_CALDAV_CREATE_DELETE_EVENTS); } catch (ConstraintViolationException e) { Log.d(TAG, e.toString()); result.putInt(ErrorToaster.KEY_STATUS_CODE, CODE_ERROR_CALDAV_CREATE_DELETE_EVENTS); } catch (SSLException e) { ErrorToaster.handleBundleError(e, result); } catch (IOException e) { ErrorToaster.handleBundleError(e, result); } } @Override protected Bundle doInBackground(String... params) { String webDavHost = ((TextView) getView().findViewById(R.id.href_webdav_host)).getText().toString() .trim(); String username = ((TextView) getView().findViewById(R.id.account_username)).getText().toString() .trim(); String password = ((TextView) getView().findViewById(R.id.account_password)).getText().toString() .trim(); Bundle result = new Bundle(); if (StringUtils.isEmpty(username)) { result.putInt(ErrorToaster.KEY_STATUS_CODE, ErrorToaster.CODE_EMPTY_ACCOUNT_ID); return result; } if (StringUtils.isEmpty(password)) { result.putInt(ErrorToaster.KEY_STATUS_CODE, ErrorToaster.CODE_SHORT_PASSWORD); return result; } DavAccount testAccount = new DavAccount(username, password, webDavHost); progress++; publishProgress(); handleCardDavTestCurrentUserPrincipal(result, testAccount); if (result.getInt(ErrorToaster.KEY_STATUS_CODE) == ErrorToaster.CODE_SUCCESS) { progress++; publishProgress(); handleCalDavTestCurrentUserPrincipal(result, testAccount); } if (result.getInt(ErrorToaster.KEY_STATUS_CODE) == ErrorToaster.CODE_SUCCESS) { progress++; publishProgress(); handleCardDavTestAddressbookHomeset(result, testAccount); } if (result.getInt(ErrorToaster.KEY_STATUS_CODE) == ErrorToaster.CODE_SUCCESS) { progress++; publishProgress(); handleCalDavTestCalendarHomeset(result, testAccount); } if (result.getInt(ErrorToaster.KEY_STATUS_CODE) == ErrorToaster.CODE_SUCCESS) { progress++; publishProgress(); handleCalDavTestCreateDeleteCollection(result, testAccount); } if (result.getInt(ErrorToaster.KEY_STATUS_CODE) == ErrorToaster.CODE_SUCCESS) { progress++; publishProgress(); handleCalDavTestCreateEditCollectionProperties(result, testAccount); } if (result.getInt(ErrorToaster.KEY_STATUS_CODE) == ErrorToaster.CODE_SUCCESS) { progress++; publishProgress(); handleCardDavTestCreateDeleteContacts(result, testAccount); } if (result.getInt(ErrorToaster.KEY_STATUS_CODE) == ErrorToaster.CODE_SUCCESS) { progress++; publishProgress(); handleCalDavTestCreateDeleteEvents(result, testAccount); if (result.getInt(ErrorToaster.KEY_STATUS_CODE) == ErrorToaster.CODE_SUCCESS) { progress++; publishProgress(); } } return result; } @Override protected void onProgressUpdate(final Void... values) { progressBar.setProgress(progress); switch (progress) { case 0: currentTest.setText(R.string.tests_not_yet_started); break; case 1: currentTest.setText(R.string.test_dav_current_user_principal); break; case 2: currentTest.setText(R.string.test_dav_current_user_principal); break; case 3: currentTest.setText(R.string.test_carddav_addressbook_homeset); break; case 4: currentTest.setText(R.string.test_caldav_calendar_homeset); break; case 5: currentTest.setText(R.string.test_caldav_create_and_delete_collections); break; case 6: currentTest.setText(R.string.test_caldav_create_and_edit_collection_properties); break; case 7: currentTest.setText(R.string.test_carddav_create_and_delete_contacts); break; case 8: currentTest.setText(R.string.test_caldav_create_and_delete_events); break; } } @Override protected void onCancelled() { currentTest.setText(R.string.tests_interrupted); progressBar.setProgress(0); } @Override protected void onPostExecute(Bundle result) { Log.d(TAG, "STATUS: " + result.getInt(ErrorToaster.KEY_STATUS_CODE)); asyncTask = null; testErrorImage.setVisibility(View.VISIBLE); ((Button) getActivity().findViewById(R.id.button_next)).setText(R.string.restart_tests); switch (result.getInt(ErrorToaster.KEY_STATUS_CODE)) { case ErrorToaster.CODE_SUCCESS: testErrorImage.setVisibility(View.GONE); handleTestsSucceeded(); break; case CODE_ERROR_CARDDAV_CURRENT_USER_PRINCIPAL: Toast.makeText(getActivity(), R.string.test_error_carddav_current_user_principal, Toast.LENGTH_LONG).show(); break; case CODE_ERROR_CALDAV_CURRENT_USER_PRINCIPAL: Toast.makeText(getActivity(), R.string.test_error_carddav_current_user_principal, Toast.LENGTH_LONG).show(); break; case CODE_ERROR_CARDDAV_ADDRESSBOOK_HOMESET: Toast.makeText(getActivity(), R.string.test_error_carddav_addressbook_homeset, Toast.LENGTH_LONG).show(); break; case CODE_ERROR_CALDAV_CALENDAR_HOMESET: Toast.makeText(getActivity(), R.string.test_error_caldav_calendar_homeset, Toast.LENGTH_LONG) .show(); break; case CODE_ERROR_CALDAV_CREATE_DELETE_COLLECTION: Toast.makeText(getActivity(), R.string.test_error_caldav_create_and_delete_collections, Toast.LENGTH_LONG).show(); break; case CODE_ERROR_CALDAV_CREATE_EDIT_COLLECTION_PROPERTIES: Toast.makeText(getActivity(), R.string.test_error_caldav_create_and_edit_collection_properties, Toast.LENGTH_LONG).show(); break; case CODE_ERROR_CARDDAV_CREATE_DELETE_CONTACTS: Toast.makeText(getActivity(), R.string.test_error_carddav_create_and_delete_contacts, Toast.LENGTH_LONG).show(); break; case CODE_ERROR_CALDAV_CREATE_DELETE_EVENTS: Toast.makeText(getActivity(), R.string.test_error_caldav_create_and_delete_events, Toast.LENGTH_LONG).show(); break; default: ErrorToaster.handleDisplayToastBundledError(getActivity(), result); } ((TextView) getView().findViewById(R.id.account_password)).setText(""); } }.execute(); }
From source file:cn.mljia.common.notify.utils.DateUtils.java
/** * ?/*from w ww .j av a 2 s. c o m*/ * * @param date * @return */ public static Date[] getSeasonDate(Date date) { Date[] season = new Date[3]; Calendar c = Calendar.getInstance(); c.setTime(date); int nSeason = getSeason(date); if (nSeason == 1) {// c.set(Calendar.MONTH, Calendar.JANUARY); season[0] = c.getTime(); c.set(Calendar.MONTH, Calendar.FEBRUARY); season[1] = c.getTime(); c.set(Calendar.MONTH, Calendar.MARCH); season[2] = c.getTime(); } else if (nSeason == 2) {// c.set(Calendar.MONTH, Calendar.APRIL); season[0] = c.getTime(); c.set(Calendar.MONTH, Calendar.MAY); season[1] = c.getTime(); c.set(Calendar.MONTH, Calendar.JUNE); season[2] = c.getTime(); } else if (nSeason == 3) {// c.set(Calendar.MONTH, Calendar.JULY); season[0] = c.getTime(); c.set(Calendar.MONTH, Calendar.AUGUST); season[1] = c.getTime(); c.set(Calendar.MONTH, Calendar.SEPTEMBER); season[2] = c.getTime(); } else if (nSeason == 4) {// c.set(Calendar.MONTH, Calendar.OCTOBER); season[0] = c.getTime(); c.set(Calendar.MONTH, Calendar.NOVEMBER); season[1] = c.getTime(); c.set(Calendar.MONTH, Calendar.DECEMBER); season[2] = c.getTime(); } return season; }
From source file:cn.mljia.common.notify.utils.DateUtils.java
/** * // w ww . j a v a2s . c om * 1 2 3 4 * * @param date * @return */ public static int getSeason(Date date) { int season = 0; Calendar c = Calendar.getInstance(); c.setTime(date); int month = c.get(Calendar.MONTH); switch (month) { case Calendar.JANUARY: case Calendar.FEBRUARY: case Calendar.MARCH: season = 1; break; case Calendar.APRIL: case Calendar.MAY: case Calendar.JUNE: season = 2; break; case Calendar.JULY: case Calendar.AUGUST: case Calendar.SEPTEMBER: season = 3; break; case Calendar.OCTOBER: case Calendar.NOVEMBER: case Calendar.DECEMBER: season = 4; break; default: break; } return season; }
From source file:org.kuali.kfs.module.endow.document.service.impl.CurrentTaxLotServiceImpl.java
/** * This method will check the current month and set the calendar to that month * //from w ww . j a v a2 s. c o m * @param month month to set the calendar, currentDate currentDate * @return calendar calendar is set to the month selected */ protected Calendar setCaledarWithMonth(String month, Date lastPaymentDate) { Calendar calendar = Calendar.getInstance(); calendar.setTime(lastPaymentDate); int calendarMonth = 1; if (EndowConstants.FrequencyMonths.JANUARY.equalsIgnoreCase(month)) { calendarMonth = Calendar.JANUARY; } else if (EndowConstants.FrequencyMonths.FEBRUARY.equalsIgnoreCase(month)) { calendarMonth = Calendar.FEBRUARY; } else if (EndowConstants.FrequencyMonths.MARCH.equalsIgnoreCase(month)) { calendarMonth = Calendar.MARCH; } else if (EndowConstants.FrequencyMonths.APRIL.equalsIgnoreCase(month)) { calendarMonth = Calendar.APRIL; } else if (EndowConstants.FrequencyMonths.MAY.equalsIgnoreCase(month)) { calendarMonth = Calendar.MAY; } else if (EndowConstants.FrequencyMonths.JUNE.equalsIgnoreCase(month)) { calendarMonth = Calendar.JUNE; } else if (EndowConstants.FrequencyMonths.JULY.equalsIgnoreCase(month)) { calendarMonth = Calendar.JULY; } else if (EndowConstants.FrequencyMonths.AUGUST.equalsIgnoreCase(month)) { calendarMonth = Calendar.AUGUST; } else if (EndowConstants.FrequencyMonths.SEPTEMBER.equalsIgnoreCase(month)) { calendarMonth = Calendar.SEPTEMBER; } else if (EndowConstants.FrequencyMonths.OCTOBER.equalsIgnoreCase(month)) { calendarMonth = Calendar.OCTOBER; } else if (EndowConstants.FrequencyMonths.NOVEMBER.equalsIgnoreCase(month)) { calendarMonth = Calendar.NOVEMBER; } else if (EndowConstants.FrequencyMonths.DECEMBER.equalsIgnoreCase(month)) { calendarMonth = Calendar.DECEMBER; } calendar.set(Calendar.MONTH, calendarMonth); return calendar; }
From source file:org.kuali.kfs.module.endow.document.service.impl.CurrentTaxLotServiceImpl.java
/** * This method will check the current month and set the calendar to that month * //from w w w .j a va 2 s . com * @param month, dayOfMonth month to set the calendar, dayOfMonth day of the month to set to * @return calendar calendar is set to the month selected */ protected void setCalendarWithDays(Calendar calendar, String dayOfMonth) { int dayInMonthToSet; int calendarMonth = calendar.get(Calendar.MONTH); if (StringUtils.equalsIgnoreCase(dayOfMonth, EndowConstants.FrequencyMonthly.MONTH_END)) { // month end for the month so // need to get max days... dayInMonthToSet = checkMaximumDaysInMonth(calendar.get(Calendar.MONTH)); } else { dayInMonthToSet = Integer.parseInt(dayOfMonth); if (dayInMonthToSet > 29 && calendarMonth == Calendar.FEBRUARY) { dayInMonthToSet = checkMaximumDaysInFebruary(); } else if (dayInMonthToSet > 30 && (calendarMonth == Calendar.APRIL || calendarMonth == Calendar.JUNE || calendarMonth == Calendar.SEPTEMBER || calendarMonth == Calendar.NOVEMBER)) { dayInMonthToSet = 30; dayInMonthToSet = checkMaximumDaysInMonth(calendarMonth); } } calendar.set(Calendar.DAY_OF_MONTH, dayInMonthToSet); }
From source file:com.frey.repo.DateUtil.java
/** * ?//from w w w.j a va 2s . c om */ public static int getPassDayOfSeason(Date date) { int day = 0; Date[] seasonDates = getSeasonDate(date); Calendar c = Calendar.getInstance(); c.setTime(date); int month = c.get(Calendar.MONTH); if (month == Calendar.JANUARY || month == Calendar.APRIL || month == Calendar.JULY || month == Calendar.OCTOBER) {// day = getPassDayOfMonth(seasonDates[0]); } else if (month == Calendar.FEBRUARY || month == Calendar.MAY || month == Calendar.AUGUST || month == Calendar.NOVEMBER) {// day = getDayOfMonth(seasonDates[0]) + getPassDayOfMonth(seasonDates[1]); } else if (month == Calendar.MARCH || month == Calendar.JUNE || month == Calendar.SEPTEMBER || month == Calendar.DECEMBER) {// day = getDayOfMonth(seasonDates[0]) + getDayOfMonth(seasonDates[1]) + getPassDayOfMonth(seasonDates[2]); } return day; }