Replace duration strings with plurals

PiperOrigin-RevId: 332014290
This commit is contained in:
olly 2020-09-16 16:43:45 +01:00 committed by Oliver Woodman
parent a3cd36beb1
commit f16f8e59ff
3 changed files with 16 additions and 9 deletions

View File

@ -1159,13 +1159,14 @@ public class StyledPlayerControlView extends FrameLayout {
if (controlDispatcher instanceof DefaultControlDispatcher) {
rewindMs = ((DefaultControlDispatcher) controlDispatcher).getRewindIncrementMs();
}
long rewindSec = rewindMs / 1_000;
int rewindSec = (int) (rewindMs / 1_000);
if (rewindButtonTextView != null) {
rewindButtonTextView.setText(String.valueOf(rewindSec));
}
if (rewindButton != null) {
rewindButton.setContentDescription(
resources.getString(R.string.exo_controls_rewind_by_amount_description, rewindSec));
resources.getQuantityString(
R.plurals.exo_controls_rewind_by_amount_description, rewindSec, rewindSec));
}
}
@ -1173,14 +1174,16 @@ public class StyledPlayerControlView extends FrameLayout {
if (controlDispatcher instanceof DefaultControlDispatcher) {
fastForwardMs = ((DefaultControlDispatcher) controlDispatcher).getFastForwardIncrementMs();
}
long fastForwardSec = fastForwardMs / 1_000;
int fastForwardSec = (int) (fastForwardMs / 1_000);
if (fastForwardButtonTextView != null) {
fastForwardButtonTextView.setText(String.valueOf(fastForwardSec));
}
if (fastForwardButton != null) {
fastForwardButton.setContentDescription(
resources.getString(
R.string.exo_controls_fastforward_by_amount_description, fastForwardSec));
resources.getQuantityString(
R.plurals.exo_controls_fastforward_by_amount_description,
fastForwardSec,
fastForwardSec));
}
}

View File

@ -43,11 +43,17 @@
<!-- Description for a media control button that causes playback to be rewound. [CHAR LIMIT=30] -->
<string name="exo_controls_rewind_description">Rewind</string>
<!-- Description for a media control button that causes playback to be rewound a specified number of seconds. [CHAR LIMIT=30] -->
<string name="exo_controls_rewind_by_amount_description">Rewind <xliff:g id="rewind_amount" example="10">%d</xliff:g> seconds</string>
<plurals name="exo_controls_rewind_by_amount_description">
<item quantity="one">Rewind <xliff:g id="rewind_amount" example="1">%d</xliff:g> second</item>
<item quantity="other">Rewind <xliff:g id="rewind_amount" example="30">%d</xliff:g> seconds</item>
</plurals>
<!-- Description for a media control button that causes playback to be fast-forwarded. [CHAR LIMIT=30] -->
<string name="exo_controls_fastforward_description">Fast forward</string>
<!-- Description for a media control button that causes playback to be fast-forwarded a specified number of seconds. [CHAR_LIMIT=55] -->
<string name="exo_controls_fastforward_by_amount_description">Fast forward <xliff:g id="fastforward_amount" example="30">%d</xliff:g> seconds</string>
<plurals name="exo_controls_fastforward_by_amount_description">
<item quantity="one">Fast forward <xliff:g id="fastforward_amount" example="1">%d</xliff:g> second</item>
<item quantity="other">Fast forward <xliff:g id="fastforward_amount" example="30">%d</xliff:g> seconds</item>
</plurals>
<!-- Description for a button that controls the repeat mode of a media playback. In this mode media is not repeated. [CHAR LIMIT=30] -->
<string name="exo_controls_repeat_off_description">Repeat none</string>
<!-- Description for a button that controls the repeat mode of a media playback. In this mode the current piece of media is repeated. [CHAR LIMIT=30] -->

View File

@ -90,14 +90,12 @@
<style name="ExoStyledControls.Button.Center.FfwdWithAmount">
<item name="android:background">@drawable/exo_ripple_ffwd</item>
<item name="android:contentDescription">@string/exo_controls_fastforward_by_amount_description</item>
<item name="android:gravity">center|bottom</item>
<item name="android:paddingBottom">@dimen/exo_icon_padding_bottom</item>
<item name="android:textAppearance">@style/ExoStyledControls.ButtonText</item>
</style>
<style name="ExoStyledControls.Button.Center.RewWithAmount">
<item name="android:background">@drawable/exo_ripple_rew</item>
<item name="android:contentDescription">@string/exo_controls_rewind_by_amount_description</item>
<item name="android:gravity">center|bottom</item>
<item name="android:paddingBottom">@dimen/exo_icon_padding_bottom</item>
<item name="android:textAppearance">@style/ExoStyledControls.ButtonText</item>