Using context.getString for getting formatted strings, as it works better with different locales

Change-Id: I9639bb11197e656c5cdd3a4d63f913edcc0987cb
This commit is contained in:
Sunny Goyal
2015-09-02 15:06:12 -07:00
parent 9e0702f4af
commit f4f89ef608
6 changed files with 8 additions and 12 deletions
+1 -1
View File
@@ -319,7 +319,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
if (commit) {
sendCustomAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED,
String.format(getContext().getString(R.string.folder_renamed), newTitle));
getContext().getString(R.string.folder_renamed, newTitle));
}
// In order to clear the focus from the text field, we set the focus on ourself. This
// ensures that every time the field is clicked, focus is gained, giving reliable behavior.
+2 -4
View File
@@ -173,8 +173,7 @@ public class FolderIcon extends FrameLayout implements FolderListener {
icon.setOnClickListener(launcher);
icon.mInfo = folderInfo;
icon.mLauncher = launcher;
icon.setContentDescription(String.format(launcher.getString(R.string.folder_name_format),
folderInfo.title));
icon.setContentDescription(launcher.getString(R.string.folder_name_format, folderInfo.title));
Folder folder = Folder.fromXml(launcher);
folder.setDragController(launcher.getDragController());
folder.setFolderIcon(icon);
@@ -714,8 +713,7 @@ public class FolderIcon extends FrameLayout implements FolderListener {
public void onTitleChanged(CharSequence title) {
mFolderName.setText(title);
setContentDescription(String.format(getContext().getString(R.string.folder_name_format),
title));
setContentDescription(getContext().getString(R.string.folder_name_format, title));
}
@Override
@@ -436,8 +436,7 @@ public class FolderPagedView extends PagedView {
}
public String getAccessibilityDescription() {
return String.format(getContext().getString(R.string.folder_opened),
mGridCountX, mGridCountY);
return getContext().getString(R.string.folder_opened, mGridCountX, mGridCountY);
}
/**
+1 -1
View File
@@ -2300,7 +2300,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
}
protected String getCurrentPageDescription() {
return String.format(getContext().getString(R.string.default_scroll_format),
return getContext().getString(R.string.default_scroll_format,
getNextPage() + 1, getChildCount());
}
+1 -1
View File
@@ -4382,7 +4382,7 @@ public class Workspace extends PagedView
private String getPageDescription(int page) {
int delta = numCustomPages();
return String.format(getContext().getString(R.string.workspace_scroll_format),
return getContext().getString(R.string.workspace_scroll_format,
page + 1 - delta, getChildCount() - delta);
}
@@ -414,11 +414,10 @@ public class AllAppsGridAdapter extends RecyclerView.Adapter<AllAppsGridAdapter.
*/
public void setLastSearchQuery(String query) {
Resources res = mLauncher.getResources();
String formatStr = res.getString(R.string.all_apps_no_search_results);
mLastSearchQuery = query;
mEmptySearchMessage = String.format(formatStr, query);
mEmptySearchMessage = res.getString(R.string.all_apps_no_search_results, query);
if (mMarketAppName != null) {
mMarketSearchMessage = String.format(res.getString(R.string.all_apps_search_market_message),
mMarketSearchMessage = res.getString(R.string.all_apps_search_market_message,
mMarketAppName);
mMarketSearchIntent = createMarketSearchIntent(query);
}