- // We need to use `SupportActionBar` from `android.support.v7.app.ActionBar` until the minimum API is >= 21.
- Toolbar guideAppBar = findViewById(R.id.guide_toolbar);
- setSupportActionBar(guideAppBar);
-
- // Display the home arrow on `ppBar`.
- final ActionBar appBar = getSupportActionBar();
- assert appBar != null; // This assert removes the incorrect lint warning in Android Studio on the following line that `appBar` might be `null`.
- appBar.setDisplayHomeAsUpEnabled(true);
-
- // Setup the ViewPager.
- ViewPager aboutViewPager = findViewById(R.id.guide_viewpager);
- assert aboutViewPager != null; // This assert removes the incorrect warning in Android Studio on the following line that aboutViewPager might be null.
- aboutViewPager.setAdapter(new guidePagerAdapter(getSupportFragmentManager()));
-
- // Setup the TabLayout and connect it to the ViewPager.
- TabLayout aboutTabLayout = findViewById(R.id.guide_tablayout);
- assert aboutTabLayout != null; // This assert removes the incorrect warning in Android Studio on the following line that aboutTabLayout might be null.
- aboutTabLayout.setupWithViewPager(aboutViewPager);
- }
-
- private class guidePagerAdapter extends FragmentPagerAdapter {
- private guidePagerAdapter(FragmentManager fm) {
- super(fm);
- }
-
- @Override
- // Get the count of the number of tabs.
- public int getCount() {
- return 9;
- }
-
- @Override
- // Get the name of each tab. Tab numbers start at 0.
- public CharSequence getPageTitle(int tab) {
- switch (tab) {
- case 0:
- return getString(R.string.overview);
-
- case 1:
- return getString(R.string.javascript);