當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。