本文整理匯總了Java中com.mikepenz.materialdrawer.model.interfaces.IDrawerItem.getIdentifier方法的典型用法代碼示例。如果您正苦於以下問題:Java IDrawerItem.getIdentifier方法的具體用法?Java IDrawerItem.getIdentifier怎麽用?Java IDrawerItem.getIdentifier使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.mikepenz.materialdrawer.model.interfaces.IDrawerItem
的用法示例。
在下文中一共展示了IDrawerItem.getIdentifier方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onDrawerItemClickListener
import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入方法依賴的package包/類
private boolean onDrawerItemClickListener(View view, int position, IDrawerItem drawerItem) {
int id = (int) drawerItem.getIdentifier();
switch (id) {
case 1:
getSupportFragmentManager().beginTransaction()
.replace(R.id.fragmentContainer, ItemsFragment.newInstance())
.commit();
drawer.closeDrawer();
break;
case 2:
getSupportFragmentManager().beginTransaction()
.replace(R.id.fragmentContainer, BottomSheetFragment.newInstance())
.commit();
drawer.closeDrawer();
break;
}
return true;
}
示例2: populateProfile
import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入方法依賴的package包/類
/**
* Populate profile
* @param department
*/
public void populateProfile( Department department){
this.accountHeader.clear();
for ( User user : department.getColaborators() ){
addProfile( user );
}
this.currentDepartment = department;
if( currentMenu != null && ((Fragment)currentMenu.getMainFrag()).isResumed() )
this.currentMenu.getMainFrag().onDepartmentChange(department);
else if(currentMenu != null ) {
( (Fragment)this.currentMenu.getMainFrag()).getArguments()
.putString( Department.INSTANCE, currentDepartment.getKey() );
}
for( IDrawerItem item : this.departamentoContainer.getSubItems() ){
if( item.getIdentifier() == department.getIdentifier() ){
item.withSetSelected( true );
this.departamentoContainer.withSetSelected( true );
}
}
}
示例3: onCheckedChanged
import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入方法依賴的package包/類
@Override
public void onCheckedChanged(IDrawerItem drawerItem, CompoundButton buttonView, boolean isChecked) {
switch ((int) drawerItem.getIdentifier()) {
case 1:
addSubscription(NetworkWrapper.get()
.setShopStatus(isChecked ? 1 : 0)
.compose(bindToLifecycle())
.subscribe(message -> {
MainActivity.this.shopStatus.withName("營業狀態:" + (isChecked ? "開" : "關"));
AppManager.getShopInfo().setStatus(isChecked ? 1 : 0);
result.updateItem(MainActivity.this.shopStatus);
setIntentService(isChecked);
}, throwable -> Snackbar.make(binding.pager, throwable.getMessage(), Snackbar.LENGTH_SHORT).show()));
break;
}
}
示例4: onItemClick
import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入方法依賴的package包/類
@Override
public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
int id = (int) drawerItem.getIdentifier();
switch (id) {
case ID_LIVE:
playLive();
break;
case ID_HISTORY:
break;
case ID_SETTING:
launchSetting();
break;
default:
History history = (History) drawerItem.getTag();
switch (history.getType()) {
case DIRECTORY:
break;
case FILE:
playHistory(history);
break;
}
break;
}
return false;
}
示例5: onItemClick
import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入方法依賴的package包/類
/**
* call this method to trigger the onItemClick on the MiniDrawer
*
* @param selectedDrawerItem
* @return
*/
public boolean onItemClick(IDrawerItem selectedDrawerItem) {
//We only need to clear if the new item is selectable
if (selectedDrawerItem.isSelectable()) {
//crossfade if we are cross faded
if (mCrossFader != null) {
if (mCrossFader.isCrossfaded()) {
mCrossFader.crossfade();
}
}
//get the identifier
int identifier = selectedDrawerItem.getIdentifier();
//update everything
setSelection(identifier);
return false;
} else {
return true;
}
}
示例6: onCheckedChanged
import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入方法依賴的package包/類
@Override
public void onCheckedChanged(IDrawerItem drawerItem, CompoundButton buttonView, boolean isChecked) {
int id = (int) drawerItem.getIdentifier();
switch (id) {
case ID_TOGGLE_DONE:
toggleDoneTab();
break;
case ID_TOGGLE_BIG_TEXT:
if (isChecked) {
HorizontalAdapter.setBigText(true);
mTinyDB.putBoolean(getString(R.string.big_text_pref), true);
DatabaseHelper.notifyAllLists();
} else {
HorizontalAdapter.setBigText(false);
mTinyDB.putBoolean(getString(R.string.big_text_pref), false);
DatabaseHelper.notifyAllLists();
}
break;
case ID_DARK_THEME:
changeDarkTheme(isChecked);
break;
}
}
示例7: onNavigationSelected
import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入方法依賴的package包/類
private void onNavigationSelected(IDrawerItem drawerItem) {
switch (drawerItem.getIdentifier()) {
case 1001:
navigateToBookShelfFragment();
break;
case 1101:
mNavigation.navigateToSettingsActivity(MainActivity.this);
break;
default:
throw new IllegalArgumentException("Unknown NavigationDrawerItem position.");
}
}
示例8: getCurrentSelection
import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入方法依賴的package包/類
/**
* get the current selected item identifier
*
* @return
*/
public long getCurrentSelection() {
IDrawerItem drawerItem = mDrawerBuilder.getDrawerItem(getCurrentSelectedPosition());
if (drawerItem != null) {
return drawerItem.getIdentifier();
}
return -1;
}
示例9: getDrawerItem
import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入方法依賴的package包/類
/**
* gets the drawerItem with the specific identifier from a drawerItem list
*
* @param drawerItems
* @param identifier
* @return
*/
public static IDrawerItem getDrawerItem(List<IDrawerItem> drawerItems, long identifier) {
if (identifier >= 0) {
for (IDrawerItem drawerItem : drawerItems) {
if (drawerItem.getIdentifier() == identifier) {
return drawerItem;
}
}
}
return null;
}
示例10: setSelection
import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入方法依賴的package包/類
/**
* set the selection of the MiniDrawer
*
* @param identifier the identifier of the item which should be selected (-1 for none)
*/
public void setSelection(long identifier) {
int count = mAdapter.getItemCount();
for (int i = 0; i < count; i++) {
IDrawerItem item = mAdapter.getItem(i);
if (item.getIdentifier() == identifier && !item.isSelected()) {
mAdapter.deselect();
mAdapter.select(i);
}
}
}
示例11: updateItem
import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入方法依賴的package包/類
/**
* update a MiniDrawerItem (after updating the main Drawer) via its identifier
*
* @param identifier the identifier of the item which was updated
*/
public void updateItem(long identifier) {
if (mDrawer != null && mAdapter != null && mAdapter.getAdapterItems() != null && identifier != -1) {
IDrawerItem drawerItem = DrawerUtils.getDrawerItem(getDrawerItems(), identifier);
for (int i = 0; i < mAdapter.getAdapterItems().size(); i++) {
if (mAdapter.getAdapterItems().get(i).getIdentifier() == drawerItem.getIdentifier()) {
IDrawerItem miniDrawerItem = generateMiniDrawerItem(drawerItem);
if (miniDrawerItem != null) {
mAdapter.set(i, miniDrawerItem);
}
}
}
}
}
示例12: getItemId
import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入方法依賴的package包/類
@Override
public long getItemId(int position) {
IDrawerItem item = getItem(position);
if (item != null && item.getIdentifier() != -1) {
return item.getIdentifier();
}
return super.getItemId(position);
}
示例13: getCurrentSelection
import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入方法依賴的package包/類
/**
* get the current selected item identifier
*
* @return
*/
public int getCurrentSelection() {
IDrawerItem drawerItem = mDrawerBuilder.getDrawerItem(mDrawerBuilder.mCurrentSelection);
if (drawerItem != null) {
return drawerItem.getIdentifier();
}
return -1;
}
示例14: getDrawerItem
import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入方法依賴的package包/類
/**
* gets the drawerItem with the specific identifier from a drawerItem list
*
* @param drawerItems
* @param identifier
* @return
*/
public static IDrawerItem getDrawerItem(List<IDrawerItem> drawerItems, int identifier) {
if (identifier >= 0) {
for (IDrawerItem drawerItem : drawerItems) {
if (drawerItem.getIdentifier() == identifier) {
return drawerItem;
}
}
}
return null;
}
示例15: updateItem
import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; //導入方法依賴的package包/類
/**
* update a MiniDrawerItem (after updating the main Drawer) via its identifier
*
* @param identifier the identifier of the item which was updated
*/
public void updateItem(int identifier) {
if (mDrawer != null && mDrawerAdapter != null && mDrawerAdapter.getDrawerItems() != null && identifier != -1) {
IDrawerItem drawerItem = DrawerUtils.getDrawerItem(getDrawerItems(), identifier);
for (int i = 0; i < mDrawerAdapter.getDrawerItems().size(); i++) {
if (mDrawerAdapter.getDrawerItems().get(i).getIdentifier() == drawerItem.getIdentifier()) {
IDrawerItem miniDrawerItem = generateMiniDrawerItem(drawerItem);
if (miniDrawerItem != null) {
mDrawerAdapter.setDrawerItem(i, miniDrawerItem);
}
}
}
}
}