1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-12-24 09:00:31 +00:00

Use DateUtils constant for 1000

This commit is contained in:
Xiang Rong Lin 2020-03-02 19:54:08 +01:00
parent 6a42714326
commit 7d3b21582c

View File

@ -6,6 +6,7 @@ import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.provider.Settings; import android.provider.Settings;
import android.text.format.DateUtils;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.preference.ListPreference; import androidx.preference.ListPreference;
@ -65,7 +66,8 @@ public class VideoAudioSettingsFragment extends BasePreferenceFragment {
.getBoolean(res.getString(R.string.use_inexact_seek_key), false); .getBoolean(res.getString(R.string.use_inexact_seek_key), false);
for (String durationsValue : durationsValues) { for (String durationsValue : durationsValues) {
currentDurationValue = Integer.parseInt(durationsValue) / 1000; currentDurationValue =
Integer.parseInt(durationsValue) / (int) DateUtils.SECOND_IN_MILLIS;
if (inexactSeek && currentDurationValue % 10 == 5) { if (inexactSeek && currentDurationValue % 10 == 5) {
continue; continue;
} }
@ -83,8 +85,9 @@ public class VideoAudioSettingsFragment extends BasePreferenceFragment {
durations.setEntryValues(displayedDurationValues.toArray(new CharSequence[0])); durations.setEntryValues(displayedDurationValues.toArray(new CharSequence[0]));
durations.setEntries(displayedDescriptionValues.toArray(new CharSequence[0])); durations.setEntries(displayedDescriptionValues.toArray(new CharSequence[0]));
final int selectedDuration = Integer.parseInt(durations.getValue()); final int selectedDuration = Integer.parseInt(durations.getValue());
if (selectedDuration / 1000 % 10 == 5) { if (selectedDuration / (int) DateUtils.SECOND_IN_MILLIS % 10 == 5) {
durations.setValue(Integer.toString(selectedDuration + 5 * 1000)); durations.setValue(
Integer.toString(selectedDuration + 5 * (int) DateUtils.SECOND_IN_MILLIS));
} }
} }