Search in sources :

Example 16 with TabLayout

use of android.support.design.widget.TabLayout in project materialistic by hidroh.

the class BaseListActivityLandTest method testToggleItemView.

@Test
public void testToggleItemView() {
    activity.onItemSelected(createWebItem());
    TabLayout tabLayout = (TabLayout) activity.findViewById(R.id.tab_layout);
    assertEquals(2, tabLayout.getTabCount());
    assertStoryMode();
    tabLayout.getTabAt(0).select();
    assertCommentMode();
    tabLayout.getTabAt(1).select();
    assertStoryMode();
}
Also used : TabLayout(android.support.design.widget.TabLayout) Test(org.junit.Test) SlowTest(io.github.hidroh.materialistic.test.suite.SlowTest)

Example 17 with TabLayout

use of android.support.design.widget.TabLayout in project materialistic by hidroh.

the class UserActivityTest method testScrollToTop.

@Config(shadows = ShadowRecyclerView.class)
@Test
public void testScrollToTop() {
    verify(userManager).getUser(eq("username"), userCaptor.capture());
    userCaptor.getValue().onResponse(user);
    RecyclerView recyclerView = (RecyclerView) activity.findViewById(R.id.recycler_view);
    recyclerView.smoothScrollToPosition(1);
    assertThat(customShadowOf(recyclerView).getScrollPosition()).isEqualTo(1);
    TabLayout.Tab tab = ((TabLayout) activity.findViewById(R.id.tab_layout)).getTabAt(0);
    tab.select();
    tab.select();
    assertThat(customShadowOf(recyclerView).getScrollPosition()).isEqualTo(0);
}
Also used : TabLayout(android.support.design.widget.TabLayout) RecyclerView(android.support.v7.widget.RecyclerView) ShadowRecyclerView(io.github.hidroh.materialistic.test.shadow.ShadowRecyclerView) Test(org.junit.Test) Config(org.robolectric.annotation.Config)

Example 18 with TabLayout

use of android.support.design.widget.TabLayout in project Timber by naman14.

the class MainFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_main, container, false);
    Toolbar toolbar = (Toolbar) rootView.findViewById(R.id.toolbar);
    ((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);
    final ActionBar ab = ((AppCompatActivity) getActivity()).getSupportActionBar();
    ab.setHomeAsUpIndicator(R.drawable.ic_menu);
    ab.setDisplayHomeAsUpEnabled(true);
    viewPager = (ViewPager) rootView.findViewById(R.id.viewpager);
    if (viewPager != null) {
        setupViewPager(viewPager);
        viewPager.setOffscreenPageLimit(2);
    }
    TabLayout tabLayout = (TabLayout) rootView.findViewById(R.id.tabs);
    tabLayout.setupWithViewPager(viewPager);
    return rootView;
}
Also used : TabLayout(android.support.design.widget.TabLayout) AppCompatActivity(android.support.v7.app.AppCompatActivity) View(android.view.View) ActionBar(android.support.v7.app.ActionBar) Toolbar(android.support.v7.widget.Toolbar)

Example 19 with TabLayout

use of android.support.design.widget.TabLayout in project XposedInstaller by rovo89.

the class DownloadDetailsActivity method setupTabs.

private void setupTabs() {
    mPager = (ViewPager) findViewById(R.id.download_pager);
    mPager.setAdapter(new SwipeFragmentPagerAdapter(getFragmentManager()));
    TabLayout mTabLayout = (TabLayout) findViewById(R.id.sliding_tabs);
    mTabLayout.setupWithViewPager(mPager);
}
Also used : TabLayout(android.support.design.widget.TabLayout)

Example 20 with TabLayout

use of android.support.design.widget.TabLayout in project RecyclerViewPager by lsjwzh.

the class MaterialDemoActivity method initTabLayout.

private void initTabLayout() {
    //给TabLayout增加Tab, 并关联ViewPager
    TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
    TabLayoutSupport.setupWithViewPager(tabLayout, mRecyclerView, mAdapter);
}
Also used : TabLayout(android.support.design.widget.TabLayout)

Aggregations

TabLayout (android.support.design.widget.TabLayout)75 View (android.view.View)33 ViewPager (android.support.v4.view.ViewPager)28 Toolbar (android.support.v7.widget.Toolbar)17 TextView (android.widget.TextView)13 Intent (android.content.Intent)12 ActionBar (android.support.v7.app.ActionBar)10 RecyclerView (android.support.v7.widget.RecyclerView)10 Fragment (android.support.v4.app.Fragment)8 ImageView (android.widget.ImageView)8 Test (org.junit.Test)8 FloatingActionButton (android.support.design.widget.FloatingActionButton)7 UiController (android.support.test.espresso.UiController)7 ViewAction (android.support.test.espresso.ViewAction)7 AppBarLayout (android.support.design.widget.AppBarLayout)6 NavigationView (android.support.design.widget.NavigationView)6 ViewGroup (android.view.ViewGroup)6 FragmentPagerAdapter (android.support.v4.app.FragmentPagerAdapter)5 SlowTest (io.github.hidroh.materialistic.test.suite.SlowTest)5 PagerAdapter (android.support.v4.view.PagerAdapter)4