@Test public void shouldNotSetPageTitlesIfAttributeSetToFalse() { Context context = RuntimeEnvironment.application; AttributeSet attributeSet = AttributeSetBuilder.from(context) .addAttribute("lib_pageTitlesVisible", valueOf(false)) .build(); IconTabLayout iconTabLayout = new IconTabLayout(context, attributeSet); iconTabLayout.setTabsFromPagerAdapter(layoutPagerAdapter); assertThat(iconTabLayout.getTabAt(0)).hasText(null).hasIcon(layoutPagerAdapter.getPageIcon(0)); assertThat(iconTabLayout.getTabAt(1)).hasText(null).hasIcon(layoutPagerAdapter.getPageIcon(1)); }
@Override public void setTabsFromPagerAdapter(@NonNull PagerAdapter adapter) { super.setTabsFromPagerAdapter( pageTitlesVisible ? adapter : TitleNullifyingPagerAdapter.from(adapter)); if (isLayoutPagerAdapterInstance(adapter)) { setTabIconsFromLayoutPagerAdapter((LayoutViewPager.LayoutPagerAdapter) adapter); } }
IconTabLayout extends TabLayout { @Override public void setTabsFromPagerAdapter(@NonNull PagerAdapter adapter) { super.setTabsFromPagerAdapter( pageTitlesVisible ? adapter : TitleNullifyingPagerAdapter.from(adapter)); if (isLayoutPagerAdapterInstance(adapter)) { setTabIconsFromLayoutPagerAdapter((LayoutViewPager.LayoutPagerAdapter) adapter); } } }
IconTabLayout extends TabLayout { @Override public void setTabsFromPagerAdapter(@NonNull PagerAdapter adapter) { super.setTabsFromPagerAdapter( pageTitlesVisible ? adapter : TitleNullifyingPagerAdapter.from(adapter)); if (isLayoutPagerAdapterInstance(adapter)) { setTabIconsFromLayoutPagerAdapter((LayoutViewPager.LayoutPagerAdapter) adapter); } } IconTabLayout(Context context);  IconTabLayout(Context context, AttributeSet attrs);  IconTabLayout(Context context, AttributeSet attrs, int defStyleAttr); }
IconTabLayout extends TabLayout { @Override public void setTabsFromPagerAdapter(@NonNull PagerAdapter adapter) { super.setTabsFromPagerAdapter( pageTitlesVisible ? adapter : TitleNullifyingPagerAdapter.from(adapter)); if (isLayoutPagerAdapterInstance(adapter)) { setTabIconsFromLayoutPagerAdapter((LayoutViewPager.LayoutPagerAdapter) adapter); } } IconTabLayout(Context context);  IconTabLayout(Context context, AttributeSet attrs);  IconTabLayout(Context context, AttributeSet attrs, int defStyleAttr); @Override void setTabsFromPagerAdapter(@NonNull PagerAdapter adapter); }
IconTabLayout extends TabLayout { @Override public void setTabsFromPagerAdapter(@NonNull PagerAdapter adapter) { super.setTabsFromPagerAdapter( pageTitlesVisible ? adapter : TitleNullifyingPagerAdapter.from(adapter)); if (isLayoutPagerAdapterInstance(adapter)) { setTabIconsFromLayoutPagerAdapter((LayoutViewPager.LayoutPagerAdapter) adapter); } } IconTabLayout(Context context);  IconTabLayout(Context context, AttributeSet attrs);  IconTabLayout(Context context, AttributeSet attrs, int defStyleAttr); @Override void setTabsFromPagerAdapter(@NonNull PagerAdapter adapter);  }