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

            // Create your application here

            SetContentView (Resource.Layout.SlidingPaneLayout);

            mSlidingLayout = (SlidingPaneLayout)FindViewById<SlidingPaneLayout> (Resource.Id.sliding_pane_layout);
            mContent = (TextView)FindViewById<TextView> (Resource.Id.content_text_slidingPaneLayout);

            mActionBar = createActionBarHelper ();
            mActionBar.init ();

            mSlidingLayout.ViewTreeObserver.GlobalLayout += HandleGlobalLayout;

            mSlidingLayout.PanelOpened += (sender, e) => {
                mActionBar.onPanelOpened();

            };
            mSlidingLayout.PanelClosed += (sender, e) => {
                mActionBar.onPanelClosed();
            };

            mList = (ListView)FindViewById<ListView> (Resource.Id.left_pane);
            items = new string[] { "Vegetables","Fruits","Flower Buds","Legumes","Bulbs","Tubers" };
            mList.Adapter = new ArrayAdapter<string>(this,Android.Resource.Layout.SimpleListItem1, items);
            mList.ItemClick += HandleItemClick;
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.MainLayout);

            slidingLayout = FindViewById<SlidingPaneLayout>(Resource.Id.main_layout);
            menuListView = FindViewById<ListView>(Resource.Id.left_pane);
            accountListFragment = new AccountListFragment
            {
                ViewModel = Mvx.Resolve<AccountListViewModel>()
            };

            statisticSelectorFragment = new StatisticSelectorFragment();
            backupFragment = new BackupFragment
            {
                ViewModel = Mvx.Resolve<BackupViewModel>()
            };

            aboutFragment = new AboutFragment
            {
                ViewModel = Mvx.Resolve<AboutViewModel>()
            };

            slidingLayout.PanelOpened += (sender, e) =>
            {
                ActionBar.SetHomeButtonEnabled(false);
                ActionBar.SetDisplayHomeAsUpEnabled(false);
                ActionBar.Title = drawerTitle;
            };

            slidingLayout.PanelClosed += (sender, e) =>
            {
                ActionBar.SetDisplayHomeAsUpEnabled(true);
                ActionBar.SetHomeButtonEnabled(true);
                ActionBar.Title = title;
            };

            menuListView.Adapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleListItem1, menuItems);
            menuListView.ItemClick += NavigationClick;

            ActionBar.SetDisplayHomeAsUpEnabled(true);
            ActionBar.SetHomeButtonEnabled(true);
            title = menuItems[0];
            drawerTitle = Strings.MenuTitle;

            slidingLayout.ViewTreeObserver.GlobalLayout += FirstLayoutListener;

            var fragmenTransaction = SupportFragmentManager.BeginTransaction();
            fragmenTransaction.Add(Resource.Id.content_pane, accountListFragment);
            fragmenTransaction.Commit();
        }
Exemple #3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            #region 滑动关闭准备工作
            //通过反射来改变SlidingPaneLayout的值
            try
            {
                mSlidingPaneLayout = new Ys_SlidingPaneLayout(this)
                {
                    IsSlideEnable = IsAllowSlidClose
                };
                //mOverhangSize属性,意思就是做菜单离右边屏幕边缘的距离;
                var f_overHang = Java.Lang.Class.FromType(typeof(SlidingPaneLayout)).GetDeclaredField("mOverhangSize");
                f_overHang.Accessible = true;
                //设置坐菜单离右边屏幕边缘的距离为0,设置全屏
                f_overHang.Set(mSlidingPaneLayout, 0);
                mSlidingPaneLayout.SetPanelSlideListener(this);
                mSlidingPaneLayout.SliderFadeColor = ContextCompat.GetColor(this, Android.Resource.Color.Transparent);
            }
            catch (Exception e)
            {
#if DEBUG
                Console.WriteLine("反射设置SlidingPaneLayout的值时出错 具体错误为:" + e.ToString());
#endif
            }

            //加入两个View,这是左侧菜单.由于Activity是透明的.这里就不用设置了
            mSlidingPaneLayout.AddView(new View(this)
            {
                //设置全屏
                LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent)
            }, 0);

            //内容布局,用来存放Activity布局用的
            mContainerFl = new FrameLayout(this)
            {
                //设置全屏
                LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent)
            };
            //内容布局不应该是透明,加了白色背景
            mContainerFl.SetBackgroundColor(Android.Graphics.Color.White);
            mSlidingPaneLayout.AddView(mContainerFl, 1);
            #endregion

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

            SetContentView(Resource.Layout.SlidingPaneLayout);

            _slidingLayout = FindViewById<SlidingPaneLayout>(Resource.Id.sliding_pane_layout);
            _list = FindViewById<ListView>(Resource.Id.left_pane);
            _content = FindViewById<TextView>(Resource.Id.content_text);

            _slidingLayout.PanelOpened += (sender, args) =>
                {
                    ActionBar.SetHomeButtonEnabled(false);
                    ActionBar.SetDisplayHomeAsUpEnabled(false);
                    ActionBar.Title = _drawerTitle;
                };

            _slidingLayout.PanelClosed += (sender, args) =>
                {
                    ActionBar.SetDisplayHomeAsUpEnabled(true);
                    ActionBar.SetHomeButtonEnabled(true);
                    ActionBar.Title = _title;
                };

            _slidingLayout.OpenPane();

            _list.Adapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleListItem1,
                Shakespeare.Titles);
            _list.ItemClick += (sender, args) =>
                {
                    _content.Text = Shakespeare.Dialogue[args.Position];
                    _title = Shakespeare.Titles[args.Position];
                    _slidingLayout.SmoothSlideClosed();
                };

            ActionBar.SetDisplayHomeAsUpEnabled(true);
            ActionBar.SetHomeButtonEnabled(true);
            _title = Shakespeare.Titles[0];
            _drawerTitle = "Pick a title";

            _slidingLayout.ViewTreeObserver.GlobalLayout += FirstLayoutListener;
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.SlidingPaneLayout);

            _slidingLayout = FindViewById <SlidingPaneLayout>(Resource.Id.sliding_pane_layout);
            _list          = FindViewById <ListView>(Resource.Id.left_pane);
            _content       = FindViewById <TextView>(Resource.Id.content_text);

            _slidingLayout.PanelOpened += (sender, args) =>
            {
                ActionBar.SetHomeButtonEnabled(false);
                ActionBar.SetDisplayHomeAsUpEnabled(false);
                ActionBar.Title = _drawerTitle;
            };

            _slidingLayout.PanelClosed += (sender, args) =>
            {
                ActionBar.SetDisplayHomeAsUpEnabled(true);
                ActionBar.SetHomeButtonEnabled(true);
                ActionBar.Title = _title;
            };

            _slidingLayout.OpenPane();

            _list.Adapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1,
                                                      Shakespeare.Titles);
            _list.ItemClick += (sender, args) =>
            {
                _content.Text = Shakespeare.Dialogue[args.Position];
                _title        = Shakespeare.Titles[args.Position];
                _slidingLayout.SmoothSlideClosed();
            };

            ActionBar.SetDisplayHomeAsUpEnabled(true);
            ActionBar.SetHomeButtonEnabled(true);
            _title       = Shakespeare.Titles[0];
            _drawerTitle = "Pick a title";

            _slidingLayout.ViewTreeObserver.GlobalLayout += FirstLayoutListener;
        }
Exemple #6
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.dashboard);

            _slidingLayout = FindViewById <SlidingPaneLayout>(Resource.Id.sliding_pane_layout);

            SupportActionBar.Title = DASHTITLE;

            SupportActionBar.SetDisplayHomeAsUpEnabled(true);

            SupportActionBar.SetDisplayShowHomeEnabled(true);

            _slidingLayout.PanelOpened += (sender, args) =>
            {
                SupportActionBar.SetHomeButtonEnabled(false);
                SupportActionBar.SetDisplayHomeAsUpEnabled(false);
            };

            _slidingLayout.PanelClosed += (sender, args) =>
            {
                SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            };

            ISharedPreferences       prefs  = PreferenceManager.GetDefaultSharedPreferences(this);
            ISharedPreferencesEditor editor = prefs.Edit();

            dialog = ProgressDialog.Show(this, "", "Loading. Please wait... ", true);
            InitializeDashboard();
            InitializeSideMenu(prefs);

            DashboardA = this;

            var ValuesTask = UpdateValues(api);

            CardsClick();
            SideMenuClick(editor);
            LatestOrdersClick();
            BestCustomersClick();
        }
 public ActionBarHelperICS(ActionBar mActionBar, SlidingPaneLayout mSlidingLayout)
 {
     this.mActionBar = mActionBar;
     this.mSlidingLayout = mSlidingLayout;
 }