diff options
| -rw-r--r-- | core/java/android/provider/Calendar.java | 403 | ||||
| -rw-r--r-- | core/java/android/util/Property.java | 4 | ||||
| -rw-r--r-- | core/java/android/widget/GridLayout.java | 203 | ||||
| -rwxr-xr-x | core/res/res/values/config.xml | 3 | ||||
| -rw-r--r-- | tests/GridLayoutTest/res/layout/grid3.xml | 68 | ||||
| -rw-r--r-- | tests/GridLayoutTest/src/com/android/test/layout/AbstractLayoutTest.java | 12 | ||||
| -rw-r--r-- | tests/GridLayoutTest/src/com/android/test/layout/GridLayoutTest.java | 1 |
7 files changed, 378 insertions, 316 deletions
diff --git a/core/java/android/provider/Calendar.java b/core/java/android/provider/Calendar.java index 38e77cdeec3b..bb6ed9c82b7c 100644 --- a/core/java/android/provider/Calendar.java +++ b/core/java/android/provider/Calendar.java @@ -111,18 +111,66 @@ public final class Calendar { */ protected interface CalendarSyncColumns { - /** Generic column for use by sync adapters. */ + + /** + * Generic column for use by sync adapters. Column name. + * <P>Type: TEXT</P> + */ public static final String CAL_SYNC1 = "cal_sync1"; - /** Generic column for use by sync adapters. */ + + /** + * Generic column for use by sync adapters. Column name. + * <P>Type: TEXT</P> + */ public static final String CAL_SYNC2 = "cal_sync2"; - /** Generic column for use by sync adapters. */ + + /** + * Generic column for use by sync adapters. Column name. + * <P>Type: TEXT</P> + */ public static final String CAL_SYNC3 = "cal_sync3"; - /** Generic column for use by sync adapters. */ + + /** + * Generic column for use by sync adapters. Column name. + * <P>Type: TEXT</P> + */ public static final String CAL_SYNC4 = "cal_sync4"; - /** Generic column for use by sync adapters. */ + + /** + * Generic column for use by sync adapters. Column name. + * <P>Type: TEXT</P> + */ public static final String CAL_SYNC5 = "cal_sync5"; - /** Generic column for use by sync adapters. */ + + /** + * Generic column for use by sync adapters. Column name. + * <P>Type: TEXT</P> + */ public static final String CAL_SYNC6 = "cal_sync6"; + + /** + * Generic column for use by sync adapters. Column name. + * <P>Type: TEXT</P> + */ + public static final String CAL_SYNC7 = "cal_sync7"; + + /** + * Generic column for use by sync adapters. Column name. + * <P>Type: TEXT</P> + */ + public static final String CAL_SYNC8 = "cal_sync8"; + + /** + * Generic column for use by sync adapters. Column name. + * <P>Type: TEXT</P> + */ + public static final String CAL_SYNC9 = "cal_sync9"; + + /** + * Generic column for use by sync adapters. Column name. + * <P>Type: TEXT</P> + */ + public static final String CAL_SYNC10 = "cal_sync10"; } /** @@ -159,35 +207,26 @@ public final class Calendar { public static final String _SYNC_ID = "_sync_id"; /** - * The last time, from the sync source's point of view, that this row - * has been synchronized. - * <P>Type: INTEGER (long)</P> - */ - public static final String _SYNC_TIME = "_sync_time"; - - /** - * The version of the row, as assigned by the server. - * <P>Type: TEXT</P> - */ - public static final String _SYNC_VERSION = "_sync_version"; - - /** - * Used only in persistent providers, and only during merging. + * Used to indicate that local, unsynced, changes are present. * <P>Type: INTEGER (long)</P> */ - public static final String _SYNC_MARK = "_sync_mark"; + public static final String DIRTY = "dirty"; /** - * Used to indicate that local, unsynced, changes are present. - * <P>Type: INTEGER (long)</P> + * Whether the row has been deleted but not synced to the server. A + * deleted row should be ignored. + * <P> + * Type: INTEGER (boolean) + * </P> */ - public static final String DIRTY = "dirty"; + public static final String DELETED = "deleted"; /** * If set to 1 this causes events on this calendar to be duplicated with - * {@link Events#LAST_SYNCED} set to 1 whenever the event transitions from non-dirty - * to dirty. The duplicated event will not be expanded in the instances table and will only - * show up in sync adapter queries of the events table. It will also be deleted when the + * {@link EventsColumns#LAST_SYNCED} set to 1 whenever the event + * transitions from non-dirty to dirty. The duplicated event will not be + * expanded in the instances table and will only show up in sync adapter + * queries of the events table. It will also be deleted when the * originating event has its dirty flag cleared by the sync adapter. * <P>Type: INTEGER (boolean)</P> */ @@ -205,33 +244,39 @@ public final class Calendar { public static final String CALENDAR_COLOR = "calendar_color"; /** + * The display name of the calendar. Column name. + * <P>Type: TEXT</P> + */ + public static final String CALENDAR_DISPLAY_NAME = "calendar_displayName"; + + /** * The level of access that the user has for the calendar * <P>Type: INTEGER (one of the values below)</P> */ - public static final String ACCESS_LEVEL = "access_level"; + public static final String CALENDAR_ACCESS_LEVEL = "calendar_access_level"; /** Cannot access the calendar */ - public static final int NO_ACCESS = 0; + public static final int CAL_ACCESS_NONE = 0; /** Can only see free/busy information about the calendar */ - public static final int FREEBUSY_ACCESS = 100; + public static final int CAL_ACCESS_FREEBUSY = 100; /** Can read all event details */ - public static final int READ_ACCESS = 200; + public static final int CAL_ACCESS_READ = 200; /** Can reply yes/no/maybe to an event */ - public static final int RESPOND_ACCESS = 300; + public static final int CAL_ACCESS_RESPOND = 300; /** not used */ - public static final int OVERRIDE_ACCESS = 400; + public static final int CAL_ACCESS_OVERRIDE = 400; /** Full access to modify the calendar, but not the access control * settings */ - public static final int CONTRIBUTOR_ACCESS = 500; + public static final int CAL_ACCESS_CONTRIBUTOR = 500; /** Full access to modify the calendar, but not the access control * settings */ - public static final int EDITOR_ACCESS = 600; + public static final int CAL_ACCESS_EDITOR = 600; /** Full access to the calendar */ - public static final int OWNER_ACCESS = 700; + public static final int CAL_ACCESS_OWNER = 700; /** Domain admin */ - public static final int ROOT_ACCESS = 800; + public static final int CAL_ACCESS_ROOT = 800; /** * Is the calendar selected to be displayed? @@ -245,7 +290,7 @@ public final class Calendar { * The time zone the calendar is associated with. * <P>Type: TEXT</P> */ - public static final String CALENDAR_TIMEZONE = "calendar_timezone"; + public static final String CALENDAR_TIME_ZONE = "calendar_timezone"; /** * Is this calendar synced and are its events stored on the device? @@ -256,17 +301,41 @@ public final class Calendar { public static final String SYNC_EVENTS = "sync_events"; /** - * Sync state data. Usable by the sync adapter. - * <p>Type: String (blob)</p> + * The owner account for this calendar, based on the calendar feed. + * This will be different from the _SYNC_ACCOUNT for delegated calendars. + * Column name. + * <P>Type: String</P> */ - public static final String SYNC_STATE = "sync_state"; + public static final String OWNER_ACCOUNT = "ownerAccount"; /** - * Whether the row has been deleted but not synced to the server. A - * deleted row should be ignored. + * Can the organizer respond to the event? If no, the status of the + * organizer should not be shown by the UI. Defaults to 1. Column name. * <P>Type: INTEGER (boolean)</P> */ - public static final String DELETED = "deleted"; + public static final String CAN_ORGANIZER_RESPOND = "canOrganizerRespond"; + + /** + * Can the organizer modify the time zone of the event? Column name. + * <P>Type: INTEGER (boolean)</P> + */ + public static final String CAN_MODIFY_TIME_ZONE = "canModifyTimeZone"; + + /** + * The maximum number of reminders allowed for an event. Column name. + * <P>Type: INTEGER</P> + */ + public static final String MAX_REMINDERS = "maxReminders"; + + /** + * A comma separated list of reminder methods supported for this + * calendar in the format "#,#,#". Valid types are + * {@link Reminders#METHOD_DEFAULT}, {@link Reminders#METHOD_ALERT}, + * {@link Reminders#METHOD_EMAIL}, {@link Reminders#METHOD_SMS}. Column + * name. + * <P>Type: TEXT</P> + */ + public static final String ALLOWED_REMINDERS = "allowedReminders"; } /** @@ -312,28 +381,30 @@ public final class Calendar { DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, ACCOUNT_TYPE); DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, _SYNC_ID); - DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, _SYNC_VERSION); - DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, _SYNC_TIME); DatabaseUtils.cursorLongToContentValuesIfPresent(cursor, cv, DIRTY); - DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, Calendars.CAL_SYNC1); - DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, Calendars.CAL_SYNC2); - DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, Calendars.CAL_SYNC3); - DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, Calendars.CAL_SYNC4); - DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, Calendars.CAL_SYNC5); - DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, Calendars.CAL_SYNC6); + DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CAL_SYNC1); + DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CAL_SYNC2); + DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CAL_SYNC3); + DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CAL_SYNC4); + DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CAL_SYNC5); + DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CAL_SYNC6); + DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CAL_SYNC7); + DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CAL_SYNC8); + DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CAL_SYNC9); + DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CAL_SYNC10); DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, Calendars.NAME); DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, - Calendars.DISPLAY_NAME); + Calendars.CALENDAR_DISPLAY_NAME); DatabaseUtils.cursorIntToContentValuesIfPresent(cursor, cv, Calendars.CALENDAR_COLOR); - DatabaseUtils.cursorIntToContentValuesIfPresent(cursor, cv, ACCESS_LEVEL); + DatabaseUtils.cursorIntToContentValuesIfPresent(cursor, cv, CALENDAR_ACCESS_LEVEL); DatabaseUtils.cursorIntToContentValuesIfPresent(cursor, cv, VISIBLE); DatabaseUtils.cursorIntToContentValuesIfPresent(cursor, cv, SYNC_EVENTS); DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, Calendars.CALENDAR_LOCATION); - DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CALENDAR_TIMEZONE); + DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CALENDAR_TIME_ZONE); DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, Calendars.OWNER_ACCOUNT); DatabaseUtils.cursorIntToContentValuesIfPresent(cursor, cv, @@ -344,6 +415,8 @@ public final class Calendar { Calendars.MAX_REMINDERS); DatabaseUtils.cursorIntToContentValuesIfPresent(cursor, cv, Calendars.CAN_PARTIALLY_UPDATE); + DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, + Calendars.ALLOWED_REMINDERS); DatabaseUtils.cursorIntToContentValuesIfPresent(cursor, cv, DELETED); @@ -429,96 +502,27 @@ public final class Calendar { public static final String DEFAULT_SORT_ORDER = "displayName"; /** - * The URL to the calendar. Column name. - * <P>Type: TEXT (URL)</P> - */ - public static final String URL = "url"; - - /** - * The URL for the calendar itself. Column name. - * <P>Type: TEXT (URL)</P> - */ - public static final String SELF_URL = "selfUrl"; - - /** - * The URL for the calendar to be edited. Column name. - * <P>Type: TEXT (URL)</P> - */ - public static final String EDIT_URL = "editUrl"; - - /** - * The URL for the calendar events. Column name. - * <P>Type: TEXT (URL)</P> - */ - public static final String EVENTS_URL = "eventsUrl"; - - /** * The name of the calendar. Column name. * <P>Type: TEXT</P> */ public static final String NAME = "name"; /** - * The display name of the calendar. Column name. - * <P>Type: TEXT</P> - */ - public static final String DISPLAY_NAME = "displayName"; - - /** * The default location for the calendar. Column name. * <P>Type: TEXT</P> */ public static final String CALENDAR_LOCATION = "calendar_location"; /** - * The owner account for this calendar, based on the calendar feed. - * This will be different from the _SYNC_ACCOUNT for delegated calendars. - * Column name. - * <P>Type: String</P> - */ - public static final String OWNER_ACCOUNT = "ownerAccount"; - - /** - * Can the organizer respond to the event? If no, the status of the - * organizer should not be shown by the UI. Defaults to 1. Column name. - * <P>Type: INTEGER (boolean)</P> - */ - public static final String CAN_ORGANIZER_RESPOND = "canOrganizerRespond"; - - /** - * Can the organizer modify the time zone of the event? Column name. - * <P>Type: INTEGER (boolean)</P> - */ - public static final String CAN_MODIFY_TIME_ZONE = "canModifyTimeZone"; - - /** - * The maximum number of reminders allowed for an event. Column name. - * <P>Type: INTEGER</P> - */ - public static final String MAX_REMINDERS = "maxReminders"; - - /** - * A comma separated list of reminder methods supported for this - * calendar in the format "#,#,#". Valid types are - * {@link Reminders#METHOD_DEFAULT}, {@link Reminders#METHOD_ALERT}, - * {@link Reminders#METHOD_EMAIL}, {@link Reminders#METHOD_SMS}. Column - * name. - * <P>Type: TEXT</P> - */ - public static final String ALLOWED_REMINDERS = "allowedReminders"; - - /** * These fields are only writable by a sync adapter. To modify them the * caller must include {@link #CALLER_IS_SYNCADAPTER}, - * {@link #ACCOUNT_NAME}, and {@link #ACCOUNT_TYPE} in the query + * {@link #ACCOUNT_NAME}, and {@link #ACCOUNT_TYPE} in the Uri's query * parameters. */ public static final String[] SYNC_WRITABLE_COLUMNS = new String[] { ACCOUNT_NAME, ACCOUNT_TYPE, _SYNC_ID, - _SYNC_TIME, - _SYNC_VERSION, DIRTY, OWNER_ACCOUNT, MAX_REMINDERS, @@ -526,8 +530,8 @@ public final class Calendar { CAN_ORGANIZER_RESPOND, CAN_PARTIALLY_UPDATE, CALENDAR_LOCATION, - CALENDAR_TIMEZONE, - ACCESS_LEVEL, + CALENDAR_TIME_ZONE, + CALENDAR_ACCESS_LEVEL, DELETED, CAL_SYNC1, CAL_SYNC2, @@ -535,7 +539,10 @@ public final class Calendar { CAL_SYNC4, CAL_SYNC5, CAL_SYNC6, - SYNC_STATE, + CAL_SYNC7, + CAL_SYNC8, + CAL_SYNC9, + CAL_SYNC10, }; } @@ -633,12 +640,6 @@ public final class Calendar { * Columns from the Events table that other tables join into themselves. */ private interface EventsColumns { - /** - * For use by sync adapter at its discretion. Column name. - * TODO change to sync_data2 - * <P>Type: INTEGER (long)</P> - */ - public static final String _SYNC_DATA = "_sync_local_id"; /** * The {@link Calendars#_ID} of the calendar the event belongs to. @@ -648,13 +649,6 @@ public final class Calendar { public static final String CALENDAR_ID = "calendar_id"; /** - * The URI for an HTML version of this event. Column name. - * TODO change to sync_data3 - * <P>Type: TEXT</P> - */ - public static final String HTML_URI = "htmlUri"; - - /** * The title of the event. Column name. * <P>Type: TEXT</P> */ @@ -673,6 +667,12 @@ public final class Calendar { public static final String EVENT_LOCATION = "eventLocation"; /** + * A secondary color for the individual event. Column name. + * <P>Type: INTEGER</P> + */ + public static final String EVENT_COLOR = "eventColor"; + + /** * The event status. Column name. * <P>Type: INTEGER (one of {@link #STATUS_TENTATIVE}...)</P> */ @@ -699,12 +699,60 @@ public final class Calendar { public static final String SYNC_DATA1 = "sync_data1"; /** - * This column is available for use by sync adapters + * This column is available for use by sync adapters. Column name. + * <P>Type: TEXT</P> + */ + public static final String SYNC_DATA2 = "sync_data2"; + + /** + * This column is available for use by sync adapters. Column name. + * <P>Type: TEXT</P> + */ + public static final String SYNC_DATA3 = "sync_data3"; + + /** + * This column is available for use by sync adapters. Column name. + * <P>Type: TEXT</P> + */ + public static final String SYNC_DATA4 = "sync_data4"; + + /** + * This column is available for use by sync adapters. Column name. + * <P>Type: TEXT</P> + */ + public static final String SYNC_DATA5 = "sync_data5"; + + /** + * This column is available for use by sync adapters. Column name. + * <P>Type: TEXT</P> + */ + public static final String SYNC_DATA6 = "sync_data6"; + + /** + * This column is available for use by sync adapters. Column name. * <P>Type: TEXT</P> */ public static final String SYNC_DATA7 = "sync_data7"; /** + * This column is available for use by sync adapters. Column name. + * <P>Type: TEXT</P> + */ + public static final String SYNC_DATA8 = "sync_data8"; + + /** + * This column is available for use by sync adapters. Column name. + * <P>Type: TEXT</P> + */ + public static final String SYNC_DATA9 = "sync_data9"; + + /** + * This column is available for use by sync adapters. Column name. + * <P>Type: TEXT</P> + */ + public static final String SYNC_DATA10 = "sync_data10"; + + /** * Used to indicate that a row is not a real event but an original copy of a locally * modified event. A copy is made when an event changes from non-dirty to dirty and the * event is on a calendar with {@link Calendars#CAN_PARTIALLY_UPDATE} set to 1. This copy @@ -716,13 +764,6 @@ public final class Calendar { public static final String LAST_SYNCED = "lastSynced"; /** - * The comments feed uri. Column name. - * TODO change to sync_data6 - * <P>Type: TEXT</P> - */ - public static final String COMMENTS_URI = "commentsUri"; - - /** * The time the event starts in UTC millis since epoch. Column name. * <P>Type: INTEGER (long; millis since epoch)</P> */ @@ -916,20 +957,6 @@ public final class Calendar { * <P>Type: INTEGER (boolean, readonly)</P> */ public static final String CAN_INVITE_OTHERS = "canInviteOthers"; - - /** - * The owner account for this calendar, based on the calendar (foreign - * key into the calendars table). Column name. - * <P>Type: String</P> - */ - public static final String OWNER_ACCOUNT = "ownerAccount"; - - /** - * Whether the row has been deleted. A deleted row should be ignored. - * Column name. - * <P>Type: INTEGER (boolean)</P> - */ - public static final String DELETED = "deleted"; } /** @@ -1024,13 +1051,11 @@ public final class Calendar { ContentValues cv = new ContentValues(); cv.put(Events._ID, eventId); DatabaseUtils.cursorIntToContentValuesIfPresent(cursor, cv, CALENDAR_ID); - DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, HTML_URI); DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, TITLE); DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, DESCRIPTION); DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, EVENT_LOCATION); DatabaseUtils.cursorIntToContentValuesIfPresent(cursor, cv, STATUS); DatabaseUtils.cursorIntToContentValuesIfPresent(cursor, cv, SELF_ATTENDEE_STATUS); - DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, COMMENTS_URI); DatabaseUtils.cursorLongToContentValuesIfPresent(cursor, cv, DTSTART); DatabaseUtils.cursorLongToContentValuesIfPresent(cursor, cv, DTEND); DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, DURATION); @@ -1059,20 +1084,29 @@ public final class Calendar { DatabaseUtils.cursorIntToContentValuesIfPresent(cursor, cv, GUESTS_CAN_SEE_GUESTS); DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, ORGANIZER); DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, _SYNC_ID); - DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, _SYNC_DATA); - DatabaseUtils.cursorLongToContentValuesIfPresent(cursor, cv, SYNC_DATA7); DatabaseUtils.cursorLongToContentValuesIfPresent(cursor, cv, DIRTY); DatabaseUtils.cursorLongToContentValuesIfPresent(cursor, cv, LAST_SYNCED); - DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, _SYNC_VERSION); DatabaseUtils.cursorIntToContentValuesIfPresent(cursor, cv, DELETED); + DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, SYNC_DATA1); + DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, SYNC_DATA2); + DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, SYNC_DATA3); + DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, SYNC_DATA4); + DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, SYNC_DATA5); + DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, SYNC_DATA6); + DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, SYNC_DATA7); + DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, SYNC_DATA8); + DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, SYNC_DATA9); + DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, SYNC_DATA10); DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CAL_SYNC1); DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CAL_SYNC2); DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CAL_SYNC3); DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CAL_SYNC4); DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CAL_SYNC5); DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CAL_SYNC6); - DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, - Events.SYNC_DATA1); + DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CAL_SYNC7); + DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CAL_SYNC8); + DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CAL_SYNC9); + DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CAL_SYNC10); Entity entity = new Entity(cv); Cursor subCursor; @@ -1163,7 +1197,8 @@ public final class Calendar { /** * Fields and helpers for interacting with Events. */ - public static final class Events implements BaseColumns, SyncColumns, EventsColumns { + public static final class Events implements BaseColumns, SyncColumns, EventsColumns, + CalendarsColumns { /** * Queries all events with the given projection. This is a blocking call @@ -1232,7 +1267,20 @@ public final class Calendar { CAL_SYNC4, CAL_SYNC5, CAL_SYNC6, + CAL_SYNC7, + CAL_SYNC8, + CAL_SYNC9, + CAL_SYNC10, + ALLOWED_REMINDERS, + CALENDAR_ACCESS_LEVEL, + CALENDAR_COLOR, + CALENDAR_TIME_ZONE, + CAN_MODIFY_TIME_ZONE, + CAN_ORGANIZER_RESPOND, + CALENDAR_DISPLAY_NAME, CAN_PARTIALLY_UPDATE, + SYNC_EVENTS, + VISIBLE, }; /** @@ -1242,10 +1290,17 @@ public final class Calendar { */ public static final String[] SYNC_WRITABLE_COLUMNS = new String[] { _SYNC_ID, - _SYNC_TIME, - _SYNC_VERSION, DIRTY, - SYNC_DATA1 + SYNC_DATA1, + SYNC_DATA2, + SYNC_DATA3, + SYNC_DATA4, + SYNC_DATA5, + SYNC_DATA6, + SYNC_DATA7, + SYNC_DATA8, + SYNC_DATA9, + SYNC_DATA10, }; } diff --git a/core/java/android/util/Property.java b/core/java/android/util/Property.java index 458e4c37b690..146db80b83fb 100644 --- a/core/java/android/util/Property.java +++ b/core/java/android/util/Property.java @@ -78,11 +78,11 @@ public abstract class Property<T, V> { /** * Sets the value on <code>object</code> which this property represents. If the method is unable - * to set the value on the target object, it will throw a {@link NoSuchPropertyException} + * to set the value on the target object it will throw an {@link UnsupportedOperationException} * exception. */ public void set(T object, V value) { - throw new NoSuchPropertyException("Property is read-only; set() is not implemented"); + throw new UnsupportedOperationException("Property " + getName() +" is read-only"); } /** diff --git a/core/java/android/widget/GridLayout.java b/core/java/android/widget/GridLayout.java index 98344858b31a..bda82a384254 100644 --- a/core/java/android/widget/GridLayout.java +++ b/core/java/android/widget/GridLayout.java @@ -536,70 +536,76 @@ public class GridLayout extends ViewGroup { return margin == UNDEFINED ? getDefaultMarginValue(view, lp, leading, horizontal) : margin; } - private static boolean isUndefined(Interval span) { - return span.min == UNDEFINED || span.max == UNDEFINED; + private static int valueIfDefined(int value, int defaultValue) { + return (value != UNDEFINED) ? value : defaultValue; } + // install default indices for cells that don't define them private void validateLayoutParams() { - // install default indices for cells if *none* are defined - if (mHorizontalAxis.maxIndex1() == UNDEFINED || (mVerticalAxis.maxIndex1() == UNDEFINED)) { - boolean horizontal = mOrientation == HORIZONTAL; - int count = horizontal ? mHorizontalAxis.count : mVerticalAxis.count; - if (count == UNDEFINED) { - count = Integer.MAX_VALUE; - } - int x = 0; - int y = 0; - int maxSize = 0; - for (int i = 0, size = getChildCount(); i < size; i++) { - LayoutParams lp = getLayoutParams1(getChildAt(i)); + new Object() { + public int maxSize = 0; - Interval hSpan = lp.columnGroup.span; - int cellWidth = hSpan.size(); + private int valueIfDefined2(int value, int defaultValue) { + if (value != UNDEFINED) { + maxSize = 0; + return value; + } else { + return defaultValue; + } + } - Interval vSpan = lp.rowGroup.span; - int cellHeight = vSpan.size(); + { + final boolean horizontal = (mOrientation == HORIZONTAL); + final int axis = horizontal ? mHorizontalAxis.count : mVerticalAxis.count; + final int count = valueIfDefined(axis, Integer.MAX_VALUE); - if (horizontal) { - if (x + cellWidth > count) { - x = 0; - y += maxSize; - maxSize = 0; - } - } else { - if (y + cellHeight > count) { - y = 0; - x += maxSize; - maxSize = 0; + int row = 0; + int col = 0; + for (int i = 0, N = getChildCount(); i < N; i++) { + LayoutParams lp = getLayoutParams1(getChildAt(i)); + + Group colGroup = lp.columnGroup; + Interval cols = colGroup.span; + int colSpan = cols.size(); + + Group rowGroup = lp.rowGroup; + Interval rows = rowGroup.span; + int rowSpan = rows.size(); + + if (horizontal) { + row = valueIfDefined2(rows.min, row); + + int newCol = valueIfDefined(cols.min, (col + colSpan > count) ? 0 : col); + if (newCol < col) { + row += maxSize; + maxSize = 0; + } + col = newCol; + maxSize = max(maxSize, rowSpan); + } else { + col = valueIfDefined2(cols.min, col); + + int newRow = valueIfDefined(rows.min, (row + rowSpan > count) ? 0 : row); + if (newRow < row) { + col += maxSize; + maxSize = 0; + } + row = newRow; + maxSize = max(maxSize, colSpan); } - } - lp.setHorizontalGroupSpan(new Interval(x, x + cellWidth)); - lp.setVerticalGroupSpan(new Interval(y, y + cellHeight)); - if (horizontal) { - x = x + cellWidth; - } else { - y = y + cellHeight; - } - maxSize = max(maxSize, horizontal ? cellHeight : cellWidth); - } - } else { - /* - At least one row and one column index have been defined. - Assume missing row/cols are in error and set them to zero so that - they will display top/left and the developer can add the right indices. - Without this UNDEFINED would cause ArrayIndexOutOfBoundsException. - */ - for (int i = 0, size = getChildCount(); i < size; i++) { - LayoutParams lp = getLayoutParams1(getChildAt(i)); - if (isUndefined(lp.columnGroup.span)) { - lp.setHorizontalGroupSpan(LayoutParams.DEFAULT_SPAN); - } - if (isUndefined(lp.rowGroup.span)) { - lp.setVerticalGroupSpan(LayoutParams.DEFAULT_SPAN); + lp.setColumnGroupSpan(new Interval(col, col + colSpan)); + lp.setRowGroupSpan(new Interval(row, row + rowSpan)); + + if (horizontal) { + col = col + colSpan; + } else { + row = row + rowSpan; + } } } - } + }; + invalidateStructure(); } private void invalidateStructure() { @@ -927,13 +933,11 @@ public class GridLayout extends ViewGroup { this.horizontal = horizontal; } - private int maxIndex(boolean internal) { + private int maxIndex() { // note the number Integer.MIN_VALUE + 1 comes up in undefined cells int count = -1; for (int i = 0, size = getChildCount(); i < size; i++) { - LayoutParams params = internal ? - getLayoutParams1(getChildAt(i)) : - getLayoutParams(getChildAt(i)); + LayoutParams params = getLayoutParams(getChildAt(i)); Group g = horizontal ? params.columnGroup : params.rowGroup; count = max(count, g.span.min); count = max(count, g.span.max); @@ -941,13 +945,9 @@ public class GridLayout extends ViewGroup { return count == -1 ? UNDEFINED : count; } - private int maxIndex1() { - return maxIndex(true); - } - public int getCount() { - if (!countWasExplicitySet && !countValid) { - count = max(0, maxIndex(false)); // if there are no cells, the count is zero + if (!countValid) { + count = max(0, maxIndex()); // if there are no cells, the count is zero countValid = true; } return count; @@ -1391,7 +1391,7 @@ public class GridLayout extends ViewGroup { private float[] getWeights() { if (weights == null) { - int N = getCount() + 1; + int N = getCount(); weights = new float[N]; } computeWeights(); @@ -1424,7 +1424,7 @@ public class GridLayout extends ViewGroup { float[] weights = getWeights(); float totalWeight = sum(weights); - if (totalWeight == 0f) { + if (totalWeight == 0f && weights.length > 0) { weights[weights.length - 1] = 1; totalWeight = 1; } @@ -1432,11 +1432,12 @@ public class GridLayout extends ViewGroup { int[] locations = getLocations(); int cumulativeDelta = 0; - for (int i = 0; i < locations.length; i++) { + // note |weights| = |locations| - 1 + for (int i = 0; i < weights.length; i++) { float weight = weights[i]; int delta = (int) (totalDelta * weight / totalWeight); cumulativeDelta += delta; - locations[i] = mins[i] + cumulativeDelta; + locations[i + 1] = mins[i + 1] + cumulativeDelta; totalDelta -= delta; totalWeight -= weight; @@ -1534,22 +1535,22 @@ public class GridLayout extends ViewGroup { private static final int DEFAULT_MARGIN = UNDEFINED; private static final int DEFAULT_ROW = UNDEFINED; private static final int DEFAULT_COLUMN = UNDEFINED; - private static final Interval DEFAULT_SPAN = new Interval(0, 1); + private static final Interval DEFAULT_SPAN = new Interval(UNDEFINED, UNDEFINED + 1); private static final int DEFAULT_SPAN_SIZE = DEFAULT_SPAN.size(); - private static final Alignment DEFAULT_HORIZONTAL_ALIGNMENT = LEFT; - private static final Alignment DEFAULT_VERTCIAL_ALGIGNMENT = BASELINE; - private static final Group DEFAULT_HORIZONTAL_GROUP = - new Group(DEFAULT_SPAN, DEFAULT_HORIZONTAL_ALIGNMENT); - private static final Group DEFAULT_VERTICAL_GROUP = - new Group(DEFAULT_SPAN, DEFAULT_VERTCIAL_ALGIGNMENT); + private static final Alignment DEFAULT_COLUMN_ALIGNMENT = LEFT; + private static final Alignment DEFAULT_ROW_ALIGNMENT = BASELINE; + private static final Group DEFAULT_COLUMN_GROUP = + new Group(DEFAULT_SPAN, DEFAULT_COLUMN_ALIGNMENT); + private static final Group DEFAULT_ROW_GROUP = + new Group(DEFAULT_SPAN, DEFAULT_ROW_ALIGNMENT); private static final int DEFAULT_WEIGHT_0 = 0; private static final int DEFAULT_WEIGHT_1 = 1; // Misc private static final Rect CONTAINER_BOUNDS = new Rect(0, 0, 2, 2); - private static final Alignment[] HORIZONTAL_ALIGNMENTS = { LEFT, CENTER, RIGHT }; - private static final Alignment[] VERTICAL_ALIGNMENTS = { TOP, CENTER, BOTTOM }; + private static final Alignment[] COLUMN_ALIGNMENTS = { LEFT, CENTER, RIGHT }; + private static final Alignment[] ROW_ALIGNMENTS = { TOP, CENTER, BOTTOM }; // TypedArray indices @@ -1623,7 +1624,7 @@ public class GridLayout extends ViewGroup { * Constructs a new LayoutParams with default values as defined in {@link LayoutParams}. */ public LayoutParams() { - this(DEFAULT_HORIZONTAL_GROUP, DEFAULT_VERTICAL_GROUP); + this(DEFAULT_ROW_GROUP, DEFAULT_COLUMN_GROUP); } // Copying constructors @@ -1714,23 +1715,23 @@ public class GridLayout extends ViewGroup { // Gravity. For conversion from the static the integers defined in the Gravity class, // use Gravity.apply() to apply gravity to a view of zero size and see where it ends up. - private static Alignment getHorizontalAlignment(int gravity, int width) { + private static Alignment getColumnAlignment(int gravity, int width) { Rect r = new Rect(0, 0, 0, 0); Gravity.apply(gravity, 0, 0, CONTAINER_BOUNDS, r); - boolean fill = width == MATCH_PARENT; - Alignment defaultAlignment = fill ? FILL : DEFAULT_HORIZONTAL_ALIGNMENT; - return getAlignment(HORIZONTAL_ALIGNMENTS, FILL, r.left, r.right, + boolean fill = (width == MATCH_PARENT); + Alignment defaultAlignment = fill ? FILL : DEFAULT_COLUMN_ALIGNMENT; + return getAlignment(COLUMN_ALIGNMENTS, FILL, r.left, r.right, !definesHorizontal(gravity), defaultAlignment); } - private static Alignment getVerticalAlignment(int gravity, int height) { + private static Alignment getRowAlignment(int gravity, int height) { Rect r = new Rect(0, 0, 0, 0); Gravity.apply(gravity, 0, 0, CONTAINER_BOUNDS, r); - boolean fill = height == MATCH_PARENT; - Alignment defaultAlignment = fill ? FILL : DEFAULT_VERTCIAL_ALGIGNMENT; - return getAlignment(VERTICAL_ALIGNMENTS, FILL, r.top, r.bottom, + boolean fill = (height == MATCH_PARENT); + Alignment defaultAlignment = fill ? FILL : DEFAULT_ROW_ALIGNMENT; + return getAlignment(ROW_ALIGNMENTS, FILL, r.top, r.bottom, !definesVertical(gravity), defaultAlignment); } @@ -1746,13 +1747,13 @@ public class GridLayout extends ViewGroup { int column = a.getInteger(COLUMN, DEFAULT_COLUMN); int columnSpan = a.getInteger(COLUMN_SPAN, DEFAULT_SPAN_SIZE); Interval hSpan = new Interval(column, column + columnSpan); - this.columnGroup = new Group(hSpan, getHorizontalAlignment(gravity, width)); + this.columnGroup = new Group(hSpan, getColumnAlignment(gravity, width)); this.columnWeight = a.getFloat(COLUMN_WEIGHT, getDefaultWeight(width)); int row = a.getInteger(ROW, DEFAULT_ROW); int rowSpan = a.getInteger(ROW_SPAN, DEFAULT_SPAN_SIZE); Interval vSpan = new Interval(row, row + rowSpan); - this.rowGroup = new Group(vSpan, getVerticalAlignment(gravity, height)); + this.rowGroup = new Group(vSpan, getRowAlignment(gravity, height)); this.rowWeight = a.getFloat(ROW_WEIGHT, getDefaultWeight(height)); } finally { a.recycle(); @@ -1768,8 +1769,8 @@ public class GridLayout extends ViewGroup { * @attr ref android.R.styleable#GridLayout_Layout_layout_gravity */ public void setGravity(int gravity) { - columnGroup = columnGroup.copyWriteAlignment(getHorizontalAlignment(gravity, width)); - rowGroup = rowGroup.copyWriteAlignment(getVerticalAlignment(gravity, height)); + columnGroup = columnGroup.copyWriteAlignment(getColumnAlignment(gravity, width)); + rowGroup = rowGroup.copyWriteAlignment(getRowAlignment(gravity, height)); } @Override @@ -1778,11 +1779,11 @@ public class GridLayout extends ViewGroup { this.height = attributes.getLayoutDimension(heightAttr, DEFAULT_HEIGHT); } - private void setVerticalGroupSpan(Interval span) { + private void setRowGroupSpan(Interval span) { rowGroup = rowGroup.copyWriteSpan(span); } - private void setHorizontalGroupSpan(Interval span) { + private void setColumnGroupSpan(Interval span) { columnGroup = columnGroup.copyWriteSpan(span); } } @@ -2073,30 +2074,30 @@ public class GridLayout extends ViewGroup { /** * Construct a new Group, {@code group}, where: * <ul> - * <li> {@code group.span = [min, max]} </li> + * <li> {@code group.span = [start, start + size]} </li> * <li> {@code group.alignment = alignment} </li> * </ul> * - * @param min the minimum - * @param max the maximum + * @param start the start + * @param size the size * @param alignment the alignment */ - public Group(int min, int max, Alignment alignment) { - this(new Interval(min, max), alignment); + public Group(int start, int size, Alignment alignment) { + this(new Interval(start, start + size), alignment); } /** * Construct a new Group, {@code group}, where: * <ul> - * <li> {@code group.span = [min, min + 1]} </li> + * <li> {@code group.span = [start, start + 1]} </li> * <li> {@code group.alignment = alignment} </li> * </ul> * - * @param min the minimum + * @param start the start index * @param alignment the alignment */ - public Group(int min, Alignment alignment) { - this(min, min + 1, alignment); + public Group(int start, Alignment alignment) { + this(start, 1, alignment); } private Group copyWriteSpan(Interval span) { diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index bc98e8446f09..c95b0ae76bb3 100755 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -627,4 +627,7 @@ Example 2: devices sold in India should include tables 4 through 13 to enable use of the new Release 9 tables for Indic languages. --> <integer-array name="config_sms_enabled_locking_shift_tables"></integer-array> + + <!-- Set to true if the RSSI should always display CDMA signal strength even on EVDO --> + <bool name="config_alwaysUseCdmaRssi">false</bool> </resources> diff --git a/tests/GridLayoutTest/res/layout/grid3.xml b/tests/GridLayoutTest/res/layout/grid3.xml index ace7b4c6fd87..31dc75abfb9c 100644 --- a/tests/GridLayoutTest/res/layout/grid3.xml +++ b/tests/GridLayoutTest/res/layout/grid3.xml @@ -19,59 +19,61 @@ android:layout_width="match_parent" android:layout_height="match_parent" + android:useDefaultMargins="true" + android:marginsIncludedInAlignment="false" + android:columnCount="4" > - <Button - android:text="fill" - android:width="200dip" - android:height="100dip" - android:layout_marginLeft="50dip" - android:layout_row="0" - android:layout_column="0" - android:layout_gravity="fill_horizontal" + <TextView + android:text="Email account" + android:textSize="48dip" + android:layout_columnSpan="4" + android:layout_gravity="center_horizontal" /> - <EditText - android:layout_row="0" - android:layout_column="1" + <TextView + android:text="You can configure email in just a few steps:" + android:textSize="20dip" + android:layout_columnSpan="4" + android:layout_gravity="left" /> - <Button - android:text="left" - android:layout_row="1" - android:layout_column="0" + <TextView + android:text="Email address:" + android:layout_gravity="right" /> <EditText - android:layout_row="1" - android:layout_column="1" + android:layout_width="100dip" /> - <Button - android:text="right" - android:layout_row="2" + <TextView + android:text="Password:" android:layout_column="0" android:layout_gravity="right" /> <EditText - android:layout_margin="50dip" - android:textSize="100dip" - android:layout_row="2" - android:layout_column="1" + android:layout_width="50dip" /> - <Button - android:text="center" - android:layout_row="3" - android:layout_column="0" - android:layout_gravity="center_horizontal" + <Space + android:layout_rowWeight="1" + android:layout_columnWeight="1" + android:layout_row="4" + android:layout_column="2" /> - <EditText - android:layout_height="fill_parent" - android:layout_row="3" - android:layout_column="1" + <Button + android:text="Manual setup" + android:layout_row="5" + android:layout_column="3" + android:layout_gravity="fill_horizontal" /> + <Button + android:text="Next" + android:layout_column="3" + android:layout_gravity="fill_horizontal" + /> </GridLayout> diff --git a/tests/GridLayoutTest/src/com/android/test/layout/AbstractLayoutTest.java b/tests/GridLayoutTest/src/com/android/test/layout/AbstractLayoutTest.java index 937eacb3b00a..4d3a843cdf87 100644 --- a/tests/GridLayoutTest/src/com/android/test/layout/AbstractLayoutTest.java +++ b/tests/GridLayoutTest/src/com/android/test/layout/AbstractLayoutTest.java @@ -19,19 +19,19 @@ package com.android.test.layout; import android.app.Activity; import android.content.Context; import android.os.Bundle; -import android.os.Debug; import android.util.Log; -import android.view.Gravity; import android.view.View; import android.view.ViewGroup; import android.widget.Button; +import static android.view.Gravity.*; + public abstract class AbstractLayoutTest extends Activity { - public static final String[] HORIZONTAL_NAMES = new String[] { "LEFT", "center", "east", "fill" }; - public static final int[] HORIZONTAL_ALIGNMENTS = new int[] { Gravity.LEFT, Gravity.CENTER, Gravity.RIGHT, Gravity.FILL }; - public static final String[] VERTICAL_NAMES = new String[] { "north", "center", "baseline", "south", "fill" }; - public static final int[] VERTICAL_ALIGNMENTS = new int[] { Gravity.TOP, Gravity.CENTER, Gravity.NO_GRAVITY, Gravity.BOTTOM, Gravity.FILL }; + public static final String[] HORIZONTAL_NAMES = { "LEFT", "CENTER", "RIGHT", "FILL" }; + public static final int[] HORIZONTAL_ALIGNMENTS = { LEFT, CENTER, RIGHT, FILL }; + public static final String[] VERTICAL_NAMES = { "TOP", "CENTER", "BASELINE", "BOTTOM", "FILL" }; + public static final int[] VERTICAL_ALIGNMENTS = { TOP, CENTER, NO_GRAVITY, BOTTOM, FILL }; public View create(Context context, String name, int size) { Button result = new Button(context); diff --git a/tests/GridLayoutTest/src/com/android/test/layout/GridLayoutTest.java b/tests/GridLayoutTest/src/com/android/test/layout/GridLayoutTest.java index 2eecb8a66b5c..c5681e2c146d 100644 --- a/tests/GridLayoutTest/src/com/android/test/layout/GridLayoutTest.java +++ b/tests/GridLayoutTest/src/com/android/test/layout/GridLayoutTest.java @@ -36,6 +36,7 @@ public class GridLayoutTest extends AbstractLayoutTest { GridLayout.Group rowGroup = new GridLayout.Group(UNDEFINED, null); GridLayout.Group colGroup = new GridLayout.Group(UNDEFINED, null); GridLayout.LayoutParams lp = new GridLayout.LayoutParams(rowGroup, colGroup); + //GridLayout.LayoutParams lp = new GridLayout.LayoutParams(); lp.setGravity(va | ha); View v = create(context, VERTICAL_NAMES[i] + "-" + HORIZONTAL_NAMES[j], 20); container.addView(v, lp); |