protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetBehindContentView(Resource.Layout.menu_frame);

            SlidingMenu.SetSecondaryMenu(Resource.Layout.menu_frame_two);
            SlidingMenu.SecondaryShadowDrawableRes = Resource.Drawable.shadowright;

            SlidingMenu.ShadowWidthRes    = Resource.Dimension.shadow_width;
            SlidingMenu.BehindOffsetRes   = Resource.Dimension.slidingmenu_offset;
            SlidingMenu.ShadowDrawableRes = Resource.Drawable.shadow;
            SlidingMenu.FadeDegree        = 0.25f;
            SlidingMenu.TouchModeAbove    = TouchMode.Fullscreen;

            ActionBar.SetDisplayHomeAsUpEnabled(true);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SlidingMenu.Mode           = MenuMode.LeftRight;
            SlidingMenu.TouchModeAbove = TouchMode.Fullscreen;

            SetContentView(Resource.Layout.content_frame);
            SupportFragmentManager
            .BeginTransaction()
            .Replace(Resource.Id.content_frame, new SampleListFragment())
            .Commit();

            SlidingMenu.SetSecondaryMenu(Resource.Layout.menu_frame_two);
            SlidingMenu.SecondaryShadowDrawableRes = Resource.Drawable.shadowright;
            SupportFragmentManager
            .BeginTransaction()
            .Replace(Resource.Id.menu_frame_two, new SampleListFragment())
            .Commit();
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SlidingActionBarEnabled = true;

            SetContentView(Resource.Layout.properties);

            // left and right modes
            var mode = FindViewById <RadioGroup>(Resource.Id.mode);

            mode.Check(Resource.Id.left);
            mode.CheckedChange += (sender, args) =>
            {
                SlidingMenu sm = GetSlidingMenu();
                switch (args.CheckedId)
                {
                case Resource.Id.left:
                    sm.Mode = SlidingMenu.LEFT;
                    sm.ShadowDrawableResource = Resource.Drawable.shadow;
                    break;

                case Resource.Id.right:
                    sm.Mode = SlidingMenu.RIGHT;
                    sm.ShadowDrawableResource = Resource.Drawable.shadowright;
                    break;

                case Resource.Id.left_right:
                    sm.Mode = SlidingMenu.LEFT_RIGHT;
                    sm.SetSecondaryMenu(Resource.Layout.menu_frame_two);
                    SupportFragmentManager
                    .BeginTransaction()
                    .Replace(Resource.Id.menu_frame_two, new SampleListFragment())
                    .Commit();
                    sm.SecondaryShadowDrawableResource = Resource.Drawable.shadowright;
                    sm.ShadowDrawableResource          = Resource.Drawable.shadow;
                    break;
                }
            };

            // touch mode stuff
            var touchAbove = FindViewById <RadioGroup>(Resource.Id.touch_above);

            touchAbove.Check(Resource.Id.touch_above_full);
            touchAbove.CheckedChange += (sender, args) =>
            {
                switch (args.CheckedId)
                {
                case Resource.Id.touch_above_full:
                    GetSlidingMenu().TouchModeAbove = SlidingMenu.TOUCHMODE_FULLSCREEN;
                    break;

                case Resource.Id.touch_above_margin:
                    GetSlidingMenu().TouchModeAbove = SlidingMenu.TOUCHMODE_MARGIN;
                    break;

                case Resource.Id.touch_above_none:
                    GetSlidingMenu().TouchModeAbove = SlidingMenu.TOUCHMODE_NONE;
                    break;
                }
            };

            // scroll scale stuff
            var scrollScale = FindViewById <SeekBar>(Resource.Id.scroll_scale);

            scrollScale.Max                = 1000;
            scrollScale.Progress           = 333;
            scrollScale.StopTrackingTouch += (sender, args) =>
            {
                GetSlidingMenu().BehindScrollScale = (float)args.SeekBar.Progress / args.SeekBar.Max;
            };

            // behind width stuff
            var behindWidth = FindViewById <SeekBar>(Resource.Id.behind_width);

            behindWidth.Max                = 1000;
            behindWidth.Progress           = 750;
            behindWidth.StopTrackingTouch += (sender, args) =>
            {
                var percent = (float)args.SeekBar.Progress / args.SeekBar.Max;
                GetSlidingMenu().BehindWidth = (int)(percent * GetSlidingMenu().Width);
                GetSlidingMenu().RequestLayout();
            };

            // shadow stuff
            var shadowEnabled = FindViewById <CheckBox>(Resource.Id.shadow_enabled);

            shadowEnabled.Checked        = true;
            shadowEnabled.CheckedChange += (sender, args) =>
            {
                if (args.IsChecked)
                {
                    GetSlidingMenu().ShadowDrawableResource = GetSlidingMenu().Mode == SlidingMenu.LEFT
                                                            ? Resource.Drawable.shadow
                                                            : Resource.Drawable.shadowright;
                }
                else
                {
                    GetSlidingMenu().ShadowDrawable = null;
                }
            };
            var shadowWidth = FindViewById <SeekBar>(Resource.Id.shadow_width);

            shadowWidth.Max                = 1000;
            shadowWidth.Progress           = 75;
            shadowWidth.StopTrackingTouch += (sender, args) =>
            {
                var percent = (float)args.SeekBar.Progress / args.SeekBar.Max;
                var width   = (int)(percent * GetSlidingMenu().Width);
                GetSlidingMenu().ShadowWidth = width;
                GetSlidingMenu().Invalidate();
            };

            // fading stuff
            var fadeEnabled = FindViewById <CheckBox>(Resource.Id.fade_enabled);

            fadeEnabled.Checked        = true;
            fadeEnabled.CheckedChange += (sender, args) =>
            {
                GetSlidingMenu().FadeEnabled = args.IsChecked;
            };

            var fadeDeg = FindViewById <SeekBar>(Resource.Id.fade_degree);

            fadeDeg.Max                = 1000;
            fadeDeg.Progress           = 666;
            fadeDeg.StopTrackingTouch += (sender, args) =>
            {
                GetSlidingMenu().FadeDegree = (float)args.SeekBar.Progress / args.SeekBar.Max;
            };
        }
Beispiel #4
0
        protected override void OnViewModelSet()
        {
            //this.Parent.RequestWindowFeature (WindowFeatures.NoTitle);

            //RequestWindowFeature (WindowFeatures.NoTitle);

            homeViewModel = (HomeViewModel)ViewModel;

            SetContentView(Resource.Layout.Content_Frame);

            MenuId = Resource.Menu.HomeMenu;


            LegacyBar = FindViewById <LegacyBar.Library.Bar.LegacyBar>(Resource.Id.actionbar);

            //LegacyBar.SetHomeLogo(Resource.Drawable.jabbr_home_icon);
            AddHomeAction(() => {
                slidingMenu.Toggle();
            }, Resource.Drawable.jabbr_home_icon);

            LegacyBar.Click += (sender, e) => {
                slidingMenu.Toggle();
            };
            LegacyBar.Title = "JabbR";



            slidingMenu = new SlidingMenu(this)
            {
                Mode                       = MenuMode.LeftRight,
                TouchModeAbove             = TouchMode.Fullscreen,
                BehindOffset               = 80,
                ShadowWidth                = 20,
                ShadowDrawableRes          = Resource.Drawable.SlidingMenuShadow,
                SecondaryShadowDrawableRes = Resource.Drawable.SlidingMenuShadowRight
            };

            slidingMenu.AttachToActivity(this, SlideStyle.Content);
            slidingMenu.SetMenu(Resource.Layout.Menu_Frame);
            //slidingMenu.ShadowDrawableRes = Resource.Drawable.SlidingMenuShadow;

            menuFragment           = new MenuFragment();
            menuFragment.ViewModel = ViewModel;

            SupportFragmentManager.BeginTransaction()
            .Replace(Resource.Id.menu_frame, menuFragment).Commit();

            slidingMenu.SetSecondaryMenu(Resource.Layout.UserList_Frame);
            //slidingMenu.SecondaryShadowDrawableRes = Resource.Drawable.SlidingMenuShadowRight;

            emptyFragment           = new EmptyFragment();
            emptyFragment.ViewModel = this.ViewModel;

            SupportFragmentManager.BeginTransaction()
            .Replace(Resource.Id.content_frame, emptyFragment).Commit();


            //TODO: Put some kind of default view in the chat fragment space

            homeViewModel.PropertyChanged += (sender, e) => {
                Console.WriteLine("PropertyChanged: " + e.PropertyName);

                if (e.PropertyName == "CurrentRoom")
                {
                    if (homeViewModel.CurrentRoom == null)
                    {
                        if (emptyFragment == null)
                        {
                            emptyFragment = new EmptyFragment();
                        }

                        chatFragment = null;

                        SupportFragmentManager.BeginTransaction()
                        .Replace(Resource.Id.content_frame, emptyFragment).Commit();

                        LegacyBar.Title = "JabbR";

                        showActions = false;
                        ToggleActions();

                        userListFragment.ViewModel = null;

                        SupportFragmentManager.BeginTransaction()
                        .Replace(Resource.Id.userlist_frame, userListFragment).Commit();
                        return;
                    }

                    showActions = true;


                    if (chatFragment == null)
                    {
                        chatFragment           = new ChatFragment();
                        chatFragment.ViewModel = homeViewModel.CurrentRoom;

                        SupportFragmentManager.BeginTransaction()
                        .Replace(Resource.Id.content_frame, chatFragment).Commit();
                    }
                    else
                    {
                        chatFragment.ViewModel = homeViewModel.CurrentRoom;
                    }

                    if (userListFragment == null)
                    {
                        userListFragment           = new UserListFragment();
                        userListFragment.ViewModel = homeViewModel.CurrentRoom;

                        SupportFragmentManager.BeginTransaction()
                        .Replace(Resource.Id.userlist_frame, userListFragment).Commit();
                    }
                    else
                    {
                        userListFragment.ViewModel = homeViewModel.CurrentRoom;
                    }


                    ToggleActions();

                    slidingMenu.Toggle();

                    this.RunOnUiThread(() => LegacyBar.Title = homeViewModel.CurrentRoom.Room.Name);
                }
            };

            messenger = Mvx.Resolve <IMvxMessenger> ();
            _mvxMsgTokUserSelected = messenger.SubscribeOnMainThread <UserSelectedMessage> (msg => {
                chatFragment.AppendText("@" + msg.User.Name);

                slidingMenu.ShowContent(true);
            });
        }
Beispiel #5
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetSlidingActionBarEnabled(true);

            SetContentView(Resource.Layout.properties);

            var mode = FindViewById <RadioGroup>(Resource.Id.mode);

            mode.Check(Resource.Id.left);
            mode.CheckedChange += (sender, args) =>
            {
                switch (args.CheckedId)
                {
                case Resource.Id.left:
                    SlidingMenu.Mode = MenuMode.Left;
                    SlidingMenu.ShadowDrawableRes = Resource.Drawable.shadow;
                    break;

                case Resource.Id.right:
                    SlidingMenu.Mode = MenuMode.Right;
                    SlidingMenu.ShadowDrawableRes = Resource.Drawable.shadowright;
                    break;

                case Resource.Id.left_right:
                    SlidingMenu.Mode = MenuMode.LeftRight;
                    SlidingMenu.SetSecondaryMenu(Resource.Layout.menu_frame_two);
                    SupportFragmentManager
                    .BeginTransaction()
                    .Replace(Resource.Id.menu_frame_two, new SampleListFragment())
                    .Commit();
                    SlidingMenu.SecondaryShadowDrawableRes = Resource.Drawable.shadowright;
                    SlidingMenu.ShadowDrawableRes          = Resource.Drawable.shadow;
                    break;
                }
            };

            var touchAbove = FindViewById <RadioGroup>(Resource.Id.touch_above);

            touchAbove.Check(Resource.Id.touch_above_full);
            touchAbove.CheckedChange += (sender, args) =>
            {
                switch (args.CheckedId)
                {
                case Resource.Id.touch_above_full:
                    SlidingMenu.TouchModeAbove = TouchMode.Fullscreen;
                    break;

                case Resource.Id.touch_above_margin:
                    SlidingMenu.TouchModeAbove = TouchMode.Margin;
                    break;

                case Resource.Id.touch_above_none:
                    SlidingMenu.TouchModeAbove = TouchMode.None;
                    break;
                }
            };

            var scrollScale = FindViewById <SeekBar>(Resource.Id.scroll_scale);

            scrollScale.Max                = 1000;
            scrollScale.Progress           = 333;
            scrollScale.StopTrackingTouch += (sender, args) =>
            {
                SlidingMenu.BehindScrollScale = (float)args.SeekBar.Progress / args.SeekBar.Max;
            };

            var behindWidth = FindViewById <SeekBar>(Resource.Id.behind_width);

            behindWidth.Max                = 1000;
            behindWidth.Progress           = 750;
            behindWidth.StopTrackingTouch += (sender, args) =>
            {
                var percent = (float)args.SeekBar.Progress / args.SeekBar.Max;
                SlidingMenu.BehindWidth = (int)(percent * SlidingMenu.Width);
                SlidingMenu.RequestLayout();
            };

            var shadowEnabled = FindViewById <CheckBox>(Resource.Id.shadow_enabled);

            shadowEnabled.Checked        = true;
            shadowEnabled.CheckedChange += (sender, args) =>
            {
                if (args.IsChecked)
                {
                    SlidingMenu.ShadowDrawableRes = SlidingMenu.Mode == MenuMode.Left
                                                            ? Resource.Drawable.shadow
                                                            : Resource.Drawable.shadowright;
                }
                else
                {
                    SlidingMenu.ShadowDrawable = null;
                }
            };

            var shadowWidth = FindViewById <SeekBar>(Resource.Id.shadow_width);

            shadowWidth.Max                = 1000;
            shadowWidth.Progress           = 75;
            shadowWidth.StopTrackingTouch += (sender, args) =>
            {
                var percent = (float)args.SeekBar.Progress / args.SeekBar.Max;
                var width   = (int)(percent * SlidingMenu.Width);
                SlidingMenu.ShadowWidth = width;
                SlidingMenu.Invalidate();
            };

            var fadeEnabled = FindViewById <CheckBox>(Resource.Id.fade_enabled);

            fadeEnabled.Checked        = true;
            fadeEnabled.CheckedChange += (sender, args) =>
            {
                SlidingMenu.FadeEnabled = args.IsChecked;
            };

            var fadeDeg = FindViewById <SeekBar>(Resource.Id.fade_degree);

            fadeDeg.Max                = 1000;
            fadeDeg.Progress           = 666; //NUMBER OF THE BEAST!
            fadeDeg.StopTrackingTouch += (sender, args) =>
            {
                SlidingMenu.FadeDegree = (float)args.SeekBar.Progress / args.SeekBar.Max;
            };
        }