本文整理汇总了Java中net.simonvt.menudrawer.MenuDrawer类的典型用法代码示例。如果您正苦于以下问题:Java MenuDrawer类的具体用法?Java MenuDrawer怎么用?Java MenuDrawer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MenuDrawer类属于net.simonvt.menudrawer包,在下文中一共展示了MenuDrawer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onBackPressed
import net.simonvt.menudrawer.MenuDrawer; //导入依赖的package包/类
@Override
public void onBackPressed() {
final int drawerState = mMenuDrawer.getDrawerState();
if (drawerState == MenuDrawer.STATE_OPEN || drawerState == MenuDrawer.STATE_OPENING) {
mMenuDrawer.closeMenu();
return;
} else {
if (isTaskRoot()) {
Intent homeIntent = new Intent(Intent.ACTION_MAIN);
homeIntent.addCategory(Intent.CATEGORY_HOME);
homeIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(homeIntent);
return;
}
}
super.onBackPressed();
}
示例2: addMenu
import net.simonvt.menudrawer.MenuDrawer; //导入依赖的package包/类
private void addMenu() {
mMenuDrawer = MenuDrawer.attach(this);
List<Object> items = new ArrayList<Object>();
items.add(new Category("Futbol Sala '13-'14"));
items.add(new Fase("1a Fase", R.drawable.green, 1314, 1));
items.add(new Fase("2a Fase", R.drawable.yellow, 1314, 2));
items.add(new Fase("3a Fase", R.drawable.red, 1314, 3));
items.add(new Category("Futbol Sala '12-'13"));
items.add(new Fase("1a Fase", R.drawable.yellow, 1213, 1));
items.add(new Fase("2a Fase", R.drawable.red, 1213, 2));
mList = new ListView(this);
mAdapter = new MenuAdapter(this, items);
mAdapter.setListener(this);
mAdapter.setActivePosition(mActivePosition);
mList.setAdapter(mAdapter);
mList.setOnItemClickListener(mItemClickListener);
mMenuDrawer.setMenuView(mList);
mMenuDrawer.setSlideDrawable(R.drawable.ic_drawer);
mMenuDrawer.setDrawerIndicatorEnabled(true);
}
示例3: appendMenuDrawer
import net.simonvt.menudrawer.MenuDrawer; //导入依赖的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;
}
示例4: initMenu
import net.simonvt.menudrawer.MenuDrawer; //导入依赖的package包/类
private void initMenu() {
try {
menuDrawer = MenuDrawer.attach(this);
final BootstrapService provider = serviceProvider.getService(this);
SafeAsyncTask<List<LanguageGroup>> languageTask = new SafeAsyncTask<List<LanguageGroup>>() {
@Override
public List<LanguageGroup> call() throws Exception {
return provider.getLanguages(getCacheDir());
}
@Override
protected void onSuccess(List<LanguageGroup> languageGroups) throws Exception {
drawMenu(languageGroups);
}
};
languageTask.execute();
} catch (IOException e) {
e.printStackTrace();
}
}
示例5: onCreate
import net.simonvt.menudrawer.MenuDrawer; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Init Device Data
DeviceData.initDeviceScreenSize(this);
mDrawer = MenuDrawer.attach(this);
mDrawer.setContentView(R.layout.activity_main);
mActionBar = getSupportActionBar();
mFragmentManager = getSupportFragmentManager();
progressLayout = (RelativeLayout) findViewById(R.id.main_progress);
initImageLoader();
initDrawer();
versionCheck();
//search when start app first time.
((GridFragment)getSupportFragmentManager().findFragmentById(R.id.grid_fragment)).Search();
}
示例6: onBackPressed
import net.simonvt.menudrawer.MenuDrawer; //导入依赖的package包/类
@Override
public void onBackPressed()
{
final int drawerState = menuDrawer.getDrawerState();
if (drawerState == MenuDrawer.STATE_OPEN || drawerState == MenuDrawer.STATE_OPENING)
{
menuDrawer.closeMenu(true);
return;
}
finish();
super.onBackPressed();
}
示例7: onBackPressed
import net.simonvt.menudrawer.MenuDrawer; //导入依赖的package包/类
@Override
public void onBackPressed()
{
final int drawerState = menuDrawer.getDrawerState();
if (drawerState == MenuDrawer.STATE_OPEN || drawerState == MenuDrawer.STATE_OPENING)
{
menuDrawer.closeMenu(true);
return;
}
super.onBackPressed();
}
示例8: initMenuDrawer
import net.simonvt.menudrawer.MenuDrawer; //导入依赖的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());
}
示例9: onBackPressed
import net.simonvt.menudrawer.MenuDrawer; //导入依赖的package包/类
@Override
public void onBackPressed() {
final int drawerState = mMenuDrawer.getDrawerState();
if (drawerState == MenuDrawer.STATE_OPEN
|| drawerState == MenuDrawer.STATE_OPENING) {
mMenuDrawer.closeMenu();
return;
}
ActivityCollector.finishAll();
super.onBackPressed();
}
示例10: onBackPressed
import net.simonvt.menudrawer.MenuDrawer; //导入依赖的package包/类
@Override
public void onBackPressed() {
if (mMenuDrawer != null) {
final int drawerState = mMenuDrawer.getDrawerState();
if (drawerState == MenuDrawer.STATE_OPEN ||
drawerState == MenuDrawer.STATE_OPENING) {
mMenuDrawer.closeMenu();
return;
}
}
super.onBackPressed();
}
示例11: onCreate
import net.simonvt.menudrawer.MenuDrawer; //导入依赖的package包/类
@Override
protected void onCreate(Bundle inState) {
super.onCreate(inState);
initImageLoader(this);
ShareSDK.initSDK(this);
mDrawer = MenuDrawer.attach(this, MenuDrawer.Type.OVERLAY);
menuView = LayoutInflater.from(this)
.inflate(R.layout.home_activity_menu, null, false);
contentView = LayoutInflater.from(this)
.inflate(R.layout.home, null, false);
actionDiscover = (ImageView) findViewById(R.id.action_discover);
setActionBar();
mDrawer.setMenuView(menuView);
setLoginUserInfo();
//设置主页面
initMenuContent(HANDPICK_FRAGMENT);
mDrawer.setContentView(contentView);
mDrawer.setSlideDrawable(R.drawable.icon_more);
mDrawer.setDrawerIndicatorEnabled(true);
mDrawer.peekDrawer(1000, 0);
mDrawer.closeMenu();
setLisenerOfDrawer();
bindViews();
}
示例12: setLisenerOfDrawer
import net.simonvt.menudrawer.MenuDrawer; //导入依赖的package包/类
private void setLisenerOfDrawer(){
mDrawer.setOnDrawerStateChangeListener(new MenuDrawer.OnDrawerStateChangeListener() {
@Override
public void onDrawerStateChange(int oldState, int newState) {
if (oldState < newState) {
direction = true;
}else {
direction = false;
}
}
@Override
public void onDrawerSlide(float openRatio, int offsetPixels) {
int lastOffset = 0;
if (Math.abs(lastOffset-offsetPixels) > 2) {
Message msg = mHandler.obtainMessage();
Bundle bundle = new Bundle();
bundle.putInt("offset", offsetPixels);
msg.setData(bundle);
mHandler.sendMessage(msg);
lastOffset = offsetPixels;
}
}
});
}
示例13: setDrawer
import net.simonvt.menudrawer.MenuDrawer; //导入依赖的package包/类
private void setDrawer() {
mMenuDrawer = MenuDrawer.attach(this, MenuDrawer.Type.OVERLAY);
mMenuDrawer.setContentView(R.layout.main);
int mTheme = PreferenceHelper.getTheme(this);
if (mTheme == R.style.MyLightTheme)
mMenuDrawer.setMenuView(R.layout.left_menu_light);
else
mMenuDrawer.setMenuView(R.layout.left_menu);
mMenuDrawer.setSlideDrawable(R.drawable.ic_drawer_black);
// Whether the previous drawable should be shown
mMenuDrawer.setDrawerIndicatorEnabled(true);
initLeftMenu();
}
示例14: dispatchKeyEvent
import net.simonvt.menudrawer.MenuDrawer; //导入依赖的package包/类
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
final int drawerState = mMenuDrawer.getDrawerState();
if (drawerState == MenuDrawer.STATE_OPEN
|| drawerState == MenuDrawer.STATE_OPENING) {
mMenuDrawer.closeMenu();
return true;
}
if (event.getKeyCode() == KeyEvent.KEYCODE_BACK
&& event.getAction() == KeyEvent.ACTION_DOWN) {
MainActivityExit();
}
return super.dispatchKeyEvent(event);
}
示例15: onBackPressed
import net.simonvt.menudrawer.MenuDrawer; //导入依赖的package包/类
@Override
public void onBackPressed() {
final int drawerState = mMenuDrawer.getDrawerState();
if (drawerState == MenuDrawer.STATE_OPEN || drawerState == MenuDrawer.STATE_OPENING) {
mMenuDrawer.closeMenu();
return;
}
super.onBackPressed();
}