コード例 #1
0
        public void OnPostCreate(Bundle savedInstanceState)
        {
            if (null == _viewBehind && null == _viewAbove)
            {
                throw new InvalidOperationException("Both SetBehindContentView must be called " +
                                                    "in OnCreate in addition to SetContentView.");
            }

            _onPostCreateCalled = true;

            _slidingMenu.AttachToActivity(_activity,
                                          _enableSlide ? SlideStyle.Window : SlideStyle.Content);

            bool open, secondary;

            if (null != savedInstanceState)
            {
                open      = savedInstanceState.GetBoolean("SlidingActivityHelper.open");
                secondary = savedInstanceState.GetBoolean("SlidingActivityHelper.secondary");
            }
            else
            {
                open      = false;
                secondary = false;
            }

            new Handler().Post(() =>
            {
                if (open)
                {
                    if (secondary)
                    {
                        _slidingMenu.ShowSecondaryMenu(false);
                    }
                    else
                    {
                        _slidingMenu.ShowMenu(false);
                    }
                }
                else
                {
                    _slidingMenu.ShowContent(false);
                }
            });
        }
コード例 #2
0
        /// <summary>
        /// Further SlidingMenu initialization. Should be called within the activitiy's onPostCreate()
        /// </summary>
        /// <param name="savedInstanceState"> the saved instance state (unused) </param>
        public void OnPostCreate(Bundle savedInstanceState)
        {
            if (mViewBehind == null || mViewAbove == null)
            {
                throw new IllegalStateException("Both setBehindContentView must be called " + "in onCreate in addition to setContentView.");
            }

            mOnPostCreateCalled = true;

            mSlidingMenu.AttachToActivity(mActivity, mEnableSlide ? SlidingMenu.SLIDING_WINDOW : SlidingMenu.SLIDING_CONTENT);

            bool open;
            bool secondary;

            if (savedInstanceState != null)
            {
                open      = savedInstanceState.GetBoolean("SlidingActivityHelper.open");
                secondary = savedInstanceState.GetBoolean("SlidingActivityHelper.secondary");
            }
            else
            {
                open      = false;
                secondary = false;
            }
            (new Handler()).Post(() =>
            {
                if (open)
                {
                    if (secondary)
                    {
                        mSlidingMenu.ShowSecondaryMenu(false);
                    }
                    else
                    {
                        mSlidingMenu.ShowMenu(false);
                    }
                }
                else
                {
                    mSlidingMenu.ShowContent(false);
                }
            });
        }