use of io.palaima.debugdrawer.timber.TimberModule in project SeriesGuide by UweTrottmann.
the class BaseNavDrawerActivity method setupNavDrawer.
/**
* Initializes the navigation drawer. Overriding activities should call this in their {@link
* #onCreate(android.os.Bundle)} after {@link #setContentView(int)}.
*/
public void setupNavDrawer() {
drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
drawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
actionBarToolbar = (Toolbar) drawerLayout.findViewById(R.id.sgToolbar);
navigationView = (NavigationView) drawerLayout.findViewById(R.id.navigation);
// setup nav drawer account header
View headerView = navigationView.getHeaderView(0);
ButterKnife.findById(headerView, R.id.containerDrawerAccountCloud).setOnClickListener(accountClickListener);
ButterKnife.findById(headerView, R.id.containerDrawerAccountTrakt).setOnClickListener(accountClickListener);
textViewHeaderUserCloud = ButterKnife.findById(headerView, R.id.textViewDrawerUserCloud);
textViewHeaderUserTrakt = ButterKnife.findById(headerView, R.id.textViewDrawerUserTrakt);
// setup nav drawer items
navigationView.inflateMenu(R.menu.menu_drawer);
navigationView.setItemIconTintList(ContextCompat.getColorStateList(this, Utils.resolveAttributeToResourceId(getTheme(), R.attr.sgColorNavDrawerIcon)));
navigationView.setItemTextColor(ContextCompat.getColorStateList(this, Utils.resolveAttributeToResourceId(getTheme(), R.attr.sgColorNavDrawerText)));
navigationView.setItemBackgroundResource(Utils.resolveAttributeToResourceId(getTheme(), R.attr.sgActivatedItemBackgroundDrawer));
navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
onNavItemClick(menuItem.getItemId());
return false;
}
});
if (BuildConfig.DEBUG) {
// add debug drawer
View debugLayout = getLayoutInflater().inflate(R.layout.debug_drawer, drawerLayout, true);
DebugView debugView = ButterKnife.findById(debugLayout, R.id.debugView);
ButtonAction buttonClearTraktRefreshToken = new ButtonAction("Clear trakt refresh token", new ButtonAction.Listener() {
@Override
public void onClick() {
TraktOAuthSettings.storeRefreshData(getApplicationContext(), "", 3600);
}
});
ButtonAction buttonInvalidateTraktAccessToken = new ButtonAction("Invalidate trakt access token", new ButtonAction.Listener() {
@Override
public void onClick() {
TraktCredentials.get(getApplicationContext()).storeAccessToken("invalid-token");
}
});
ButtonAction buttonInvalidateTraktRefreshToken = new ButtonAction("Invalidate trakt refresh token", new ButtonAction.Listener() {
@Override
public void onClick() {
TraktOAuthSettings.storeRefreshData(getApplicationContext(), "invalid-token", 3600);
}
});
debugView.modules(new ActionsModule(buttonClearTraktRefreshToken, buttonInvalidateTraktAccessToken, buttonInvalidateTraktRefreshToken), new TimberModule(), new DeviceModule(this));
}
}
Aggregations