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


Java Drawer.OnDrawerItemClickListener方法代码示例

本文整理汇总了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;
    }
  };
}
 
开发者ID:ShaolinZhang,项目名称:HACKxFDU-CrisisProbingUAV,代码行数:17,代码来源:BaseActivity.java

示例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);
  }
}
 
开发者ID:AtlantPlatform,项目名称:atlant-android,代码行数:22,代码来源:DrawerHelper.java

示例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) {
                        //
                    }
                }

            }
        }
    };
}
 
开发者ID:tral,项目名称:MaterialDrawerFragmentSample,代码行数:34,代码来源:Utils.java

示例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;
}
 
开发者ID:TelerikAcademy,项目名称:Mobile-Applications-for-Android,代码行数:12,代码来源:DrawerFragment.java

示例5: setListener

import com.mikepenz.materialdrawer.Drawer; //导入方法依赖的package包/类
public void setListener(Drawer.OnDrawerItemClickListener listener) {
  drawer.setOnDrawerItemClickListener(listener);
}
 
开发者ID:AtlantPlatform,项目名称:atlant-android,代码行数:4,代码来源:DrawerHelper.java

示例6: showLuckyNumber

import com.mikepenz.materialdrawer.Drawer; //导入方法依赖的package包/类
private Drawer.OnDrawerItemClickListener showLuckyNumber(LuckyNumber luckyNumber) {
    return (v, p, di) -> {
        presenter.luckyNumberClicked(luckyNumber);
        return true;
    };
}
 
开发者ID:shymmq,项目名称:librus-client,代码行数:7,代码来源:MainActivity.java

示例7: withOnDrawerItemClickListener

import com.mikepenz.materialdrawer.Drawer; //导入方法依赖的package包/类
@Override
public ExpandableDrawerItem withOnDrawerItemClickListener(Drawer.OnDrawerItemClickListener onDrawerItemClickListener) {
    mOnDrawerItemClickListener = onDrawerItemClickListener;
    return this;
}
 
开发者ID:LeMinhAn,项目名称:MaterialDrawer,代码行数:6,代码来源:ExpandableDrawerItem.java

示例8: getOnDrawerItemClickListener

import com.mikepenz.materialdrawer.Drawer; //导入方法依赖的package包/类
@Override
public Drawer.OnDrawerItemClickListener getOnDrawerItemClickListener() {
    return mOnArrowDrawerItemClickListener;
}
 
开发者ID:LeMinhAn,项目名称:MaterialDrawer,代码行数:5,代码来源:ExpandableDrawerItem.java

示例9: getOnDrawerItemClickListener

import com.mikepenz.materialdrawer.Drawer; //导入方法依赖的package包/类
public Drawer.OnDrawerItemClickListener getOnDrawerItemClickListener() {
    return mOnDrawerItemClickListener;
}
 
开发者ID:LeMinhAn,项目名称:MaterialDrawer,代码行数:4,代码来源:AbstractDrawerItem.java

示例10: setOnDrawerItemClickListener

import com.mikepenz.materialdrawer.Drawer; //导入方法依赖的package包/类
public void setOnDrawerItemClickListener(Drawer.OnDrawerItemClickListener onDrawerItemClickListener) {
    this.onDrawerItemClickListener = onDrawerItemClickListener;
}
 
开发者ID:TelerikAcademy,项目名称:Mobile-Applications-for-Android,代码行数:4,代码来源:DrawerFragment.java

示例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;
}
 
开发者ID:LeMinhAn,项目名称:MaterialDrawer,代码行数:13,代码来源:AbstractDrawerItem.java


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