summaryrefslogtreecommitdiff
path: root/library/main/src/com
diff options
context:
space:
mode:
authorMaurice Lam <yukl@google.com>2015-12-04 12:37:34 -0800
committerMaurice Lam <yukl@google.com>2015-12-04 12:49:03 -0800
commit5a4d6cdfb63240c41527ba80b7baddba8933d770 (patch)
tree6215ac882adfbbb245c346b5a1e0c10bb44bf6ad /library/main/src/com
parent678740df07b7df6708d7b1dafd492e3e4236cea2 (diff)
downloadsetupwizard-5a4d6cdfb63240c41527ba80b7baddba8933d770.tar.gz
[SuwLib] GLIF layout adjustment for headers
- Store the list item directly in the view holder and update in onBindViewHolder, so that the click handler is not prone to adapter position changes. - Glif[List/Recycler]Layout now returns the wrapped adapter when getAdapter is called. - Disable dividers for header views Change-Id: Ie782a4de06e2296d4996cb8b81b5d7d3fc834ccf
Diffstat (limited to 'library/main/src/com')
-rw-r--r--library/main/src/com/android/setupwizardlib/GlifListLayout.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/library/main/src/com/android/setupwizardlib/GlifListLayout.java b/library/main/src/com/android/setupwizardlib/GlifListLayout.java
index 4a1859f..77065c8 100644
--- a/library/main/src/com/android/setupwizardlib/GlifListLayout.java
+++ b/library/main/src/com/android/setupwizardlib/GlifListLayout.java
@@ -26,6 +26,7 @@ import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.widget.HeaderViewListAdapter;
import android.widget.ListAdapter;
import android.widget.ListView;
@@ -132,7 +133,11 @@ public class GlifListLayout extends GlifLayout {
}
public ListAdapter getAdapter() {
- return getListView().getAdapter();
+ final ListAdapter adapter = getListView().getAdapter();
+ if (adapter instanceof HeaderViewListAdapter) {
+ return ((HeaderViewListAdapter) adapter).getWrappedAdapter();
+ }
+ return adapter;
}
/**