summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Powell <adamp@google.com>2010-11-04 17:54:45 -0700
committerAdam Powell <adamp@google.com>2010-11-04 18:16:38 -0700
commit2614c6c1f9fb19af21b901c16c443335bbc9d50b (patch)
tree240cdbf45ea52ad689421098dce14dd383e0751a
parentd7120ed63da2c7e8af044db66c9e109353f9d1b0 (diff)
downloadframeworks_base-2614c6c1f9fb19af21b901c16c443335bbc9d50b.zip
frameworks_base-2614c6c1f9fb19af21b901c16c443335bbc9d50b.tar.gz
frameworks_base-2614c6c1f9fb19af21b901c16c443335bbc9d50b.tar.bz2
Fix bug 3167099 and bug 3009490 - GridView choice modes and
getCheckedItemCount after orientation change Remove the restriction on choice modes for GridView - this is handled by common code in AbsListView. Persist the checked item count in saved instance state. Change-Id: Iebb964bb3c43779c082a458ea3f2754ab694b69d
-rw-r--r--core/java/android/widget/AbsListView.java6
-rw-r--r--core/java/android/widget/GridView.java20
2 files changed, 6 insertions, 20 deletions
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index 2107e43..d4a26cc 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -1210,6 +1210,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
int position;
int height;
String filter;
+ int checkedItemCount;
SparseBooleanArray checkState;
LongSparseArray<Boolean> checkIdState;
@@ -1231,6 +1232,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
position = in.readInt();
height = in.readInt();
filter = in.readString();
+ checkedItemCount = in.readInt();
checkState = in.readSparseBooleanArray();
long[] idState = in.createLongArray();
@@ -1249,6 +1251,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
out.writeInt(position);
out.writeInt(height);
out.writeString(filter);
+ out.writeInt(checkedItemCount);
out.writeSparseBooleanArray(checkState);
out.writeLongArray(checkIdState != null ? checkIdState.getKeys() : new long[0]);
}
@@ -1329,6 +1332,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
ss.checkState = mCheckStates;
ss.checkIdState = mCheckedIdStates;
+ ss.checkedItemCount = mCheckedItemCount;
return ss;
}
@@ -1370,6 +1374,8 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
mCheckedIdStates = ss.checkIdState;
}
+ mCheckedItemCount = ss.checkedItemCount;
+
requestLayout();
}
diff --git a/core/java/android/widget/GridView.java b/core/java/android/widget/GridView.java
index 936a97d..b963536 100644
--- a/core/java/android/widget/GridView.java
+++ b/core/java/android/widget/GridView.java
@@ -107,26 +107,6 @@ public class GridView extends AbsListView {
a.recycle();
}
- /**
- * Set how the user may select items from the grid.
- *
- * <p>GridView only supports {@link AbsListView#CHOICE_MODE_NONE} and
- * {@link AbsListView#CHOICE_MODE_MULTIPLE_MODAL}. Attempting to set an unsupported choice
- * mode will throw an UnsupportedOperationException.
- */
- @Override
- public void setChoiceMode(int choiceMode) {
- switch (choiceMode) {
- case CHOICE_MODE_NONE:
- case CHOICE_MODE_MULTIPLE_MODAL:
- super.setChoiceMode(choiceMode);
- break;
-
- default:
- throw new UnsupportedOperationException("Unsupported choice mode " + choiceMode);
- }
- }
-
@Override
public ListAdapter getAdapter() {
return mAdapter;