Java Code Examples for com.jeremyfeinstein.slidingmenu.lib.SlidingMenu#setShadowWidthRes()

The following examples show how to use com.jeremyfeinstein.slidingmenu.lib.SlidingMenu#setShadowWidthRes() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HomeActivity.java    From Moring-Alarm with Apache License 2.0 6 votes vote down vote up
private void initSlideMenu() {
        setBehindContentView(R.layout.menu_home);
        //获取到slidingMenu对象
        SlidingMenu slidingMenu = getSlidingMenu();
        slidingMenu.setMode(SlidingMenu.RIGHT);
        slidingMenu.setShadowWidthRes(R.dimen.shadow_width);
        slidingMenu.setShadowDrawable(R.drawable.shadow);

        //设置为全屏拉出菜单
        slidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
        //设置菜单拉出后剩余屏幕宽度
//让侧拉菜单充满屏幕的四分之三
        int menuWidth=getWitdh();
        slidingMenu.setBehindOffset(menuWidth);
        slidingMenu.setOnCloseListener(new SlidingMenu.OnCloseListener() {
            @Override
            public void onClose() {
                Log.d("changecity", "菜单关闭");
                mFragWether.refreshData();
                mFragSlideMenu.stopAlarmMusic();
            }
        });
    }
 
Example 2
Source File: MainActivity.java    From buddycloud-android with Apache License 2.0 6 votes vote down vote up
private void customizeMenu() {
	SlidingMenu sm = getSlidingMenu();
	sm.setShadowWidthRes(R.dimen.shadow_width);
	sm.setShadowDrawable(R.drawable.shadow);
	sm.setBehindOffsetRes(R.dimen.slidingmenu_offset);
	sm.setFadeDegree(0.15f);
	sm.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
	sm.setOnOpenedListener(new OnOpenedListener() {
		@Override
		public void onOpened() {
			fragmentChanged();
		}
	});
	
	sm.setOnClosedListener(new OnClosedListener() {
		@Override
		public void onClosed() {
			fragmentChanged();
		}
	});
}
 
Example 3
Source File: AttachExample.java    From Moring-Alarm with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	setTitle(R.string.attach);

	// set the Above View
	setContentView(R.layout.content_frame);
	getSupportFragmentManager()
	.beginTransaction()
	.replace(R.id.content_frame, new SampleListFragment())
	.commit();

	// configure the SlidingMenu
	menu = new SlidingMenu(this);
	menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
	menu.setShadowWidthRes(R.dimen.shadow_width);
	menu.setShadowDrawable(R.drawable.shadow);
	menu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
	menu.setFadeDegree(0.35f);
	menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
	menu.setMenu(R.layout.menu_frame);
	getSupportFragmentManager()
	.beginTransaction()
	.replace(R.id.menu_frame, new SampleListFragment())
	.commit();
}
 
Example 4
Source File: AttachExample.java    From Moring-Alarm with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	setTitle(R.string.attach);

	// set the Above View
	setContentView(R.layout.content_frame);
	getSupportFragmentManager()
	.beginTransaction()
	.replace(R.id.content_frame, new SampleListFragment())
	.commit();

	// configure the SlidingMenu
	menu = new SlidingMenu(this);
	menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
	menu.setShadowWidthRes(R.dimen.shadow_width);
	menu.setShadowDrawable(R.drawable.shadow);
	menu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
	menu.setFadeDegree(0.35f);
	menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
	menu.setMenu(R.layout.menu_frame);
	getSupportFragmentManager()
	.beginTransaction()
	.replace(R.id.menu_frame, new SampleListFragment())
	.commit();
}
 
Example 5
Source File: SubCategoryActivity.java    From wallpaper with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	currentPageSubLatest = 0;
	currentPageSubRecommended = 0;
	currentPageHottest = 0;
	currentPage = 0;
	isFromRefreshDataSubLatest = true;
	isFromRefreshDataSubRecommended = true;
	isFromRefreshDataHottest = true;
	latestGroups = new ArrayList<Group>();
	recommendedGroups = new ArrayList<Group>();
	hottestGroups = new ArrayList<Group>();
	setContentView(R.layout.activity_subcategory);

	subcategory_title_textview = (TextView) findViewById(R.id.subcategory_title_textview);
	subcategoryBackImage = (ImageView) findViewById(R.id.subcategory_back_image);
	subcategoryBackImage.setOnClickListener(this);

	pager = (ViewPager) findViewById(R.id.pager);
	pager.setOffscreenPageLimit(2);
	fragments = new ArrayList<Fragment>();

	SubLatestFragment sublatestFragment = new SubLatestFragment();
	SubRecommendedFragment subrecommendedFragment = new SubRecommendedFragment();
	HottestFragment hottestfragment = new HottestFragment();
	fragments.add(sublatestFragment);
	fragments.add(subrecommendedFragment);
	fragments.add(hottestfragment);

	latestButton = (RadioButton) findViewById(R.id.radio_sub_latest);
	latestButton.setOnClickListener(this);
	recommendedButton = (RadioButton) findViewById(R.id.radio_sub_recommended);
	recommendedButton.setOnClickListener(this);
	hottestButton = (RadioButton) findViewById(R.id.radio_hottest);
	hottestButton.setOnClickListener(this);

	mAdapter = new ViewPagerAdapter(getSupportFragmentManager(), fragments);
	pager.setAdapter(mAdapter);
	menu = new SlidingMenu(this);
	menu.setMode(SlidingMenu.LEFT);
	menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
	menu.setShadowWidthRes(R.dimen.shadow_width);
	menu.setShadowDrawable(R.drawable.slidingmenu_shadow);
	menu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
	menu.setFadeDegree(0.35f);
	menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
	menu.setMenu(R.layout.layout_menu);
	menu.setMode(SlidingMenu.LEFT);
	menu.setMenu(R.layout.layout_menu);
	long screenWidth = WallWrapperEnvConfigure.getScreenWidth();
	menu.setBehindWidth((int) (screenWidth * 0.7));

	pager.setOnPageChangeListener(this);

	menuListView = (ListView) menu.getMenu().findViewById(R.id.menu_listview);
	menuListView.setAdapter(new MenuListViewAdapter(this));
	menuListView.setOnItemClickListener(this);
}
 
Example 6
Source File: MainActivity.java    From wallpaper with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	UmengUpdateAgent.update(this);

	currentPageLatest = 0;
	currentPageRecommended = 0;
	currentPage = 0;
	isFromRefreshData = true;
	isFromRefreshDataRecommended = true;
	latestGroups = new ArrayList<Group>();
	recommendedGroups = new ArrayList<Group>();

	setContentView(R.layout.activity_main);

	pager = (ViewPager) findViewById(R.id.main_pager);
	pager.setOffscreenPageLimit(2);

	fragments = new ArrayList<Fragment>();
	menuImageView = (ImageView) findViewById(R.id.main_menu_imageView);
	menuImageView.setOnClickListener(this);// 菜单点击
	searchImageView = (ImageView) findViewById(R.id.main_search_imageview);
	searchImageView.setOnClickListener(this);// 搜索点击

	recommendedButton = (RadioButton) findViewById(R.id.main_recommended_radio);
	recommendedButton.setOnClickListener(this);
	latestButton = (RadioButton) findViewById(R.id.main_latest_radio);
	latestButton.setOnClickListener(this);
	categoryButton = (RadioButton) findViewById(R.id.main_category_radio);
	categoryButton.setOnClickListener(this);

	LatestFragment latestFragment = new LatestFragment();
	RecommendedFragment recommendedFragment = new RecommendedFragment();
	CategoryFragment categoryFragment = new CategoryFragment();
	categoryFragment.setCategoryFragmentListener(this);

	fragments.add(latestFragment);
	fragments.add(recommendedFragment);
	fragments.add(categoryFragment);

	mAdapter = new ViewPagerAdapter(getSupportFragmentManager(), fragments);
	pager.setAdapter(mAdapter);
	pager.setOnPageChangeListener(this);

	menu = new SlidingMenu(this);
	menu.setMode(SlidingMenu.LEFT);
	menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
	menu.setShadowWidthRes(R.dimen.shadow_width);

	menu.setShadowDrawable(R.drawable.slidingmenu_shadow);
	menu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
	menu.setFadeDegree(0.35f);
	menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
	menu.setMenu(R.layout.layout_menu);
	menu.setMode(SlidingMenu.LEFT);
	menu.setMenu(R.layout.layout_menu);
	long screenWidth = WallWrapperEnvConfigure.getScreenWidth();
	menu.setBehindWidth((int) (screenWidth * 0.7));

	menuListView = (ListView) menu.getMenu().findViewById(R.id.menu_listview);
	menuListView.setAdapter(new MenuListViewAdapter(this));
	menuListView.setOnItemClickListener(this);

}
 
Example 7
Source File: SubCategoryActivity.java    From wallpaper with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	currentPageSubLatest = 0;
	currentPageSubRecommended = 0;
	currentPageHottest = 0;
	currentPage = 0;
	isFromRefreshDataSubLatest = true;
	isFromRefreshDataSubRecommended = true;
	isFromRefreshDataHottest = true;
	latestGroups = new ArrayList<Group>();
	recommendedGroups = new ArrayList<Group>();
	hottestGroups = new ArrayList<Group>();
	setContentView(R.layout.activity_subcategory);

	subcategory_title_textview = (TextView) findViewById(R.id.subcategory_title_textview);
	subcategoryBackImage = (ImageView) findViewById(R.id.subcategory_back_image);
	subcategoryBackImage.setOnClickListener(this);

	pager = (ViewPager) findViewById(R.id.pager);
	pager.setOffscreenPageLimit(2);
	fragments = new ArrayList<Fragment>();

	SubLatestFragment sublatestFragment = new SubLatestFragment();
	SubRecommendedFragment subrecommendedFragment = new SubRecommendedFragment();
	HottestFragment hottestfragment = new HottestFragment();
	fragments.add(sublatestFragment);
	fragments.add(subrecommendedFragment);
	fragments.add(hottestfragment);

	latestButton = (RadioButton) findViewById(R.id.radio_sub_latest);
	latestButton.setOnClickListener(this);
	recommendedButton = (RadioButton) findViewById(R.id.radio_sub_recommended);
	recommendedButton.setOnClickListener(this);
	hottestButton = (RadioButton) findViewById(R.id.radio_hottest);
	hottestButton.setOnClickListener(this);

	mAdapter = new ViewPagerAdapter(getSupportFragmentManager(), fragments);
	pager.setAdapter(mAdapter);
	menu = new SlidingMenu(this);
	menu.setMode(SlidingMenu.LEFT);
	menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
	menu.setShadowWidthRes(R.dimen.shadow_width);
	menu.setShadowDrawable(R.drawable.slidingmenu_shadow);
	menu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
	menu.setFadeDegree(0.35f);
	menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
	menu.setMenu(R.layout.layout_menu);
	menu.setMode(SlidingMenu.LEFT);
	menu.setMenu(R.layout.layout_menu);
	long screenWidth = WallWrapperEnvConfigure.getScreenWidth();
	menu.setBehindWidth((int) (screenWidth * 0.7));

	pager.setOnPageChangeListener(this);

	menuListView = (ListView) menu.getMenu().findViewById(R.id.menu_listview);
	menuListView.setAdapter(new MenuListViewAdapter(this));
	menuListView.setOnItemClickListener(this);
}
 
Example 8
Source File: MainActivity.java    From wallpaper with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	UmengUpdateAgent.update(this);

	currentPageLatest = 0;
	currentPageRecommended = 0;
	currentPage = 0;
	isFromRefreshData = true;
	isFromRefreshDataRecommended = true;
	latestGroups = new ArrayList<Group>();
	recommendedGroups = new ArrayList<Group>();

	setContentView(R.layout.activity_main);

	pager = (ViewPager) findViewById(R.id.main_pager);
	pager.setOffscreenPageLimit(2);

	fragments = new ArrayList<Fragment>();
	menuImageView = (ImageView) findViewById(R.id.main_menu_imageView);
	menuImageView.setOnClickListener(this);// 菜单点击
	searchImageView = (ImageView) findViewById(R.id.main_search_imageview);
	searchImageView.setOnClickListener(this);// 搜索点击

	recommendedButton = (RadioButton) findViewById(R.id.main_recommended_radio);
	recommendedButton.setOnClickListener(this);
	latestButton = (RadioButton) findViewById(R.id.main_latest_radio);
	latestButton.setOnClickListener(this);
	categoryButton = (RadioButton) findViewById(R.id.main_category_radio);
	categoryButton.setOnClickListener(this);

	LatestFragment latestFragment = new LatestFragment();
	RecommendedFragment recommendedFragment = new RecommendedFragment();
	CategoryFragment categoryFragment = new CategoryFragment();
	categoryFragment.setCategoryFragmentListener(this);

	fragments.add(latestFragment);
	fragments.add(recommendedFragment);
	fragments.add(categoryFragment);

	mAdapter = new ViewPagerAdapter(getSupportFragmentManager(), fragments);
	pager.setAdapter(mAdapter);
	pager.setOnPageChangeListener(this);

	menu = new SlidingMenu(this);
	menu.setMode(SlidingMenu.LEFT);
	menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
	menu.setShadowWidthRes(R.dimen.shadow_width);

	menu.setShadowDrawable(R.drawable.slidingmenu_shadow);
	menu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
	menu.setFadeDegree(0.35f);
	menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
	menu.setMenu(R.layout.layout_menu);
	menu.setMode(SlidingMenu.LEFT);
	menu.setMenu(R.layout.layout_menu);
	long screenWidth = WallWrapperEnvConfigure.getScreenWidth();
	menu.setBehindWidth((int) (screenWidth * 0.7));

	menuListView = (ListView) menu.getMenu().findViewById(R.id.menu_listview);
	menuListView.setAdapter(new MenuListViewAdapter(this));
	menuListView.setOnItemClickListener(this);

}
 
Example 9
Source File: ResponsiveUIActivity.java    From Moring-Alarm with Apache License 2.0 4 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setTitle(R.string.responsive_ui);

	setContentView(R.layout.responsive_content_frame);

	// check if the content frame contains the menu frame
	if (findViewById(R.id.menu_frame) == null) {
		setBehindContentView(R.layout.menu_frame);
		getSlidingMenu().setSlidingEnabled(true);
		getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
		// show home as up so we can toggle
		getSupportActionBar().setDisplayHomeAsUpEnabled(true);
	} else {
		// add a dummy view
		View v = new View(this);
		setBehindContentView(v);
		getSlidingMenu().setSlidingEnabled(false);
		getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_NONE);
	}

	// set the Above View Fragment
	if (savedInstanceState != null)
		mContent = getSupportFragmentManager().getFragment(savedInstanceState, "mContent");
	if (mContent == null)
		mContent = new BirdGridFragment(0);	
	getSupportFragmentManager()
	.beginTransaction()
	.replace(R.id.content_frame, mContent)
	.commit();

	// set the Behind View Fragment
	getSupportFragmentManager()
	.beginTransaction()
	.replace(R.id.menu_frame, new BirdMenuFragment())
	.commit();

	// customize the SlidingMenu
	SlidingMenu sm = getSlidingMenu();
	sm.setBehindOffsetRes(R.dimen.slidingmenu_offset);
	sm.setShadowWidthRes(R.dimen.shadow_width);
	sm.setShadowDrawable(R.drawable.shadow);
	sm.setBehindScrollScale(0.25f);
	sm.setFadeDegree(0.25f);

	// show the explanation dialog
	if (savedInstanceState == null)
		new AlertDialog.Builder(this)
		.setTitle(R.string.what_is_this)
		.setMessage(R.string.responsive_explanation)
		.show();
}
 
Example 10
Source File: ResponsiveUIActivity.java    From Moring-Alarm with Apache License 2.0 4 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setTitle(R.string.responsive_ui);

	setContentView(R.layout.responsive_content_frame);

	// check if the content frame contains the menu frame
	if (findViewById(R.id.menu_frame) == null) {
		setBehindContentView(R.layout.menu_frame);
		getSlidingMenu().setSlidingEnabled(true);
		getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
		// show home as up so we can toggle
		getActionBar().setDisplayHomeAsUpEnabled(true);
	} else {
		// add a dummy view
		View v = new View(this);
		setBehindContentView(v);
		getSlidingMenu().setSlidingEnabled(false);
		getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_NONE);
	}

	// set the Above View Fragment
	if (savedInstanceState != null)
		mContent = getSupportFragmentManager().getFragment(savedInstanceState, "mContent");
	if (mContent == null)
		mContent = new BirdGridFragment(0);	
	getSupportFragmentManager()
	.beginTransaction()
	.replace(R.id.content_frame, mContent)
	.commit();

	// set the Behind View Fragment
	getSupportFragmentManager()
	.beginTransaction()
	.replace(R.id.menu_frame, new BirdMenuFragment())
	.commit();

	// customize the SlidingMenu
	SlidingMenu sm = getSlidingMenu();
	sm.setBehindOffsetRes(R.dimen.slidingmenu_offset);
	sm.setShadowWidthRes(R.dimen.shadow_width);
	sm.setShadowDrawable(R.drawable.shadow);
	sm.setBehindScrollScale(0.25f);
	sm.setFadeDegree(0.25f);

	// show the explanation dialog
	if (savedInstanceState == null)
		new AlertDialog.Builder(this)
		.setTitle(R.string.what_is_this)
		.setMessage(R.string.responsive_explanation)
		.show();
}
 
Example 11
Source File: ActivityMainSliding.java    From BigApp_WordPress_Android with Apache License 2.0 4 votes vote down vote up
@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EventBus.getDefault().register(this);
        if (new SpTool(this, SpTool.SP_SETTING).getBoolean("moon", false)) {
            BaseApplication.sDefaultImageDrawable = R.drawable.z_iv_default_y;
            setTheme(R.style.ActivityThemeMoon);
        } else {
            BaseApplication.sDefaultImageDrawable = R.drawable.z_iv_default;
            setTheme(R.style.ActivityTheme);
        }
        // set the Above View
        if (savedInstanceState != null) {
            mFragmentMainHome = (FragmentMainHome) getSupportFragmentManager().getFragment(savedInstanceState, "mFragmentMainHome");
        }
        if (mFragmentMainHome == null) {
            mFragmentMainHome = new FragmentMainHome();
            mFragmentMainHome.setArguments(getIntent().getExtras());
        }
        setContentView(R.layout.activity_main_sliding);
        getSupportFragmentManager().beginTransaction()
                .replace(R.id.content_frame, mFragmentMainHome)
                .commit();

        // set the Behind View
        setBehindContentView(R.layout.v_layout_sliding_menu);
        if (savedInstanceState != null) {
            mFragmentSlidingMenu = (FragmentSlidingMenu) this.getSupportFragmentManager().findFragmentById(R.id.menu_frame);
        }
        if (mFragmentSlidingMenu == null) {
            mFragmentSlidingMenu = new FragmentSlidingMenu();
            getSupportFragmentManager().beginTransaction()
                    .replace(R.id.menu_frame, mFragmentSlidingMenu)
                    .commit();
        }

        // customize the SlidingMenu
        SlidingMenu sm = getSlidingMenu();
        sm.setShadowWidthRes(R.dimen.slidingmenu_shadow_width);
        sm.setShadowDrawable(R.drawable.v_sliding_menu_shadow);
        sm.setBehindOffset(ScreenTools.getScreenParams(this).width * 3 / 10);
        sm.setFadeDegree(0.35f);
        //设置触摸方式,必须为 TOUCHMODE_FULLSCREEN(全屏可触摸),TOUCHMODE_MARGIN(边缘可触摸),默认 48dp, TOUCHMODE_NONE(不可触摸)三者之一
        sm.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);
        //动画效果
        sm.setBehindScrollScale(0.0f);
        sm.setBackgroundColor(Color.parseColor("#252525"));
        sm.setBehindCanvasTransformer(getTransformer(1));

//		getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    }
 
Example 12
Source File: HomeActivity.java    From Rumble with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_home);
    mTitle = getTitle();

    /* sliding menu with both right and left drawer */
    slidingMenu = new SlidingMenu(this);
    slidingMenu.setShadowWidthRes(R.dimen.shadow_width);
    slidingMenu.setShadowDrawable(R.drawable.shadow);
    slidingMenu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
    slidingMenu.setFadeDegree(0.35f);
    slidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
    slidingMenu.setMode(SlidingMenu.LEFT_RIGHT);
    slidingMenu.setMenu(R.layout.slidingmenu_navigation_drawer);
    slidingMenu.setSecondaryMenu(R.layout.slidingmenu_network_drawer);
    slidingMenu.setSecondaryShadowDrawable(R.drawable.shadowright);
    if (savedInstanceState == null) {
        mNavigationDrawerFragment = new FragmentNavigationDrawer();
        mNetworkDrawerFragment    = new FragmentNetworkDrawer();
        this.getSupportFragmentManager().beginTransaction()
                .replace(R.id.navigation_drawer_frame, mNavigationDrawerFragment).commit();
        this.getSupportFragmentManager().beginTransaction()
                .replace(R.id.network_drawer_frame, mNetworkDrawerFragment).commit();
    } else {
        mNavigationDrawerFragment = (FragmentNavigationDrawer) this.getSupportFragmentManager().findFragmentById(R.id.navigation_drawer_frame);
        mNetworkDrawerFragment = (FragmentNetworkDrawer) this.getSupportFragmentManager().findFragmentById(R.id.network_drawer_frame);
    }
    slidingMenu.attachToActivity(this, SlidingMenu.SLIDING_WINDOW);

    /*
     * the tablayout for status and chat message with a viewpager.
     * note that we cannot swipe views with the viewpager as the swipe
     * gesture is catched by slidingmenu to slide the panel
     */
    TabLayout tabLayout = (TabLayout) findViewById(R.id.home_tab_layout);
    viewPager = (ViewPager) findViewById(R.id.home_viewpager);
    pagerAdapter = new HomePagerAdapter(getSupportFragmentManager());
    viewPager.setAdapter(pagerAdapter);
    viewPager.addOnPageChangeListener(onPageChangeListener);
    tabLayout.setupWithViewPager(viewPager);

    // little hack to set the icons instead of text
    notifStatus = renderTabView(this, R.drawable.ic_world,  (ViewGroup)tabLayout.getParent());
    notifChat   = renderTabView(this, R.drawable.ic_forum_white_24dp, (ViewGroup)tabLayout.getParent());
    tabLayout.getTabAt(0).setCustomView(notifStatus);
    tabLayout.getTabAt(1).setCustomView(notifChat);
    tabLayout.setSelectedTabIndicatorHeight(10);

    // for notification
    refreshStatusNotifications();
    refreshChatNotifications();
    EventBus.getDefault().register(this);
}
 
Example 13
Source File: ZenMainActivity.java    From zen4android with MIT License 4 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	ZenAdsModel model = ZenAdsModel.getInstance();
	model.load();
	getSupportActionBar().setDisplayShowHomeEnabled(false);
	getSupportActionBar().setDisplayHomeAsUpEnabled(true);

	setContentView(R.layout.zen_main_frame);
	mLoading = new ZenLoadingView(this);

	if (findViewById(R.id.zen_menu_frame) == null) {
		setBehindContentView(R.layout.zen_menu_frame);
		getSlidingMenu().setSlidingEnabled(true);
		getSlidingMenu()
				.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
		// show home as up so we can toggle

	} else {
		// add a dummy view
		View v = new View(this);
		setBehindContentView(v);
		getSlidingMenu().setSlidingEnabled(false);
		getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_NONE);
	}

	// set the Behind View Fragment
	getSupportFragmentManager().beginTransaction()
			.replace(R.id.zen_menu_frame, new ZenMenuFragment()).commit();

	// set the Front View Fragment
	ZenThreadsFragment threadsFragment = new ZenThreadsFragment();
	mContent = threadsFragment;
	setTitle("���н�");
	threadsFragment.fid = "34";
	mFid = "34";
	getSupportFragmentManager().beginTransaction()
			.replace(R.id.zen_main_frame, threadsFragment).commit();

	// customize the SlidingMenu
	SlidingMenu sm = getSlidingMenu();
	sm.setBehindOffsetRes(R.dimen.slidingmenu_offset);
	sm.setShadowWidthRes(R.dimen.shadow_width);
	sm.setShadowDrawable(R.drawable.shadow);
	sm.setBehindScrollScale(0.25f);
	sm.setFadeDegree(0.25f);
	ZenMyBoardsModel boardModel = ZenMyBoardsModel.getInstance();
	boardModel.load();
	mHasNewNotification = false;
	try {
		IntentFilter filter = new IntentFilter();
		filter.addAction(ZenNotificationModel.ZEN_NEW_NOTIFICATION);
		filter.addAction(ZenNotificationModel.ZEN_NOTIFICATION_EMPTY);
		registerReceiver(mBroadcastReceiver, filter);

		IntentFilter update = new IntentFilter();
		update.addAction(ZenUpdateManager.ZEN_NEW_VERSION);
		registerReceiver(mUpdateReceiver, update);
	} catch (Exception e) {
		e.printStackTrace();
	}

	ZenUpdateManager.getInstance().CheckUpdate();
}
 
Example 14
Source File: MainActivity.java    From android-kernel-tweaker with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_main_container);
	RootTools.debugMode = false;
	
	boolean access = RootTools.isAccessGiven();
	boolean busybox = RootTools.isBusyboxAvailable();
	if(!access) {
		showRootWarning();
	}
	if(!busybox) {
		showBusyBoxWarning();
	}
	
	mContainer = (FrameLayout) findViewById(R.id.activity_container);
	mContext = this;
	mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
	getActionBar().setDisplayHomeAsUpEnabled(true);
	getActionBar().setHomeButtonEnabled(true);
	View v = this.getLayoutInflater().inflate(R.layout.menu_list, null, false);
	menulist = (ListView) v.findViewById(R.id.navbarlist);
	db = new DatabaseHandler(this);
	vddDb = new VddDatabaseHandler(this);

	menu = new SlidingMenu(this);
	menu.setMode(SlidingMenu.LEFT_RIGHT);
	menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
	menu.setShadowWidthRes(R.dimen.shadow_width);
	menu.setShadowDrawable(R.drawable.shadow);
	//menu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
	menu.setBehindWidthRes(R.dimen.slidingmenu_offset);
	menu.setFadeDegree(0.35f);
	menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
	menu.setMenu(v);
	View vv = this.getLayoutInflater().inflate(R.layout.menu_glossary, null, false);
	mGlossaryContainer = (FrameLayout) vv.findViewById(R.id.menu_frame);
	menu.setSecondaryMenu(vv);
	menu.setSecondaryShadowDrawable(R.drawable.shadow_right);

	mAdapter = new CustomArrayAdapter(
			this,
			R.layout.menu_main_list_item,
			getResources().getStringArray(R.array.menu_entries), 
			getResources().getStringArray(R.array.menu_descs),
			getResources().getStringArray(R.array.menu_colors),
			icons);
	menulist.setAdapter(mAdapter);
	menulist.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
	menulist.setOnItemClickListener(this);

	colors = getResources().getStringArray(R.array.menu_colors);

	FragmentTransaction ft = getFragmentManager().beginTransaction();
	Fragment prefs = new TimeInState();
	CpuGlossaryFragment glo = new CpuGlossaryFragment();
	ft.replace(R.id.activity_container,prefs);
	ft.replace(R.id.menu_frame, glo);
	ft.commit();

	
	setAppTheme();
	mountPartitions();
	copyHelpers();
}