1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-12-24 09:00:31 +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 //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)); final ListPreference durations = (ListPreference) findPreference(getString(R.string.seek_duration_key));
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]));
@ -90,11 +91,9 @@ public class VideoAudioSettingsFragment extends BasePreferenceFragment {
final int newDuration = selectedDuration / (int) DateUtils.SECOND_IN_MILLIS + 5; final int newDuration = selectedDuration / (int) DateUtils.SECOND_IN_MILLIS + 5;
durations.setValue(Integer.toString(newDuration * (int) DateUtils.SECOND_IN_MILLIS)); durations.setValue(Integer.toString(newDuration * (int) DateUtils.SECOND_IN_MILLIS));
Toast toast = Toast.makeText(getContext(), Toast toast = Toast
getString(R.string.new_seek_duration_toast) + " " + String.format( .makeText(getContext(),
res.getQuantityString(R.plurals.dynamic_seek_duration_description, getString(R.string.new_seek_duration_toast, newDuration),
newDuration),
newDuration),
Toast.LENGTH_LONG); Toast.LENGTH_LONG);
toast.show(); toast.show();
} }

View File

@ -593,7 +593,7 @@
<string name="app_language_title">App language</string> <string name="app_language_title">App language</string>
<string name="systems_language">System default</string> <string name="systems_language">System default</string>
<string name="dynamic_seek_duration_description">%s seconds</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"> <plurals name="dynamic_seek_duration_description">
<item quantity="other">%s seconds</item> <item quantity="other">%s seconds</item>
</plurals> </plurals>