use of org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Time in project Etar-Calendar by Etar-Group.
the class CalendarViewAdapter method buildDayOfWeek.
// Builds a string with the day of the week and the word yesterday/today/tomorrow
// before it if applicable.
private String buildDayOfWeek() {
Time t = new Time(mTimeZone);
t.set(mMilliTime);
long julianDay = Time.getJulianDay(mMilliTime, t.getGmtOffset());
String dayOfWeek = null;
mStringBuilder.setLength(0);
if (julianDay == mTodayJulianDay) {
dayOfWeek = mContext.getString(R.string.agenda_today, DateUtils.formatDateRange(mContext, mFormatter, mMilliTime, mMilliTime, DateUtils.FORMAT_SHOW_WEEKDAY, mTimeZone).toString());
} else if (julianDay == mTodayJulianDay - 1) {
dayOfWeek = mContext.getString(R.string.agenda_yesterday, DateUtils.formatDateRange(mContext, mFormatter, mMilliTime, mMilliTime, DateUtils.FORMAT_SHOW_WEEKDAY, mTimeZone).toString());
} else if (julianDay == mTodayJulianDay + 1) {
dayOfWeek = mContext.getString(R.string.agenda_tomorrow, DateUtils.formatDateRange(mContext, mFormatter, mMilliTime, mMilliTime, DateUtils.FORMAT_SHOW_WEEKDAY, mTimeZone).toString());
} else {
dayOfWeek = DateUtils.formatDateRange(mContext, mFormatter, mMilliTime, mMilliTime, DateUtils.FORMAT_SHOW_WEEKDAY, mTimeZone).toString();
}
return dayOfWeek.toUpperCase();
}
use of org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Time in project Etar-Calendar by Etar-Group.
the class DayView method init.
private void init(Context context) {
setFocusable(true);
// Allow focus in touch mode so that we can do keyboard shortcuts
// even after we've entered touch mode.
setFocusableInTouchMode(true);
setClickable(true);
setOnCreateContextMenuListener(this);
mFirstDayOfWeek = Utils.getFirstDayOfWeek(context);
mCurrentTime = new Time(Utils.getTimeZone(context, mTZUpdater));
long currentTime = System.currentTimeMillis();
mCurrentTime.set(currentTime);
mTodayJulianDay = Time.getJulianDay(currentTime, mCurrentTime.getGmtOffset());
mWeek_todayColor = DynamicTheme.getColor(mContext, "week_today");
mWeek_saturdayColor = DynamicTheme.getColor(mContext, "week_saturday");
mWeek_sundayColor = DynamicTheme.getColor(mContext, "week_sunday");
mCalendarDateBannerTextColor = DynamicTheme.getColor(mContext, "calendar_date_banner_text_color");
mFutureBgColorRes = DynamicTheme.getColor(mContext, "calendar_future_bg_color");
mBgColor = DynamicTheme.getColor(mContext, "calendar_hour_background");
mCalendarHourLabelColor = DynamicTheme.getColor(mContext, "calendar_hour_label");
mCalendarGridAreaSelected = DynamicTheme.getColor(mContext, "calendar_grid_area_selected");
mCalendarGridLineInnerHorizontalColor = DynamicTheme.getColor(mContext, "calendar_grid_line_inner_horizontal_color");
mCalendarGridLineInnerVerticalColor = DynamicTheme.getColor(mContext, "calendar_grid_line_inner_vertical_color");
mPressedColor = DynamicTheme.getColor(mContext, "pressed");
mClickedColor = DynamicTheme.getColor(mContext, "day_event_clicked_background_color");
mEventTextColor = DynamicTheme.getColor(mContext, "calendar_event_text_color");
mMoreEventsTextColor = DynamicTheme.getColor(mContext, "month_event_other_color");
int gridLineColor = mResources.getColor(R.color.calendar_grid_line_highlight_color);
Paint p = mSelectionPaint;
p.setColor(gridLineColor);
p.setStyle(Style.FILL);
p.setAntiAlias(false);
p = mPaint;
p.setAntiAlias(true);
// Allocate space for 2 weeks worth of weekday names so that we can
// easily start the week display at any week day.
mDayStrs = new String[14];
// Also create an array of 2-letter abbreviations.
mDayStrs2Letter = new String[14];
for (int i = Calendar.SUNDAY; i <= Calendar.SATURDAY; i++) {
int index = i - Calendar.SUNDAY;
// e.g. Tue for Tuesday
mDayStrs[index] = DateUtils.getDayOfWeekString(i, DateUtils.LENGTH_MEDIUM);
mDayStrs[index + 7] = mDayStrs[index];
// e.g. Tu for Tuesday
mDayStrs2Letter[index] = DateUtils.getDayOfWeekString(i, DateUtils.LENGTH_SHORT);
// If we don't have 2-letter day strings, fall back to 1-letter.
if (mDayStrs2Letter[index].equals(mDayStrs[index])) {
mDayStrs2Letter[index] = DateUtils.getDayOfWeekString(i, DateUtils.LENGTH_SHORTEST);
}
mDayStrs2Letter[index + 7] = mDayStrs2Letter[index];
}
// Figure out how much space we need for the 3-letter abbrev names
// in the worst case.
p.setTextSize(DATE_HEADER_FONT_SIZE);
p.setTypeface(mBold);
String[] dateStrs = { " 28", " 30" };
mDateStrWidth = computeMaxStringWidth(0, dateStrs, p);
p.setTextSize(DAY_HEADER_FONT_SIZE);
mDateStrWidth += computeMaxStringWidth(0, mDayStrs, p);
p.setTextSize(HOURS_TEXT_SIZE);
p.setTypeface(null);
handleOnResume();
String[] timeStrs = { "12 AM", "12 PM", "22:00" };
p.setTextSize(HOURS_TEXT_SIZE);
mHoursWidth = HOURS_MARGIN + computeMaxStringWidth(mHoursWidth, timeStrs, p);
GRID_LINE_LEFT_MARGIN = mHoursWidth;
LayoutInflater inflater;
inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mPopupView = inflater.inflate(R.layout.bubble_event, null);
mPopupView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
mPopup = new PopupWindow(context);
mPopup.setContentView(mPopupView);
Resources.Theme dialogTheme = getResources().newTheme();
dialogTheme.applyStyle(android.R.style.Theme_Dialog, true);
TypedArray ta = dialogTheme.obtainStyledAttributes(new int[] { android.R.attr.windowBackground });
mPopup.setBackgroundDrawable(ta.getDrawable(0));
ta.recycle();
// Enable touching the popup window
mPopupView.setOnClickListener(this);
// Catch long clicks for creating a new event
setOnLongClickListener(this);
mBaseDate = new Time(Utils.getTimeZone(context, mTZUpdater));
long millis = System.currentTimeMillis();
mBaseDate.set(millis);
mEarliestStartHour = new int[mNumDays];
mHasAllDayEvent = new boolean[mNumDays];
// mLines is the array of points used with Canvas.drawLines() in
// drawGridBackground() and drawAllDayEvents(). Its size depends
// on the max number of lines that can ever be drawn by any single
// drawLines() call in either of those methods.
final int maxGridLines = // max horizontal lines we might draw
(24 + 1) + // max vertical lines we might draw
(mNumDays + 1);
mLines = new float[maxGridLines * 4];
}
use of org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Time in project ddf by codice.
the class CertificateSigningRequestTest method testNewCertificateBuilderWithSan.
@Test
public void testNewCertificateBuilderWithSan() throws Exception {
final DateTime start = DateTime.now().minusDays(1);
final DateTime end = start.plusYears(100);
final KeyPair kp = makeKeyPair();
csr.setSerialNumber(1);
csr.setNotBefore(start);
csr.setNotAfter(end);
csr.setCommonName("A");
csr.setSubjectKeyPair(kp);
csr.addSubjectAlternativeNames("IP:1.2.3.4", "DNS:A");
final X509Certificate issuerCert = mock(X509Certificate.class);
doReturn(new X500Principal("CN=Duke, OU=JavaSoft, O=Sun Microsystems, C=US")).when(issuerCert).getSubjectX500Principal();
final JcaX509v3CertificateBuilder builder = csr.newCertificateBuilder(issuerCert);
final X509CertificateHolder holder = builder.build(new DemoCertificateAuthority().getContentSigner());
assertThat(holder.getSerialNumber(), equalTo(BigInteger.ONE));
assertThat(holder.getNotBefore(), equalTo(new Time(start.toDate()).getDate()));
assertThat(holder.getNotAfter(), equalTo(new Time(end.toDate()).getDate()));
assertThat(holder.getSubject().toString(), equalTo("cn=A"));
assertThat("Unable to validate public key", holder.getSubjectPublicKeyInfo(), equalTo(SubjectPublicKeyInfo.getInstance(kp.getPublic().getEncoded())));
final org.bouncycastle.asn1.x509.Extension csn = holder.getExtension(org.bouncycastle.asn1.x509.Extension.subjectAlternativeName);
assertThat(csn.getParsedValue().toASN1Primitive().getEncoded(ASN1Encoding.DER), equalTo(new GeneralNamesBuilder().addName(new GeneralName(GeneralName.iPAddress, "1.2.3.4")).addName(new GeneralName(GeneralName.dNSName, "A")).build().getEncoded(ASN1Encoding.DER)));
}
use of org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Time in project ddf by codice.
the class CertificateSigningRequestTest method testNewCertificateBuilderWithoutSan.
@Test
public void testNewCertificateBuilderWithoutSan() throws Exception {
final DateTime start = DateTime.now().minusDays(1);
final DateTime end = start.plusYears(100);
final KeyPair kp = makeKeyPair();
csr.setSerialNumber(1);
csr.setNotBefore(start);
csr.setNotAfter(end);
csr.setCommonName("A");
csr.setSubjectKeyPair(kp);
final X509Certificate issuerCert = mock(X509Certificate.class);
doReturn(new X500Principal("CN=Duke, OU=JavaSoft, O=Sun Microsystems, C=US")).when(issuerCert).getSubjectX500Principal();
final JcaX509v3CertificateBuilder builder = csr.newCertificateBuilder(issuerCert);
final X509CertificateHolder holder = builder.build(new DemoCertificateAuthority().getContentSigner());
assertThat(holder.getSerialNumber(), equalTo(BigInteger.ONE));
assertThat(holder.getNotBefore(), equalTo(new Time(start.toDate()).getDate()));
assertThat(holder.getNotAfter(), equalTo(new Time(end.toDate()).getDate()));
assertThat(holder.getSubject().toString(), equalTo("cn=A"));
assertThat("Unable to validate public key", holder.getSubjectPublicKeyInfo(), equalTo(SubjectPublicKeyInfo.getInstance(kp.getPublic().getEncoded())));
assertThat("There should be no subject alternative name extension", holder.getExtension(org.bouncycastle.asn1.x509.Extension.subjectAlternativeName), nullValue(org.bouncycastle.asn1.x509.Extension.class));
}
use of org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Time in project clinical_quality_language by cqframework.
the class TimeInvocation method getOperands.
@Override
public Iterable<Expression> getOperands() {
Time t = (Time) expression;
List<Expression> opList = Arrays.asList(t.getHour(), t.getMinute(), t.getSecond(), t.getMillisecond());
// If the last expression is null, we should trim this down
int i;
for (i = 3; i > 0 && opList.get(i) == null; i--) ;
return opList.subList(0, i + 1);
}
Aggregations