Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,6 @@ public final View createView(LayoutInflater inflater) {
if (mContentView == null) {
mContentView = inflater.inflate(mContentLayoutResId, null);
}
if (mHeaderView == null) {
mHeaderView = inflater.inflate(mHeaderLayoutResId, null, false);
}

//
// See if we are in a ListView, WebView or ScrollView scenario
Expand Down Expand Up @@ -223,7 +220,7 @@ private View createWebView() {

mHeaderContainer = (FrameLayout) webViewContainer.findViewById(R.id.fab__header_container);
initializeGradient(mHeaderContainer);
mHeaderContainer.addView(mHeaderView, 0);
addHeaderView(mHeaderContainer, mHeaderLayoutResId);

mMarginView = new FrameLayout(webView.getContext());
mMarginView.setBackgroundColor(Color.TRANSPARENT);
Expand All @@ -244,7 +241,8 @@ private View createScrollView() {
contentContainer.addView(mContentView);
mHeaderContainer = (FrameLayout) scrollViewContainer.findViewById(R.id.fab__header_container);
initializeGradient(mHeaderContainer);
mHeaderContainer.addView(mHeaderView, 0);
addHeaderView(mHeaderContainer, mHeaderLayoutResId);

mMarginView = (FrameLayout) contentContainer.findViewById(R.id.fab__content_top_margin);

return scrollViewContainer;
Expand All @@ -262,7 +260,7 @@ private View createListView(ListView listView) {

mHeaderContainer = (FrameLayout) contentContainer.findViewById(R.id.fab__header_container);
initializeGradient(mHeaderContainer);
mHeaderContainer.addView(mHeaderView, 0);
addHeaderView(mHeaderContainer, mHeaderLayoutResId);

mMarginView = new FrameLayout(listView.getContext());
mMarginView.setLayoutParams(new AbsListView.LayoutParams(LayoutParams.MATCH_PARENT, 0));
Expand Down Expand Up @@ -352,4 +350,11 @@ private void initializeGradient(ViewGroup headerContainer) {
}
gradientView.setBackgroundResource(gradient);
}

private void addHeaderView(ViewGroup headerContainer, int headerLayoutResId){
if (mHeaderView == null) {
mHeaderView = mInflater.inflate(headerLayoutResId, headerContainer, false);
}
headerContainer.addView(mHeaderView, 0);
}
}