Skip to content

Commit

Permalink
Use string formatting for media runtime display
Browse files Browse the repository at this point in the history
  • Loading branch information
dtrexler authored and nielsvanvelzen committed Dec 28, 2024
1 parent 2fa7753 commit 5182000
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -688,15 +688,11 @@ private String getRunTime() {
int hours = totalMinutes / 60;
int minutes = totalMinutes % 60;

String runtimeString = "";

if (hours > 0) {
runtimeString += hours + getString(R.string.hours_shorthand) + " ";
return getString(R.string.runtime_hours_minutes, hours, minutes);
}

runtimeString += minutes + getString(R.string.minutes_shorthand);

return runtimeString;
return getString(R.string.runtime_minutes, minutes);
}

private String getEndTime() {
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@
<string name="lbl_watched">Watched</string>
<string name="lbl_sd">SD</string>
<string name="lbl_runs">"Runs"</string>
<string name="minutes_shorthand">"m"</string>
<string name="hours_shorthand">"h"</string>
<string name="runtime_hours_minutes">%1$dh %2$dm</string>
<string name="runtime_minutes">%1$dm</string>
<string name="lbl_ends">"Ends"</string>
<string name="lbl_directed_by">"Directed by"</string>
<string name="lbl_last_played">"Last played "</string>
Expand Down

0 comments on commit 5182000

Please sign in to comment.