@Test public void testGetLongFormat() { final UserDateFormatter f = new UserDefaultsDateFormatter(TimeZone.getDefault().getID()); assertNotNull(f.getLongFormat(System.currentTimeMillis(), false)); assertNotNull(f.getLongFormat(System.currentTimeMillis(), true)); }
@Override public String getLongFormat(final long milliseconds, boolean natural) { synchronized(longDateFormatter) { if(-1 == milliseconds) { return LocaleFactory.localizedString("Unknown"); } longDateFormatter.setTimeZone(NSTimeZone.timeZoneWithName(timezone)); if(natural) { return longDateNaturalFormatter.stringFromDate(toDate(milliseconds)); } return longDateFormatter.stringFromDate(toDate(milliseconds)); } }
UserDefaultsDateFormatter extends AbstractUserDateFormatter implements UserDateFormatter { @Override public String getLongFormat(final long milliseconds, boolean natural) { synchronized(longDateFormatter) { if(-1 == milliseconds) { return LocaleFactory.localizedString("Unknown"); } longDateFormatter.setTimeZone(NSTimeZone.timeZoneWithName(timezone)); if(natural) { return longDateNaturalFormatter.stringFromDate(toDate(milliseconds)); } return longDateFormatter.stringFromDate(toDate(milliseconds)); } } }
UserDefaultsDateFormatter extends AbstractUserDateFormatter implements UserDateFormatter { @Override public String getLongFormat(final long milliseconds, boolean natural) { synchronized(longDateFormatter) { if(-1 == milliseconds) { return LocaleFactory.localizedString("Unknown"); } longDateFormatter.setTimeZone(NSTimeZone.timeZoneWithName(timezone)); if(natural) { return longDateNaturalFormatter.stringFromDate(toDate(milliseconds)); } return longDateFormatter.stringFromDate(toDate(milliseconds)); } } UserDefaultsDateFormatter(final String timezone); }
UserDefaultsDateFormatter extends AbstractUserDateFormatter implements UserDateFormatter { @Override public String getLongFormat(final long milliseconds, boolean natural) { synchronized(longDateFormatter) { if(-1 == milliseconds) { return LocaleFactory.localizedString("Unknown"); } longDateFormatter.setTimeZone(NSTimeZone.timeZoneWithName(timezone)); if(natural) { return longDateNaturalFormatter.stringFromDate(toDate(milliseconds)); } return longDateFormatter.stringFromDate(toDate(milliseconds)); } } UserDefaultsDateFormatter(final String timezone); @Override String getShortFormat(final long milliseconds, boolean natural); @Override String getMediumFormat(final long milliseconds, boolean natural); @Override String getLongFormat(final long milliseconds, boolean natural); }
UserDefaultsDateFormatter extends AbstractUserDateFormatter implements UserDateFormatter { @Override public String getLongFormat(final long milliseconds, boolean natural) { synchronized(longDateFormatter) { if(-1 == milliseconds) { return LocaleFactory.localizedString("Unknown"); } longDateFormatter.setTimeZone(NSTimeZone.timeZoneWithName(timezone)); if(natural) { return longDateNaturalFormatter.stringFromDate(toDate(milliseconds)); } return longDateFormatter.stringFromDate(toDate(milliseconds)); } } UserDefaultsDateFormatter(final String timezone); @Override String getShortFormat(final long milliseconds, boolean natural); @Override String getMediumFormat(final long milliseconds, boolean natural); @Override String getLongFormat(final long milliseconds, boolean natural);  }