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);
}
Aggregations