diff options
Diffstat (limited to 'library')
-rw-r--r-- | library/main/src/com/android/setupwizardlib/GlifLayout.java | 4 | ||||
-rw-r--r-- | library/test/src/com/android/setupwizardlib/test/GlifLayoutTest.java | 9 |
2 files changed, 11 insertions, 2 deletions
diff --git a/library/main/src/com/android/setupwizardlib/GlifLayout.java b/library/main/src/com/android/setupwizardlib/GlifLayout.java index 3d79da5..765e6a6 100644 --- a/library/main/src/com/android/setupwizardlib/GlifLayout.java +++ b/library/main/src/com/android/setupwizardlib/GlifLayout.java @@ -236,7 +236,9 @@ public class GlifLayout extends TemplateLayout { public void setProgressBarShown(boolean shown) { if (shown) { View progressBar = getProgressBar(); - progressBar.setVisibility(View.VISIBLE); + if (progressBar != null) { + progressBar.setVisibility(View.VISIBLE); + } } else { View progressBar = peekProgressBar(); if (progressBar != null) { diff --git a/library/test/src/com/android/setupwizardlib/test/GlifLayoutTest.java b/library/test/src/com/android/setupwizardlib/test/GlifLayoutTest.java index 24351da..8100eda 100644 --- a/library/test/src/com/android/setupwizardlib/test/GlifLayoutTest.java +++ b/library/test/src/com/android/setupwizardlib/test/GlifLayoutTest.java @@ -121,13 +121,20 @@ public class GlifLayoutTest extends InstrumentationTestCase { } @SmallTest - public void testPekkProgressBar() { + public void testPeekProgressBar() { GlifLayout layout = new GlifLayout(mContext); layout.setProgressBarShown(true); assertNotNull("Peek progress bar should return the bar after setProgressBarShown(true)", layout.peekProgressBar()); } + @SmallTest + public void testSetProgressBarShownInvalid() { + GlifLayout layout = new GlifLayout(mContext, R.layout.test_template); + layout.setProgressBarShown(true); + // This is a no-op because there is no progress bar stub + } + private void assertDefaultTemplateInflated(GlifLayout layout) { View title = layout.findViewById(R.id.suw_layout_title); assertNotNull("@id/suw_layout_title should not be null", title); |