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

The following examples show how to use com.jeremyfeinstein.slidingmenu.lib.SlidingMenu#setBehindScrollScale() . 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: MainActivity.java    From LiuAGeAndroid with MIT License 5 votes vote down vote up
/**
 * 准备侧滑菜单
 */
private void prepareMenu() {
    mSlidingMenu = new SlidingMenu(mContext);
    mSlidingMenu.setMode(SlidingMenu.LEFT);
    mSlidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);
    mSlidingMenu.setShadowWidth(0);
    mSlidingMenu.setBehindOffset((int) (SizeUtils.getScreenWidthPx(mContext) * 0.5));
    mSlidingMenu.setFadeDegree(0.0f);
    mSlidingMenu.setBehindScrollScale(0.0f);
    mSlidingMenu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);

    // 为侧滑菜单设置布局
    View view = View.inflate(mContext, R.layout.slidingmenu_profile, null);
    mSlidingMenu.setMenu(view);

    mPortraitView = view.findViewById(R.id.ll_slidingmenu_profile_portrait_layout);
    mPortraitImageView = (SimpleDraweeView) view.findViewById(R.id.sdv_slidingmenu_profile_portrait_image);
    mNicknameTextView = (TextView) view.findViewById(R.id.tv_slidingmenu_profile_nickname);
    mCollectionView = view.findViewById(R.id.rl_slidingmenu_profile_collection_layout);
    mCommentView = view.findViewById(R.id.rl_slidingmenu_profile_comment_layout);
    mClearCacheView = view.findViewById(R.id.rl_slidingmenu_profile_clear_cache_layout);
    mChangModeView = view.findViewById(R.id.rl_slidingmenu_profile_change_mode_layout);
    mFeedbackView = view.findViewById(R.id.rl_slidingmenu_profile_feekback_layout);
    mCommendView = view.findViewById(R.id.rl_slidingmenu_profile_commend_layout);
    mAboutView = view.findViewById(R.id.rl_slidingmenu_profile_aboutme_layout);

    mPortraitView.setOnClickListener(this);
    mCollectionView.setOnClickListener(this);
    mCommentView.setOnClickListener(this);
    mClearCacheView.setOnClickListener(this);
    mChangModeView.setOnClickListener(this);
    mFeedbackView.setOnClickListener(this);
    mCommendView.setOnClickListener(this);
    mAboutView.setOnClickListener(this);

}
 
Example 2
Source File: CustomAnimation.java    From Moring-Alarm with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	// set the Above View
	setContentView(R.layout.content_frame);
	getSupportFragmentManager()
	.beginTransaction()
	.replace(R.id.content_frame, new SampleListFragment())
	.commit();
	
	SlidingMenu sm = getSlidingMenu();
	setSlidingActionBarEnabled(true);
	sm.setBehindScrollScale(0.0f);
	sm.setBehindCanvasTransformer(mTransformer);
}
 
Example 3
Source File: CustomAnimation.java    From Moring-Alarm with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	// set the Above View
	setContentView(R.layout.content_frame);
	getSupportFragmentManager()
	.beginTransaction()
	.replace(R.id.content_frame, new SampleListFragment())
	.commit();
	
	SlidingMenu sm = getSlidingMenu();
	setSlidingActionBarEnabled(true);
	sm.setBehindScrollScale(0.0f);
	sm.setBehindCanvasTransformer(mTransformer);
}
 
Example 4
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 5
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 6
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 7
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();
}