summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authoryingying <yingying@codeaurora.org>2014-02-21 17:17:44 +0800
committerSteve Kondik <steve@cyngn.com>2015-10-18 13:52:39 -0700
commit01d8d3561efa4b93d3d7d92d0e5d9019e7954b92 (patch)
treee6139b26e1bd8bb5b77b850b9827132d48ec11f5 /src
parent6433add1b2827a71e2e88fd66e46fecc6bf35223 (diff)
downloadandroid_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')
-rw-r--r--src/com/android/calendar/CalendarViewAdapter.java12
-rw-r--r--src/com/android/calendar/DayView.java9
-rw-r--r--src/com/android/calendar/month/MonthWeekEventsView.java39
-rw-r--r--src/com/android/lunar/ILunarService.aidl26
4 files changed, 49 insertions, 37 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();
diff --git a/src/com/android/lunar/ILunarService.aidl b/src/com/android/lunar/ILunarService.aidl
index f5a24f32..99702a1c 100644
--- a/src/com/android/lunar/ILunarService.aidl
+++ b/src/com/android/lunar/ILunarService.aidl
@@ -30,21 +30,13 @@
package com.android.lunar;
interface ILunarService {
- String getTraditionalFestivalSimple();
- String getTraditionalFestival(int lunarYear, int lunarMonth, int lunarDay);
- String getFestivalSimple();
- String getFestival(int year, int month, int day);
- String getLunarSolarTerms(int year);
- String getAnimalsYearSimple();
- String getAnimalsYear(int lunarYear);
- String getChinaMonthStringSimple();
- String getChinaMonthString(int lunarMonth, boolean isLeapMonth);
- String getChinaDayStringSimple(boolean isDisplayLunarMonthForFirstDay);
- String getChinaDayString(int lunarMonth, int lunarDay, boolean isLeapMonth,
- boolean isDisplayLunarMonthForFirstDay);
- String getChinaYearStringSimple();
- String getChinaYearString(int lunarYear);
- String getLunarCalendarInfo();
- String getLunarStringForDayView(int year, int month, int monthDay);
- String getLunarDay(int year, int month, int monthDay);
+ String getLunarInfo(int year, int month, int monthDay, boolean multipleInfo,
+ boolean appendType);
+ String getComplexLunarInfo(int year, int month, int monthDay, boolean multipleInfo,
+ boolean appendType);
+ String[] getLunarInfoForMonth(int year, int month, boolean multipleInfo, boolean appendType);
+ String getSeparationForMultiInfo();
+ String getSeparationForType();
+ String getSpecialFlag();
+ String getCommonFlag();
}