com.mikepenz.materialdrawer.model.interfaces.Nameable Java Examples
The following examples show how to use
com.mikepenz.materialdrawer.model.interfaces.Nameable.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Drawer.java From MaterialDrawer-Xamarin with Apache License 2.0 | 5 votes |
/** * update the name for a specific drawerItem * identified by its id * * @param identifier * @param name */ public void updateName(int identifier, StringHolder name) { IDrawerItem drawerItem = getDrawerItem(identifier); if (drawerItem instanceof Nameable) { Nameable pdi = (Nameable) drawerItem; pdi.withName(name); updateItem((IDrawerItem) pdi); } }
Example #2
Source File: SearchActivity.java From GithubApp with Apache License 2.0 | 4 votes |
private void initViews() { Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); setTitle(R.string.search); mSearchView.setVoiceSearch(false); mSearchView.setSuggestions(getResources().getStringArray(R.array.query_suggestions)); mSearchView.setOnQueryTextListener(mQueryListener); mSearchView.post(new Runnable() { @Override public void run() { mSearchView.showSearch(false); } }); mDrawer = new DrawerBuilder() .withActivity(this) .withToolbar(toolbar) .withTranslucentStatusBar(false) .withDisplayBelowStatusBar(true) .withActionBarDrawerToggleAnimated(true) .withDrawerWidthRes(R.dimen.dimen_180) .addDrawerItems( new PrimaryDrawerItem().withName("Java").withIcon(DevIcon.Icon.dev_java_plain), new PrimaryDrawerItem().withName("Objective-C").withIcon(DevIcon.Icon.dev_apple_plain), new PrimaryDrawerItem().withName("Swift").withIcon(R.drawable.ic_swift), new PrimaryDrawerItem().withName("JavaScript").withIcon(DevIcon.Icon.dev_javascript_plain), new PrimaryDrawerItem().withName("Python").withIcon(DevIcon.Icon.dev_python_plain), new PrimaryDrawerItem().withName("HTML").withIcon(DevIcon.Icon.dev_html5_plain), new PrimaryDrawerItem().withName("C#").withIcon(DevIcon.Icon.dev_csharp_plain_wordmark), new PrimaryDrawerItem().withName("C++").withIcon(DevIcon.Icon.dev_cplusplus_plain_wordmark), new PrimaryDrawerItem().withName("Ruby").withIcon(DevIcon.Icon.dev_ruby_plain) ) .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() { @Override public boolean onItemClick(View view, int position, IDrawerItem drawerItem) { AppLog.d("onItemClick, position = " + position + ", item = " + ((Nameable)drawerItem).getName()); mCurrentLang = ((Nameable)drawerItem).getName().toString(); search(mCurrentKey, mCurrentLang); mDrawer.closeDrawer(); return true; } }) .build(); mAdapter = new RepoListRecyclerAdapter(null); mAdapter.setOnRecyclerViewItemClickListener(mItemtClickListener); mRepoListView.setLayoutManager(new LinearLayoutManager(this)); mRepoListView.addItemDecoration(new HorizontalDividerItemDecoration .Builder(this) .color(Color.TRANSPARENT) .size(getResources().getDimensionPixelSize(R.dimen.divider_height)) .build()); mRepoListView.setAdapter(mAdapter); // default is null mCurrentLang = ""; }