Merge "Ensure Gallery does not unselect the selected item after a layout. Bug #2573921"

This commit is contained in:
Romain Guy
2010-04-14 14:45:43 -07:00
committed by Android (Google) Code Review

View File

@@ -1207,7 +1207,7 @@ public class Gallery extends AbsSpinner implements GestureDetector.OnGestureList
// We unfocus the old child down here so the above hasFocus check
// returns true
if (oldSelectedChild != null) {
if (oldSelectedChild != null && oldSelectedChild != child) {
// Make sure its drawable state doesn't contain 'selected'
oldSelectedChild.setSelected(false);
@@ -1263,6 +1263,7 @@ public class Gallery extends AbsSpinner implements GestureDetector.OnGestureList
*/
if (gainFocus && mSelectedChild != null) {
mSelectedChild.requestFocus(direction);
mSelectedChild.setSelected(true);
}
}