use of com.github.vase4kin.teamcityapp.root.view.RootProjectsActivity in project TeamCityApp by vase4kin.
the class DrawerViewImpl method initDrawer.
/**
* Init drawer
*/
private void initDrawer() {
BadgeStyle badgeStyle = new BadgeStyle().withTextColor(Color.WHITE).withColorRes(mDefaultColor);
mDrawerResult = new DrawerBuilder().withActivity(mActivity).withToolbar(mToolbar).withAccountHeader(mHeaderResult).addDrawerItems(new PrimaryDrawerItem().withName(R.string.projects_drawer_item).withIcon(new IconDrawable(mActivity, MaterialIcons.md_home).colorRes(mDefaultColor)).withSelectedTextColorRes(mDefaultColor).withIdentifier(PROJECTS), new PrimaryDrawerItem().withName(R.string.running_builds_drawer_item).withIcon(new IconDrawable(mActivity, MaterialIcons.md_directions_run).colorRes(mDefaultColor)).withSelectedTextColorRes(mDefaultColor).withBadgeStyle(badgeStyle).withIdentifier(RUNNING_BUILDS), new PrimaryDrawerItem().withName(R.string.build_queue_drawer_item).withIcon(new IconDrawable(mActivity, MaterialIcons.md_layers).colorRes(mDefaultColor)).withSelectedTextColorRes(mDefaultColor).withBadgeStyle(badgeStyle).withIdentifier(BUILD_QUEUE), new PrimaryDrawerItem().withName(R.string.agents_drawer_item).withIcon(new IconDrawable(mActivity, MaterialIcons.md_directions_railway).colorRes(mDefaultColor)).withSelectedTextColorRes(mDefaultColor).withBadgeStyle(badgeStyle).withIdentifier(AGENTS), new DividerDrawerItem(), new PrimaryDrawerItem().withName("About").withIcon(new IconDrawable(mActivity, MaterialIcons.md_help).colorRes(mDefaultColor)).withSelectedTextColorRes(mDefaultColor).withIdentifier(ABOUT)).withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
@Override
public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
if (drawerItem != null) {
switch((int) drawerItem.getIdentifier()) {
case PROJECTS:
if (mActivity instanceof RootProjectsActivity) {
break;
}
mOnDrawerPresenterListener.startRootProjectsActivity();
break;
case AGENTS:
if (mActivity instanceof AgentTabsActivity) {
break;
}
mOnDrawerPresenterListener.startAgentActivity();
break;
case RUNNING_BUILDS:
if (mActivity instanceof RunningBuildsListActivity) {
break;
}
mOnDrawerPresenterListener.startBuildRunningActivity();
break;
case BUILD_QUEUE:
if (mActivity instanceof BuildQueueActivity) {
break;
}
mOnDrawerPresenterListener.startQueuedBuildsActivity();
break;
case ABOUT:
if (mActivity instanceof AboutLibrariesActivity) {
break;
}
mOnDrawerPresenterListener.startAboutActivity();
break;
default:
showDialogWithAdvice();
break;
}
}
return false;
}
}).withOnDrawerNavigationListener(new Drawer.OnDrawerNavigationListener() {
@Override
public boolean onNavigationClickListener(View clickedView) {
// this method is only called if the Arrow icon is shown. The hamburger is automatically managed by the MaterialDrawer
// if the back arrow is shown. close the activity
backButtonPressed();
// return true if we have consumed the event
return true;
}
}).withOnDrawerListener(new OnDrawerListenerImpl(mOnDrawerPresenterListener)).withShowDrawerOnFirstLaunch(false).build();
}
Aggregations