本文整理汇总了Java中net.simonvt.menudrawer.Position类的典型用法代码示例。如果您正苦于以下问题:Java Position类的具体用法?Java Position怎么用?Java Position使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Position类属于net.simonvt.menudrawer包,在下文中一共展示了Position类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: appendMenuDrawer
import net.simonvt.menudrawer.Position; //导入依赖的package包/类
private MenuDrawer appendMenuDrawer() {
MenuDrawer menuDrawer = null;
if (mXLargeDevice) {
if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
menuDrawer = MenuDrawer.attach(this,
MenuDrawer.MENU_DRAG_CONTENT, Position.LEFT, true);
getSupportActionBar().setDisplayHomeAsUpEnabled(false);
} else {
menuDrawer = MenuDrawer.attach(this,
MenuDrawer.MENU_DRAG_CONTENT);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
} else {
menuDrawer = MenuDrawer.attach(this, MenuDrawer.MENU_DRAG_CONTENT);
}
int shadowSizeInPixels = getResources().getDimensionPixelSize(
R.dimen.menu_shadow_width);
menuDrawer.setDropShadowSize(shadowSizeInPixels);
menuDrawer.setDropShadowColor(getResources().getColor(
R.color.md_shadowColor));
return menuDrawer;
}
示例2: initMenuDrawer
import net.simonvt.menudrawer.Position; //导入依赖的package包/类
private void initMenuDrawer() {
mMenuDrawer = MenuDrawer.attach(this, MenuDrawer.Type.BEHIND,
Position.LEFT, MenuDrawer.MENU_DRAG_CONTENT);
View view = LayoutInflater.from(this).inflate(R.layout.left_menu, null);
mMenuDrawer.setMenuView(view);
mMenuDrawer.setContentView(R.layout.activity_main_page);
mMenuDrawer.setSlideDrawable(R.drawable.ic_drawer_dark);
mMenuDrawer.setDrawerIndicatorEnabled(true);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
getActionBar().setDisplayHomeAsUpEnabled(true);
}
// 拖拽屏幕边缘时才会弹出
mMenuDrawer.setTouchMode(MenuDrawer.TOUCH_MODE_BEZEL);
mMenuDrawer
.setOnInterceptMoveEventListener(new MenuDrawer.OnInterceptMoveEventListener() {
@Override
public boolean isViewDraggable(View v, int dx, int x, int y) {
if (v == mViewPager) {
return !(mPagerPosition == 0 && mPagerOffsetPixels == 0)
|| dx < 0;
}
return false;
}
});
initLefMenu(mMenuDrawer.getMenuView());
}
示例3: initializeMenuDrawer
import net.simonvt.menudrawer.Position; //导入依赖的package包/类
private void initializeMenuDrawer() {
mMenuDrawer = MenuDrawer.attach(this, MenuDrawer.Type.OVERLAY, Position.LEFT, MenuDrawer.MENU_DRAG_WINDOW);
mMenuDrawer.setMenuView(R.layout.subreddit_menudrawer);
mMenuDrawer.getMenuContainer().setBackgroundColor(0xf51b1b1b);
mMenuDrawer.setSlideDrawable(R.drawable.ic_drawer);
mMenuDrawer.setDrawerIndicatorEnabled(true);
mMenuDrawer.setMenuSize(getResources().getDimensionPixelSize(R.dimen.menu_size));
}
示例4: onCreate
import net.simonvt.menudrawer.Position; //导入依赖的package包/类
@Override
protected void onCreate(Bundle bundle)
{
setUncaughtExceptionHandler();
applyTheme();
super.onCreate(bundle);
startService(new Intent(this, DownloadServiceImpl.class));
setVolumeControlStream(AudioManager.STREAM_MUSIC);
if (bundle != null)
{
activePosition = bundle.getInt(STATE_ACTIVE_POSITION);
menuActiveViewId = bundle.getInt(STATE_ACTIVE_VIEW_ID);
}
menuDrawer = MenuDrawer.attach(this, MenuDrawer.Type.BEHIND, Position.LEFT, MenuDrawer.MENU_DRAG_WINDOW);
menuDrawer.setMenuView(R.layout.menu_main);
chatMenuItem = findViewById(R.id.menu_chat);
bookmarksMenuItem = findViewById(R.id.menu_bookmarks);
sharesMenuItem = findViewById(R.id.menu_shares);
findViewById(R.id.menu_home).setOnClickListener(this);
findViewById(R.id.menu_browse).setOnClickListener(this);
findViewById(R.id.menu_search).setOnClickListener(this);
findViewById(R.id.menu_playlists).setOnClickListener(this);
findViewById(R.id.menu_podcasts).setOnClickListener(this);
sharesMenuItem.setOnClickListener(this);
chatMenuItem.setOnClickListener(this);
bookmarksMenuItem.setOnClickListener(this);
findViewById(R.id.menu_now_playing).setOnClickListener(this);
findViewById(R.id.menu_settings).setOnClickListener(this);
findViewById(R.id.menu_about).setOnClickListener(this);
findViewById(R.id.menu_exit).setOnClickListener(this);
setActionBarDisplayHomeAsUp(true);
TextView activeView = (TextView) findViewById(menuActiveViewId);
if (activeView != null)
{
menuDrawer.setActiveView(activeView);
}
}
示例5: initMenuDrawer
import net.simonvt.menudrawer.Position; //导入依赖的package包/类
private void initMenuDrawer() {
mMenuDrawer = MenuDrawer.attach(this, MenuDrawer.Type.OVERLAY,
Position.LEFT);
mMenuDrawer.setContentView(R.layout.main_activity);
/* The drawable that replaces the up indicator in the action bar */
mMenuDrawer.setSlideDrawable(R.drawable.ic_drawer);
mMenuDrawer.setDrawerIndicatorEnabled(true);
MenuListView menuListView = new MenuListView(this);
menuListView.setDivider(null);
menuListView.setDividerHeight(0);
menuListView.setCacheColorHint(0);
menuListView.setBackgroundResource(R.drawable.navy_blue_tiled);
menuListView.setSelector(R.drawable.selectable_background_glimmrdark);
menuListView.setAdapter(mMenuAdapter);
menuListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
switch (mMenuAdapter.getItemViewType(position)) {
case MENU_DRAWER_ITEM:
mViewPager.setCurrentItem(position);
mActivePosition = position;
mMenuDrawer.setActiveView(view, position);
mMenuDrawer.closeMenu();
break;
case MENU_DRAWER_ACTIVITY_ITEM:
/* offset the position by number of content items + 1
* for the category item */
startViewerForActivityItem(position - mContent.size() - 1);
break;
}
}
});
menuListView.setOnScrollChangedListener(
new MenuListView.OnScrollChangedListener() {
@Override
public void onScrollChanged() {
mMenuDrawer.invalidate();
}
});
/* If first run, make the "up" button blink until clicked */
final boolean isFirstRun = mPrefs.getBoolean(
Constants.KEY_IS_FIRST_RUN, true);
if (isFirstRun) {
if (BuildConfig.DEBUG) Log.d(TAG, "First run");
mMenuDrawer.peekDrawer();
}
mMenuDrawer.setMenuView(menuListView);
mActionBar.setDisplayHomeAsUpEnabled(true);
mMenuDrawer.setTouchMode(MenuDrawer.TOUCH_MODE_FULLSCREEN);
mMenuDrawer.setOnDrawerStateChangeListener(
new MenuDrawer.OnDrawerStateChangeListener() {
@Override
public void onDrawerStateChange(int oldState,
int newState) {
if (newState == MenuDrawer.STATE_OPEN) {
if (activityItemsNeedsUpdate()) {
updateMenuListItems(false);
}
}
}
@Override
public void onDrawerSlide(float openRatio,
int offsetPixels) {
}
});
updateMenuListItems(false);
}