diff options
author | Alan Viverette <alanv@google.com> | 2015-06-04 17:19:25 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-06-04 17:19:27 +0000 |
commit | 2e4e5d745f6e2bc2d9d63b25a45385b55ec4cfe3 (patch) | |
tree | ea39ad05c4272fb7b13a53f2ffeb9c1ef47916d6 /core/java | |
parent | 2fe44efced5ac28bc3e03c9c101644b4ef0134bb (diff) | |
parent | 31ff78b1465b26d50c629f8f47d1a485218f6ad5 (diff) | |
download | frameworks_base-2e4e5d745f6e2bc2d9d63b25a45385b55ec4cfe3.zip frameworks_base-2e4e5d745f6e2bc2d9d63b25a45385b55ec4cfe3.tar.gz frameworks_base-2e4e5d745f6e2bc2d9d63b25a45385b55ec4cfe3.tar.bz2 |
Merge "Revert "Synchronize selected item data on-demand after data set invalidation"" into mnc-dev
Diffstat (limited to 'core/java')
-rw-r--r-- | core/java/android/widget/AbsListView.java | 7 | ||||
-rw-r--r-- | core/java/android/widget/AdapterView.java | 59 |
2 files changed, 10 insertions, 56 deletions
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java index 7f85f5a..a0d1930 100644 --- a/core/java/android/widget/AbsListView.java +++ b/core/java/android/widget/AbsListView.java @@ -5309,13 +5309,6 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te } @Override - void syncSelectedItem() { - if (mDataChanged) { - layoutChildren(); - } - } - - @Override protected void handleDataChanged() { int count = mItemCount; int lastHandledItemCount = mLastHandledItemCount; diff --git a/core/java/android/widget/AdapterView.java b/core/java/android/widget/AdapterView.java index cfe02bd..6962711 100644 --- a/core/java/android/widget/AdapterView.java +++ b/core/java/android/widget/AdapterView.java @@ -551,67 +551,37 @@ public abstract class AdapterView<T extends Adapter> extends ViewGroup { } /** - * Returns the position of the currently selected item within the adapter's - * data set, or {@link #INVALID_POSITION} if there is nothing selected. - * <p> - * <strong>Note:</strong> Prior to {@link android.os.Build.VERSION_CODES#MNC}, - * calling this method between an adapter data set change and a subsequent - * layout pass could return invalid data. + * Return the position of the currently selected item within the adapter's data set * - * @return the selected item's position (starting at 0), or - * {@link #INVALID_POSITION} if there is nothing selected + * @return int Position (starting at 0), or {@link #INVALID_POSITION} if there is nothing selected. */ @ViewDebug.CapturedViewProperty public int getSelectedItemPosition() { - syncSelectedItem(); return mNextSelectedPosition; } /** - * Returns the row ID corresponding to the currently selected item, or - * {@link #INVALID_ROW_ID} if nothing is selected. - * <p> - * <strong>Note:</strong> Prior to {@link android.os.Build.VERSION_CODES#MNC}, - * calling this method between an adapter data set change and a subsequent - * layout pass could return invalid data. - * - * @return the selected item's row ID, or {@link #INVALID_ROW_ID} if - * nothing is selected + * @return The id corresponding to the currently selected item, or {@link #INVALID_ROW_ID} + * if nothing is selected. */ @ViewDebug.CapturedViewProperty public long getSelectedItemId() { - syncSelectedItem(); return mNextSelectedRowId; } /** - * Returns the view corresponding to the currently selected item, or - * {@code null} if nothing is selected. - * <p> - * <strong>Note:</strong> Prior to {@link android.os.Build.VERSION_CODES#MNC}, - * calling this method between an adapter data set change and a subsequent - * layout pass could return inconsistent data. - * - * @return the selected item's view, or {@code null} if nothing is selected + * @return The view corresponding to the currently selected item, or null + * if nothing is selected */ - @Nullable public abstract View getSelectedView(); /** - * Returns the data corresponding to the currently selected item, or - * {@code null} if nothing is selected. - * <p> - * <strong>Note:</strong> Prior to {@link android.os.Build.VERSION_CODES#MNC}, - * calling this method between an adapter data set change and a subsequent - * layout pass could return inconsistent data. - * - * @return the data corresponding to the currently selected item, or - * {@code null} if there is nothing selected. + * @return The data corresponding to the currently selected item, or + * null if there is nothing selected. */ - @Nullable public Object getSelectedItem() { - final T adapter = getAdapter(); - final int selection = getSelectedItemPosition(); + T adapter = getAdapter(); + int selection = getSelectedItemPosition(); if (adapter != null && adapter.getCount() > 0 && selection >= 0) { return adapter.getItem(selection); } else { @@ -620,15 +590,6 @@ public abstract class AdapterView<T extends Adapter> extends ViewGroup { } /** - * Synchronizes the selected item's position and ID, if necessary. - */ - void syncSelectedItem() { - if (mDataChanged) { - onLayout(false, mLeft, mTop, mRight, mBottom); - } - } - - /** * @return The number of items owned by the Adapter associated with this * AdapterView. (This is the number of data items, which may be * larger than the number of visible views.) |