Define Utils.formatRelativeTime() and use it
Previously, relative times were formatted using formatElapsedTime() (appending translations of "ago" to them), sometimes resulting in grammatically hard-to-understand or unnatural localizations. Now we use ICU's RelativeDateTimeFormatter, which uses grammatically correct and natural localizations from CLDR data. Bug: 64507689 Bug: 64605781 Bug: 64556849 Bug: 64550172 Test: make -j RunSettingsRoboTests Change-Id: Ia2d098b190ab99e7748ef6f03b919f5c6174ba7d
This commit is contained in:
@@ -235,10 +235,8 @@ public class RecentAppsPreferenceController extends AbstractPreferenceController
|
||||
pref.setKey(pkgName);
|
||||
pref.setTitle(appEntry.label);
|
||||
pref.setIcon(mIconDrawableFactory.getBadgedIcon(appEntry.info));
|
||||
pref.setSummary(TextUtils.expandTemplate(
|
||||
mContext.getResources().getText(R.string.recent_app_summary),
|
||||
Utils.formatElapsedTime(mContext,
|
||||
System.currentTimeMillis() - stat.getLastTimeUsed(), false)));
|
||||
pref.setSummary(Utils.formatRelativeTime(mContext,
|
||||
System.currentTimeMillis() - stat.getLastTimeUsed(), false));
|
||||
pref.setOrder(i);
|
||||
pref.setOnPreferenceClickListener(preference -> {
|
||||
AppInfoBase.startAppInfoFragment(InstalledAppDetails.class,
|
||||
|
Reference in New Issue
Block a user