mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-10 12:09:27 +01:00
Adds plurals to a string of the Widget.
This commit is contained in:
parent
80db647692
commit
43bfa791ad
@ -2,6 +2,7 @@ package nodomain.freeyourgadget.gadgetbridge.activities;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.view.View;
|
||||
@ -42,7 +43,8 @@ public class WidgetAlarmsActivity extends Activity implements View.OnClickListen
|
||||
int userSleepDuration = new ActivityUser().getSleepDuration();
|
||||
textView = findViewById(R.id.alarm5);
|
||||
if (userSleepDuration > 0) {
|
||||
textView.setText(String.format(this.getString(R.string.widget_alarm_target_hours), userSleepDuration));
|
||||
Resources res = getResources();
|
||||
textView.setText(String.format(res.getQuantityString(R.plurals.widget_alarm_target_hours, userSleepDuration, userSleepDuration)));
|
||||
} else {
|
||||
textView.setVisibility(View.GONE);
|
||||
}
|
||||
|
@ -733,5 +733,11 @@
|
||||
<string name="widget_20_minutes">20 minutes</string>
|
||||
<string name="widget_1_hour">1 hour</string>
|
||||
<string name="icon_placeholder" translatable="false">Icon</string>
|
||||
<string name="widget_alarm_target_hours">%d hours</string>
|
||||
<plurals name="widget_alarm_target_hours">
|
||||
<item quantity="one">%d hour</item>
|
||||
<item quantity="two">%d hours</item>
|
||||
<item quantity="few">%d hours</item>
|
||||
<item quantity="many">%d hours</item>
|
||||
<item quantity="other">%d hours</item>
|
||||
</plurals>
|
||||
</resources>
|
Loading…
Reference in New Issue
Block a user