diff options
author | Rohit Yengisetty <rohit@cyngn.com> | 2015-01-20 10:35:20 -0800 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2015-01-22 03:25:49 +0000 |
commit | 629086e468bb9d7f705fc68121872d30789f5ea4 (patch) | |
tree | 5b77d6684692f9a9a6bf0618fc414b0f5a9aa6c0 | |
parent | 836ee449b9db7c08347e66308a978d9535c47833 (diff) | |
download | android_packages_apps_Calendar-629086e468bb9d7f705fc68121872d30789f5ea4.tar.gz android_packages_apps_Calendar-629086e468bb9d7f705fc68121872d30789f5ea4.tar.bz2 android_packages_apps_Calendar-629086e468bb9d7f705fc68121872d30789f5ea4.zip |
Calendar - Bug fixes in DeleteEvents activity
> stop checkboxes from stealing touch events
> correct listview's getChildAt usage
> fix onDestroyActionMode from inadvertently triggering
onItemCheckedStateChanged with wrong parameters
Change-Id: Ibd151c4de4b373733a9ae6e0b982c088de7bd5ad
-rw-r--r-- | res/layout/event_list_item.xml | 7 | ||||
-rw-r--r-- | src/com/android/calendar/DeleteEventsActivity.java | 21 |
2 files changed, 13 insertions, 15 deletions
diff --git a/res/layout/event_list_item.xml b/res/layout/event_list_item.xml index 17c22e41..eb53fecf 100644 --- a/res/layout/event_list_item.xml +++ b/res/layout/event_list_item.xml @@ -32,8 +32,7 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. android:layout_width="match_parent" android:layout_height="match_parent" android:paddingTop="2dp" - android:paddingBottom="2dp" - android:background="?android:attr/activatedBackgroundIndicator"> + android:paddingBottom="2dp"> <CheckBox android:id="@+id/checkbox" @@ -42,7 +41,9 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. android:layout_alignParentStart="true" android:layout_centerVertical="true" android:layout_marginStart="4dp" - android:layout_marginEnd="4dp" /> + android:layout_marginEnd="4dp" + android:focusable="false" + android:clickable="false"/> <TextView android:id="@+id/event_title" diff --git a/src/com/android/calendar/DeleteEventsActivity.java b/src/com/android/calendar/DeleteEventsActivity.java index abeb4718..da2b6bc5 100644 --- a/src/com/android/calendar/DeleteEventsActivity.java +++ b/src/com/android/calendar/DeleteEventsActivity.java @@ -255,7 +255,15 @@ public class DeleteEventsActivity extends ListActivity @Override public void onItemCheckedStateChanged(ActionMode mode, int position, long id, boolean checked) { - View v = mListView.getChildAt(position); + int firstVisiblePosition = mListView.getFirstVisiblePosition(); + int actualPosition = position - firstVisiblePosition; + + if (DEBUG) { + Log.i(TAG, "position , firstVisiblePosition, actualPosition : " + + position + " " + firstVisiblePosition + " " + actualPosition); + } + + View v = mListView.getChildAt(actualPosition); CheckBox checkbox = (CheckBox) v.findViewById(R.id.checkbox); checkbox.toggle(); @@ -300,7 +308,6 @@ public class DeleteEventsActivity extends ListActivity @Override public void onDestroyActionMode(ActionMode mode) { mListView.clearChoices(); - deselectAll(); mSelectedMap.clear(); mActionMode = null; } @@ -470,16 +477,6 @@ public class DeleteEventsActivity extends ListActivity } } - private void deselectAll() { - for (int i = 0; i < mListView.getCount(); i ++) { - if (mSelectedMap.containsKey(mListView.getItemIdAtPosition(i))) { - mListView.setItemChecked(i, false); - } - } - mAdapter.notifyDataSetChanged(); - updateTitle(); - } - private void selectAll() { mSelectedMap.clear(); for (Long event : mEventList){ |