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


Java MenuDrawer类代码示例

本文整理汇总了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();
	
}
 
开发者ID:Nightonke,项目名称:TimeFleeting,代码行数:20,代码来源:MainActivity.java

示例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);
}
 
开发者ID:YerayAlonso,项目名称:LligaIntermunicipal,代码行数:23,代码来源:MainActivity.java

示例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;
}
 
开发者ID:ais-albania,项目名称:ZalartAndroid,代码行数:23,代码来源:BaseActivity.java

示例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();
    }
}
 
开发者ID:GreySyntax,项目名称:Ghostbin-for-Android,代码行数:24,代码来源:PasteActivity.java

示例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();
}
 
开发者ID:rishubil,项目名称:GalbijjimSearcher,代码行数:21,代码来源:MainActivity.java

示例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();
}
 
开发者ID:ultrasonic,项目名称:ultrasonic,代码行数:16,代码来源:HelpActivity.java

示例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();
}
 
开发者ID:ultrasonic,项目名称:ultrasonic,代码行数:14,代码来源:SubsonicTabActivity.java

示例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());
}
 
开发者ID:minixalpha,项目名称:Webo,代码行数:31,代码来源:MainPageActivity.java

示例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();
}
 
开发者ID:minixalpha,项目名称:Webo,代码行数:12,代码来源:MainPageActivity.java

示例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();
}
 
开发者ID:brk3,项目名称:glimmr,代码行数:13,代码来源:MainActivity.java

示例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();
    
}
 
开发者ID:SimonJoker,项目名称:OnTheRoad,代码行数:32,代码来源:HomeActivity.java

示例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;
		}	
		
	}
});
  }
 
开发者ID:SimonJoker,项目名称:OnTheRoad,代码行数:30,代码来源:HomeActivity.java

示例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();
}
 
开发者ID:Consoar,项目名称:zhangshangwuda,代码行数:14,代码来源:MainActivity.java

示例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);
}
 
开发者ID:Consoar,项目名称:zhangshangwuda,代码行数:15,代码来源:MainActivity.java

示例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();
}
 
开发者ID:YerayAlonso,项目名称:LligaIntermunicipal,代码行数:11,代码来源:MainActivity.java


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