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


Java Drawer类代码示例

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


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

示例1: addDepartamento

import com.mikepenz.materialdrawer.Drawer; //导入依赖的package包/类
/**
 * Adicionar os departamentos
 * @param department
 * @param news
 */
private void addDepartamento( Department department, boolean news ) {
    if( news && this.departamentsWorks.contains( department ) ) return;
    else if( news ) this.departamentsWorks.add( department );

    this.departamentoContainer.withSubItems(
            new SecondaryDrawerItem().withName( department.getNome() )
                    .withIdentifier( department.getIdentifier() )
                    .withIcon( R.drawable.ic_home_teal_500_24dp )
                    .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
                        @Override
                        public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
                            onChangeDepartmentTo( drawerItem.getIdentifier() );
                            return false;
                        }
                    })
    );
}
 
开发者ID:tec-ustp,项目名称:SIIEScanner,代码行数:23,代码来源:MainBuildView.java

示例2: addProfile

import com.mikepenz.materialdrawer.Drawer; //导入依赖的package包/类
/**
 * Add new profile
 * @param user
 */
private void addProfile(User user) {
    this.accountHeader.addProfiles(
            new ProfileDrawerItem().withName( user.getName() )
                    .withEmail( user.getKey() )
                    .withIcon( user.createBitMap( this.main ) )
                    .withIdentifier( user.getIdentifier() )
                    .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
                        @Override
                        public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
                            onProfileChange( view, position, drawerItem );
                            return false;
                        }
                    })
    );
}
 
开发者ID:tec-ustp,项目名称:SIIEScanner,代码行数:20,代码来源:MainBuildView.java

示例3: onCreate

import com.mikepenz.materialdrawer.Drawer; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Realm.init(getApplicationContext());
    setContentView(R.layout.activity_browsing);

    Toolbar toolbar = (Toolbar) findViewById(R.id.secondToolbar);
    setSupportActionBar(toolbar);
    Drawer drawer = DrawerInitializer.createDrawer(this, this, toolbar);

    drawer.getActionBarDrawerToggle().setDrawerIndicatorEnabled(true);
    Config.setActiveDrawer(drawer);
    layoutManager = new LinearLayoutManager(getApplicationContext());
    recyclerView = (RecyclerView) findViewById(R.id.browsingRecyclerView);
    recyclerView.setLayoutManager(layoutManager);
    ArrayList<File> files = Utility.getListOfFoldersAndAudioFilesInDirectoryWithParent(getApplicationContext());

    FileAdapter fileAdapter = new FileAdapter(files, this);
    recyclerView.setAdapter(fileAdapter);
}
 
开发者ID:chenshuiluke,项目名称:BeatPulse,代码行数:21,代码来源:BrowsingActivity.java

示例4: initDrawer

import com.mikepenz.materialdrawer.Drawer; //导入依赖的package包/类
@UiThread void initDrawer() {
  PrimaryDrawerItem home =
      new PrimaryDrawerItem().withName(R.string.home).withIcon(GoogleMaterial.Icon.gmd_home);
  new DrawerBuilder().withActivity((Activity) act)
      .withToolbar(toolbar)
      .withHasStableIds(true)
      .withTranslucentStatusBar(true)
      .withSelectedItem(-1)
      .withAccountHeader(headerResult)
      .addDrawerItems(home)
      .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
        @Override public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
          switch (position) {
            case 1:
              context.startActivity(new Intent(context, MainActivity_.class));
              return true;
            default:
              return true;
          }
        }
      })
      .build();
}
 
开发者ID:Pierry,项目名称:cartolapp,代码行数:24,代码来源:ToolbarBase.java

示例5: drawerItemClicked

import com.mikepenz.materialdrawer.Drawer; //导入依赖的package包/类
public boolean drawerItemClicked(final Drawer drawer, long id, final IDrawerItem drawerItem) {
    if (drawerItem instanceof ChannelDrawerItem) {

        getView().setPostsRefreshing(true);

        // Reset the ViewModel state.
        channel = ((ChannelDrawerItem) drawerItem).getChannel();
        posts.clear();
        newPosts.clear();

        // Set activity title.
        setActivityTitle(channel.displayName());

        // Clear the message adapter.
        footerAdapter.clear();
        postsAdapter.clear();

        getView().recreateOnScrollListener();

        noMoreScrollBack = false;

        postsManager.setChannel(channel);
        drawer.closeDrawer();
    }
    return true;
}
 
开发者ID:grundleborg,项目名称:matterdroid,代码行数:27,代码来源:MainActivityPresenter.java

示例6: 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

示例7: onCreate

import com.mikepenz.materialdrawer.Drawer; //导入依赖的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

示例8: initializeDrawer

import com.mikepenz.materialdrawer.Drawer; //导入依赖的package包/类
public void initializeDrawer(Activity activity) {


        this.response = new DrawerBuilder().withActivity(activity)
                .addDrawerItems(
                        audioActivity,
                        fileActivity,
                        new DividerDrawerItem(),
                        about
                ).withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
                    @Override
                    public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
                        updatedSelection();
                        return true;
                    }
                })
                .build();
    }
 
开发者ID:TeamRegalad,项目名称:Rega-Play,代码行数:19,代码来源:DrawerUtils.java

示例9: 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

示例10: setDrawer

import com.mikepenz.materialdrawer.Drawer; //导入依赖的package包/类
protected void setDrawer(Boolean upEnabled) {
    Toolbar toolbar_main = (Toolbar) findViewById(R.id.toolbar_main);
    setSupportActionBar(toolbar_main);

    ActionBar supportActionBar = getSupportActionBar();
    if (supportActionBar != null)
        if (upEnabled) {
            supportActionBar.setDisplayHomeAsUpEnabled(true);
        } else {
            final Intent intent = new Intent(this, FormActivity.class);
            new DrawerBuilder()
                    .withActivity(this)
                    .withToolbar(toolbar_main)
                    .addDrawerItems(
                            new PrimaryDrawerItem()
                                    .withName(R.string.new_task)
                                    .withIcon(MaterialDesignIconic.Icon.gmi_plus)
                                    .withSelectable(false)
                                    .withIdentifier(1)
                    ).withSelectedItem(-1)
                    .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
                        @Override
                        public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
                            switch (drawerItem.getIdentifier()) {
                                case 1:
                                    startActivityForResult(intent, NEW_TASK);
                                    break;
                            }
                            return false;
                        }
                    })
                    .build();
        }
}
 
开发者ID:thawatchai,项目名称:duedo,代码行数:35,代码来源:BaseActivity.java

示例11: DrawerManager

import com.mikepenz.materialdrawer.Drawer; //导入依赖的package包/类
public DrawerManager(Context context, Drawer startDrawer, Drawer endDrawer, OnCheckedChangeListener unreadSwitchListener) {
    allUnreadFolder = new AllUnreadFolder(context);
    starredFolder = new StarredFolder(context);
    freshFolder = new FreshFolder(context);

    state = new State();

    startAdapter = new SubscriptionDrawerManager(startDrawer, unreadSwitchListener);
    endAdapter = new FolderDrawerManager(endDrawer);
}
 
开发者ID:schaal,项目名称:ocreader,代码行数:11,代码来源:DrawerManager.java

示例12: SubscriptionDrawerManager

import com.mikepenz.materialdrawer.Drawer; //导入依赖的package包/类
public SubscriptionDrawerManager(Drawer drawer, OnCheckedChangeListener unreadSwitchListener) {
    super(drawer);

    topDrawerItems.add(
            new TreeItemSwitchDrawerItem(allUnreadFolder)
                    .withOnCheckedChangeListener(unreadSwitchListener)
    );
    topDrawerItems.add(new TreeItemDrawerItem(starredFolder));
    topDrawerItems.add(new TreeItemDrawerItem(freshFolder));

    topDrawerItems.add(new DividerDrawerItem());
}
 
开发者ID:schaal,项目名称:ocreader,代码行数:13,代码来源:DrawerManager.java

示例13: init

import com.mikepenz.materialdrawer.Drawer; //导入依赖的package包/类
private void init(){
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    Drawer drawer = DrawerInitializer.createDrawer(this, this, toolbar);

    drawer.getActionBarDrawerToggle().setDrawerIndicatorEnabled(true);
    Config.setActiveDrawer(drawer);


    Realm realm = Realm.getDefaultInstance();
    RealmResults<Song> results = realm.where(Song.class).findAll();
    drawer.setSelection(Config.ALBUM_DRAWER_ITEM_POS + 1, false);


    if(firstRun){
        Toast.makeText(this, "Scanning for music...", Toast.LENGTH_LONG).show();
        scanForMusic();
        firstRun = false;

        if(Config.getLastSong(getApplicationContext()) != null){
            drawer.setSelection(Config.NOW_PLAYING_DRAWER_ITEM_POS+1, true);
        } else {
            drawer.setSelection(Config.ALL_SONGS_DRAWER_ITEM_POS+1, true);
        }

    }
    populateAlbumList();
}
 
开发者ID:chenshuiluke,项目名称:BeatPulse,代码行数:29,代码来源:MainActivity.java

示例14: onCreate

import com.mikepenz.materialdrawer.Drawer; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Realm.init(getApplicationContext());
    setContentView(R.layout.activity_all_songs);


    Toolbar toolbar = (Toolbar) findViewById(R.id.fourthToolbar);
    setSupportActionBar(toolbar);
    Drawer drawer = DrawerInitializer.createDrawer(this, this, toolbar);

    drawer.getActionBarDrawerToggle().setDrawerIndicatorEnabled(true);
    Config.setActiveDrawer(drawer);
    layoutManager = new LinearLayoutManager(getApplicationContext());
    recyclerView = (RecyclerView) findViewById(R.id.allSongsRecyclerView);
    recyclerView.setLayoutManager(layoutManager);

    Realm realm = Realm.getDefaultInstance();
    RealmResults<Song> songs = realm.where(Song.class).findAll();

    ArrayList<Song> songList = new ArrayList<>();
    songList.addAll(songs);



    AllSongAdapter songAdapter = new AllSongAdapter(songList, this);
    recyclerView.setAdapter(songAdapter);

}
 
开发者ID:chenshuiluke,项目名称:BeatPulse,代码行数:30,代码来源:AllSongsActivity.java

示例15: onCreate

import com.mikepenz.materialdrawer.Drawer; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Timber.v("onCreate() Called");

    // Redirect to Launch activity if we can't inject the Team Component.
    TeamComponent teamComponent = ((App) getApplication()).getTeamComponent();
    if (teamComponent == null) {
        LaunchActivity.launch(this);
        finish();
        return;
    }
    teamComponent.inject(this);

    setContentView(R.layout.ac_main);
    ButterKnife.bind(this);

    setSupportActionBar(toolbar);

    // Set up the drawer.
    drawer = new DrawerBuilder()
            .withActivity(this)
            .withToolbar(toolbar)
            .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
                @Override
                public boolean onItemClick(final View view, final int position, final IDrawerItem drawerItem) {
                    return presenter.drawerItemClicked(drawer, position, drawerItem);
                }
            })
            .build();

    // Disable pull to refresh.
    postsRefreshView.setEnabled(false);

    // Connect to the presenter.
    presenter.takeView(this, savedInstanceState);
}
 
开发者ID:grundleborg,项目名称:matterdroid,代码行数:38,代码来源:MainActivity.java


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