Fix Echo using wrong number of days in a year (#6822)

This commit is contained in:
ByteHamster 2023-12-28 20:15:26 +01:00 committed by GitHub
parent b066c6e23c
commit d39ddaa113
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -209,7 +209,11 @@ public class EchoActivity extends AppCompatActivity {
viewBinding.largeLabel.setText(String.format(getEchoLanguage(), "%d", queueSecondsLeft / 3600));
viewBinding.belowLabel.setText(getResources().getQuantityString(
R.plurals.echo_queue_hours_waiting, queueNumEpisodes, queueNumEpisodes));
int daysUntilNextYear = Math.max(356 - Calendar.getInstance().get(Calendar.DAY_OF_YEAR) + 1, 1);
Calendar dec31 = Calendar.getInstance();
dec31.set(Calendar.DAY_OF_MONTH, 31);
dec31.set(Calendar.MONTH, Calendar.DECEMBER);
int daysUntilNextYear = Math.max(1,
dec31.get(Calendar.DAY_OF_YEAR) - Calendar.getInstance().get(Calendar.DAY_OF_YEAR) + 1);
long secondsPerDay = queueSecondsLeft / daysUntilNextYear;
String timePerDay = Converter.getDurationStringLocalized(
getLocalizedResources(this, getEchoLanguage()), secondsPerDay * 1000);