Bug 1270958 - Include string for "1 device" instead of "1 devices" for Synced devices. r=ahunt
MozReview-Commit-ID: 6zkDuGlBsmz
--- a/mobile/android/base/java/org/mozilla/gecko/home/CombinedHistoryAdapter.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/CombinedHistoryAdapter.java
@@ -98,17 +98,17 @@ public class CombinedHistoryAdapter exte
@Override
public void onBindViewHolder(CombinedHistoryItem viewHolder, int position) {
final CombinedHistoryItem.ItemType itemType = getItemTypeForPosition(position);
final int localPosition = transformAdapterPositionForDataStructure(itemType, position);
switch (itemType) {
case SYNCED_DEVICES:
- ((CombinedHistoryItem.SmartFolder) viewHolder).bind(R.drawable.cloud, R.string.home_synced_devices_smartfolder, R.string.home_synced_devices_number, deviceCount);
+ ((CombinedHistoryItem.SmartFolder) viewHolder).bind(R.drawable.cloud, R.string.home_synced_devices_smartfolder, R.string.home_synced_devices_one, R.string.home_synced_devices_number, deviceCount);
break;
case SECTION_HEADER:
((TextView) viewHolder.itemView).setText(getSectionHeaderTitle(sectionHeaders.get(localPosition)));
break;
case HISTORY:
if (historyCursor == null || !historyCursor.moveToPosition(localPosition)) {
--- a/mobile/android/base/java/org/mozilla/gecko/home/CombinedHistoryItem.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/CombinedHistoryItem.java
@@ -54,20 +54,21 @@ public abstract class CombinedHistoryIte
super(view);
context = view.getContext();
icon = (ImageView) view.findViewById(R.id.device_type);
title = (TextView) view.findViewById(R.id.title);
subtext = (TextView) view.findViewById(R.id.subtext);
}
- public void bind(int drawableRes, int titleRes, int subtitleRes, int numDevices) {
+ public void bind(int drawableRes, int titleRes, int singleDeviceRes, int multiDeviceRes, int numDevices) {
icon.setImageResource(drawableRes);
title.setText(titleRes);
- subtext.setText(context.getString(subtitleRes, numDevices));
+ final String subtitle = numDevices == 1 ? context.getString(singleDeviceRes) : context.getString(multiDeviceRes, numDevices);
+ subtext.setText(subtitle);
}
}
public static class HistoryItem extends CombinedHistoryItem {
public HistoryItem(View view) {
super(view);
}
--- a/mobile/android/base/locales/en-US/android_strings.dtd
+++ b/mobile/android/base/locales/en-US/android_strings.dtd
@@ -538,16 +538,18 @@ size. -->
<!ENTITY home_top_sites_add "Add a site">
<!-- Localization note (home_title): This string should be kept in sync
with the page title defined in aboutHome.dtd -->
<!ENTITY home_title "&brandShortName; Home">
<!ENTITY home_history_title "History">
<!ENTITY home_synced_devices_smartfolder "Synced devices">
<!ENTITY home_synced_devices_number "&formatD; devices">
+<!-- Localization note (home_synced_devices_one_device): This is the singular version of home_synced_devices_number, referring to the number of devices a user has synced. -->
+<!ENTITY home_synced_devices_one "1 device">
<!ENTITY home_history_back_to2 "Back to full History">
<!ENTITY home_clear_history_button "Clear browsing history">
<!ENTITY home_clear_history_confirm "Are you sure you want to clear your history?">
<!ENTITY home_bookmarks_empty "Bookmarks you save show up here.">
<!ENTITY home_closed_tabs_title "Recently closed tabs">
<!ENTITY home_last_tabs_title "Tabs from last time">
<!ENTITY home_last_tabs_empty "Your recent tabs show up here.">
<!ENTITY home_open_all "Open all">
--- a/mobile/android/base/strings.xml.in
+++ b/mobile/android/base/strings.xml.in
@@ -437,16 +437,17 @@
<string name="button_copy">&button_copy;</string>
<string name="home_title">&home_title;</string>
<string name="home_top_sites_title">&home_top_sites_title;</string>
<string name="home_top_sites_add">&home_top_sites_add;</string>
<string name="home_history_title">&home_history_title;</string>
<string name="home_synced_devices_smartfolder">&home_synced_devices_smartfolder;</string>
<string name="home_synced_devices_number">&home_synced_devices_number;</string>
+ <string name="home_synced_devices_one">&home_synced_devices_one;</string>
<string name="home_history_back_to">&home_history_back_to2;</string>
<string name="home_clear_history_button">&home_clear_history_button;</string>
<string name="home_clear_history_confirm">&home_clear_history_confirm;</string>
<string name="home_bookmarks_empty">&home_bookmarks_empty;</string>
<string name="home_closed_tabs_title">&home_closed_tabs_title;</string>
<string name="home_last_tabs_title">&home_last_tabs_title;</string>
<string name="home_last_tabs_empty">&home_last_tabs_empty;</string>
<string name="home_open_all">&home_open_all;</string>