mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-24 00:50:32 +00:00
Show a toast when seek duration was rounded up
This commit is contained in:
parent
7d3b21582c
commit
e3fff4356a
@ -7,6 +7,7 @@ import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
|
||||
import android.text.format.DateUtils;
|
||||
import android.widget.Toast;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.preference.ListPreference;
|
||||
|
||||
@ -86,8 +87,16 @@ public class VideoAudioSettingsFragment extends BasePreferenceFragment {
|
||||
durations.setEntries(displayedDescriptionValues.toArray(new CharSequence[0]));
|
||||
final int selectedDuration = Integer.parseInt(durations.getValue());
|
||||
if (selectedDuration / (int) DateUtils.SECOND_IN_MILLIS % 10 == 5) {
|
||||
durations.setValue(
|
||||
Integer.toString(selectedDuration + 5 * (int) DateUtils.SECOND_IN_MILLIS));
|
||||
final int newDuration = selectedDuration / (int) DateUtils.SECOND_IN_MILLIS + 5;
|
||||
durations.setValue(Integer.toString(newDuration * (int) DateUtils.SECOND_IN_MILLIS));
|
||||
|
||||
Toast toast = Toast.makeText(getContext(),
|
||||
getString(R.string.new_seek_duration_toast) + " " + String.format(
|
||||
res.getQuantityString(R.plurals.dynamic_seek_duration_description,
|
||||
newDuration),
|
||||
newDuration),
|
||||
Toast.LENGTH_LONG);
|
||||
toast.show();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -593,6 +593,7 @@
|
||||
<string name="app_language_title">App language</string>
|
||||
<string name="systems_language">System default</string>
|
||||
<string name="dynamic_seek_duration_description">%s seconds</string>
|
||||
<string name="new_seek_duration_toast">Due to ExoPlayer contraints the seek duration was set to</string>
|
||||
<plurals name="dynamic_seek_duration_description">
|
||||
<item quantity="other">%s seconds</item>
|
||||
</plurals>
|
||||
|
Loading…
Reference in New Issue
Block a user