WelcomeConfiguration { public BackgroundColor[] getBackgroundColors() { return pages.getBackgroundColors(getContext()); } WelcomeConfiguration(Builder builder); Context getContext(); Fragment getFragment(int index); Fragment createFragment(int index); BackgroundColor getDefaultBackgroundColor(); BackgroundColor[] getBackgroundColors(); int pageCount(); int viewablePageCount(); WelcomePageList getPages(); boolean getBackButtonSkips(); boolean getBackButtonNavigatesPages(); String getSkipButtonTypefacePath(); String getDoneButtonTypefacePath(); String getDefaultTitleTypefacePath(); String getDefaultHeaderTypefacePath(); String getDefaultDescriptionTypefacePath(); boolean getCanSkip(); boolean getSwipeToDismiss(); boolean isRtl(); int firstPageIndex(); int lastPageIndex(); int lastViewablePageIndex(); @AnimRes int getExitAnimation(); boolean getAnimateButtons(); boolean getUseCustomDoneButton(); boolean getShowNextButton(); boolean getShowPrevButton(); boolean getShowActionBarBackButton(); @LayoutRes int getBottomLayoutResId(); static final int NO_ANIMATION_SET; }
@Test public void testBackgroundColors() { int[] colors = { Color.RED, Color.GREEN, Color.BLUE }; for (int color : colors) { builder2.page(newBlankPage().background(new BackgroundColor(color))); } builder2.swipeToDismiss(false); BackgroundColor[] bgColors = builder2.build().getBackgroundColors(); assertEquals(colors.length, bgColors.length); for (int i = 0; i < colors.length; i++) { assertEquals(colors[i], bgColors[i].value()); } setRtl(true); BackgroundColor[] reversedBg = builder2.build().getBackgroundColors(); assertEquals(colors.length, reversedBg.length); int maxIndex = colors.length - 1; for (int i = maxIndex; i >= 0; i--) { assertEquals(colors[maxIndex - i], reversedBg[i].value()); } setRtl(false); builder2.swipeToDismiss(true); bgColors = builder2.build().getBackgroundColors(); assertEquals(colors.length + 1, bgColors.length); for (int i = 0; i < bgColors.length; i++) { int j = i; if (j == colors.length) j--; assertEquals(colors[j], bgColors[i].value()); } setRtl(true); reversedBg = builder2.build().getBackgroundColors(); assertEquals(colors.length + 1, reversedBg.length); maxIndex = reversedBg.length - 1; for (int i = maxIndex; i >= 0; i--) { int j = maxIndex - i; if (j == colors.length) { j--; } assertEquals(colors[j], reversedBg[i].value()); } }