summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSvetoslav Ganov <svetoslavganov@google.com>2011-11-02 10:14:46 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-11-02 10:14:46 -0700
commite5d0f19953189fdd0e2661ebb7f0ea925f14ea13 (patch)
tree567fec078f7af384fa2ed34ca1ef7fc4827cca6c
parent6e42470f928bbf60c9fd3d17a2a69a4b96cec170 (diff)
parent1442da620c117910e7628b36efc32ff962be02b2 (diff)
downloadframeworks_base-e5d0f19953189fdd0e2661ebb7f0ea925f14ea13.zip
frameworks_base-e5d0f19953189fdd0e2661ebb7f0ea925f14ea13.tar.gz
frameworks_base-e5d0f19953189fdd0e2661ebb7f0ea925f14ea13.tar.bz2
Merge "CalendarView title incorrectly updated for different languages." into ics-mr1
-rw-r--r--core/java/android/widget/CalendarView.java26
1 files changed, 13 insertions, 13 deletions
diff --git a/core/java/android/widget/CalendarView.java b/core/java/android/widget/CalendarView.java
index 9cbe8db..e0403ff 100644
--- a/core/java/android/widget/CalendarView.java
+++ b/core/java/android/widget/CalendarView.java
@@ -16,8 +16,6 @@
package android.widget;
-import com.android.internal.R;
-
import android.annotation.Widget;
import android.app.Service;
import android.content.Context;
@@ -31,7 +29,6 @@ import android.graphics.Paint.Style;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.text.TextUtils;
-import android.text.format.DateFormat;
import android.text.format.DateUtils;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
@@ -44,6 +41,8 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView.OnScrollListener;
+import com.android.internal.R;
+
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
@@ -121,11 +120,6 @@ public class CalendarView extends FrameLayout {
private static final int SCROLL_CHANGE_DELAY = 40;
/**
- * String for formatting the month name in the title text view.
- */
- private static final String FORMAT_MONTH_NAME = "MMMM, yyyy";
-
- /**
* String for parsing dates.
*/
private static final String DATE_FORMAT = "MM/dd/yyyy";
@@ -940,11 +934,17 @@ public class CalendarView extends FrameLayout {
* @param calendar A day in the new focus month.
*/
private void setMonthDisplayed(Calendar calendar) {
- mMonthName.setText(DateFormat.format(FORMAT_MONTH_NAME, calendar));
- mMonthName.invalidate();
- mCurrentMonthDisplayed = calendar.get(Calendar.MONTH);
- mAdapter.setFocusMonth(mCurrentMonthDisplayed);
- // TODO Send Accessibility Event
+ final int newMonthDisplayed = calendar.get(Calendar.MONTH);
+ if (mCurrentMonthDisplayed != newMonthDisplayed) {
+ mCurrentMonthDisplayed = newMonthDisplayed;
+ mAdapter.setFocusMonth(mCurrentMonthDisplayed);
+ final int flags = DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_NO_MONTH_DAY
+ | DateUtils.FORMAT_SHOW_YEAR;
+ final long millis = calendar.getTimeInMillis();
+ String newMonthName = DateUtils.formatDateRange(mContext, millis, millis, flags);
+ mMonthName.setText(newMonthName);
+ mMonthName.invalidate();
+ }
}
/**