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


Java MenuDrawer.attach方法代码示例

本文整理汇总了Java中net.simonvt.menudrawer.MenuDrawer.attach方法的典型用法代码示例。如果您正苦于以下问题:Java MenuDrawer.attach方法的具体用法?Java MenuDrawer.attach怎么用?Java MenuDrawer.attach使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.simonvt.menudrawer.MenuDrawer的用法示例。


在下文中一共展示了MenuDrawer.attach方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: initializeMenuDrawer

import net.simonvt.menudrawer.MenuDrawer; //导入方法依赖的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));
}
 
开发者ID:antew,项目名称:RedditInPictures,代码行数:9,代码来源:BaseFragmentActivityWithMenu.java

示例9: onCreate

import net.simonvt.menudrawer.MenuDrawer; //导入方法依赖的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);
	}
}
 
开发者ID:ultrasonic,项目名称:ultrasonic,代码行数:45,代码来源:SubsonicTabActivity.java

示例10: initMenuDrawer

import net.simonvt.menudrawer.MenuDrawer; //导入方法依赖的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);
}
 
开发者ID:brk3,项目名称:glimmr,代码行数:72,代码来源:MainActivity.java

示例11: initMenuDrawer

import net.simonvt.menudrawer.MenuDrawer; //导入方法依赖的package包/类
private void initMenuDrawer() {
	// 覆盖在View之前的侧边栏菜单
	mMenuDrawer = MenuDrawer.attach(this, MenuDrawer.Type.BEHIND);
	mMenuDrawer.setMenuSize(Math.round(0.6f * SystemUtils
			.getDisplayWidth(this)));
	// View之后的侧边栏菜单
	// mMenuDrawer = MenuDrawer.attach(this, MenuDrawer.Type.BEHIND,
	// Position.LEFT, MenuDrawer.MENU_DRAG_CONTENT);
	mMenuListView = (ListView) LayoutInflater.from(this).inflate(
			R.layout.sidemenu_listview, null);
	mMenuDrawer.setMenuView(mMenuListView);
	mMenuDrawer.setTouchMode(MenuDrawer.TOUCH_MODE_FULLSCREEN);
	mMenuDrawer
			.setOnInterceptMoveEventListener(new MenuDrawer.OnInterceptMoveEventListener() {
				@Override
				public boolean isViewDraggable(View v, int dx, int x, int y) {
					if (v == mMainViewPager) {
						return !(mPagerPosition == 0 && mPagerOffsetPixels == 0)
								|| dx < 0;
					}
					return false;
				}
			});
	mMenuDrawer
			.setOnDrawerStateChangeListener(new OnDrawerStateChangeListener() {

				@Override
				public void onDrawerStateChange(int oldState, int newState) {
					// TODO Auto-generated method stub

				}

				@Override
				public void onDrawerSlide(float openRatio, int offsetPixels) {
					// TODO Auto-generated method stub
					changeBlurImageViewAlpha(openRatio);
				}
			});
	mMenuAdapter = new SideMenuAdapter(this);
	// mMenuAdapter.addContent(mTmpCities);
	mMenuListView.setAdapter(mMenuAdapter);
	mMenuListView.setOnItemClickListener(mItemClickListener);
}
 
开发者ID:way1989,项目名称:WayHoo,代码行数:44,代码来源:MainActivity.java


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