1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-12-23 16:40:32 +00:00

Change toast string resource to be useable with different languages

This commit is contained in:
Xiang Rong Lin 2020-03-03 19:50:50 +01:00
parent e3fff4356a
commit efb67b0fd4
2 changed files with 6 additions and 7 deletions

View File

@ -82,6 +82,7 @@ public class VideoAudioSettingsFragment extends BasePreferenceFragment {
//if this happens, the translation is missing, and the english string will be displayed instead
}
}
final ListPreference durations = (ListPreference) findPreference(getString(R.string.seek_duration_key));
durations.setEntryValues(displayedDurationValues.toArray(new CharSequence[0]));
durations.setEntries(displayedDescriptionValues.toArray(new CharSequence[0]));
@ -90,12 +91,10 @@ public class VideoAudioSettingsFragment extends BasePreferenceFragment {
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 toast = Toast
.makeText(getContext(),
getString(R.string.new_seek_duration_toast, newDuration),
Toast.LENGTH_LONG);
toast.show();
}
}

View File

@ -593,7 +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>
<string name="new_seek_duration_toast">Due to ExoPlayer contraints the seek duration was set to %d seconds</string>
<plurals name="dynamic_seek_duration_description">
<item quantity="other">%s seconds</item>
</plurals>