summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBobby Georgescu <georgescu@google.com>2013-01-16 13:22:37 -0800
committerBobby Georgescu <georgescu@google.com>2013-01-16 13:22:37 -0800
commitf63e1f7ab9a4f4a97909564cfc5975cbac66872f (patch)
tree7c0cd410ed0e5eeb368a6e5bf15fb31a754854d1 /src
parentaeb7d79d2a35f534276bc6bf8128349f9768ae6b (diff)
downloadandroid_packages_apps_Gallery2-f63e1f7ab9a4f4a97909564cfc5975cbac66872f.tar.gz
android_packages_apps_Gallery2-f63e1f7ab9a4f4a97909564cfc5975cbac66872f.tar.bz2
android_packages_apps_Gallery2-f63e1f7ab9a4f4a97909564cfc5975cbac66872f.zip
Importer date tiles reflect language change
Bug: 8020035 Change-Id: I1ac2a27ca7be088e6ad6f9b8c624c36e04ff03b0
Diffstat (limited to 'src')
-rw-r--r--src/com/android/gallery3d/ingest/IngestActivity.java2
-rw-r--r--src/com/android/gallery3d/ingest/ui/DateTileView.java28
2 files changed, 28 insertions, 2 deletions
diff --git a/src/com/android/gallery3d/ingest/IngestActivity.java b/src/com/android/gallery3d/ingest/IngestActivity.java
index a21ccc2fe..feaf465c3 100644
--- a/src/com/android/gallery3d/ingest/IngestActivity.java
+++ b/src/com/android/gallery3d/ingest/IngestActivity.java
@@ -40,6 +40,7 @@ import android.widget.GridView;
import com.android.gallery3d.R;
import com.android.gallery3d.ingest.adapter.MtpAdapter;
+import com.android.gallery3d.ingest.ui.DateTileView;
import java.lang.ref.WeakReference;
import java.util.Collection;
@@ -167,6 +168,7 @@ public class IngestActivity extends Activity implements
@Override
protected void onResume() {
+ DateTileView.refreshLocale();
mActive = true;
if (mHelperService != null) mHelperService.setClientActivity(this);
super.onResume();
diff --git a/src/com/android/gallery3d/ingest/ui/DateTileView.java b/src/com/android/gallery3d/ingest/ui/DateTileView.java
index 19b3c608d..52fe9b85b 100644
--- a/src/com/android/gallery3d/ingest/ui/DateTileView.java
+++ b/src/com/android/gallery3d/ingest/ui/DateTileView.java
@@ -25,9 +25,26 @@ import com.android.gallery3d.R;
import com.android.gallery3d.ingest.SimpleDate;
import java.text.DateFormatSymbols;
+import java.util.Locale;
public class DateTileView extends FrameLayout {
- private static final String[] sMonthNames = DateFormatSymbols.getInstance().getShortMonths();
+ private static String[] sMonthNames = DateFormatSymbols.getInstance().getShortMonths();
+ private static Locale sLocale;
+
+ static {
+ refreshLocale();
+ }
+
+ public static boolean refreshLocale() {
+ Locale currentLocale = Locale.getDefault();
+ if (!currentLocale.equals(sLocale)) {
+ sLocale = currentLocale;
+ sMonthNames = DateFormatSymbols.getInstance(sLocale).getShortMonths();
+ return true;
+ } else {
+ return false;
+ }
+ }
private TextView mDateTextView;
private TextView mMonthTextView;
@@ -35,6 +52,7 @@ public class DateTileView extends FrameLayout {
private int mMonth = -1;
private int mYear = -1;
private int mDate = -1;
+ private String[] mMonthNames = sMonthNames;
public DateTileView(Context context) {
super(context);
@@ -71,9 +89,15 @@ public class DateTileView extends FrameLayout {
mDate = date;
mDateTextView.setText(mDate > 9 ? Integer.toString(mDate) : "0" + mDate);
}
+ if (mMonthNames != sMonthNames) {
+ mMonthNames = sMonthNames;
+ if (month == mMonth) {
+ mMonthTextView.setText(mMonthNames[mMonth]);
+ }
+ }
if (month != mMonth) {
mMonth = month;
- mMonthTextView.setText(sMonthNames[mMonth]);
+ mMonthTextView.setText(mMonthNames[mMonth]);
}
if (year != mYear) {
mYear = year;