summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2016-04-04 08:44:26 +0200
committerMichael Bestas <mikeioannina@gmail.com>2017-01-04 21:57:49 +0200
commitce39da59f29d1b24ca7d9bec889254bd79ac46f7 (patch)
tree3bcca1052d28855190115d9fc70d3a6ae4d5e5a2
parent385eb681a0776d9ced5a4cc2290ba4a88f55b997 (diff)
downloadandroid_packages_apps_Snap-ce39da59f29d1b24ca7d9bec889254bd79ac46f7.zip
android_packages_apps_Snap-ce39da59f29d1b24ca7d9bec889254bd79ac46f7.tar.gz
android_packages_apps_Snap-ce39da59f29d1b24ca7d9bec889254bd79ac46f7.tar.bz2
Fix view index tracking.
As we have a header and a footer view now, the assumption 'pref list size == child count' doesn't hold anymore. Change-Id: I1b4ab16907eea758921ccce64af01d2a73e82459
-rw-r--r--src/com/android/camera/ui/ListMenu.java10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/com/android/camera/ui/ListMenu.java b/src/com/android/camera/ui/ListMenu.java
index 1e9d436..cb11a80 100644
--- a/src/com/android/camera/ui/ListMenu.java
+++ b/src/com/android/camera/ui/ListMenu.java
@@ -227,7 +227,7 @@ public class ListMenu extends ListView
mEnabled[j] = enable;
int offset = getFirstVisiblePosition();
if (offset >= 0) {
- int indexInView = j - offset;
+ int indexInView = j + getHeaderViewsCount() - offset;
if (getChildCount() > indexInView && indexInView >= 0) {
getChildAt(indexInView).setEnabled(enable);
}
@@ -271,11 +271,9 @@ public class ListMenu extends ListView
public void reloadPreference() {
int count = getChildCount();
for (int i = 0; i < count; i++) {
- ListPreference pref = mListItem.get(i);
- if (pref != null) {
- ListMenuItem listMenuItem =
- (ListMenuItem) getChildAt(i);
- listMenuItem.reloadPreference();
+ View view = getChildAt(i);
+ if (view instanceof ListMenuItem) {
+ ((ListMenuItem) view).reloadPreference();
}
}
}