当前位置: 首页>>代码示例>>Java>>正文


Java LocalTime.parse方法代码示例

本文整理汇总了Java中org.joda.time.LocalTime.parse方法的典型用法代码示例。如果您正苦于以下问题:Java LocalTime.parse方法的具体用法?Java LocalTime.parse怎么用?Java LocalTime.parse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.joda.time.LocalTime的用法示例。


在下文中一共展示了LocalTime.parse方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onSetInitialValue

import org.joda.time.LocalTime; //导入方法依赖的package包/类
@Override
protected void onSetInitialValue(boolean restoreValue, Object defaultValue) {
    String value;
    if (restoreValue) {
        if (defaultValue == null) {
            value = getPersistedString(DEFAULT_VALUE);
        } else {
            value = getPersistedString((String) defaultValue);
        }
    } else {
        value = (String) defaultValue;
    }

    LocalTime time = LocalTime.parse(value, DatabaseHelper.DB_TIME_FORMATTER);
    setTime(time.getHourOfDay(), time.getMinuteOfHour());
}
 
开发者ID:canyapan,项目名称:DietDiaryApp,代码行数:17,代码来源:TimePreferenceCompat.java

示例2: formatTime

import org.joda.time.LocalTime; //导入方法依赖的package包/类
private void formatTime( String time, String timePattern ) {
    DateTimeFormatter customTimeFormatter = DateTimeFormat.forPattern( timePattern );
    String timeString = time;
    if ( time != null ) {
        timeString = time;
        // timeString should already be padded with zeros before being parsed
        myTime = time == null ? null : LocalTime.parse( timeString, customTimeFormatter );
        dt = dt.withTime( myTime.getHourOfDay(), myTime.getMinuteOfHour(), 0, 0 );
    }
}
 
开发者ID:dataloom,项目名称:integrations,代码行数:11,代码来源:FormattedDateTime.java

示例3: formatTime

import org.joda.time.LocalTime; //导入方法依赖的package包/类
private void formatTime( String time, String timePattern ) {
    DateTimeFormatter customTimeFormatter = DateTimeFormat.forPattern( timePattern );
    String timeString = time;
    if ( time != null && !time.equals( "" ) ) {
        timeString = time;
        // timeString should already be padded with zeros before being parsed
        myTime = time == null ? null : LocalTime.parse( timeString, customTimeFormatter );
        dt = dt.withTime( myTime.getHourOfDay(), myTime.getMinuteOfHour(), 0, 0 );
    }
}
 
开发者ID:dataloom,项目名称:integrations,代码行数:11,代码来源:FormattedDateTime.java

示例4: TimeConstant

import org.joda.time.LocalTime; //导入方法依赖的package包/类
public TimeConstant(String value) {
    super(LocalTime.parse(value));
}
 
开发者ID:FraunhoferIOSB,项目名称:SensorThingsServer,代码行数:4,代码来源:TimeConstant.java

示例5: withLessonNumber

import org.joda.time.LocalTime; //导入方法依赖的package包/类
private List<JsonLesson> withLessonNumber(JsonLesson lesson, int lessonNo) {
    PlainLesson plainLesson = getPlainLesson(lessonNo);

    LocalTime startTime = LocalTime.parse("08:00");
    LocalTime lessonStart = startTime.plusHours(lessonNo);
    LocalTime lessonEnd = lessonStart.plusMinutes(45);

    JsonLesson res = ImmutableJsonLesson.copyOf(lesson)
            .withSubject(getLessonSubject(plainLesson))
            .withTeacher(getLessonTeacher(plainLesson))
            .withLessonNo(lessonNo)
            .withHourFrom(lessonStart)
            .withHourTo(lessonEnd);
    return Lists.newArrayList(res);
}
 
开发者ID:shymmq,项目名称:librus-client,代码行数:16,代码来源:APIClient.java

示例6: setLocation

import org.joda.time.LocalTime; //导入方法依赖的package包/类
public void setLocation(Location location, double qiblaAngle) {
    if (location == null) return;
    mPrayTimes.setCoordinates(location.getLatitude(), location.getLongitude(), 0);
    mQiblaAngle = qiblaAngle;
    mQiblaTime = mPrayTimes.getQiblaTime();
    LocalTime sunrise = LocalTime.parse(mPrayTimes.getTime(Constants.TIMES_SUNRISE));
    LocalTime sunset = LocalTime.parse(mPrayTimes.getTime(Constants.TIMES_SUNSET));
    LocalTime current = LocalTime.now();

    mShowSun = !(sunset.isBefore(current) || sunrise.isAfter(current));

    mSunriseAngle = Math.toDegrees(getAzimuth(sunrise.toDateTimeToday().getMillis(), location.getLatitude(), location.getLongitude())) - qiblaAngle - 90;
    mSunsetAngle = Math.toDegrees(getAzimuth(sunset.toDateTimeToday().getMillis(), location.getLatitude(), location.getLongitude())) - qiblaAngle - 90;
    mCurrentAngle = Math.toDegrees(getAzimuth(current.toDateTimeToday().getMillis(), location.getLatitude(), location.getLongitude())) - qiblaAngle - 90;
}
 
开发者ID:metinkale38,项目名称:prayer-times-android,代码行数:16,代码来源:QiblaTimeView.java

示例7: DataParser

import org.joda.time.LocalTime; //导入方法依赖的package包/类
public DataParser(String date, String dateTime, String decimal, Integer integer, String string, String empty, String time) {
    this.date = LocalDate.parse(date);
    this.dateTime = LocalDateTime.parse(dateTime);
    this.decimal = decimal != null ? new BigDecimal(decimal) : null;
    this.integer = integer;
    this.string = string;
    this.empty = empty;
    this.time = LocalTime.parse(time);
}
 
开发者ID:tecsinapse,项目名称:tecsinapse-data-io,代码行数:10,代码来源:DataParser.java

示例8: setup

import org.joda.time.LocalTime; //导入方法依赖的package包/类
public static void setup(@NonNull final Context context, final SharedPreferences sharedPreferences) {
    if (sharedPreferences.getBoolean(KEY_NOTIFICATIONS_ACTIVE_BOOL, false)
            && sharedPreferences.getBoolean(KEY_NOTIFICATIONS_DAILY_REMAINDER_BOOL, false)) {
        final LocalTime time = LocalTime.parse(
                sharedPreferences.getString(KEY_NOTIFICATIONS_DAILY_REMAINDER_TIME_STRING, DEFAULT_TIME),
                DatabaseHelper.DB_TIME_FORMATTER);

        setup(context, getSecondsUntilTime(time));
    }
}
 
开发者ID:canyapan,项目名称:DietDiaryApp,代码行数:11,代码来源:DailyReminderServiceHelper.java

示例9: getSecondsUntilTime

import org.joda.time.LocalTime; //导入方法依赖的package包/类
private static int getSecondsUntilTime(@NonNull final Frequency frequency, final LocalDate lastUpdate) {
    final LocalTime time = LocalTime.parse(DEFAULT_TIME, DatabaseHelper.DB_TIME_FORMATTER);

    LocalDateTime alarmClock;
    if (null == lastUpdate) { // Never run before
        alarmClock = LocalDate.now().toLocalDateTime(time);
    } else { // Run before
        alarmClock = lastUpdate.toLocalDateTime(time);
        switch (frequency) {
            case DAILY:
                alarmClock = alarmClock.plusDays(1);
                break;
            case WEEKLY:
                alarmClock = alarmClock.plusWeeks(1);
                break;
            case MONTHLY:
                alarmClock = alarmClock.plusMonths(1);
                break;
            default:
                throw new IllegalStateException("Unknown value " + frequency);
        }
    }

    // May be pointing some time before now.
    while (alarmClock.isBefore(LocalDateTime.now())) {
        alarmClock = alarmClock.plusDays(1);
    }

    return Seconds.secondsBetween(LocalDateTime.now(), alarmClock).getSeconds();
}
 
开发者ID:canyapan,项目名称:DietDiaryApp,代码行数:31,代码来源:DriveBackupServiceHelper.java

示例10: onPreferenceChange

import org.joda.time.LocalTime; //导入方法依赖的package包/类
/**
 * A preference value change listener that updates the preference's summary
 * to reflect its new value.
 */
@Override
public boolean onPreferenceChange(Preference preference, Object value) {
    if (preference instanceof ListPreference) {
        // For list preferences, look up the correct display value in
        // the preference's 'entries' list.
        ListPreference listPreference = (ListPreference) preference;
        if (null != value) {
            int index = listPreference.findIndexOfValue(value.toString());

            CharSequence summary;
            if (index >= 0) {
                summary = listPreference.getEntries()[index];
            } else if (null != listPreference.getValue()) {
                summary = listPreference.getValue();
            } else {
                summary = null;
            }

            // Set the summary to reflect the new value.
            preference.setSummary(summary);
        }
    } else if (preference instanceof TimePreferenceCompat) {
        if (null != value && value instanceof String) {
            LocalTime time = LocalTime.parse((String) value, DatabaseHelper.DB_TIME_FORMATTER);

            //TimePreferenceCompat timePreference = (TimePreferenceCompat) preference;
            preference.setSummary(DateTimeHelper.convertLocalTimeToString(preference.getContext(),
                    time.getHourOfDay(), time.getMinuteOfHour()));
        }
    } else {
        // For all other preferences, set the summary to the value's
        // simple string representation.
        if (value instanceof String) {
            preference.setSummary(value.toString());
        }
    }

    return true;
}
 
开发者ID:canyapan,项目名称:DietDiaryApp,代码行数:44,代码来源:SettingsSupportFragment.java

示例11: readTime

import org.joda.time.LocalTime; //导入方法依赖的package包/类
@NonNull
private LocalTime readTime() throws IOException {
    String temp = null;
    try {
        temp = reader.nextString();
        return LocalTime.parse(temp, DatabaseHelper.DB_TIME_FORMATTER);
    } catch (IllegalArgumentException e) {
        Log.e(RestoreFragment.TAG, MessageFormat.format("JSON time cannot be parsed. record: {0} time: {1}", index, temp));
        throw e;
    }
}
 
开发者ID:canyapan,项目名称:DietDiaryApp,代码行数:12,代码来源:RestoreDialog.java

示例12: parse

import org.joda.time.LocalTime; //导入方法依赖的package包/类
public static Event parse(@NonNull final Cursor cursor) {
    return new Event(
            cursor.getLong(0), // ROWID
            LocalDate.parse(cursor.getString(1), DatabaseHelper.DB_DATE_FORMATTER), // DATE
            LocalTime.parse(cursor.getString(2), DatabaseHelper.DB_TIME_FORMATTER), // TIME
            cursor.getInt(3), // TYPE
            cursor.getInt(4), // SUBTYPE
            cursor.getString(5) // DESCRIPTION
    );
}
 
开发者ID:canyapan,项目名称:DietDiaryApp,代码行数:11,代码来源:EventHelper.java

示例13: formatTime

import org.joda.time.LocalTime; //导入方法依赖的package包/类
private void formatTime( String time, String timePattern ) {
    DateTimeFormatter customTimeFormatter = DateTimeFormat.forPattern( timePattern );
    // Note that time should already match timePattern format before parsing
    myTime = time == null ? null : LocalTime.parse( time, customTimeFormatter );
    myDateTime = myDateTime.withTime( myTime.getHourOfDay(), myTime.getMinuteOfHour(), 0, 0 );
}
 
开发者ID:dataloom,项目名称:integrations,代码行数:7,代码来源:FormattedDateTime.java

示例14: deserialize

import org.joda.time.LocalTime; //导入方法依赖的package包/类
@Override
public LocalTime deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
    return LocalTime.parse(json.getAsString());
}
 
开发者ID:3wks,项目名称:generator-thundr-gae-react,代码行数:5,代码来源:LocalTimeTypeAdapter.java

示例15: loadFacilitiesCursor

import org.joda.time.LocalTime; //导入方法依赖的package包/类
/**
 * Load stations from a cursor. This method <strong>does not close the cursor afterwards</strong>.
 *
 * @param c The cursor from which stations should be loaded.
 * @return The array of loaded stations
 */
private StationFacilities loadFacilitiesCursor(Cursor c) {
    if (c.isClosed()) {
        FirebaseCrash.logcat(SEVERE.intValue(), LOGTAG, "Tried to load closed cursor");
        return null;
    }

    if (c.getCount() == 0) {
        FirebaseCrash.logcat(SEVERE.intValue(), LOGTAG, "Tried to load cursor with 0 results!");
        return null;
    }

    c.moveToFirst();

    int[][] indices = new int[][]{
            new int[]{c.getColumnIndex(StationFacilityColumns.COLUMN_SALES_OPEN_MONDAY), c.getColumnIndex(StationFacilityColumns.COLUMN_SALES_CLOSE_MONDAY)},
            new int[]{c.getColumnIndex(StationFacilityColumns.COLUMN_SALES_OPEN_TUESDAY), c.getColumnIndex(StationFacilityColumns.COLUMN_SALES_CLOSE_MONDAY)},
            new int[]{c.getColumnIndex(StationFacilityColumns.COLUMN_SALES_OPEN_WEDNESDAY), c.getColumnIndex(StationFacilityColumns.COLUMN_SALES_CLOSE_WEDNESDAY)},
            new int[]{c.getColumnIndex(StationFacilityColumns.COLUMN_SALES_OPEN_THURSDAY), c.getColumnIndex(StationFacilityColumns.COLUMN_SALES_CLOSE_THURSDAY)},
            new int[]{c.getColumnIndex(StationFacilityColumns.COLUMN_SALES_OPEN_FRIDAY), c.getColumnIndex(StationFacilityColumns.COLUMN_SALES_CLOSE_FRIDAY)},
            new int[]{c.getColumnIndex(StationFacilityColumns.COLUMN_SALES_OPEN_SATURDAY), c.getColumnIndex(StationFacilityColumns.COLUMN_SALES_CLOSE_SATURDAY)},
            new int[]{c.getColumnIndex(StationFacilityColumns.COLUMN_SALES_OPEN_SUNDAY), c.getColumnIndex(StationFacilityColumns.COLUMN_SALES_CLOSE_SUNDAY)},
    };

    LocalTime[][] openingHours = new LocalTime[7][];
    DateTimeFormatter localTimeFormatter = DateTimeFormat.forPattern("HH:mm");
    for (int i = 0; i < 7; i++) {
        if (c.getString(indices[i][0]) == null) {
            openingHours[i] = null;
        } else {
            openingHours[i] = new LocalTime[2];
            openingHours[i][0] = LocalTime.parse(c.getString(indices[i][0]), localTimeFormatter);
            openingHours[i][1] = LocalTime.parse(c.getString(indices[i][0]), localTimeFormatter);
        }
    }

    return new StationFacilities(openingHours,
            c.getString(c.getColumnIndex(StationFacilityColumns.COLUMN_STREET)),
            c.getString(c.getColumnIndex(StationFacilityColumns.COLUMN_ZIP)),
            c.getString(c.getColumnIndex(StationFacilityColumns.COLUMN_CITY)),
            c.getInt(c.getColumnIndex(StationFacilityColumns.COLUMN_TICKET_VENDING_MACHINE)) == 1,
            c.getInt(c.getColumnIndex(StationFacilityColumns.COLUMN_LUGGAGE_LOCKERS)) == 1,
            c.getInt(c.getColumnIndex(StationFacilityColumns.COLUMN_FREE_PARKING)) == 1,
            c.getInt(c.getColumnIndex(StationFacilityColumns.COLUMN_TAXI)) == 1,
            c.getInt(c.getColumnIndex(StationFacilityColumns.COLUMN_BICYCLE_SPOTS)) == 1,
            c.getInt(c.getColumnIndex(StationFacilityColumns.COLUMN_BLUE_BIKE)) == 1,
            c.getInt(c.getColumnIndex(StationFacilityColumns.COLUMN_BUS)) == 1,
            c.getInt(c.getColumnIndex(StationFacilityColumns.COLUMN_TRAM)) == 1,
            c.getInt(c.getColumnIndex(StationFacilityColumns.COLUMN_METRO)) == 1,
            c.getInt(c.getColumnIndex(StationFacilityColumns.COLUMN_WHEELCHAIR_AVAILABLE)) == 1,
            c.getInt(c.getColumnIndex(StationFacilityColumns.COLUMN_RAMP)) == 1,
            c.getInt(c.getColumnIndex(StationFacilityColumns.COLUMN_DISABLED_PARKING_SPOTS)),
            c.getInt(c.getColumnIndex(StationFacilityColumns.COLUMN_ELEVATED_PLATFORM)) == 1,
            c.getInt(c.getColumnIndex(StationFacilityColumns.COLUMN_ESCALATOR_UP)) == 1,
            c.getInt(c.getColumnIndex(StationFacilityColumns.COLUMN_ESCALATOR_DOWN)) == 1,
            c.getInt(c.getColumnIndex(StationFacilityColumns.COLUMN_ELEVATOR_PLATFORM)) == 1,
            c.getInt(c.getColumnIndex(StationFacilityColumns.COLUMN_HEARING_AID_SIGNAL)) == 1);

}
 
开发者ID:hyperrail,项目名称:hyperrail-for-android,代码行数:65,代码来源:StationsDb.java


注:本文中的org.joda.time.LocalTime.parse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。