Search in sources :

Example 1 with TextDrawable

use of com.cryptobuddy.ryanbridges.cryptobuddy.TextDrawable in project CryptoBuddy by Patchett.

the class CurrencyListTabsActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_currency_list_tabs);
    context = this;
    mToolbar = findViewById(R.id.toolbar_currency_list);
    setSupportActionBar(mToolbar);
    TabLayout tabLayout = findViewById(R.id.currency_list_tabs);
    mViewPager = findViewById(R.id.currency_list_tabs_container);
    libsBuilder = new LibsBuilder().withActivityStyle(Libs.ActivityStyle.LIGHT_DARK_TOOLBAR).withAboutIconShown(true).withLicenseShown(true).withVersionShown(true).withAboutVersionShownName(true).withAboutVersionShownCode(true).withAboutVersionString("Version: " + BuildConfig.VERSION_NAME).withActivityStyle(Libs.ActivityStyle.LIGHT_DARK_TOOLBAR).withActivityTitle("CryptoBuddy").withLibraries("easyrest", "materialabout", "androiddevicenames", "customtabs", "togglebuttongroup", "materialfavoritebutton");
    TextDrawable t = new TextDrawable(this);
    t.setText("ART");
    t.setTextAlign(Layout.Alignment.ALIGN_CENTER);
    t.setTextColor(Color.BLACK);
    t.setTextSize(10);
    AccountHeader headerResult = new AccountHeaderBuilder().withActivity(this).withHeaderBackground(t).build();
    drawer = new DrawerBuilder().withActivity(this).withToolbar(mToolbar).withSelectedItem(1).withAccountHeader(headerResult).addDrawerItems(new PrimaryDrawerItem().withIdentifier(1).withName(R.string.Home).withIcon(FontAwesome.Icon.faw_home), new PrimaryDrawerItem().withIdentifier(2).withName(R.string.News).withIcon(FontAwesome.Icon.faw_newspaper), new PrimaryDrawerItem().withIdentifier(3).withName("About").withIcon(FontAwesome.Icon.faw_question_circle), new PrimaryDrawerItem().withIdentifier(4).withName("Open Source").withIcon(FontAwesome.Icon.faw_github_square), new PrimaryDrawerItem().withIdentifier(5).withName("Rate on Google Play").withIcon(FontAwesome.Icon.faw_thumbs_up)).withTranslucentStatusBar(false).build();
    drawer.setOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {

        @Override
        public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
            switch(position) {
                case 1:
                    drawer.closeDrawer();
                    return true;
                case 2:
                    drawer.closeDrawer();
                    drawer.setSelection(1);
                    startActivity(new Intent(context, NewsListActivity.class));
                    return true;
                case 3:
                    drawer.closeDrawer();
                    drawer.setSelection(1);
                    startActivity(new Intent(context, AboutTheDevActivity.class));
                    return true;
                case 4:
                    drawer.closeDrawer();
                    drawer.setSelection(1);
                    libsBuilder.start(context);
                default:
                    return true;
            }
        }
    });
    mSectionsPagerAdapter = new SectionsPagerAdapterCurrencyList(getSupportFragmentManager());
    mViewPager.setAdapter(mSectionsPagerAdapter);
    mViewPager.setOffscreenPageLimit(2);
    mViewPager.addOnPageChangeListener(this);
    tabLayout.setupWithViewPager(mViewPager);
    tabLayout.setSelectedTabIndicatorColor(Color.WHITE);
}
Also used : TextDrawable(com.cryptobuddy.ryanbridges.cryptobuddy.TextDrawable) PrimaryDrawerItem(com.mikepenz.materialdrawer.model.PrimaryDrawerItem) IDrawerItem(com.mikepenz.materialdrawer.model.interfaces.IDrawerItem) AccountHeaderBuilder(com.mikepenz.materialdrawer.AccountHeaderBuilder) Intent(android.content.Intent) Drawer(com.mikepenz.materialdrawer.Drawer) View(android.view.View) AccountHeader(com.mikepenz.materialdrawer.AccountHeader) TabLayout(android.support.design.widget.TabLayout) LibsBuilder(com.mikepenz.aboutlibraries.LibsBuilder) DrawerBuilder(com.mikepenz.materialdrawer.DrawerBuilder)

Aggregations

Intent (android.content.Intent)1 TabLayout (android.support.design.widget.TabLayout)1 View (android.view.View)1 TextDrawable (com.cryptobuddy.ryanbridges.cryptobuddy.TextDrawable)1 LibsBuilder (com.mikepenz.aboutlibraries.LibsBuilder)1 AccountHeader (com.mikepenz.materialdrawer.AccountHeader)1 AccountHeaderBuilder (com.mikepenz.materialdrawer.AccountHeaderBuilder)1 Drawer (com.mikepenz.materialdrawer.Drawer)1 DrawerBuilder (com.mikepenz.materialdrawer.DrawerBuilder)1 PrimaryDrawerItem (com.mikepenz.materialdrawer.model.PrimaryDrawerItem)1 IDrawerItem (com.mikepenz.materialdrawer.model.interfaces.IDrawerItem)1