本文整理汇总了Java中com.mikepenz.materialdrawer.model.SecondaryDrawerItem类的典型用法代码示例。如果您正苦于以下问题:Java SecondaryDrawerItem类的具体用法?Java SecondaryDrawerItem怎么用?Java SecondaryDrawerItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SecondaryDrawerItem类属于com.mikepenz.materialdrawer.model包,在下文中一共展示了SecondaryDrawerItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialDrawerItems
import com.mikepenz.materialdrawer.model.SecondaryDrawerItem; //导入依赖的package包/类
private void initialDrawerItems() {
//Menu Items
mDrawerItem_Parser = new PrimaryDrawerItem().withName("Source").withIcon(R.mipmap.ic_launcher).withIdentifier(1);
mDrawerItem_Catalog = new PrimaryDrawerItem().withName(R.string.menu_title_catalog).withIcon(ThemeManager.getInstance().isLightBackground() ? R.drawable.ic_public_black_24dp : R.drawable.ic_public_white_24dp).withIdentifier(2);
mDrawerItem_Library = new PrimaryDrawerItem().withName(R.string.menu_title_library).withIcon(ThemeManager.getInstance().isLightBackground() ? R.drawable.ic_home_black_24dp : R.drawable.ic_home_white_24dp).withIdentifier(3);
mDrawerItem_Favorites = new PrimaryDrawerItem().withName(R.string.menu_title_favorites).withIcon(ThemeManager.getInstance().isLightBackground() ? R.drawable.ic_favorite_black_24dp : R.drawable.ic_favorite_white_24dp).withIdentifier(4);
mDrawerItem_History = new PrimaryDrawerItem().withName(R.string.menu_title_history).withIcon(ThemeManager.getInstance().isLightBackground() ? R.drawable.ic_history_black_24dp : R.drawable.ic_history_white_24dp).withIdentifier(5);
mDrawerItem_Downloads = new PrimaryDrawerItem().withName(R.string.menu_title_downloads).withIcon(ThemeManager.getInstance().isLightBackground() ? R.drawable.ic_save_black_24dp : R.drawable.ic_save_white_24dp).withIdentifier(6);
mDrawerItem_AllManga = new PrimaryDrawerItem().withName(R.string.menu_title_all_anime).withIcon(ThemeManager.getInstance().isLightBackground() ? R.drawable.ic_public_black_24dp : R.drawable.ic_public_white_24dp).withIdentifier(7);
mDrawerItem_Genres = new PrimaryDrawerItem().withName(R.string.menu_title_genres).withIcon(ThemeManager.getInstance().isLightBackground() ? R.drawable.ic_filter_list_black_24dp : R.drawable.ic_filter_list_white_24dp).withIdentifier(8);
mDrawerItem_LatestReleases = new PrimaryDrawerItem().withName(R.string.menu_title_latest_releases).withIcon(ThemeManager.getInstance().isLightBackground() ? R.drawable.ic_new_releases_black_24dp : R.drawable.ic_new_releases_white_24dp).withIdentifier(9);
mDrawerItem_RandomManga = new PrimaryDrawerItem().withName(R.string.menu_title_random_anime).withIcon(ThemeManager.getInstance().isLightBackground() ? R.drawable.ic_help_outline_black_24dp : R.drawable.ic_help_outline_white_24dp).withIdentifier(10);
mDrawerItem_AdvancedSearch = new PrimaryDrawerItem().withName(R.string.menu_title_advanced_search).withIcon(ThemeManager.getInstance().isLightBackground() ? R.drawable.ic_search_black_24dp : R.drawable.ic_search_white_24dp).withIdentifier(11);
mDrawerItem_NewSeries = new PrimaryDrawerItem().withName(R.string.menu_title_new_series).withIcon(ThemeManager.getInstance().isLightBackground() ? R.drawable.ic_today_black_24dp : R.drawable.ic_today_white_24dp).withIdentifier(12);
//new PrimaryDrawerItem().withName(R.string.menu_title_queue).withIcon(new IconicsDrawable(this, GoogleMaterial.Icon.gmd_comment_list)).withIdentifier(14);
mDrawerItem_ServerSearch = new PrimaryDrawerItem().withName("Search Online").withIcon(ThemeManager.getInstance().isLightBackground() ? R.drawable.ic_search_black_24dp : R.drawable.ic_search_white_24dp).withIdentifier(15);
mDrawerItem_Settings = new PrimaryDrawerItem().withName(R.string.menu_title_settings).withIcon(ThemeManager.getInstance().isLightBackground() ? R.drawable.ic_settings_black_24dp : R.drawable.ic_settings_white_24dp).withIdentifier(16);
mDrawerItem_Patreon = new PrimaryDrawerItem().withName(R.string.menu_title_patreon).withIcon(R.drawable.patreon).withIdentifier(17);
mDrawerItem_Version = new SecondaryDrawerItem().withName("Version: " + BuildConfig.VERSION_NAME).withSelectable(false);
}
示例2: addDepartamento
import com.mikepenz.materialdrawer.model.SecondaryDrawerItem; //导入依赖的package包/类
/**
* Adicionar os departamentos
* @param department
* @param news
*/
private void addDepartamento( Department department, boolean news ) {
if( news && this.departamentsWorks.contains( department ) ) return;
else if( news ) this.departamentsWorks.add( department );
this.departamentoContainer.withSubItems(
new SecondaryDrawerItem().withName( department.getNome() )
.withIdentifier( department.getIdentifier() )
.withIcon( R.drawable.ic_home_teal_500_24dp )
.withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
@Override
public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
onChangeDepartmentTo( drawerItem.getIdentifier() );
return false;
}
})
);
}
示例3: populateProductItems
import com.mikepenz.materialdrawer.model.SecondaryDrawerItem; //导入依赖的package包/类
private void populateProductItems() {
boolean showDiscontinued = DoserApplication.getDoserPreferences().getShowDiscontinuedProducts();
for (Map.Entry<ExpandableDrawerItem, List<SecondaryDrawerItem>> entry : mProductItemGroups.entrySet()) {
ExpandableDrawerItem parent = entry.getKey();
List<SecondaryDrawerItem> children = entry.getValue();
if(parent.getSubItems() != null)
parent.getSubItems().clear();
for (IDrawerItem child : children) {
SeachemProduct product = (SeachemProduct) child.getTag();
if (product.isDiscontinued() && !showDiscontinued)
continue;
parent.withSubItems(child);
}
mDrawer.getAdapter().notifyAdapterSubItemsChanged(mDrawer.getPosition(parent));
}
}
示例4: drawerItems
import com.mikepenz.materialdrawer.model.SecondaryDrawerItem; //导入依赖的package包/类
@NonNull
protected List<IDrawerItem> drawerItems() {
return Arrays.<IDrawerItem>asList(
new PrimaryDrawerItem()
.withName(R.string.drawer_item_recognize_tags)
.withOnDrawerItemClickListener(goToActivityListener(RecognizeConceptsActivity.class)),
new SecondaryDrawerItem()
.withName(R.string.drawer_item_recognize_colors)
.withOnDrawerItemClickListener(goToActivityListener(RecognizeColorsActivity.class))
);
}
示例5: onCreateView
import com.mikepenz.materialdrawer.model.SecondaryDrawerItem; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// Inflate the layout for this fragment
// don't look at this layout it's just a listView to show how to handle the keyboard
View view = inflater.inflate(R.layout.fragment_simple_sample, container, false);
result = new DrawerBuilder()
.withActivity(getActivity())
.withRootView((ViewGroup) view.findViewById(R.id.rootView))
.withDisplayBelowStatusBar(false)
.withSavedInstance(savedInstanceState)
.addDrawerItems(
new PrimaryDrawerItem().withName(R.string.drawer_item_home).withIcon(FontAwesome.Icon.faw_home).withIdentifier(1),
new PrimaryDrawerItem().withName(R.string.drawer_item_free_play).withIcon(FontAwesome.Icon.faw_gamepad),
new PrimaryDrawerItem().withName(R.string.drawer_item_custom).withIcon(FontAwesome.Icon.faw_eye),
new SectionDrawerItem().withName(R.string.drawer_item_section_header),
new SecondaryDrawerItem().withName(R.string.drawer_item_settings).withIcon(FontAwesome.Icon.faw_cog),
new SecondaryDrawerItem().withName(R.string.drawer_item_help).withIcon(FontAwesome.Icon.faw_question).withEnabled(false),
new SecondaryDrawerItem().withName(R.string.drawer_item_open_source).withIcon(FontAwesome.Icon.faw_github),
new SecondaryDrawerItem().withName(R.string.drawer_item_contact).withIcon(FontAwesome.Icon.faw_bullhorn)
)
.buildForFragment();
TextView textView = (TextView) view.findViewById(R.id.title);
textView.setText(getArguments().getString(KEY_TITLE));
result.getDrawerLayout().setFitsSystemWindows(false);
result.getSlider().setFitsSystemWindows(false);
return view;
}
示例6: onCreate
import com.mikepenz.materialdrawer.model.SecondaryDrawerItem; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sample_collapsing_toolbar);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
CollapsingToolbarLayout collapsingToolbarLayout = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
collapsingToolbarLayout.setTitle(getString(R.string.drawer_item_collapsing_toolbar_drawer));
headerResult = new AccountHeaderBuilder()
.withActivity(this)
.withCompactStyle(false)
.withHeaderBackground(R.drawable.header)
.withSavedInstance(savedInstanceState)
.build();
result = new DrawerBuilder()
.withActivity(this)
.withAccountHeader(headerResult)
.withToolbar(toolbar)
.withFullscreen(true)
.addDrawerItems(
new PrimaryDrawerItem().withName(R.string.drawer_item_home).withIcon(FontAwesome.Icon.faw_home).withIdentifier(1),
new PrimaryDrawerItem().withName(R.string.drawer_item_free_play).withIcon(FontAwesome.Icon.faw_gamepad),
new PrimaryDrawerItem().withName(R.string.drawer_item_custom).withIcon(FontAwesome.Icon.faw_eye),
new SectionDrawerItem().withName(R.string.drawer_item_section_header),
new SecondaryDrawerItem().withName(R.string.drawer_item_settings).withIcon(FontAwesome.Icon.faw_cog),
new SecondaryDrawerItem().withName(R.string.drawer_item_help).withIcon(FontAwesome.Icon.faw_question).withEnabled(false),
new SecondaryDrawerItem().withName(R.string.drawer_item_open_source).withIcon(FontAwesome.Icon.faw_github),
new SecondaryDrawerItem().withName(R.string.drawer_item_contact).withIcon(FontAwesome.Icon.faw_bullhorn)
)
.withSavedInstance(savedInstanceState)
.build();
fillFab();
loadBackdrop();
}
示例7: onCreate
import com.mikepenz.materialdrawer.model.SecondaryDrawerItem; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sample_custom_container_dark_toolbar);
// Handle Toolbar
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setTitle(R.string.drawer_item_custom_container_drawer);
//Create the drawer
result = new DrawerBuilder(this)
//this layout have to contain child layouts
.withRootView(R.id.drawer_container)
.withToolbar(toolbar)
.withDisplayBelowStatusBar(false)
.withActionBarDrawerToggleAnimated(true)
.addDrawerItems(
new PrimaryDrawerItem().withName(R.string.drawer_item_home).withIcon(FontAwesome.Icon.faw_home),
new PrimaryDrawerItem().withName(R.string.drawer_item_free_play).withIcon(FontAwesome.Icon.faw_gamepad),
new PrimaryDrawerItem().withName(R.string.drawer_item_custom).withIcon(FontAwesome.Icon.faw_eye),
new SectionDrawerItem().withName(R.string.drawer_item_section_header),
new SecondaryDrawerItem().withName(R.string.drawer_item_settings).withIcon(FontAwesome.Icon.faw_cog),
new SecondaryDrawerItem().withName(R.string.drawer_item_help).withIcon(FontAwesome.Icon.faw_question).withEnabled(false),
new SecondaryDrawerItem().withName(R.string.drawer_item_open_source).withIcon(FontAwesome.Icon.faw_github),
new SecondaryDrawerItem().withName(R.string.drawer_item_contact).withIcon(FontAwesome.Icon.faw_bullhorn)
)
.withSavedInstance(savedInstanceState)
.build();
}
示例8: onCreate
import com.mikepenz.materialdrawer.model.SecondaryDrawerItem; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
//supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sample_actionbar);
setTitle(R.string.drawer_item_action_bar_drawer);
// Handle Toolbar
result = new DrawerBuilder()
.withActivity(this)
.withSavedInstance(savedInstanceState)
.withDisplayBelowStatusBar(false)
.withTranslucentStatusBar(false)
.withDrawerLayout(R.layout.material_drawer_fits_not)
.addDrawerItems(
new PrimaryDrawerItem().withName(R.string.drawer_item_home).withIcon(FontAwesome.Icon.faw_home),
new SecondaryDrawerItem().withName(R.string.drawer_item_settings).withIcon(FontAwesome.Icon.faw_cog)
)
.withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
@Override
public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
if (drawerItem instanceof Nameable) {
Toast.makeText(ActionBarActivity.this, ((Nameable) drawerItem).getName().getText(ActionBarActivity.this), Toast.LENGTH_SHORT).show();
}
return false;
}
}).build();
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(false);
}
示例9: generateMiniDrawerItem
import com.mikepenz.materialdrawer.model.SecondaryDrawerItem; //导入依赖的package包/类
/**
* generates a MiniDrawerItem from a IDrawerItem
*
* @param drawerItem
* @return
*/
public IDrawerItem generateMiniDrawerItem(IDrawerItem drawerItem) {
if (drawerItem instanceof SecondaryDrawerItem) {
return mIncludeSecondaryDrawerItems ? new MiniDrawerItem((SecondaryDrawerItem) drawerItem).withEnableSelectedBackground(mEnableSelectedMiniDrawerItemBackground) : null;
} else if (drawerItem instanceof PrimaryDrawerItem) {
return new MiniDrawerItem((PrimaryDrawerItem) drawerItem).withEnableSelectedBackground(mEnableSelectedMiniDrawerItemBackground);
} else if (drawerItem instanceof ProfileDrawerItem) {
MiniProfileDrawerItem mpdi = new MiniProfileDrawerItem((ProfileDrawerItem) drawerItem);
mpdi.withEnabled(mEnableProfileClick);
return mpdi;
}
return null;
}
示例10: fillStickyDrawerItemFooter
import com.mikepenz.materialdrawer.model.SecondaryDrawerItem; //导入依赖的package包/类
/**
* helper method to fill the sticky footer with it's elements
*
* @param drawer
* @param container
* @param onClickListener
*/
public static void fillStickyDrawerItemFooter(DrawerBuilder drawer, ViewGroup container, View.OnClickListener onClickListener) {
//add all drawer items
for (IDrawerItem drawerItem : drawer.mStickyDrawerItems) {
//get the selected_color
int selected_color = UIUtils.getThemeColorFromAttrOrRes(container.getContext(), R.attr.material_drawer_selected, R.color.material_drawer_selected);
if (drawerItem instanceof PrimaryDrawerItem) {
selected_color = ColorHolder.color(((PrimaryDrawerItem) drawerItem).getSelectedColor(), container.getContext(), R.attr.material_drawer_selected, R.color.material_drawer_selected);
} else if (drawerItem instanceof SecondaryDrawerItem) {
selected_color = ColorHolder.color(((SecondaryDrawerItem) drawerItem).getSelectedColor(), container.getContext(), R.attr.material_drawer_selected, R.color.material_drawer_selected);
}
View view = drawerItem.generateView(container.getContext(), container);
view.setTag(drawerItem);
if (drawerItem.isEnabled()) {
UIUtils.setBackground(view, DrawerUIUtils.getSelectableBackground(container.getContext(), selected_color));
view.setOnClickListener(onClickListener);
}
container.addView(view);
//for android API 17 --> Padding not applied via xml
DrawerUIUtils.setDrawerVerticalPadding(view);
}
//and really. don't ask about this. it won't set the padding if i don't set the padding for the container
container.setPadding(0, 0, 0, 0);
}
示例11: generateMiniDrawerItem
import com.mikepenz.materialdrawer.model.SecondaryDrawerItem; //导入依赖的package包/类
/**
* generates a MiniDrawerItem from a IDrawerItem
*
* @param drawerItem
* @return
*/
public IDrawerItem generateMiniDrawerItem(IDrawerItem drawerItem) {
if (drawerItem instanceof PrimaryDrawerItem) {
return new MiniDrawerItem((PrimaryDrawerItem) drawerItem).withEnableSelectedBackground(mEnableSelectedMiniDrawerItemBackground);
} else if (drawerItem instanceof SecondaryDrawerItem && mIncludeSecondaryDrawerItems) {
return new MiniDrawerItem((SecondaryDrawerItem) drawerItem).withEnableSelectedBackground(mEnableSelectedMiniDrawerItemBackground);
} else if (drawerItem instanceof ProfileDrawerItem) {
MiniProfileDrawerItem mpdi = new MiniProfileDrawerItem((ProfileDrawerItem) drawerItem);
mpdi.withEnabled(mEnableProfileClick);
return mpdi;
}
return null;
}
示例12: getMainDrawerItems
import com.mikepenz.materialdrawer.model.SecondaryDrawerItem; //导入依赖的package包/类
private List<IDrawerItem> getMainDrawerItems() {
List<IDrawerItem> drawerItemList = new ArrayList<>();
drawerItemList.add(getColorSetting(new PrimaryDrawerItem().withIdentifier(1001).withName(R.string.home_page).withIcon(R.drawable.ic_home)));
drawerItemList.add(getColorSetting(new PrimaryDrawerItem().withIdentifier(1005).withName(R.string.refresh_menu).withIcon(R.drawable.ic_loop).withSelectable(false)));
drawerItemList.add(getColorSetting(new PrimaryDrawerItem().withIdentifier(1006).withName(R.string.clear_cache).withIcon(R.drawable.ic_clear_cache).withSelectable(false)));
drawerItemList.add(getColorSetting(new PrimaryDrawerItem().withIdentifier(1002).withName(R.string.sponsor).withIcon(R.drawable.ic_sponsor).withSelectable(false)));
drawerItemList.add(new DividerDrawerItem());
drawerItemList.add(new SecondaryDrawerItem().withName(R.string.others).withSelectable(false));
drawerItemList.add(getColorSetting(new PrimaryDrawerItem().withIdentifier(1003).withName(R.string.rating).withIcon(R.drawable.ic_rate).withSelectable(false)));
drawerItemList.add(getColorSetting(new PrimaryDrawerItem().withIdentifier(1004).withName(R.string.feedback).withIcon(R.drawable.ic_feedback).withSelectable(false)));
return drawerItemList;
}
示例13: setUpDrawer
import com.mikepenz.materialdrawer.model.SecondaryDrawerItem; //导入依赖的package包/类
private void setUpDrawer() {
AccountHeader accountHeader = new AccountHeaderBuilder()
.withActivity(MainActivity.this)
.withHeaderBackground(R.drawable.minx_small)
.withHeaderBackgroundScaleType(ImageView.ScaleType.FIT_CENTER)
.withHeightDp(200)
.build();
result = new DrawerBuilder()
.withHeaderDivider(true)
.withActivity(this)
.withAccountHeader(accountHeader)
.withToolbar(toolbar)
.addDrawerItems(
new PrimaryDrawerItem().withName(R.string.drawer_item_home),
new DividerDrawerItem(),
new SecondaryDrawerItem().withName(R.string.drawer_item_saved),
new SecondaryDrawerItem().withName(R.string.drawer_item_share),
new SecondaryDrawerItem().withName(R.string.drawer_item_settings),
new SecondaryDrawerItem().withName(R.string.drawer_item_about)
)
.withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
@Override
public boolean onItemClick(AdapterView<?> parent, View view, int position, long id, IDrawerItem drawerItem) {
// do something with the clicked item :D
Toast.makeText(MainActivity.this, "You clicked on item : " + position, Toast.LENGTH_SHORT).show();
loadFragment(position);
return false;
}
})
.build();
getSupportActionBar().setDisplayHomeAsUpEnabled(false);
result.getActionBarDrawerToggle().setDrawerIndicatorEnabled(true);
}
示例14: setupDrawer
import com.mikepenz.materialdrawer.model.SecondaryDrawerItem; //导入依赖的package包/类
private void setupDrawer() {
Intent intent = getIntent();
long currentIdentifier = intent.getLongExtra(EXTRA_IDENTIFIER, 1);
Toolbar toolbar = getToolbar();
mDrawer = new DrawerBuilder()
.withActivity(this)
.withToolbar(toolbar)
.addDrawerItems(new PrimaryDrawerItem()
.withIdentifier(1)
.withName("Persons List")
)
.addDrawerItems(new ExpandableDrawerItem()
.withName("APIs")
.withSubItems(
new SecondaryDrawerItem()
.withIdentifier(3)
.withName("Location")
))
.addStickyDrawerItems(
new PrimaryDrawerItem()
.withIdentifier(2)
.withName("Profile")
)
.withSelectedItem(currentIdentifier)
.withOnDrawerItemClickListener(this)
.build();
}
示例15: getSecondaryMenuItem
import com.mikepenz.materialdrawer.model.SecondaryDrawerItem; //导入依赖的package包/类
public static IDrawerItem getSecondaryMenuItem(DrawerItem drawerItem) {
SecondaryDrawerItem secondaryDrawerItem = new SecondaryDrawerItem()
.withName(drawerItem.name)
.withIdentifier(drawerItem.id)
.withIcon(drawerItem.icon);
if (drawerItem.withBadge) {
secondaryDrawerItem
.withBadgeStyle(new BadgeStyle()
.withTextColor(Color.WHITE)
.withColorRes(R.color.grey));
}
return secondaryDrawerItem;
}