当前位置: 首页>>代码示例>>Java>>正文


Java Nameable类代码示例

本文整理汇总了Java中com.mikepenz.materialdrawer.model.interfaces.Nameable的典型用法代码示例。如果您正苦于以下问题:Java Nameable类的具体用法?Java Nameable怎么用?Java Nameable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Nameable类属于com.mikepenz.materialdrawer.model.interfaces包,在下文中一共展示了Nameable类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCheckedChanged

import com.mikepenz.materialdrawer.model.interfaces.Nameable; //导入依赖的package包/类
@Override
public void onCheckedChanged(IDrawerItem drawerItem, CompoundButton buttonView, boolean isChecked) {
    PreferenceManager.getDefaultSharedPreferences(ListActivity.this)
            .edit()
            .putBoolean(Preferences.SHOW_ONLY_UNREAD.getKey(), isChecked)
            .apply();

    if(drawerItem instanceof Nameable && drawerItem.getTag() instanceof AllUnreadFolder) {
        final AllUnreadFolder unreadFolder = (AllUnreadFolder) drawerItem.getTag();

        unreadFolder.updateName(ListActivity.this, isShowOnlyUnread());
        ((Nameable) drawerItem).withName(unreadFolder.getName());
    }

    drawerManager.reloadAdapters(getRealm(), isShowOnlyUnread());
    reloadListFragment();
}
 
开发者ID:schaal,项目名称:ocreader,代码行数:18,代码来源:ListActivity.java

示例2: onCreate

import com.mikepenz.materialdrawer.model.interfaces.Nameable; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sample_dark_toolbar);

    // Handle Toolbar
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setTitle(R.string.drawer_item_menu_drawer);

    //Create the drawer
    result = new DrawerBuilder()
            .withActivity(this)
            .withToolbar(toolbar)
            .inflateMenu(R.menu.example_menu)
            .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
                @Override
                public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
                    if (drawerItem instanceof Nameable) {
                        Toast.makeText(MenuDrawerActivity.this, ((Nameable) drawerItem).getName().getText(MenuDrawerActivity.this), Toast.LENGTH_SHORT).show();
                    }

                    return false;
                }
            }).build();
}
 
开发者ID:LeMinhAn,项目名称:MaterialDrawer,代码行数:27,代码来源:MenuDrawerActivity.java

示例3: showDefaultProduct

import com.mikepenz.materialdrawer.model.interfaces.Nameable; //导入依赖的package包/类
private void showDefaultProduct() {
    SeachemProduct defaultProduct = DoserApplication.getDoserPreferences().getDefaultProduct();
    if (defaultProduct != null) {
        SeachemProductCategory category = SeachemManager.getProductCategory(defaultProduct);

        ExpandableDrawerItem parent = mProductCategoryItems.get(category);

        // first open parent item
        parent.withIsExpanded(true);
        mDrawer.updateItem(parent);

        // now select + click child item
        for (IDrawerItem item : parent.getSubItems()) {
            String title = ((Nameable) item).getName().getText();
            if (title != null && title.equals(defaultProduct.getName())) {
                mDrawer.setSelection(item, true);
                break;
            }
        }
    } else {
        setCurrentFragment(getString(R.string.app_name), new DefaultFragment());
    }
}
 
开发者ID:NateShoffner,项目名称:Seachem-Doser,代码行数:24,代码来源:MainActivity.java

示例4: getDrawerItemResourceInPosition

import com.mikepenz.materialdrawer.model.interfaces.Nameable; //导入依赖的package包/类
public int getDrawerItemResourceInPosition(int position) {
  if (drawer.getHeader() == null) {
    return ((Nameable) drawer.getDrawerItems().get(position)).getName().getTextRes();
  } else {
    return ((Nameable) drawer.getDrawerItems().get(position - 1)).getName().getTextRes();
  }
}
 
开发者ID:AtlantPlatform,项目名称:atlant-android,代码行数:8,代码来源:DrawerHelper.java

示例5: onCheckedChanged

import com.mikepenz.materialdrawer.model.interfaces.Nameable; //导入依赖的package包/类
@Override
public void onCheckedChanged(IDrawerItem drawerItem, CompoundButton buttonView, boolean isChecked) {
    if (drawerItem instanceof Nameable) {
        Log.i("material-drawer", "DrawerItem: " + ((Nameable) drawerItem).getName() + " - toggleChecked: " + isChecked);
    } else {
        Log.i("material-drawer", "toggleChecked: " + isChecked);
    }
}
 
开发者ID:LeMinhAn,项目名称:MaterialDrawer,代码行数:9,代码来源:MiniDrawerActivity.java

示例6: onCreate

import com.mikepenz.materialdrawer.model.interfaces.Nameable; //导入依赖的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);
}
 
开发者ID:LeMinhAn,项目名称:MaterialDrawer,代码行数:33,代码来源:ActionBarActivity.java

示例7: updateName

import com.mikepenz.materialdrawer.model.interfaces.Nameable; //导入依赖的package包/类
/**
 * update the name for a specific drawerItem
 * identified by its id
 *
 * @param identifier
 * @param name
 */
public void updateName(long identifier, StringHolder name) {
    IDrawerItem drawerItem = getDrawerItem(identifier);
    if (drawerItem instanceof Nameable) {
        Nameable pdi = (Nameable) drawerItem;
        pdi.withName(name);
        updateItem((IDrawerItem) pdi);
    }
}
 
开发者ID:LeMinhAn,项目名称:MaterialDrawer,代码行数:16,代码来源:Drawer.java

示例8: updateName

import com.mikepenz.materialdrawer.model.interfaces.Nameable; //导入依赖的package包/类
/**
 * 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);
    }
}
 
开发者ID:FreedomZZQ,项目名称:YouJoin-Android,代码行数:16,代码来源:Drawer.java

示例9: onClickDrawerItem

import com.mikepenz.materialdrawer.model.interfaces.Nameable; //导入依赖的package包/类
private boolean onClickDrawerItem(IDrawerItem drawerItem) {
	switch (drawerItem.getIdentifier()) {
		case ID_SETTINGS:
			// show settings
			return true;
		default:
			setTitle(((Nameable)drawerItem).getNameRes());
			return true;
	}
}
 
开发者ID:arcao,项目名称:Trackables,代码行数:11,代码来源:MainActivity.java

示例10: initViews

import com.mikepenz.materialdrawer.model.interfaces.Nameable; //导入依赖的package包/类
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.distance_180dp)
            .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.mipmap.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) {
                    Logger.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.setOnItemClickListener(mItemtClickListener);
    mAdapter.openLoadAnimation(BaseQuickAdapter.SCALEIN);
    mRepoList.setAdapter(mAdapter);

    // default is null
    mCurrentLang = "";
}
 
开发者ID:Jusenr,项目名称:androidgithub,代码行数:56,代码来源:SearchActivity.java

示例11: initViews

import com.mikepenz.materialdrawer.model.interfaces.Nameable; //导入依赖的package包/类
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 = "";
}
 
开发者ID:mingjunli,项目名称:GithubApp,代码行数:63,代码来源:SearchActivity.java

示例12: onCreate

import com.mikepenz.materialdrawer.model.interfaces.Nameable; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    //supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sample_nontranslucent);

    // Handle Toolbar
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setTitle(R.string.drawer_item_non_translucent_status_drawer);

    // Create a few sample profile
    result = new DrawerBuilder()
            .withActivity(this)
            .withTranslucentStatusBar(false)
            .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)
            )
            .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
                @Override
                public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
                    if (drawerItem instanceof Nameable) {
                        Toast.makeText(NonTranslucentDrawerActivity.this, ((Nameable) drawerItem).getName().getText(NonTranslucentDrawerActivity.this), Toast.LENGTH_SHORT).show();
                    }
                    return false;
                }
            })
            .withSelectedItemByPosition(2)
            .withSavedInstance(savedInstanceState)
            .build();

    //set the back arrow in the toolbar
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeButtonEnabled(false);
}
 
开发者ID:LeMinhAn,项目名称:MaterialDrawer,代码行数:44,代码来源:NonTranslucentDrawerActivity.java

示例13: onCreate

import com.mikepenz.materialdrawer.model.interfaces.Nameable; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sample);

    // Handle Toolbar
    final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setTitle(R.string.drawer_item_compact_header);

    // Create a few sample profile
    final IProfile profile = new ProfileDrawerItem().withName("Mike Penz").withEmail("[email protected]").withIcon(R.drawable.profile);
    final IProfile profile2 = new ProfileDrawerItem().withName("Max Muster").withEmail("[email protected]").withIcon(R.drawable.profile2);
    final IProfile profile3 = new ProfileDrawerItem().withName("Felix House").withEmail("[email protected]").withIcon(R.drawable.profile3);
    final IProfile profile4 = new ProfileDrawerItem().withName("Mr. X").withEmail("[email protected]").withIcon(R.drawable.profile4);
    final IProfile profile5 = new ProfileDrawerItem().withName("Batman").withEmail("[email protected]").withIcon(R.drawable.profile5);

    // Create the AccountHeader
    headerResult = new AccountHeaderBuilder()
            .withActivity(this)
            .withCompactStyle(true)
            .withHeaderBackground(R.drawable.header)
            .addProfiles(
                    profile,
                    profile2,
                    profile3,
                    profile4,
                    profile5,
                    //don't ask but google uses 14dp for the add account icon in gmail but 20dp for the normal icons (like manage account)
                    new ProfileSettingDrawerItem().withName("Add Account").withDescription("Add new GitHub Account").withIcon(new IconicsDrawable(this, GoogleMaterial.Icon.gmd_plus).actionBar().paddingDp(5).colorRes(R.color.material_drawer_dark_primary_text)).withIdentifier(PROFILE_SETTING),
                    new ProfileSettingDrawerItem().withName("Manage Account").withIcon(GoogleMaterial.Icon.gmd_settings)
            )
            .withSavedInstance(savedInstanceState)
            .build();

    //Create the drawer
    result = new DrawerBuilder()
            .withActivity(this)
            .withAccountHeader(headerResult) //set the AccountHeader we created earlier for the header
            .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).withIdentifier(5),
                    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)
            )
            .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
                @Override
                public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
                    if (drawerItem != null && drawerItem.getIdentifier() == 1) {
                        startSupportActionMode(new ActionBarCallBack());
                        findViewById(R.id.action_mode_bar).setBackgroundColor(UIUtils.getThemeColorFromAttrOrRes(CompactHeaderDrawerActivity.this, R.attr.colorPrimary, R.color.material_drawer_primary));
                    }

                    if (drawerItem instanceof Nameable) {
                        toolbar.setTitle(((Nameable) drawerItem).getName().getText(CompactHeaderDrawerActivity.this));
                    }

                    return false;
                }
            })
            .withSavedInstance(savedInstanceState)
            .build();

    // set the selection to the item with the identifier 5
    if (savedInstanceState == null) {
        result.setSelection(5, false);
    }

    //set the back arrow in the toolbar
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeButtonEnabled(false);
}
 
开发者ID:LeMinhAn,项目名称:MaterialDrawer,代码行数:77,代码来源:CompactHeaderDrawerActivity.java


注:本文中的com.mikepenz.materialdrawer.model.interfaces.Nameable类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。