use of get.saga.ui.SlidingTabLayout in project saga-android by AnandChowdhary.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
if (!sp.getBoolean("tos_accepted", false)) {
Intent intent = new Intent(this, WelcomeActivity.class);
startActivity(intent);
finish();
}
final ViewPager pager;
final ViewPagerAdapter adapter;
SlidingTabLayout tabs;
File folder = new File(Utils.getStoragePath(this));
if (!folder.exists()) {
folder.mkdirs();
}
try {
// Get tracker.
Tracker t = ((ApplicationWrapper) getApplication()).getTracker(ApplicationWrapper.TrackerName.APP_TRACKER);
// Set screen name.
t.setScreenName("MainActivity");
// Send a screen view.
t.send(new HitBuilders.ScreenViewBuilder().build());
} catch (Exception e) {
//just as a protective measure
}
setContentView(R.layout.activity_main);
String title = "";
if (mToolbar == null) {
mToolbar = (Toolbar) findViewById(R.id.toolbar);
if (mToolbar != null) {
setSupportActionBar(mToolbar);
getSupportActionBar().setTitle(title);
}
}
adapter = new ViewPagerAdapter(getSupportFragmentManager());
pager = (ViewPager) findViewById(R.id.pager);
pager.setAdapter(adapter);
tabs = (SlidingTabLayout) findViewById(R.id.tabs);
tabs.setDistributeEvenly(true);
tabs.setCustomTabColorizer(new SlidingTabLayout.TabColorizer() {
@Override
public int getIndicatorColor(int position) {
return getResources().getColor(R.color.colorAccent);
}
});
tabs.setViewPager(pager);
}
Aggregations