0
こんにちは私はProfileSettingDrawerItem
がクリックされるが、これは DrawerBuilder()
でAccountHeaderBuilder()
ないで定義されている時に活動を開く必要があります。ここ はコードです:オープンProfileSettingDrawerItem(から活動))
headerResult = new AccountHeaderBuilder()
.withActivity(this)
.withCompactStyle(true)
.withHeaderBackground(R.drawable.header)
.addProfiles(
profile,
profile2,
//don't ask but google uses 14dp for the add account icon in gmail but 20dp for the normal icons (like manage account)
item = new ProfileSettingDrawerItem().withName("Add Account").withDescription("Add Account").withIcon(new IconicsDrawable(this, GoogleMaterial.Icon.gmd_plus).actionBar().paddingDp(5).colorRes(R.color.material_drawer_dark_primary_text)).withIdentifier(PROFILE_SETTING),
item1= new ProfileSettingDrawerItem().withName("Manage Account").withIcon(GoogleMaterial.Icon.gmd_settings).withIdentifier(11)
)
.withSavedInstance(savedInstanceState)
.build();
//Create the drawer
result = new DrawerBuilder()
.withActivity(this)
.withToolbar(toolbar)
.withHasStableIds(true)
.withDrawerLayout(R.layout.crossfade_drawer)
.withDrawerWidthDp(72)
.withGenerateMiniDrawer(true)
.withAccountHeader(headerResult) //set the AccountHeader we created earlier for the header
.addDrawerItems(
new PrimaryDrawerItem().withName("NASLOVNA").withIcon(GoogleMaterial.Icon.gmd_sun).withIdentifier(1),
new PrimaryDrawerItem().withName("MODA").withIcon(FontAwesome.Icon.faw_home).withBadge("22").withBadgeStyle(new BadgeStyle(Color.RED, Color.RED)).withIdentifier(2).withSelectable(false),
new PrimaryDrawerItem().withName("LIFESTYLE").withIcon(FontAwesome.Icon.faw_gamepad).withIdentifier(3),
new PrimaryDrawerItem().withName("LEPOTA I ZDRAVLJE").withIcon(GoogleMaterial.Icon.gmd_sun).withIdentifier(8),
new PrimaryDrawerItem().withName("VODIC").withIcon(FontAwesome.Icon.faw_eye).withIdentifier(4),
new PrimaryDrawerItem().withName("MAMA I DETE ").withIcon(GoogleMaterial.Icon.gmd_adb).withIdentifier(5),
new PrimaryDrawerItem().withName("INTERVJU").withIcon(GoogleMaterial.Icon.gmd_sun).withIdentifier(6),
new PrimaryDrawerItem().withName("BLOG").withIcon(GoogleMaterial.Icon.gmd_sun).withIdentifier(7),
new SectionDrawerItem().withName(R.string.drawer_item_section_header),
new SecondaryDrawerItem().withName("SETTINGS").withIcon(FontAwesome.Icon.faw_github),
new SecondaryDrawerItem().withName("Contact").withIcon(GoogleMaterial.Icon.gmd_format_color_fill).withTag("Bullhorn")
) // add the items we want to use with our Drawer
.withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
@Override
public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
// if (drawerItem instanceof Nameable) {
Toast.makeText(CrossfadeDrawerLayoutActvitiy.this, ((Nameable) drawerItem).getName().getText(CrossfadeDrawerLayoutActvitiy.this), Toast.LENGTH_SHORT).show();
if (drawerItem != null) {
Intent intent = null;
if (drawerItem.getIdentifier() == 1) {
intent = new Intent(CrossfadeDrawerLayoutActvitiy.this, AddAccount.class);
} else if (drawerItem.getIdentifier() == 11) {
intent = new Intent(CrossfadeDrawerLayoutActvitiy.this, AddAccount.class);
}
if (intent != null) {
CrossfadeDrawerLayoutActvitiy.this.startActivity(intent);
}
}
//we do not consume the event and want the Drawer to continue with the event chain
return false;
}
})
.withSavedInstance(savedInstanceState)
.withShowDrawerOnFirstLaunch(true)
.build();
はAddAccount.classを開くためにitem1 = new ProfileSettingDrawerItem().withName("Manage Account").withIcon(GoogleMaterial.Icon.gmd_settings).withIdentifier(11)
を押した後方法はありますか?