本文整理汇总了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;
}
})
);
}
示例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;
}
})
);
}
示例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);
}
示例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();
}
示例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;
}
示例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;
}
};
}
示例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();
}
示例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();
}
示例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);
}
}
示例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();
}
}
示例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);
}
示例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());
}
示例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();
}
示例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);
}
示例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);
}