summaryrefslogtreecommitdiff
path: root/library/main/src
diff options
context:
space:
mode:
authorMaurice Lam <yukl@google.com>2017-03-07 10:52:34 -0800
committerMaurice Lam <yukl@google.com>2017-03-07 14:57:18 -0800
commit48c121912f865be865e564a4d0a899988a100d37 (patch)
treeac4a882648376290797f19a088724f538be7d6e7 /library/main/src
parent925f4b24fc2f635271cf381c92f7bd9dca569197 (diff)
downloadsetupwizard-48c121912f865be865e564a4d0a899988a100d37.tar.gz
Add suwFooter attribute to GlifLayout
Add the suwFooter attribute so custom footer layouts can be easily added, in conjunction with <aapt:attr> tag. Test: ./gradlew connectedAndroidTest test Bug: 36009807 Change-Id: Id7d937486451e34bdc30775a0f5f3dfcde47598f
Diffstat (limited to 'library/main/src')
-rw-r--r--library/main/src/com/android/setupwizardlib/GlifLayout.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/library/main/src/com/android/setupwizardlib/GlifLayout.java b/library/main/src/com/android/setupwizardlib/GlifLayout.java
index 037a148..667d699 100644
--- a/library/main/src/com/android/setupwizardlib/GlifLayout.java
+++ b/library/main/src/com/android/setupwizardlib/GlifLayout.java
@@ -31,6 +31,7 @@ import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.view.ViewStub;
import android.widget.ProgressBar;
import android.widget.ScrollView;
import android.widget.TextView;
@@ -123,6 +124,11 @@ public class GlifLayout extends TemplateLayout {
a.getBoolean(R.styleable.SuwGlifLayout_suwBackgroundPatterned, true);
setBackgroundPatterned(backgroundPatterned);
+ final int footer = a.getResourceId(R.styleable.SuwGlifLayout_suwFooter, 0);
+ if (footer != 0) {
+ inflateFooter(footer);
+ }
+
a.recycle();
}
@@ -142,6 +148,19 @@ public class GlifLayout extends TemplateLayout {
return super.findContainer(containerId);
}
+ /**
+ * Sets the footer of the layout, which is at the bottom of the content area outside the
+ * scrolling container. The footer can only be inflated once per layout.
+ *
+ * @param footer The layout to be inflated as footer.
+ * @return The root of the inflated footer view.
+ */
+ public View inflateFooter(@LayoutRes int footer) {
+ ViewStub footerStub = (ViewStub) findManagedViewById(R.id.suw_layout_footer);
+ footerStub.setLayoutResource(footer);
+ return footerStub.inflate();
+ }
+
public ScrollView getScrollView() {
final View view = findManagedViewById(R.id.suw_scroll_view);
return view instanceof ScrollView ? (ScrollView) view : null;