summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRohit Yengisetty <rohit@cyngn.com>2015-01-20 10:35:20 -0800
committerSteve Kondik <steve@cyngn.com>2015-10-18 13:52:42 -0700
commit5e912dbf645a355f8a72949c1c8b69e193688e52 (patch)
treebebba9c2a1e17a2878c3d0fa61eb7bd6392d7ef2
parent87b24fb1aa6f98d5202397cfd8207d0d428c1adf (diff)
downloadandroid_packages_apps_Calendar-5e912dbf645a355f8a72949c1c8b69e193688e52.tar.gz
android_packages_apps_Calendar-5e912dbf645a355f8a72949c1c8b69e193688e52.tar.bz2
android_packages_apps_Calendar-5e912dbf645a355f8a72949c1c8b69e193688e52.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.xml7
-rw-r--r--src/com/android/calendar/DeleteEventsActivity.java21
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){