fix unit strings

Fixes #3295
Closes #3320

//FREEBIE
This commit is contained in:
agrajaghh 2015-06-03 20:37:13 +02:00 committed by Moxie Marlinspike
parent a712875830
commit 570f79d91a
2 changed files with 3 additions and 7 deletions

View File

@ -158,6 +158,7 @@
<!-- DateUtils -->
<string name="DateUtils_now">Now</string>
<string name="DateUtils_minutes_ago">%d min</string>
<!-- ShareActivity -->
<string name="ShareActivity_share_with">Share with</string>
@ -684,11 +685,6 @@
<string name="arrays__use_custom">Use custom</string>
<!-- plurals.xml -->
<plurals name="minutes_ago">
<item quantity="one">%d min</item>
<item quantity="other">%d mins</item>
</plurals>
<plurals name="hours_ago">
<item quantity="one">%d hour</item>
<item quantity="other">%d hours</item>

View File

@ -50,7 +50,7 @@ public class DateUtils extends android.text.format.DateUtils {
return c.getString(R.string.DateUtils_now);
} else if (isWithin(timestamp, 1, TimeUnit.HOURS)) {
int mins = convertDelta(timestamp, TimeUnit.MINUTES);
return c.getResources().getQuantityString(R.plurals.minutes_ago, mins, mins);
return c.getResources().getString(R.string.DateUtils_minutes_ago, mins);
} else if (isWithin(timestamp, 1, TimeUnit.DAYS)) {
int hours = convertDelta(timestamp, TimeUnit.HOURS);
return c.getResources().getQuantityString(R.plurals.hours_ago, hours, hours);
@ -68,7 +68,7 @@ public class DateUtils extends android.text.format.DateUtils {
return c.getString(R.string.DateUtils_now);
} else if (isWithin(timestamp, 1, TimeUnit.HOURS)) {
int mins = (int)TimeUnit.MINUTES.convert(System.currentTimeMillis() - timestamp, TimeUnit.MILLISECONDS);
return c.getResources().getQuantityString(R.plurals.minutes_ago, mins, mins);
return c.getResources().getString(R.string.DateUtils_minutes_ago, mins);
} else {
StringBuilder format = new StringBuilder();
if (isWithin(timestamp, 6, TimeUnit.DAYS)) format.append("EEE ");