summaryrefslogtreecommitdiffstats
path: root/src/com/android/calendar/EventInfoActivity.java
diff options
context:
space:
mode:
authorMichael Chan <mchan@android.com>2010-03-11 17:52:48 -0800
committerErik <roboerik@android.com>2010-03-16 16:05:31 -0700
commitff6be831fc682374be6b78c13ecf5daca81f86d9 (patch)
treefce33f1b3554a45099c2d5bfd0b88cba9cb847d9 /src/com/android/calendar/EventInfoActivity.java
parent16d119af4234cba88a54990fdef9a125f6d377db (diff)
downloadandroid_packages_apps_Calendar-ff6be831fc682374be6b78c13ecf5daca81f86d9.tar.gz
android_packages_apps_Calendar-ff6be831fc682374be6b78c13ecf5daca81f86d9.tar.bz2
android_packages_apps_Calendar-ff6be831fc682374be6b78c13ecf5daca81f86d9.zip
b/2494603 Improve UI to disambiguate calendars with the same name
Added checks for calendars with duplicated names and if found will now include the owner e-mail with the display name. Also did some minor layout changes for German ( b/2516982 ). And started a tests class for Utils. Change-Id: I567c6552a8c17b2c7e73d23312ac60f5dc85a1ec
Diffstat (limited to 'src/com/android/calendar/EventInfoActivity.java')
-rw-r--r--src/com/android/calendar/EventInfoActivity.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/com/android/calendar/EventInfoActivity.java b/src/com/android/calendar/EventInfoActivity.java
index 3e194f7b..af83a846 100644
--- a/src/com/android/calendar/EventInfoActivity.java
+++ b/src/com/android/calendar/EventInfoActivity.java
@@ -163,6 +163,7 @@ public class EventInfoActivity extends Activity implements View.OnClickListener,
static final int CALENDARS_INDEX_OWNER_CAN_RESPOND = 3;
static final String CALENDARS_WHERE = Calendars._ID + "=%d";
+ static final String CALENDARS_DUPLICATE_NAME_WHERE = Calendars.DISPLAY_NAME + "=?";
private static final String[] REMINDERS_PROJECTION = new String[] {
Reminders._ID, // 0
@@ -229,6 +230,7 @@ public class EventInfoActivity extends Activity implements View.OnClickListener,
private int mOriginalAttendeeResponse;
private int mAttendeeResponseFromIntent = ATTENDEE_NO_RESPONSE;
private boolean mIsRepeating;
+ private boolean mIsDuplicateName;
private Pattern mWildcardPattern = Pattern.compile("^.*$");
private LayoutInflater mLayoutInflater;
@@ -335,6 +337,9 @@ public class EventInfoActivity extends Activity implements View.OnClickListener,
mCalendarsCursor.moveToFirst();
mCalendarOwnerAccount = mCalendarsCursor.getString(CALENDARS_INDEX_OWNER_ACCOUNT);
mOrganizerCanRespond = mCalendarsCursor.getInt(CALENDARS_INDEX_OWNER_CAN_RESPOND) != 0;
+
+ String displayName = mCalendarsCursor.getString(CALENDARS_INDEX_DISPLAY_NAME);
+ mIsDuplicateName = isDuplicateName(displayName);
}
String eventOrganizer = mEventCursor.getString(EVENT_INDEX_ORGANIZER);
mIsOrganizer = mCalendarOwnerAccount.equalsIgnoreCase(eventOrganizer);
@@ -442,6 +447,19 @@ public class EventInfoActivity extends Activity implements View.OnClickListener,
}
}
+ boolean isDuplicateName(String displayName) {
+ Cursor dupNameCursor = managedQuery(Calendars.CONTENT_URI, CALENDARS_PROJECTION,
+ CALENDARS_DUPLICATE_NAME_WHERE, new String[] {displayName}, null);
+ boolean isDuplicateName = false;
+ if(dupNameCursor != null) {
+ if (dupNameCursor.getCount() > 1) {
+ isDuplicateName = true;
+ }
+ dupNameCursor.close();
+ }
+ return isDuplicateName;
+ }
+
/**
* Initializes the event cursor, which is expected to point to the first
* (and only) result from a query.
@@ -910,6 +928,13 @@ public class EventInfoActivity extends Activity implements View.OnClickListener,
// Calendar
if (mCalendarsCursor != null) {
String calendarName = mCalendarsCursor.getString(CALENDARS_INDEX_DISPLAY_NAME);
+ if (mIsDuplicateName) {
+ calendarName = new StringBuilder(calendarName)
+ .append(Utils.OPEN_EMAIL_MARKER)
+ .append(mCalendarsCursor.getString(CALENDARS_INDEX_OWNER_ACCOUNT))
+ .append(Utils.CLOSE_EMAIL_MARKER)
+ .toString();
+ }
setTextCommon(R.id.calendar, calendarName);
} else {
setVisibilityCommon(R.id.calendar_container, View.GONE);