android.support.v4.view.PagerTitleStrip Java Examples

The following examples show how to use android.support.v4.view.PagerTitleStrip. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MainActivity.java    From Kandroid with GNU General Public License v3.0 4 votes vote down vote up
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        mMainView = findViewById(R.id.pager);
        mProgress = findViewById(R.id.main_progress);

        mViewPager = (ViewPager) mMainView;
        mTitleStrip = (PagerTitleStrip) mViewPager.findViewById(R.id.pager_title_strip);
        mArrayPager = new ArrayPagerAdapter(getSupportFragmentManager());
        mViewPager.setAdapter(mArrayPager);

        self = this;

        FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
        fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                        .setAction("Action", null).show();
            }
        });

        if (savedInstanceState != null) {
            restoreSavedState(savedInstanceState);
        }

        DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
        ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
                this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close) {
            public void onDrawerOpened(View drawerView) {
//                TextView mServerUrl = (TextView) findViewById(R.id.nav_serverurl);
//                if ((Me != null) && (mServerUrl != null))
//                    mServerUrl.setText(Me.getName());
            }
        };
        drawer.addDrawerListener(toggle);

        toggle.syncState();

        NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
        navigationView.setNavigationItemSelectedListener(this);

    }
 
Example #2
Source File: MainActivity.java    From Kandroid with GNU General Public License v3.0 4 votes vote down vote up
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        mMainView = findViewById(R.id.pager);
        mProgress = findViewById(R.id.main_progress);

        mViewPager = (ViewPager) mMainView;
        mTitleStrip = (PagerTitleStrip) mViewPager.findViewById(R.id.pager_title_strip);
        mArrayPager = new ArrayPagerAdapter(getSupportFragmentManager());
        mViewPager.setAdapter(mArrayPager);

        self = this;

        FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
        fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                        .setAction("Action", null).show();
            }
        });

        if (savedInstanceState != null) {
            restoreSavedState(savedInstanceState);
        }

        DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
        ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
                this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close) {
            public void onDrawerOpened(View drawerView) {
//                TextView mServerUrl = (TextView) findViewById(R.id.nav_serverurl);
//                if ((Me != null) && (mServerUrl != null))
//                    mServerUrl.setText(Me.getName());
            }
        };
        drawer.addDrawerListener(toggle);

        toggle.syncState();

        NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
        navigationView.setNavigationItemSelectedListener(this);

    }
 
Example #3
Source File: SupportCoreUiDSL.java    From anvil with MIT License 4 votes vote down vote up
public static BaseDSL.ViewClassResult pagerTitleStrip() {
  return BaseDSL.v(PagerTitleStrip.class);
}
 
Example #4
Source File: SupportCoreUiDSL.java    From anvil with MIT License 4 votes vote down vote up
public static Void pagerTitleStrip(Anvil.Renderable r) {
  return BaseDSL.v(PagerTitleStrip.class, r);
}
 
Example #5
Source File: SearchActivity.java    From QuickLyric with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    updateSearchProviders();

    SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
    int[] themes = new int[]{R.style.Theme_QuickLyric, R.style.Theme_QuickLyric_Red,
            R.style.Theme_QuickLyric_Purple, R.style.Theme_QuickLyric_Indigo,
            R.style.Theme_QuickLyric_Green, R.style.Theme_QuickLyric_Lime,
            R.style.Theme_QuickLyric_Brown, R.style.Theme_QuickLyric_Dark};
    int themeNum = Integer.valueOf(sharedPref.getString("pref_theme", "0"));
    boolean nightMode = sharedPref.getBoolean("pref_night_mode", false);
    if (nightMode && NightTimeVerifier.check(this))
        setTheme(R.style.Theme_QuickLyric_Night);
    else
        setTheme(themes[themeNum]);
    setStatusBarColor(null);
    setNavBarColor(null);

    setContentView(R.layout.search_view_pager);
    Toolbar toolbar = findViewById(R.id.search_toolbar);
    setSupportActionBar(toolbar);
    if (getActionBar() != null)
        getActionBar().setDisplayHomeAsUpEnabled(true);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        ActivityManager.TaskDescription taskDescription =
                new ActivityManager.TaskDescription
                        (null, null, toolbar.getSolidColor());
        this.setTaskDescription(taskDescription);
    }

    ViewPager viewPager = getViewPager();
    viewPager.setAdapter(new SearchPagerAdapter(
            this.getFragmentManager(), this, searchQuery));
    boolean online = OnlineAccessVerifier.check(this);
    viewPager.setCurrentItem(online ? 1 : 0);
    PagerTitleStrip titleIndicator = findViewById(R.id.pager_title_strip);
    titleIndicator.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16);
    setSearchQuery(getIntent().getStringExtra("query"));
}