當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。