Esempio n. 1
0
        void ToggleActions()
        {
            if (!showActions)
            {
                LegacyBar.RemoveActionAtMenuId(Resource.Id.menu_leave_room);
                LegacyBar.RemoveActionAtMenuId(Resource.Id.menu_connection);
                return;
            }

            if (LegacyBar.ActionCount <= 1)
            {
                var connectionActionBarAction = new MenuItemLegacyBarAction(
                    this, Resource.Id.menu_leave_room, Resource.Drawable.icon_green_circle_small, Resource.String.menu_string_exit)
                {
                    ActionType = ActionType.Always,
                };

                LegacyBar.AddAction(connectionActionBarAction);

                var itemActionBarAction = new MenuItemLegacyBarAction(
                    this, Resource.Id.menu_leave_room, Resource.Drawable.icon_exit, Resource.String.menu_string_exit)
                {
                    ActionType = ActionType.CollapseActionView,
                };

                LegacyBar.AddAction(itemActionBarAction);
            }
        }
Esempio n. 2
0
        private void Start( )
        {
            //Check to ensure everything's setup right
            PushClient.CheckDevice(Application.Context);
            PushClient.CheckManifest(Application.Context);

            PushClient.Register(Application.Context, PushHandlerBroadcastReceiver.SENDER_IDS);

            SetContentView(Resource.Layout.Auth);
            activityIsVisible = true;

            MenuId    = Resource.Menu.EmptyMenu;
            LegacyBar = FindViewById <LegacyBar.Library.Bar.LegacyBar>(Resource.Id.ActionBar);
            LegacyBar.SetHomeLogo(Resource.Drawable.Icon);

            txtLicense  = FindViewById <EditText>(Resource.Id.txtLicense);
            txtPassword = FindViewById <EditText>(Resource.Id.txtPassword);
            lblError    = FindViewById <TextView>(Resource.Id.lblError);
            btnLogin    = FindViewById <Button>(Resource.Id.btnLogin);

            txtLicense.Text = GetSharedPreferences(Application.Context.PackageName, FileCreationMode.Private).GetString("License", String.Empty);

            var encryptedPassword = GetSharedPreferences(Application.Context.PackageName, FileCreationMode.Private).GetString("Password", null);

            txtPassword.Text = encryptedPassword != null
                                                                   ? Crypto.DecryptStringAES(encryptedPassword, SharedSecret)
                                                                   : String.Empty;

            lblError.Text   = String.Empty;
            btnLogin.Click += btnLogin_Click;

            LegacyBar.ProgressBarVisibility = ViewStates.Visible;
            ThreadPool.QueueUserWorkItem(o => GetAreas( ));
        }
Esempio n. 3
0
        protected override void OnViewModelSet()
        {
            viewModel = ViewModel as EditAccountViewModel;

            SetContentView(Resource.Layout.View_EditAccount);

            MenuId = Resource.Menu.EditAccountMenu;

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

            AddHomeAction(() => {
                this.Finish();
            }, Resource.Drawable.jabbr_home_icon);

            if (!viewModel.NewAccount)
            {
                var deleteActionBarAction = new MenuItemLegacyBarAction(
                    this, Resource.Id.menu_delete, Resource.Drawable.icon_delete, Resource.String.menu_string_delete)
                {
                    ActionType = ActionType.Always
                };
                LegacyBar.AddAction(deleteActionBarAction);
            }

            var itemActionBarAction = new MenuItemLegacyBarAction(
                this, Resource.Id.menu_save, Resource.Drawable.icon_save, Resource.String.menu_string_save)
            {
                ActionType = ActionType.Always
            };

            LegacyBar.AddAction(itemActionBarAction);

            //LegacyBar.Title = viewModel.NewAccount ? "Add Account" : "Edit Account";
        }
Esempio n. 4
0
        public void AddHomeAction(Type activity, int resId)
        {
            var homeIntent = new Intent(this, activity);

            homeIntent.AddFlags(ActivityFlags.ClearTop);
            homeIntent.AddFlags(ActivityFlags.NewTask);
            LegacyBar.SetHomeAction(new DefaultLegacyBarAction(this, homeIntent, resId));
            LegacyBar.SetDisplayHomeAsUpEnabled(true);
        }
Esempio n. 5
0
        protected override void OnViewModelSet()
        {
            base.OnViewModelSet();

            SetContentView(Resource.Layout.Speaker);

            LegacyBar.AddAction(new ActionLegacyBarAction(this, () => ViewModel.EmailSpeakerCommand.Execute(null),
                                                          Resource.Drawable.Email));
        }
Esempio n. 6
0
        protected override void OnViewModelSet()
        {
            base.OnViewModelSet();

            SetContentView(Resource.Layout.Sponsor);

            LegacyBar.AddAction(new ActionLegacyBarAction(this, () => ViewModel.ViewWebsiteCommand.Execute(null),
                                                          Resource.Drawable.Link));
        }
Esempio n. 7
0
        protected override void OnViewModelSet()
        {
            base.OnViewModelSet();

            SetContentView(Resource.Layout.Overview);
            var list = FindViewById <MvxListView>(Resource.Id.SessionList);

            list.Adapter = new SessionListAdapter(this, (IMvxAndroidBindingContext)BindingContext, ViewModel.ViewSessionCommand);

            ViewModel.BindLoadingMessage(this, vm => vm.IsRefreshing, "Refreshing...");

            LegacyBar.AddAction(new ActionLegacyBarAction(this, () => ViewModel.ViewFullScheduleCommand.Execute(null), Resource.Drawable.Calendar));
        }
Esempio n. 8
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            MenuId = Resource.Menu.mainmenu;

            SetContentView(Resource.Layout.fragment_tabs);
            _tabHost = FindViewById <TabHost>(Android.Resource.Id.TabHost);
            _tabHost.Setup();

            _viewPager = FindViewById <ViewPager>(Resource.Id.pager);

            _tabsAdapter = new TabsAdapter(this, _tabHost, _viewPager);


            LegacyBar       = FindViewById <Library.Bar.LegacyBar>(Resource.Id.actionbar);
            LegacyBar.Title = "Look Fragments";
            AddHomeAction(typeof(HomeActivity), Resource.Drawable.icon);


            var action = new MenuItemLegacyBarAction(this, Resource.Id.menu_search,
                                                     Resource.Drawable.ic_action_search_dark,
                                                     Resource.String.menu_string_search);

            LegacyBar.AddAction(action);


            TabHost.TabSpec spec = _tabHost.NewTabSpec("tv");
            spec.SetIndicator("Tab 1", Resources.GetDrawable(Resource.Drawable.icon));
            _tabsAdapter.AddTab(spec, Class.FromType(typeof(FramgmentTab1)), null);


            spec = _tabHost.NewTabSpec("tab2");
            spec.SetIndicator("Tab 2", Resources.GetDrawable(Resource.Drawable.icon));
            _tabsAdapter.AddTab(spec, Class.FromType(typeof(FramgmentTab2)), null);

            if (bundle != null)
            {
                _tabHost.SetCurrentTabByTag(bundle.GetString("tab"));
            }
            else
            {
                _tabHost.CurrentTab = 0;
            }
        }
        protected override void OnViewModelSet()
        {
            viewModel = this.ViewModel as AccountsViewModel;

            SetContentView(Resource.Layout.View_Accounts);

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

            MenuId = Resource.Menu.AccountsMenu;


            AddHomeAction(() => {
                this.Finish();
            }, Resource.Drawable.jabbr_home_icon, true);

            var itemActionBarAction = new MenuItemLegacyBarAction(
                this, Resource.Id.menu_add, Resource.Drawable.icon_add, Resource.String.menu_string_save)
            {
                ActionType = ActionType.Always
            };

            LegacyBar.AddAction(itemActionBarAction);
        }
Esempio n. 10
0
 public void AddHomeAction(Action action, int resId, bool isHomeAsUpEnabled = true)
 {
     LegacyBar.SetHomeAction(new ActionLegacyBarAction(this, action, resId));
     LegacyBar.SetDisplayHomeAsUpEnabled(isHomeAsUpEnabled);
 }
Esempio n. 11
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Order);

            #region ActionBars settings
            //TopActionBar settings
            MenuId    = Resource.Menu.ListMenu;
            LegacyBar = FindViewById <LegacyBar.Library.Bar.LegacyBar>(Resource.Id.ActionBar);
            LegacyBar.SetHomeLogo(Resource.Drawable.Icon);
            LegacyBar.Title = "Заказ";

            var itemActionBarAction = new MenuItemLegacyBarAction(
                this, Resource.Id.btnRefresh, Resource.Drawable.ic_refresh,
                Resource.String.Refresh)
            {
                ActionType = ActionType.Always
            };
            LegacyBar.AddAction(itemActionBarAction);

            itemActionBarAction = new MenuItemLegacyBarAction(
                this, Resource.Id.btnGetBalance, Resource.Drawable.ic_balance,
                Resource.String.Balance)
            {
                ActionType = ActionType.IfRoom
            };
            LegacyBar.AddAction(itemActionBarAction);


            //BottomActionBar settings
            var bottomActionBar = FindViewById <LegacyBar.Library.Bar.LegacyBar>(Resource.Id.bottomActionbar);

            var action = new MenuItemLegacyBarAction(this, Resource.Id.btnMagicCall, Resource.Drawable.ic_call,
                                                     Resource.String.CallMagicNumber)
            {
                ActionType = ActionType.Always
            };

            bottomActionBar.AddAction(action);

            action = new MenuItemLegacyBarAction(
                this, Resource.Id.btnSetArea, Resource.Drawable.ic_location,
                Resource.String.ChooseArea)
            {
                ActionType = ActionType.Always
            };
            bottomActionBar.AddAction(action);

            action = new MenuItemLegacyBarAction(
                this, Resource.Id.btnLogout, Resource.Drawable.ic_exit,
                Resource.String.Logout)
            {
                ActionType = ActionType.Always
            };
            bottomActionBar.AddAction(action);

            action = new MenuItemLegacyBarAction(this, Resource.Id.btnSettings, Resource.Drawable.ic_settings,
                                                 Resource.String.Settings)
            {
                ActionType = ActionType.Always
            };

            bottomActionBar.AddAction(action);
            #endregion

            if (UserInfo.State == StateTypes.Free)
            {
                AddHomeAction(typeof(ListActivity), Resource.Drawable.Icon);
            }

            txtFrom        = FindViewById <TextView>(Resource.Id.txtFrom);
            txtThru        = FindViewById <TextView>(Resource.Id.txtThru);
            txtTo          = FindViewById <TextView>(Resource.Id.txtTo);
            txtTime        = FindViewById <TextView>(Resource.Id.txtTime);
            txtPrice       = FindViewById <TextView>(Resource.Id.txtPrice);
            lblThru        = FindViewById <TextView>(Resource.Id.lblThru);
            btnPhone       = FindViewById <Button>(Resource.Id.btnPhone);
            btnTake        = FindViewById <Button>(Resource.Id.btnTake);
            btnArrived     = FindViewById <Button>(Resource.Id.btnArrived);
            btnPersonInCar = FindViewById <Button>(Resource.Id.btnPersonInCar);
            btnCompleted   = FindViewById <Button>(Resource.Id.btnCompleted);

            ThreadPool.QueueUserWorkItem(o => Refresh( ));

            btnPhone.Click += (o, e) =>
            {
                var callIntent = new Intent(Intent.ActionCall);
                callIntent.SetData(Android.Net.Uri.Parse("tel:" + UserInfo.CurrentOrder.Phone));
                StartActivity(callIntent);
            };

            tmrState.Elapsed += tmrState_Elapsed;
        }
Esempio n. 12
0
        private void Refresh( )
        {
            if (UserInfo.State == StateTypes.ActiveOrder)
            {
                UserInfo.CurrentOrder = Requests.GetActiveOrder(UserInfo.UserId);
            }
            else if (UserInfo.State == StateTypes.PersonInCar)
            {
                UserInfo.CurrentOrder = Requests.GetActiveOrderInCar(UserInfo.UserId);
            }
            else if (UserInfo.State == StateTypes.Arrived)
            {
                UserInfo.CurrentOrder = Requests.GetActiveOrder(UserInfo.UserId);
            }

            RunOnUiThread(() =>
            {
                if (UserInfo.State == StateTypes.Free)
                {
                    AddHomeAction(Finish, Resource.Drawable.Icon);
                }
                else
                {
                    LegacyBar.ClearHomeAction( );
                    LegacyBar.SetHomeLogo(Resource.Drawable.Icon);
                }

                txtFrom.Text  = UserInfo.CurrentOrder.From;
                txtThru.Text  = "";
                txtTo.Text    = UserInfo.CurrentOrder.To;
                txtTime.Text  = UserInfo.CurrentOrder.Time;
                txtPrice.Text = UserInfo.CurrentOrder.Price;

                if (UserInfo.CurrentOrder.Waypoints.Count != 0)
                {
                    foreach (var cWaypoint in UserInfo.CurrentOrder.Waypoints)
                    {
                        txtThru.Text += cWaypoint + "\n";
                    }
                    txtThru.Text = txtThru.Text.Remove(txtThru.Text.Length - 1);
                }
                else
                {
                    txtThru.Visibility = ViewStates.Gone;
                    lblThru.Visibility = ViewStates.Gone;
                }

                btnPhone.Visibility       = ViewStates.Gone;
                btnArrived.Visibility     = ViewStates.Gone;
                btnPersonInCar.Visibility = ViewStates.Gone;
                btnCompleted.Visibility   = ViewStates.Gone;
                btnTake.Visibility        = ViewStates.Gone;

                switch (UserInfo.State)
                {
                case StateTypes.Free:
                    btnTake.Visibility = ViewStates.Visible;
                    break;

                case StateTypes.ActiveOrder:
                    btnPersonInCar.Visibility = ViewStates.Visible;
                    btnArrived.Visibility     = ViewStates.Visible;
                    btnPhone.Visibility       = ViewStates.Visible;
                    break;

                case StateTypes.Arrived:
                    btnPhone.Visibility       = ViewStates.Visible;
                    btnPersonInCar.Visibility = ViewStates.Visible;
                    break;

                case StateTypes.PersonInCar:
                    btnPhone.Visibility     = ViewStates.Visible;
                    btnCompleted.Visibility = ViewStates.Visible;
                    break;
                }

                btnTake.Click        += btnTake_Click;
                btnArrived.Click     += btnArrived_Click;
                btnPersonInCar.Click += btnPersonInCar_Click;
                btnCompleted.Click   += btnCompleted_Click;

                if (UserInfo.CurrentOrder.Accepted == "0")
                {
                    var dialog = new AlertDialog.Builder(this);
                    dialog.SetTitle(Resource.String.AcceptOrder);
                    dialog.SetMessage(String.Format("{0} -> {1}\nКогда: {2}\nЦена: {3}р.", UserInfo.CurrentOrder.From, UserInfo.CurrentOrder.To, UserInfo.CurrentOrder.Time, UserInfo.CurrentOrder.Price));
                    dialog.SetPositiveButton(Resource.String.Accept, (sender, args) => ThreadPool.QueueUserWorkItem(o =>
                    {
                        Requests.AcceptOrder(UserInfo.UserId, UserInfo.CurrentOrder.ID);
                        UserInfo.CurrentOrder.Accepted = "1";
                    }));
                    dialog.SetNegativeButton(Resource.String.Decline, (sender, args) => ThreadPool.QueueUserWorkItem(o =>
                    {
                        Requests.DeclineOrder(UserInfo.UserId, UserInfo.CurrentOrder.ID);
                        StartActivity(typeof(ListActivity));
                    }));
                    dialog.Show( );
                }
            });
        }
Esempio n. 13
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            var theme = (LegacyBarTheme)Intent.GetIntExtra("Theme", 0);

            switch (theme)
            {
            case LegacyBarTheme.HoloBlack:
                SetContentView(Resource.Layout.black_theme);
                break;

            case LegacyBarTheme.HoloBlue:
                SetContentView(Resource.Layout.blue_theme);
                break;

            case LegacyBarTheme.HoloGray:
                SetContentView(Resource.Layout.gray_theme);
                break;

            case LegacyBarTheme.HoloLight:
                SetContentView(Resource.Layout.light_theme);
                break;

            default:
                SetContentView(Resource.Layout.other);
                break;
            }

            //First we will specify the menu we are using.
            MenuId = Resource.Menu.othermainmenu;

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

            // You can also assign the title programmatically by passing a
            // CharSequence or resource id.
            LegacyBar.Title = "Other Activity";

            //Set the Up button to go home, also much set current activity on the Legacy Bar
            AddHomeAction(typeof(HomeActivity), Resource.Drawable.icon);

            //always show the search icon no matter what.
            var itemActionBarAction = new MenuItemLegacyBarAction(
                this, Resource.Id.menu_search, LegacyBar.LightIcons ? Resource.Drawable.ic_action_search : Resource.Drawable.ic_action_search_dark,
                Resource.String.menu_string_search)
            {
                ActionType = ActionType.Always
            };

            LegacyBar.AddAction(itemActionBarAction);


            //the rest of them I will say NEVER show. now on devices with a menu button you can press it and it will show old menus with the icon you specifies in the menu.xml file
            //on newer devices without a menu button an overflow will appear.
            itemActionBarAction = new MenuItemLegacyBarAction(
                this, Resource.Id.menu_refresh, LegacyBar.LightIcons ? Resource.Drawable.ic_action_refresh :
                Resource.Drawable.ic_action_refresh_dark,
                Resource.String.menu_string_refresh)
            {
                ActionType = ActionType.Never
            };
            LegacyBar.AddAction(itemActionBarAction);

            itemActionBarAction = new MenuItemLegacyBarAction(
                this, Resource.Id.menu_test1, LegacyBar.LightIcons ? Resource.Drawable.ic_action_refresh :
                Resource.Drawable.ic_action_refresh_dark,
                Resource.String.menu_string_refresh)
            {
                ActionType = ActionType.Never
            };
            LegacyBar.AddAction(itemActionBarAction);

            itemActionBarAction = new MenuItemLegacyBarAction(
                this, Resource.Id.menu_test2, LegacyBar.LightIcons ? Resource.Drawable.ic_action_refresh :
                Resource.Drawable.ic_action_refresh_dark,
                Resource.String.menu_string_refresh)
            {
                ActionType = ActionType.Never
            };
            LegacyBar.AddAction(itemActionBarAction);

            itemActionBarAction = new MenuItemLegacyBarAction(
                this, Resource.Id.menu_test3, LegacyBar.LightIcons ? Resource.Drawable.ic_action_refresh :
                Resource.Drawable.ic_action_refresh_dark,
                Resource.String.menu_string_refresh)
            {
                ActionType = ActionType.Never
            };
            LegacyBar.AddAction(itemActionBarAction);

            var bottomActionBar = FindViewById <Library.Bar.LegacyBar>(Resource.Id.bottomActionbar);

            var action = new MenuItemLegacyBarAction(this, Resource.Id.menu_up, bottomActionBar.LightIcons ? Resource.Drawable.ic_action_up : Resource.Drawable.ic_action_up_dark,
                                                     Resource.String.menu_string_down)
            {
                ActionType = ActionType.Always
            };

            bottomActionBar.AddAction(action);
            action = new MenuItemLegacyBarAction(this, Resource.Id.menu_down, bottomActionBar.LightIcons ? Resource.Drawable.ic_action_down : Resource.Drawable.ic_action_down_dark,
                                                 Resource.String.menu_string_down)
            {
                ActionType = ActionType.Always
            };
            bottomActionBar.AddAction(action);

            action = new MenuItemLegacyBarAction(this, Resource.Id.menu_left, bottomActionBar.LightIcons ? Resource.Drawable.ic_action_left : Resource.Drawable.ic_action_left_dark,
                                                 Resource.String.menu_string_left)
            {
                ActionType = ActionType.Always
            };
            bottomActionBar.AddAction(action);

            action = new MenuItemLegacyBarAction(this, Resource.Id.menu_right, bottomActionBar.LightIcons ? Resource.Drawable.ic_action_right : Resource.Drawable.ic_action_right_dark,
                                                 Resource.String.menu_string_right)
            {
                ActionType = ActionType.Always
            };
            bottomActionBar.AddAction(action);

            LegacyBar.SetDropDown(this, new string[] { "My First Account", "My Second Account", "My Third Account" }, DropDownSelected);
        }
Esempio n. 14
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

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

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

            /*
             * You can also set the title of the LegacyBar with:
             * LegacyBar.Title = "MyAwesomeTitle";
             *
             * or
             *
             * LegacyBar.Title = Resource.String.<yourStringId>;
             *
             * Title Color can be set with:
             * LegacyBar.TitleColor = Color.Blue; //Or any other Color you want
             *
             * The Separator between the Action Bar Items can be set with:
             * LegacyBar.SeparatorColor = Color.Blue;
             *
             * and with a drawable:
             *
             * LegacyBar.SeparatorDrawable = myDrawable;
             */

            //always put these 2 in there since they are NOT in my menu.xml
            MenuId = Resource.Menu.mainmenu;

            LegacyBarAction shareAction = new DefaultLegacyBarAction(this, CreateShareIntent(),
                                                                     LegacyBar.LightIcons ? Resource.Drawable.ic_action_sort : Resource.Drawable.ic_action_sort_dark)
            {
                ActionType = ActionType.Always
            };

            LegacyBar.AddAction(shareAction);


            var otherAction = new DefaultLegacyBarAction(this, new Intent(this, typeof(OtherActivity)),
                                                         LegacyBar.LightIcons ? Resource.Drawable.ic_action_share : Resource.Drawable.ic_action_share_dark)
            {
                ActionType = ActionType.Always
            };

            LegacyBar.AddAction(otherAction);

            //only put in if there is room
            var searchMenuItemAction = new MenuItemLegacyBarAction(
                this, Resource.Id.menu_search, LegacyBar.LightIcons ? Resource.Drawable.ic_action_share : Resource.Drawable.ic_action_share_dark,
                Resource.String.menu_string_search)
            {
                ActionType = ActionType.IfRoom
            };

            LegacyBar.AddAction(searchMenuItemAction);

            //never put this guy in there
            searchMenuItemAction = new MenuItemLegacyBarAction(
                this, Resource.Id.menu_refresh, LegacyBar.LightIcons ? Resource.Drawable.ic_action_refresh : Resource.Drawable.ic_action_refresh_dark,
                Resource.String.menu_string_refresh)
            {
                ActionType = ActionType.Never
            };
            LegacyBar.AddAction(searchMenuItemAction);

            var startProgress = FindViewById <Button>(Resource.Id.start_progress);

            startProgress.Click += (s, e) => LegacyBar.ProgressBarVisibility = ViewStates.Visible;

            var stopProgress = FindViewById <Button>(Resource.Id.stop_progress);

            stopProgress.Click += (s, e) => LegacyBar.ProgressBarVisibility = ViewStates.Gone;

            var removeActions = FindViewById <Button>(Resource.Id.remove_actions);

            removeActions.Click += (s, e) => LegacyBar.RemoveAllActions();

            var removeShareAction = FindViewById <Button>(Resource.Id.remove_share_action);

            removeShareAction.Click += (s, e) => LegacyBar.RemoveAction(shareAction);

            var addAction = FindViewById <Button>(Resource.Id.add_action);

            addAction.Click += (s, e) =>
            {
                var action = new MyOtherActionBarAction(this, null, LegacyBar.LightIcons ? Resource.Drawable.ic_action_share : Resource.Drawable.ic_action_share_dark);
                LegacyBar.AddAction(action);
            };

            var removeAction = FindViewById <Button>(Resource.Id.remove_action);

            removeAction.Click += (s, e) =>
            {
                LegacyBar.RemoveActionAt(LegacyBar.ActionCount - 1);
                Toast.MakeText(this, "Removed legacyBarAction.", ToastLength.Short).Show();
            };

            var otherActivity = FindViewById <Button>(Resource.Id.other_activity);

            otherActivity.Click += (s, e) =>
            {
                var intent = new Intent(this, typeof(OtherActivity));
                StartActivity(intent);
            };

            var black = FindViewById <Button>(Resource.Id.black_activity);

            black.Click += (s, e) =>
            {
                var intent = new Intent(this, typeof(OtherActivity));
                intent.PutExtra("Theme", (int)LegacyBarTheme.HoloBlack);
                StartActivity(intent);
            };

            var blue = FindViewById <Button>(Resource.Id.blue_activity);

            blue.Click += (s, e) =>
            {
                var intent = new Intent(this, typeof(OtherActivity));
                intent.PutExtra("Theme", (int)LegacyBarTheme.HoloBlue);
                StartActivity(intent);
            };

            var light = FindViewById <Button>(Resource.Id.light_activity);

            light.Click += (s, e) =>
            {
                var intent = new Intent(this, typeof(OtherActivity));
                intent.PutExtra("Theme", (int)LegacyBarTheme.HoloLight);
                StartActivity(intent);
            };

            var gray = FindViewById <Button>(Resource.Id.gray_activity);

            gray.Click += (s, e) =>
            {
                var intent = new Intent(this, typeof(OtherActivity));
                intent.PutExtra("Theme", (int)LegacyBarTheme.HoloGray);
                StartActivity(intent);
            };


            var fragmentActivity = FindViewById <Button>(Resource.Id.fragment_activity);

            fragmentActivity.Click += (s, e) =>
            {
                var intent = new Intent(this, typeof(FragmentTabActivity));
                StartActivity(intent);
            };

            var spinnerActivity = FindViewById <Button>(Resource.Id.dropdown_activity);

            spinnerActivity.Click += (s, e) =>
            {
                var intent = new Intent(this, typeof(SpinnerActivity));
                StartActivity(intent);
            };
        }
Esempio n. 15
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.List);

            tmrState.Elapsed += tmrState_Elapsed;
            tmrState.Start( );

            #region ActionBars settings
            //TopActionBar settings
            MenuId    = Resource.Menu.ListMenu;
            LegacyBar = FindViewById <LegacyBar.Library.Bar.LegacyBar>(Resource.Id.ActionBar);
            LegacyBar.SetHomeLogo(Resource.Drawable.Icon);
            LegacyBar.Title = "Баланс: " + UserInfo.Balance + " р.";

            var itemActionBarAction = new MenuItemLegacyBarAction(
                this, Resource.Id.btnRefresh, Resource.Drawable.ic_refresh,
                Resource.String.Refresh)
            {
                ActionType = ActionType.Always
            };
            LegacyBar.AddAction(itemActionBarAction);

            itemActionBarAction = new MenuItemLegacyBarAction(
                this, Resource.Id.btnGetBalance, Resource.Drawable.ic_balance,
                Resource.String.Balance)
            {
                ActionType = ActionType.IfRoom
            };
            LegacyBar.AddAction(itemActionBarAction);


            //BottomActionBar settings
            var bottomActionBar = FindViewById <LegacyBar.Library.Bar.LegacyBar>(Resource.Id.bottomActionbar);

            var action = new MenuItemLegacyBarAction(this, Resource.Id.btnMagicCall, Resource.Drawable.ic_call,
                                                     Resource.String.CallMagicNumber)
            {
                ActionType = ActionType.Always
            };

            bottomActionBar.AddAction(action);

            action = new MenuItemLegacyBarAction(
                this, Resource.Id.btnSetArea, Resource.Drawable.ic_location,
                Resource.String.ChooseArea)
            {
                ActionType = ActionType.Always
            };
            bottomActionBar.AddAction(action);

            action = new MenuItemLegacyBarAction(
                this, Resource.Id.btnLogout, Resource.Drawable.ic_exit,
                Resource.String.Logout)
            {
                ActionType = ActionType.Always
            };
            bottomActionBar.AddAction(action);

            action = new MenuItemLegacyBarAction(this, Resource.Id.btnSettings, Resource.Drawable.ic_settings,
                                                 Resource.String.Settings)
            {
                ActionType = ActionType.Always
            };

            bottomActionBar.AddAction(action);
            #endregion

            lstOrders   = FindViewById <ListView>(Resource.Id.lstOrders);
            txtNoOrders = FindViewById <TextView>(Resource.Id.txtNoOrders);

            lstOrders.ItemClick += lstOrders_ItemClick;

            LegacyBar.ProgressBarVisibility = ViewStates.Visible;
            ThreadPool.QueueUserWorkItem(o => Refresh( ));
        }