use of org.joda.time.LocalTime in project Auto.js by hyb1996.
the class TimedTaskSettingActivity method setUpTime.
private void setUpTime() {
mDisposableTaskDate.setText(DATE_FORMATTER.print(LocalDate.now()));
mDisposableTaskTime.setText(TIME_FORMATTER.print(LocalTime.now()));
if (mTimedTask == null) {
mDailyTaskRadio.setChecked(true);
return;
}
if (mTimedTask.isDisposable()) {
mDisposableTaskRadio.setChecked(true);
mDisposableTaskTime.setText(TIME_FORMATTER.print(mTimedTask.getMillis()));
mDisposableTaskDate.setText(DATE_FORMATTER.print(mTimedTask.getMillis()));
return;
}
LocalTime time = LocalTime.fromMillisOfDay(mTimedTask.getMillis());
mDailyTaskTimePicker.setCurrentHour(time.getHourOfDay());
mDailyTaskTimePicker.setCurrentMinute(time.getMinuteOfHour());
if (mTimedTask.isDaily()) {
mDailyTaskRadio.setChecked(true);
} else {
mWeeklyTaskRadio.setChecked(true);
for (int i = 0; i < mDayOfWeekCheckBoxes.size(); i++) {
mDayOfWeekCheckBoxes.get(i).setChecked(mTimedTask.hasDayOfWeek(i + 1));
}
}
}
use of org.joda.time.LocalTime in project Auto.js by hyb1996.
the class TimedTaskSettingActivity method createWeeklyTask.
private TimedTask createWeeklyTask() {
long timeFlag = 0;
for (int i = 0; i < mDayOfWeekCheckBoxes.size(); i++) {
if (mDayOfWeekCheckBoxes.get(i).isChecked()) {
timeFlag |= TimedTask.getDayOfWeekTimeFlag(i + 1);
}
}
if (timeFlag == 0) {
Toast.makeText(this, R.string.text_weekly_task_should_check_day_of_week, Toast.LENGTH_SHORT).show();
return null;
}
LocalTime time = new LocalTime(mDailyTaskTimePicker.getCurrentHour(), mDailyTaskTimePicker.getCurrentMinute());
return TimedTask.weeklyTask(time, timeFlag, mScriptFile.getPath(), ExecutionConfig.getDefault());
}
use of org.joda.time.LocalTime in project Auto.js by hyb1996.
the class TimedTaskSettingActivity method showDisposableTaskTimePicker.
@Click(R.id.disposable_task_time_container)
void showDisposableTaskTimePicker() {
LocalTime time = TIME_FORMATTER.parseLocalTime(mDisposableTaskTime.getText().toString());
new TimePickerDialog(this, (view, hourOfDay, minute) -> mDisposableTaskTime.setText(TIME_FORMATTER.print(new LocalTime(hourOfDay, minute))), time.getHourOfDay(), time.getMinuteOfHour(), true).show();
}
use of org.joda.time.LocalTime in project drill by axbaretto.
the class CompareFunctionsProcessor method visitSchemaPath.
@Override
public Boolean visitSchemaPath(SchemaPath path, LogicalExpression valueArg) throws RuntimeException {
// If valueArg is null, this might be a IS NULL/IS NOT NULL type of query
if (valueArg == null) {
this.path = path;
return true;
}
if (valueArg instanceof QuotedString) {
this.value = KeyValueBuilder.initFrom(((QuotedString) valueArg).value);
this.path = path;
return true;
}
if (valueArg instanceof IntExpression) {
this.value = KeyValueBuilder.initFrom(((IntExpression) valueArg).getInt());
this.path = path;
return true;
}
if (valueArg instanceof FloatExpression) {
this.value = KeyValueBuilder.initFrom(((FloatExpression) valueArg).getFloat());
this.path = path;
return true;
}
if (valueArg instanceof BooleanExpression) {
this.value = KeyValueBuilder.initFrom(((BooleanExpression) valueArg).getBoolean());
this.path = path;
return true;
}
if (valueArg instanceof Decimal28Expression) {
this.value = KeyValueBuilder.initFrom(((Decimal28Expression) valueArg).getBigDecimal());
this.path = path;
return true;
}
if (valueArg instanceof Decimal38Expression) {
this.value = KeyValueBuilder.initFrom(((Decimal38Expression) valueArg).getBigDecimal());
this.path = path;
return true;
}
if (valueArg instanceof DoubleExpression) {
this.value = KeyValueBuilder.initFrom(((DoubleExpression) valueArg).getDouble());
this.path = path;
return true;
}
if (valueArg instanceof LongExpression) {
this.value = KeyValueBuilder.initFrom(((LongExpression) valueArg).getLong());
this.path = path;
return true;
}
if (valueArg instanceof DateExpression) {
long d = ((DateExpression) valueArg).getDate();
final long MILLISECONDS_IN_A_DAY = (long) 1000 * 60 * 60 * 24;
int daysSinceEpoch = (int) (d / MILLISECONDS_IN_A_DAY);
this.value = KeyValueBuilder.initFrom(ODate.fromDaysSinceEpoch(daysSinceEpoch));
this.path = path;
return true;
}
if (valueArg instanceof TimeExpression) {
int t = ((TimeExpression) valueArg).getTime();
LocalTime lT = LocalTime.fromMillisOfDay(t);
this.value = KeyValueBuilder.initFrom(new OTime(lT.getHourOfDay(), lT.getMinuteOfHour(), lT.getSecondOfMinute(), lT.getMillisOfSecond()));
this.path = path;
return true;
}
if (valueArg instanceof TimeStampExpression) {
// disable pushdown of TimeStampExpression type until bug 22824 is fixed.
//
// this.value = KeyValueBuilder.initFrom(new OTimestamp(((TimeStampExpression)valueArg).getTimeStamp()));
// this.path = path;
// return true;
}
return false;
}
use of org.joda.time.LocalTime in project drill by apache.
the class TestDateFunctions method testToChar.
@Test
public void testToChar() throws Exception {
mockUsDateFormatSymbols();
String[] expectedResults = { (new LocalDate(2008, 2, 23)).toString("yyyy-MMM-dd"), (new LocalTime(12, 20, 30)).toString("HH mm ss"), (new LocalDateTime(2008, 2, 23, 12, 0, 0)).toString("yyyy MMM dd HH:mm:ss") };
testCommon(expectedResults, "/functions/date/to_char.json", "/test_simple_date.json");
}
Aggregations