summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSara Ting <sarating@google.com>2012-08-02 10:55:52 -0700
committerSara Ting <sarating@google.com>2012-08-02 15:15:36 -0700
commit6aad0ffcbdda48fc895543e2780b1d1c9fef3942 (patch)
tree1efad7d6ea80362d4e23d8db001114efc3aeb116
parentfe3ed0116fda7e41493d939bf246e963e5abcce6 (diff)
downloadandroid_packages_apps_Calendar-6aad0ffcbdda48fc895543e2780b1d1c9fef3942.tar.gz
android_packages_apps_Calendar-6aad0ffcbdda48fc895543e2780b1d1c9fef3942.tar.bz2
android_packages_apps_Calendar-6aad0ffcbdda48fc895543e2780b1d1c9fef3942.zip
Add calendar owner to event info if more than 1 calendar.
Bug:5033589 Change-Id: I8cb7bdab29ea7d7d79573ba329b0e17703b6e71f
-rw-r--r--res/layout/event_info.xml33
-rw-r--r--res/layout/event_info_dialog.xml94
-rw-r--r--src/com/android/calendar/EventInfoFragment.java42
3 files changed, 126 insertions, 43 deletions
diff --git a/res/layout/event_info.xml b/res/layout/event_info.xml
index 3f3dc997..1ac8546f 100644
--- a/res/layout/event_info.xml
+++ b/res/layout/event_info.xml
@@ -149,12 +149,43 @@
android:layout_height="wrap_content"
android:paddingLeft="16dip"
android:paddingRight="16dip"
+ android:layout_marginTop="8dip"
android:orientation="vertical">
+ <!-- Calendar Owner -->
+ <LinearLayout
+ android:id="@+id/calendar_container"
+ android:visibility="gone"
+ android:paddingRight="16dip"
+ android:orientation="horizontal"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+ <TextView
+ android:id="@+id/calendar_label"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:singleLine="true"
+ android:text="@string/view_event_calendar_label"
+ android:textColor="@color/event_info_organizer_color"
+ style="?android:attr/textAppearanceSmall"
+ android:textSize="14sp"/>
+ <TextView
+ android:id="@+id/calendar_name"
+ android:layout_width="0px"
+ android:layout_height="wrap_content"
+ android:ellipsize="end"
+ android:layout_weight="1"
+ android:singleLine="true"
+ android:layout_marginLeft="2dip"
+ android:textIsSelectable="true"
+ android:textColor="@color/event_info_organizer_color"
+ style="?android:attr/textAppearanceSmall"
+ android:textSize="14sp"/>
+ </LinearLayout>
+
<!-- Organizer -->
<LinearLayout
android:id="@+id/organizer_container"
android:visibility="gone"
- android:layout_marginTop="8dip"
android:paddingRight="16dip"
android:orientation="horizontal"
android:layout_width="match_parent"
diff --git a/res/layout/event_info_dialog.xml b/res/layout/event_info_dialog.xml
index 3ac2ff17..e51b7f24 100644
--- a/res/layout/event_info_dialog.xml
+++ b/res/layout/event_info_dialog.xml
@@ -160,37 +160,75 @@
style="?android:attr/textAppearanceLarge" />
</LinearLayout>
- <!-- Organizer -->
<LinearLayout
- android:id="@+id/organizer_container"
- android:visibility="gone"
android:layout_marginTop="10dip"
- android:orientation="horizontal"
+ android:orientation="vertical"
android:layout_width="match_parent"
- android:layout_height="wrap_content">
- <TextView
- android:id="@+id/organizer_label"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:paddingLeft="16dip"
- android:singleLine="true"
- android:text="@string/event_info_organizer"
- android:textColor="@color/event_info_organizer_color"
- style="?android:attr/textAppearanceSmall"
- android:textSize="18sp"/>
- <TextView
- android:id="@+id/organizer"
- android:layout_width="0px"
- android:layout_height="wrap_content"
- android:ellipsize="end"
- android:layout_weight="1"
- android:singleLine="true"
- android:layout_marginLeft="4dip"
- android:layout_marginRight="8dip"
- android:textIsSelectable="true"
- android:textColor="@color/event_info_organizer_color"
- style="?android:attr/textAppearanceSmall"
- android:textSize="18sp"/>
+ android:layout_height="wrap_content" >
+
+ <!-- Calendar Owner -->
+ <LinearLayout
+ android:id="@+id/calendar_container"
+ android:visibility="gone"
+ android:orientation="horizontal"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+ <TextView
+ android:id="@+id/calendar_label"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:paddingLeft="16dip"
+ android:singleLine="true"
+ android:text="@string/view_event_calendar_label"
+ android:textColor="@color/event_info_organizer_color"
+ style="?android:attr/textAppearanceSmall"
+ android:textSize="18sp"/>
+ <TextView
+ android:id="@+id/calendar_name"
+ android:layout_width="0px"
+ android:layout_height="wrap_content"
+ android:ellipsize="end"
+ android:layout_weight="1"
+ android:singleLine="true"
+ android:layout_marginLeft="4dip"
+ android:layout_marginRight="8dip"
+ android:textIsSelectable="true"
+ android:textColor="@color/event_info_organizer_color"
+ style="?android:attr/textAppearanceSmall"
+ android:textSize="18sp"/>
+ </LinearLayout>
+
+ <!-- Organizer -->
+ <LinearLayout
+ android:id="@+id/organizer_container"
+ android:visibility="gone"
+ android:orientation="horizontal"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+ <TextView
+ android:id="@+id/organizer_label"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:paddingLeft="16dip"
+ android:singleLine="true"
+ android:text="@string/event_info_organizer"
+ android:textColor="@color/event_info_organizer_color"
+ style="?android:attr/textAppearanceSmall"
+ android:textSize="18sp"/>
+ <TextView
+ android:id="@+id/organizer"
+ android:layout_width="0px"
+ android:layout_height="wrap_content"
+ android:ellipsize="end"
+ android:layout_weight="1"
+ android:singleLine="true"
+ android:layout_marginLeft="4dip"
+ android:layout_marginRight="8dip"
+ android:textIsSelectable="true"
+ android:textColor="@color/event_info_organizer_color"
+ style="?android:attr/textAppearanceSmall"
+ android:textSize="18sp"/>
+ </LinearLayout>
</LinearLayout>
<!-- DESCRIPTION -->
diff --git a/src/com/android/calendar/EventInfoFragment.java b/src/com/android/calendar/EventInfoFragment.java
index 5e97aade..ce162db5 100644
--- a/src/com/android/calendar/EventInfoFragment.java
+++ b/src/com/android/calendar/EventInfoFragment.java
@@ -148,9 +148,11 @@ public class EventInfoFragment extends DialogFragment implements OnCheckedChange
private static final int TOKEN_QUERY_ATTENDEES = 1 << 2;
private static final int TOKEN_QUERY_DUPLICATE_CALENDARS = 1 << 3;
private static final int TOKEN_QUERY_REMINDERS = 1 << 4;
+ private static final int TOKEN_QUERY_VISIBLE_CALENDARS = 1 << 5;
private static final int TOKEN_QUERY_ALL = TOKEN_QUERY_DUPLICATE_CALENDARS
| TOKEN_QUERY_ATTENDEES | TOKEN_QUERY_CALENDARS | TOKEN_QUERY_EVENT
- | TOKEN_QUERY_REMINDERS;
+ | TOKEN_QUERY_REMINDERS | TOKEN_QUERY_VISIBLE_CALENDARS;
+
private int mCurrentQuery = 0;
private static final String[] EVENT_PROJECTION = new String[] {
@@ -252,6 +254,7 @@ public class EventInfoFragment extends DialogFragment implements OnCheckedChange
static final String CALENDARS_WHERE = Calendars._ID + "=?";
static final String CALENDARS_DUPLICATE_NAME_WHERE = Calendars.CALENDAR_DISPLAY_NAME + "=?";
+ static final String CALENDARS_VISIBLE_WHERE = Calendars.VISIBLE + "=?";
private static final String NANP_ALLOWED_SYMBOLS = "()+-*#.";
private static final int NANP_MIN_DIGITS = 7;
@@ -287,7 +290,6 @@ public class EventInfoFragment extends DialogFragment implements OnCheckedChange
private boolean mCanModifyEvent;
private boolean mIsBusyFreeCalendar;
private int mNumOfAttendees;
-
private EditResponseHelper mEditResponseHelper;
private boolean mDeleteDialogVisible = false;
private DeleteEventHelper mDeleteHelper;
@@ -460,16 +462,25 @@ public class EventInfoFragment extends DialogFragment implements OnCheckedChange
mRemindersCursor = Utils.matrixCursorFromCursor(cursor);
initReminders(mView, mRemindersCursor);
break;
+ case TOKEN_QUERY_VISIBLE_CALENDARS:
+ if (cursor.getCount() > 1) {
+ // Start duplicate calendars query to detect whether to add the calendar
+ // email to the calendar owner display.
+ String displayName = mCalendarsCursor.getString(CALENDARS_INDEX_DISPLAY_NAME);
+ mHandler.startQuery(TOKEN_QUERY_DUPLICATE_CALENDARS, null,
+ Calendars.CONTENT_URI, CALENDARS_PROJECTION,
+ CALENDARS_DUPLICATE_NAME_WHERE, new String[] {displayName}, null);
+ } else {
+ // Don't need to display the calendar owner when there is only a single
+ // calendar. Skip the duplicate calendars query.
+ setVisibilityCommon(mView, R.id.calendar_container, View.GONE);
+ mCurrentQuery |= TOKEN_QUERY_DUPLICATE_CALENDARS;
+ }
+ break;
case TOKEN_QUERY_DUPLICATE_CALENDARS:
Resources res = activity.getResources();
SpannableStringBuilder sb = new SpannableStringBuilder();
- // Label
- String label = res.getString(R.string.view_event_calendar_label);
- sb.append(label).append(" ");
- sb.setSpan(new StyleSpan(Typeface.BOLD), 0, label.length(),
- Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
-
// Calendar display name
String calendarName = mCalendarsCursor.getString(CALENDARS_INDEX_DISPLAY_NAME);
sb.append(calendarName);
@@ -477,15 +488,19 @@ public class EventInfoFragment extends DialogFragment implements OnCheckedChange
// Show email account if display name is not unique and
// display name != email
String email = mCalendarsCursor.getString(CALENDARS_INDEX_OWNER_ACCOUNT);
- if (cursor.getCount() > 1 && !calendarName.equalsIgnoreCase(email)) {
+ if (cursor.getCount() > 1 && !calendarName.equalsIgnoreCase(email) &&
+ Utils.isValidEmail(email)) {
sb.append(" (").append(email).append(")");
}
+ setVisibilityCommon(mView, R.id.calendar_container, View.VISIBLE);
+ setTextCommon(mView, R.id.calendar_name, sb);
break;
}
cursor.close();
sendAccessibilityEventIfQueryDone(token);
- // All queries are done, show the view
+
+ // All queries are done, show the view.
if (mCurrentQuery == TOKEN_QUERY_ALL) {
if (mLoadingMsgView.getAlpha() == 1) {
// Loading message is showing, let it stay a bit more (to prevent
@@ -1695,10 +1710,9 @@ public class EventInfoFragment extends DialogFragment implements OnCheckedChange
String displayName = mCalendarsCursor.getString(CALENDARS_INDEX_DISPLAY_NAME);
- // start duplicate calendars query
- mHandler.startQuery(TOKEN_QUERY_DUPLICATE_CALENDARS, null, Calendars.CONTENT_URI,
- CALENDARS_PROJECTION, CALENDARS_DUPLICATE_NAME_WHERE,
- new String[] {displayName}, null);
+ // start visible calendars query
+ mHandler.startQuery(TOKEN_QUERY_VISIBLE_CALENDARS, null, Calendars.CONTENT_URI,
+ CALENDARS_PROJECTION, CALENDARS_VISIBLE_WHERE, new String[] {"1"}, null);
mEventOrganizerEmail = mEventCursor.getString(EVENT_INDEX_ORGANIZER);
mIsOrganizer = mCalendarOwnerAccount.equalsIgnoreCase(mEventOrganizerEmail);