Skip to content

Commit

Permalink
Change toast string resource to be useable with different languages
Browse files Browse the repository at this point in the history
  • Loading branch information
XiangRongLin committed Mar 3, 2020
1 parent e3fff43 commit efb67b0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ private void updateSeekOptions() {
//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]));
Expand All @@ -90,12 +91,10 @@ private void updateSeekOptions() {
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();
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit efb67b0

Please sign in to comment.