Наследование: ActionBarDrawerToggle
Пример #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.PageHomeView);

            string channelName      = Intent.GetStringExtra("Channel");
            string channelGroupName = Intent.GetStringExtra("ChannelGroup");

            bool   enableSSL = Convert.ToBoolean((Intent.GetStringExtra("SslOn")));
            string cipher    = (Intent.GetStringExtra("Cipher"));

            string ssl = "";

            if (enableSSL)
            {
                ssl = "SSL,";
            }

            if (!String.IsNullOrWhiteSpace(cipher))
            {
                cipher = " Cipher";
            }

            string head = String.Format("{0}{1}", ssl, cipher);

            pubnub = LaunchScreen.pubnub;

            config                    = pubnub.PNConfig;
            config.PubnubLog          = new LocalLog();
            config.LogVerbosity       = PNLogVerbosity.BODY;
            config.ReconnectionPolicy = PNReconnectionPolicy.LINEAR;

            listener = new SubscribeCallbackExt(
                (o, m) =>
            {
                if (m != null)
                {
                    Display(pubnub.JsonPluggableLibrary.SerializeToJsonString(m.Message));
                }
            },
                (o, p) =>
            {
                if (p != null)
                {
                    Display(p.Event);
                }
            },
                (o, s) =>
            {
                if (s != null)
                {
                    Display(s.Category + " " + s.Operation + " " + s.StatusCode);
                }
            });

            Title        = head;
            this.m_Title = this.m_DrawerTitle = this.Title;

            TextView txtSubscribedChannel = FindViewById <TextView> (Resource.Id.newChannels);

            txtSubscribedChannel.Text = channelName;
            channel = txtSubscribedChannel.Text;

            TextView txtSubscribedChannelGroup = FindViewById <TextView> (Resource.Id.newChannelGroups);

            txtSubscribedChannelGroup.Text = channelGroupName;
            channelGroup = txtSubscribedChannelGroup.Text;

            TextView txtViewLog = FindViewById <TextView> (Resource.Id.txtViewLog);

            txtViewLog.Text = "";
            try {
                this.m_Drawer                = this.FindViewById <DrawerLayout> (Resource.Id.drawer_layout);
                this.m_DrawerList            = this.FindViewById <ListView> (Resource.Id.left_drawer);
                this.m_DrawerList.Adapter    = new ArrayAdapter <string> (this, Resource.Layout.ItemMenu, Sections);
                this.m_DrawerList.ItemClick += (sender, args) => ListItemClicked(args.Position);

                this.m_Drawer.SetDrawerShadow(Resource.Drawable.drawer_shadow_dark, (int)GravityFlags.Start);
                //DrawerToggle is the animation that happens with the indicator next to the actionbar
                this.m_DrawerToggle = new MyActionBarDrawerToggle(this, this.m_Drawer,
                                                                  Resource.Drawable.ic_drawer_light,
                                                                  Resource.String.drawer_open,
                                                                  Resource.String.drawer_close);
                //Display the current fragments title and update the options menu
                this.m_DrawerToggle.DrawerClosed += (o, args) => {
                    this.ActionBar.Title = this.m_Title;
                    this.InvalidateOptionsMenu();
                };
                //Display the drawer title and update the options menu
                this.m_DrawerToggle.DrawerOpened += (o, args) => {
                    this.ActionBar.Title = this.m_DrawerTitle;
                    this.InvalidateOptionsMenu();
                };
                //Set the drawer lister to be the toggle.
                this.m_Drawer.SetDrawerListener(this.m_DrawerToggle);

                //if first time you will want to go ahead and click first item.
                this.ActionBar.SetDisplayHomeAsUpEnabled(true);
                this.ActionBar.SetHomeButtonEnabled(true);
            } catch (Exception ex) {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
            }
        }
Пример #2
0
        protected override void OnCreate (Bundle bundle)
        {
            base.OnCreate (bundle);
            /*if (ApplicationContext.Resources.Configuration.ScreenLayout = Android.Content.Res.ScreenLayout.SizeLarge) {
                SetContentView (Resource.Layout.Mainlarge);
            } else {*/
                
            //}
            //Build.VERSION.Sdk

            //SetContentView (Resource.Layout.Main);
            SetContentView (Resource.Layout.PageHomeView);

            string channelName = Intent.GetStringExtra ("Channel");
            string channelGroupName = Intent.GetStringExtra ("ChannelGroup");

            bool enableSSL = Convert.ToBoolean ((Intent.GetStringExtra ("SslOn")));
            string cipher = (Intent.GetStringExtra ("Cipher"));

            string ssl = "";
            if (enableSSL)
                ssl = "SSL,";

            if (!String.IsNullOrWhiteSpace (cipher)) {
                cipher = " Cipher";
            }

            string head = String.Format ("{0}{1}", ssl, cipher);

            pubnub = LaunchScreen.pubnub;

            Title = head; 
            this.m_Title = this.m_DrawerTitle = this.Title;

            TextView txtSubscribedChannel = FindViewById<TextView> (Resource.Id.newChannels);
            txtSubscribedChannel.Text = channelName;
            channel = txtSubscribedChannel.Text;

            TextView txtSubscribedChannelGroup = FindViewById<TextView> (Resource.Id.newChannelGroups);
            txtSubscribedChannelGroup.Text = channelGroupName;
            channelGroup = txtSubscribedChannelGroup.Text;

            TextView txtViewLog = FindViewById<TextView> (Resource.Id.txtViewLog);
            txtViewLog.Text = "";
            try {
                this.m_Drawer = this.FindViewById<DrawerLayout> (Resource.Id.drawer_layout);
                this.m_DrawerList = this.FindViewById<ListView> (Resource.Id.left_drawer);
                this.m_DrawerList.Adapter = new ArrayAdapter<string> (this, Resource.Layout.ItemMenu, Sections);
                this.m_DrawerList.ItemClick += (sender, args) => ListItemClicked (args.Position);

                this.m_Drawer.SetDrawerShadow (Resource.Drawable.drawer_shadow_dark, (int)GravityFlags.Start);
                //DrawerToggle is the animation that happens with the indicator next to the actionbar
                this.m_DrawerToggle = new MyActionBarDrawerToggle (this, this.m_Drawer,
                    Resource.Drawable.ic_drawer_light,
                    Resource.String.drawer_open,
                    Resource.String.drawer_close);
                //Display the current fragments title and update the options menu
                this.m_DrawerToggle.DrawerClosed += (o, args) => {
                    this.ActionBar.Title = this.m_Title;
                    this.InvalidateOptionsMenu ();
                };
                //Display the drawer title and update the options menu
                this.m_DrawerToggle.DrawerOpened += (o, args) => {
                    this.ActionBar.Title = this.m_DrawerTitle;
                    this.InvalidateOptionsMenu ();
                };
                //Set the drawer lister to be the toggle.
                this.m_Drawer.SetDrawerListener (this.m_DrawerToggle);

                //if first time you will want to go ahead and click first item.
                this.ActionBar.SetDisplayHomeAsUpEnabled (true);
                this.ActionBar.SetHomeButtonEnabled (true);


            } catch (Exception ex) {
                Console.WriteLine (ex.ToString ());
            }
        }
Пример #3
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            /*if (ApplicationContext.Resources.Configuration.ScreenLayout = Android.Content.Res.ScreenLayout.SizeLarge) {
             *  SetContentView (Resource.Layout.Mainlarge);
             * } else {*/

            //}
            //Build.VERSION.Sdk

            //SetContentView (Resource.Layout.Main);
            SetContentView(Resource.Layout.PageHomeView);

            string channelName      = Intent.GetStringExtra("Channel");
            string channelGroupName = Intent.GetStringExtra("ChannelGroup");

            bool   enableSSL = Convert.ToBoolean((Intent.GetStringExtra("SslOn")));
            string cipher    = (Intent.GetStringExtra("Cipher"));

            string ssl = "";

            if (enableSSL)
            {
                ssl = "SSL,";
            }

            if (!String.IsNullOrWhiteSpace(cipher))
            {
                cipher = " Cipher";
            }

            string head = String.Format("{0}{1}", ssl, cipher);

            pubnub = LaunchScreen.pubnub;

            Title        = head;
            this.m_Title = this.m_DrawerTitle = this.Title;

            TextView txtSubscribedChannel = FindViewById <TextView> (Resource.Id.newChannels);

            txtSubscribedChannel.Text = channelName;
            channel = txtSubscribedChannel.Text;

            TextView txtSubscribedChannelGroup = FindViewById <TextView> (Resource.Id.newChannelGroups);

            txtSubscribedChannelGroup.Text = channelGroupName;
            channelGroup = txtSubscribedChannelGroup.Text;

            TextView txtViewLog = FindViewById <TextView> (Resource.Id.txtViewLog);

            txtViewLog.Text = "";
            try {
                this.m_Drawer                = this.FindViewById <DrawerLayout> (Resource.Id.drawer_layout);
                this.m_DrawerList            = this.FindViewById <ListView> (Resource.Id.left_drawer);
                this.m_DrawerList.Adapter    = new ArrayAdapter <string> (this, Resource.Layout.ItemMenu, Sections);
                this.m_DrawerList.ItemClick += (sender, args) => ListItemClicked(args.Position);

                this.m_Drawer.SetDrawerShadow(Resource.Drawable.drawer_shadow_dark, (int)GravityFlags.Start);
                //DrawerToggle is the animation that happens with the indicator next to the actionbar
                this.m_DrawerToggle = new MyActionBarDrawerToggle(this, this.m_Drawer,
                                                                  Resource.Drawable.ic_drawer_light,
                                                                  Resource.String.drawer_open,
                                                                  Resource.String.drawer_close);
                //Display the current fragments title and update the options menu
                this.m_DrawerToggle.DrawerClosed += (o, args) => {
                    this.ActionBar.Title = this.m_Title;
                    this.InvalidateOptionsMenu();
                };
                //Display the drawer title and update the options menu
                this.m_DrawerToggle.DrawerOpened += (o, args) => {
                    this.ActionBar.Title = this.m_DrawerTitle;
                    this.InvalidateOptionsMenu();
                };
                //Set the drawer lister to be the toggle.
                this.m_Drawer.SetDrawerListener(this.m_DrawerToggle);

                //if first time you will want to go ahead and click first item.
                this.ActionBar.SetDisplayHomeAsUpEnabled(true);
                this.ActionBar.SetHomeButtonEnabled(true);
            } catch (Exception ex) {
                Console.WriteLine(ex.ToString());
            }
        }