diff options
author | James Kung <kingkung@google.com> | 2013-02-28 14:26:19 -0800 |
---|---|---|
committer | James Kung <kingkung@google.com> | 2013-02-28 14:26:19 -0800 |
commit | c1678c2f19857e9f4147c760a5168b91965ef68c (patch) | |
tree | 527c78c766f0c2a9a3b5b189e84f3c6ef9c761bb | |
parent | 14d76a209b38d1f1b9db35256880d40319e3e35e (diff) | |
download | android_packages_apps_Calendar-c1678c2f19857e9f4147c760a5168b91965ef68c.tar.gz android_packages_apps_Calendar-c1678c2f19857e9f4147c760a5168b91965ef68c.tar.bz2 android_packages_apps_Calendar-c1678c2f19857e9f4147c760a5168b91965ef68c.zip |
UI adjustments to mini calendar items for tablets.
Change-Id: Ie84eb6720ce11d21895c7ac2143fb38c065e8580
-rw-r--r-- | res/layout/mini_calendar_item.xml | 12 | ||||
-rw-r--r-- | src/com/android/calendar/selectcalendars/SelectCalendarsSimpleAdapter.java | 50 |
2 files changed, 18 insertions, 44 deletions
diff --git a/res/layout/mini_calendar_item.xml b/res/layout/mini_calendar_item.xml index 07579b07..aa0ab9d8 100644 --- a/res/layout/mini_calendar_item.xml +++ b/res/layout/mini_calendar_item.xml @@ -27,9 +27,9 @@ <com.android.calendar.selectcalendars.CalendarColorSquare android:id="@+id/color" - android:layout_height="48dip" - android:layout_width="48dip" - android:layout_marginLeft="13dip" + android:layout_height="20dip" + android:layout_width="20dip" + android:layout_marginLeft="16dip" android:layout_gravity="center_vertical" style="?android:attr/quickContactBadgeStyleWindowMedium" android:cropToPadding="true" @@ -37,9 +37,9 @@ <TextView android:id="@+id/calendar" android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginLeft="44dip" - android:layout_marginTop="3dip" + android:layout_height="wrap_content" + android:layout_toRightOf="@id/color" + android:layout_marginLeft="8dip" android:singleLine="true" android:ellipsize="marquee" style="@style/TextAppearance.SelectCalendar_Name" diff --git a/src/com/android/calendar/selectcalendars/SelectCalendarsSimpleAdapter.java b/src/com/android/calendar/selectcalendars/SelectCalendarsSimpleAdapter.java index 12f847d6..75c9c1a5 100644 --- a/src/com/android/calendar/selectcalendars/SelectCalendarsSimpleAdapter.java +++ b/src/com/android/calendar/selectcalendars/SelectCalendarsSimpleAdapter.java @@ -22,7 +22,6 @@ import android.content.res.Configuration; import android.content.res.Resources; import android.database.Cursor; import android.graphics.Rect; -import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.provider.CalendarContract.Calendars; import android.text.TextUtils; @@ -34,9 +33,7 @@ import android.view.ViewGroup; import android.view.ViewGroup.LayoutParams; import android.widget.BaseAdapter; import android.widget.CheckBox; -import android.widget.ImageView; import android.widget.ListAdapter; -import android.widget.RelativeLayout; import android.widget.TextView; import com.android.calendar.CalendarColorPickerDialog; @@ -45,11 +42,7 @@ import com.android.calendar.Utils; public class SelectCalendarsSimpleAdapter extends BaseAdapter implements ListAdapter { private static final String TAG = "SelectCalendarsAdapter"; - private static int SELECTED_COLOR_CHIP_SIZE = 16; - private static int UNSELECTED_COLOR_CHIP_SIZE = 10; - private static int COLOR_CHIP_LEFT_MARGIN = 20; - private static int COLOR_CHIP_RIGHT_MARGIN = 8; - private static int COLOR_CHIP_TOP_OFFSET = 5; + private static int BOTTOM_ITEM_HEIGHT = 64; private static int NORMAL_ITEM_HEIGHT = 48; @@ -105,11 +98,6 @@ public class SelectCalendarsSimpleAdapter extends BaseAdapter implements ListAda if (mScale == 0) { mScale = mRes.getDisplayMetrics().density; - SELECTED_COLOR_CHIP_SIZE *= mScale; - UNSELECTED_COLOR_CHIP_SIZE *= mScale; - COLOR_CHIP_LEFT_MARGIN *= mScale; - COLOR_CHIP_RIGHT_MARGIN *= mScale; - COLOR_CHIP_TOP_OFFSET *= mScale; BOTTOM_ITEM_HEIGHT *= mScale; NORMAL_ITEM_HEIGHT *= mScale; } @@ -208,6 +196,7 @@ public class SelectCalendarsSimpleAdapter extends BaseAdapter implements ListAda notifyDataSetChanged(); } + @Override public View getView(final int position, View convertView, ViewGroup parent) { if (position >= mRowCount) { return null; @@ -257,20 +246,20 @@ public class SelectCalendarsSimpleAdapter extends BaseAdapter implements ListAda } }); + int textColor; + if (selected) { + textColor = mColorCalendarVisible; + } else { + textColor = mColorCalendarHidden; + } + calendarName.setTextColor(textColor); + CheckBox syncCheckBox = (CheckBox) view.findViewById(R.id.sync); if (syncCheckBox != null) { // Full screen layout syncCheckBox.setChecked(selected); - int textColor; - if (selected) { - textColor = mColorCalendarVisible; - } else { - textColor = mColorCalendarHidden; - } - calendarName.setTextColor(textColor); LayoutParams layoutParam = calendarName.getLayoutParams(); - TextView secondaryText = (TextView) view.findViewById(R.id.status); if (!TextUtils.isEmpty(mData[position].ownerAccount) && !mData[position].ownerAccount.equals(name) @@ -294,23 +283,8 @@ public class SelectCalendarsSimpleAdapter extends BaseAdapter implements ListAda } else { // Tablet layout - RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams( - SELECTED_COLOR_CHIP_SIZE, SELECTED_COLOR_CHIP_SIZE); - params.leftMargin = COLOR_CHIP_LEFT_MARGIN; - params.rightMargin = COLOR_CHIP_RIGHT_MARGIN; - // This offset is needed because the assets include the bottom of the - // previous item - params.topMargin = COLOR_CHIP_TOP_OFFSET; - if (!selected) { - params.height = UNSELECTED_COLOR_CHIP_SIZE; - params.width = UNSELECTED_COLOR_CHIP_SIZE; - params.leftMargin += (SELECTED_COLOR_CHIP_SIZE - UNSELECTED_COLOR_CHIP_SIZE) / 2; - params.topMargin += (SELECTED_COLOR_CHIP_SIZE - UNSELECTED_COLOR_CHIP_SIZE) / 2; - } - colorView.setLayoutParams(params); - - Drawable bg = getBackground(position, selected); - view.setBackgroundDrawable(bg); + view.findViewById(R.id.color).setEnabled(selected); + view.setBackgroundDrawable(getBackground(position, selected)); ViewGroup.LayoutParams newParams = view.getLayoutParams(); if (position == mData.length - 1) { newParams.height = BOTTOM_ITEM_HEIGHT; |