Skip to content

Commit

Permalink
chore: minimum track duration to restore last position can be 0
Browse files Browse the repository at this point in the history
  • Loading branch information
MSOB7YY committed Oct 20, 2023
1 parent 6b06adc commit c1dfb51
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/controller/audio_handler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class NamidaAudioVideoHandler<Q extends Playable> extends BasicAudioHandler<Q> {
Future<void> tryRestoringLastPosition(Track trackPre) async {
final minValueInSet = settings.minTrackDurationToRestoreLastPosInMinutes.value * 60;

if (minValueInSet > 0) {
if (minValueInSet >= 0) {
final seekValueInMS = settings.seekDurationInSeconds.value * 1000;
final track = trackPre.toTrackExt();
final lastPos = track.stats.lastPositionInMs;
Expand Down
1 change: 1 addition & 0 deletions lib/core/translations/keys.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class LanguageKeys {
late String ALBUMS;
late String ALL_TIME;
late String ALWAYS_ASK;
late String ALWAYS_RESTORE;
late String ANIMATING_THUMBNAIL_INTENSITY;
late String ANIMATING_THUMBNAIL_INVERSED_SUBTITLE;
late String ANIMATING_THUMBNAIL_INVERSED;
Expand Down
4 changes: 4 additions & 0 deletions lib/core/translations/language.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ class Language extends LanguageKeys {
ALBUMS = getKey("ALBUMS");
ALL_TIME = getKey("ALL_TIME");
ALWAYS_ASK = getKey("ALWAYS_ASK");
ALWAYS_RESTORE = getKey("ALWAYS_RESTORE");
ANIMATING_THUMBNAIL_INTENSITY = getKey("ANIMATING_THUMBNAIL_INTENSITY");
ANIMATING_THUMBNAIL_INVERSED_SUBTITLE = getKey("ANIMATING_THUMBNAIL_INVERSED_SUBTITLE");
ANIMATING_THUMBNAIL_INVERSED = getKey("ANIMATING_THUMBNAIL_INVERSED");
Expand Down Expand Up @@ -720,6 +721,9 @@ class Language extends LanguageKeys {









Expand Down
11 changes: 8 additions & 3 deletions lib/ui/widgets/settings/playback_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -446,19 +446,24 @@ class PlaybackSettings extends StatelessWidget {
Obx(
() {
final valInSet = settings.minTrackDurationToRestoreLastPosInMinutes.value;
const max = 121;
return CustomListTile(
icon: Broken.refresh_left_square,
title: lang.MIN_TRACK_DURATION_TO_RESTORE_LAST_POSITION,
trailing: NamidaWheelSlider(
totalCount: 120,
totalCount: max,
initValue: valInSet,
itemSize: 2,
squeeze: 0.4,
onValueChanged: (val) {
final v = (val) as int;
settings.save(minTrackDurationToRestoreLastPosInMinutes: v);
settings.save(minTrackDurationToRestoreLastPosInMinutes: v >= max ? -1 : v);
},
text: valInSet == 0 ? lang.DONT_RESTORE_POSITION : "${valInSet}m",
text: valInSet == 0
? lang.ALWAYS_RESTORE
: valInSet <= -1
? lang.DONT_RESTORE_POSITION
: "${valInSet}m",
),
);
},
Expand Down

0 comments on commit c1dfb51

Please sign in to comment.