diff options
author | yingying <yingying@codeaurora.org> | 2014-02-21 17:17:44 +0800 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2015-10-18 13:52:39 -0700 |
commit | 01d8d3561efa4b93d3d7d92d0e5d9019e7954b92 (patch) | |
tree | e6139b26e1bd8bb5b77b850b9827132d48ec11f5 /src/com/android/calendar | |
parent | 6433add1b2827a71e2e88fd66e46fecc6bf35223 (diff) | |
download | android_packages_apps_Calendar-01d8d3561efa4b93d3d7d92d0e5d9019e7954b92.tar.gz android_packages_apps_Calendar-01d8d3561efa4b93d3d7d92d0e5d9019e7954b92.tar.bz2 android_packages_apps_Calendar-01d8d3561efa4b93d3d7d92d0e5d9019e7954b92.zip |
Calendar: To display the complex lunar info.
Change-Id: Iae448e24c6d05bd7fde7873b3f575310a227112e
Diffstat (limited to 'src/com/android/calendar')
-rw-r--r-- | src/com/android/calendar/CalendarViewAdapter.java | 12 | ||||
-rw-r--r-- | src/com/android/calendar/DayView.java | 9 | ||||
-rw-r--r-- | src/com/android/calendar/month/MonthWeekEventsView.java | 39 |
3 files changed, 40 insertions, 20 deletions
diff --git a/src/com/android/calendar/CalendarViewAdapter.java b/src/com/android/calendar/CalendarViewAdapter.java index 1e75d1fd..9f5dc778 100644 --- a/src/com/android/calendar/CalendarViewAdapter.java +++ b/src/com/android/calendar/CalendarViewAdapter.java @@ -485,8 +485,8 @@ public class CalendarViewAdapter extends BaseAdapter { String date = Utils.formatDateRange(mContext, mMilliTime, mMilliTime, DateUtils.FORMAT_SHOW_DATE); if (!mLunarInfoMap.containsKey(date)) { - String lunarInfo = service.getLunarStringForDayView( - time.year, time.month, time.monthDay); + String lunarInfo = service.getComplexLunarInfo( + time.year, time.month, time.monthDay, true, false); mLunarInfoMap.put(date, lunarInfo); } @@ -496,8 +496,8 @@ public class CalendarViewAdapter extends BaseAdapter { date = Utils.formatDateRange(mContext, preMilliTime, preMilliTime, DateUtils.FORMAT_SHOW_DATE); if (!mLunarInfoMap.containsKey(date)) { - String lunarInfo = service.getLunarStringForDayView( - time.year, time.month, time.monthDay); + String lunarInfo = service.getComplexLunarInfo( + time.year, time.month, time.monthDay, true, false); mLunarInfoMap.put(date, lunarInfo); } @@ -507,8 +507,8 @@ public class CalendarViewAdapter extends BaseAdapter { date = Utils.formatDateRange(mContext, nextMilliTime, nextMilliTime, DateUtils.FORMAT_SHOW_DATE); if (!mLunarInfoMap.containsKey(date)) { - String lunarInfo = service.getLunarStringForDayView( - time.year, time.month, time.monthDay); + String lunarInfo = service.getComplexLunarInfo( + time.year, time.month, time.monthDay, true, false); mLunarInfoMap.put(date, lunarInfo); } } diff --git a/src/com/android/calendar/DayView.java b/src/com/android/calendar/DayView.java index 7f6cbce6..381ed0c6 100644 --- a/src/com/android/calendar/DayView.java +++ b/src/com/android/calendar/DayView.java @@ -2619,7 +2619,14 @@ public class DayView extends View implements View.OnCreateContextMenuListener, } try { - String display = service.getLunarDay(year, month, dateNum); + String[] lunarInfo = service.getLunarInfo(year, month, dateNum, true, false) + .split(service.getSeparationForMultiInfo()); + String display = null; + if (lunarInfo.length > 1) { + display = lunarInfo[0] + "*"; + } else { + display = lunarInfo[0]; + } if (!TextUtils.isEmpty(display)) { canvas.drawText(display, x, y + DAY_HEADER_FONT_SIZE + 2, p); } diff --git a/src/com/android/calendar/month/MonthWeekEventsView.java b/src/com/android/calendar/month/MonthWeekEventsView.java index a5dd5dae..70b0d652 100644 --- a/src/com/android/calendar/month/MonthWeekEventsView.java +++ b/src/com/android/calendar/month/MonthWeekEventsView.java @@ -67,7 +67,7 @@ public class MonthWeekEventsView extends SimpleWeekView { /* NOTE: these are not constants, and may be multiplied by a scale factor */ private static int TEXT_SIZE_MONTH_NUMBER = 32; - private static int TEXT_SIZE_LUNAR = 18; + private static int TEXT_SIZE_LUNAR = 20; private static int TEXT_SIZE_EVENT = 12; private static int TEXT_SIZE_EVENT_TITLE = 14; private static int TEXT_SIZE_MORE_EVENTS = 12; @@ -93,6 +93,7 @@ public class MonthWeekEventsView extends SimpleWeekView { private static int DAY_SEPARATOR_VERTICAL_LENGTH = 53; private static int DAY_SEPARATOR_VERTICAL_LENGHT_PORTRAIT = 64; private static int MIN_WEEK_WIDTH = 50; + private static int LUNAR_PADDING_LUNAR = 2; private static int EVENT_X_OFFSET_LANDSCAPE = 38; private static int EVENT_Y_OFFSET_LANDSCAPE = 8; @@ -750,22 +751,34 @@ public class MonthWeekEventsView extends SimpleWeekView { } try { - String display = service.getLunarDay(year, month, monthDay); - if (!TextUtils.isEmpty(display)) { - float originalTextSize = mMonthNumPaint.getTextSize(); - mMonthNumPaint.setTextSize(TEXT_SIZE_LUNAR); - Resources res = getResources(); - int mOrientation = res.getConfiguration().orientation; + String[] lunarInfo = service.getLunarInfo(year, month, monthDay, true, false) + .split(service.getSeparationForMultiInfo()); + + float originalTextSize = mMonthNumPaint.getTextSize(); + mMonthNumPaint.setTextSize(TEXT_SIZE_LUNAR); + Resources res = getResources(); + int mOrientation = res.getConfiguration().orientation; + + int num = 0; + for (int index = 0; index < lunarInfo.length; index++) { + String info = lunarInfo[index]; + if (TextUtils.isEmpty(info)) continue; + + int infoX = 0; + int infoY = 0; if (mOrientation == Configuration.ORIENTATION_LANDSCAPE) { - canvas.drawText(display, x - mMonthNumHeight - TOP_PADDING_MONTH_NUMBER, - y , mMonthNumPaint); + infoX = x - mMonthNumHeight - TOP_PADDING_MONTH_NUMBER; + infoY = y + (mMonthNumHeight + LUNAR_PADDING_LUNAR) * num; } else { - canvas.drawText(display, x, y + mMonthNumHeight - + TOP_PADDING_MONTH_NUMBER, mMonthNumPaint); + infoX = x; + infoY = y + (mMonthNumHeight + LUNAR_PADDING_LUNAR) * (num + 1); } - // restore the text size. - mMonthNumPaint.setTextSize(originalTextSize); + canvas.drawText(info, infoX, infoY, mMonthNumPaint); + num = num + 1; } + + // restore the text size. + mMonthNumPaint.setTextSize(originalTextSize); } catch (RemoteException e) { Log.e(TAG, "RemoteException e:" + e.toString()); e.printStackTrace(); |