本文整理汇总了Java中com.mikepenz.materialdrawer.Drawer.OnDrawerItemClickListener方法的典型用法代码示例。如果您正苦于以下问题:Java Drawer.OnDrawerItemClickListener方法的具体用法?Java Drawer.OnDrawerItemClickListener怎么用?Java Drawer.OnDrawerItemClickListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.mikepenz.materialdrawer.Drawer
的用法示例。
在下文中一共展示了Drawer.OnDrawerItemClickListener方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: goToActivityListener
import com.mikepenz.materialdrawer.Drawer; //导入方法依赖的package包/类
private Drawer.OnDrawerItemClickListener goToActivityListener(
@NonNull final Class<? extends Activity> activityClass) {
return new Drawer.OnDrawerItemClickListener() {
@Override
public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
// Don't open a new activity if we're already in the activity the user clicked on
if (BaseActivity.this.getClass().equals(activityClass)) {
return true;
}
startActivity(new Intent(BaseActivity.this, activityClass)
.putExtra(INTENT_EXTRA_DRAWER_POSITION, position)
);
return true;
}
};
}
示例2: DrawerHelper
import com.mikepenz.materialdrawer.Drawer; //导入方法依赖的package包/类
@Inject
public DrawerHelper(final AppCompatActivity activity) {
View view = LayoutInflater.from(activity).inflate(R.layout.view_menu_header, null);
TextView textTitle = view.findViewById(R.id.menu_title);
FontsUtils.toOctarineBold(activity, textTitle);
drawer = new DrawerBuilder()
.withActivity(activity)
.withSliderBackgroundDrawableRes(R.drawable.fon_gradient)
.withHeader(R.layout.view_menu_header)
.withHeader(view)
.withActionBarDrawerToggle(true)
.withStickyFooter(R.layout.view_menu_footer)
.withStickyFooterDivider(false)
.build();
if (activity instanceof Drawer.OnDrawerItemClickListener) {
drawer.setOnDrawerItemClickListener((Drawer.OnDrawerItemClickListener) activity);
}
}
示例3: handlerOnClick
import com.mikepenz.materialdrawer.Drawer; //导入方法依赖的package包/类
public static Drawer.OnDrawerItemClickListener handlerOnClick(final Drawer.Result drawerResult, final ActionBarActivity activity) {
return new Drawer.OnDrawerItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id, IDrawerItem drawerItem) {
//check if the drawerItem is set.
//there are different reasons for the drawerItem to be null
//--> click on the header
//--> click on the footer
//those items don't contain a drawerItem
if (drawerItem != null) {
if (drawerItem.getIdentifier() == 1) {
activity.getSupportFragmentManager().beginTransaction().replace(R.id.frame_container, new Fragment1()).commit();
} else if (drawerItem.getIdentifier() == 2) {
activity.getSupportFragmentManager().beginTransaction().replace(R.id.frame_container, new Fragment2()).commit();
} else if (drawerItem.getIdentifier() == 3) {
activity.getSupportFragmentManager().beginTransaction().replace(R.id.frame_container, new Fragment3()).commit();
} else if (drawerItem.getIdentifier() == 70) {
// Rate App
try {
Intent int_rate = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + activity.getApplicationContext().getPackageName()));
int_rate.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
activity.getApplicationContext().startActivity(int_rate);
} catch (Exception e) {
//
}
}
}
}
};
}
示例4: createFragment
import com.mikepenz.materialdrawer.Drawer; //导入方法依赖的package包/类
public static DrawerFragment createFragment(ArrayList<DrawerItemInfo> drawerItems,
Drawer.OnDrawerItemClickListener onDrawerItemClickListener) {
DrawerFragment drawerFragment = new DrawerFragment();
Bundle args = new Bundle();
drawerFragment.setOnDrawerItemClickListener(onDrawerItemClickListener);
args.putSerializable(ARG_DRAWER_ITEMS_KEY, drawerItems);
drawerFragment.setArguments(args);
return drawerFragment;
}
示例5: setListener
import com.mikepenz.materialdrawer.Drawer; //导入方法依赖的package包/类
public void setListener(Drawer.OnDrawerItemClickListener listener) {
drawer.setOnDrawerItemClickListener(listener);
}
示例6: showLuckyNumber
import com.mikepenz.materialdrawer.Drawer; //导入方法依赖的package包/类
private Drawer.OnDrawerItemClickListener showLuckyNumber(LuckyNumber luckyNumber) {
return (v, p, di) -> {
presenter.luckyNumberClicked(luckyNumber);
return true;
};
}
示例7: withOnDrawerItemClickListener
import com.mikepenz.materialdrawer.Drawer; //导入方法依赖的package包/类
@Override
public ExpandableDrawerItem withOnDrawerItemClickListener(Drawer.OnDrawerItemClickListener onDrawerItemClickListener) {
mOnDrawerItemClickListener = onDrawerItemClickListener;
return this;
}
示例8: getOnDrawerItemClickListener
import com.mikepenz.materialdrawer.Drawer; //导入方法依赖的package包/类
@Override
public Drawer.OnDrawerItemClickListener getOnDrawerItemClickListener() {
return mOnArrowDrawerItemClickListener;
}
示例9: getOnDrawerItemClickListener
import com.mikepenz.materialdrawer.Drawer; //导入方法依赖的package包/类
public Drawer.OnDrawerItemClickListener getOnDrawerItemClickListener() {
return mOnDrawerItemClickListener;
}
示例10: setOnDrawerItemClickListener
import com.mikepenz.materialdrawer.Drawer; //导入方法依赖的package包/类
public void setOnDrawerItemClickListener(Drawer.OnDrawerItemClickListener onDrawerItemClickListener) {
this.onDrawerItemClickListener = onDrawerItemClickListener;
}
示例11: withOnDrawerItemClickListener
import com.mikepenz.materialdrawer.Drawer; //导入方法依赖的package包/类
/**
* this listener is called when an item is clicked in the drawer.
* WARNING: don't overwrite this in the Switch / Toggle drawerItems if you want the toggle / switch to be selected
* if the item is clicked and the item is not selectable.
*
* @param onDrawerItemClickListener
* @return
*/
public T withOnDrawerItemClickListener(Drawer.OnDrawerItemClickListener onDrawerItemClickListener) {
this.mOnDrawerItemClickListener = onDrawerItemClickListener;
return (T) this;
}