Fix bug where default folder name doesn't change when locale changes.

Bug: 78611156
Change-Id: I25c67fc5ebc3edc2d6090f0da0e37bf2e4c07cbf
This commit is contained in:
Jon Miranda committed 2018-07-12 12:41:52 -07:00
1 parent 90218c4435
commit aeb4dd026c
3 files changed
+19 -14

No files matched your search

+12 -7
View File
@@ -25,6 +25,7 @@ import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Rect;
import android.text.InputType;
@@ -191,14 +192,9 @@ public class Folder extends AbstractFloatingView implements DragSource,
public Folder(Context context, AttributeSet attrs) {
super(context, attrs);
setAlwaysDrawnWithCacheEnabled(false);
Resources res = getResources();
if (sDefaultFolderName == null) {
sDefaultFolderName = res.getString(R.string.folder_name);
}
if (sHintText == null) {
sHintText = res.getString(R.string.folder_hint_text);
}
setLocaleDependentFields(getResources(), false /* force */);
mLauncher = Launcher.getLauncher(context);
// We need this view to be focusable in touch mode so that when text editing of the folder
// name is complete, we have something to focus on, thus hiding the cursor and giving
@@ -1473,4 +1469,13 @@ public class Folder extends AbstractFloatingView implements DragSource,
}
return false;
}
public static void setLocaleDependentFields(Resources res, boolean force) {
if (sDefaultFolderName == null || force) {
sDefaultFolderName = res.getString(R.string.folder_name);
}
if (sHintText == null || force) {
sHintText = res.getString(R.string.folder_hint_text);
}
}
}