public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            base.OnCreateView(inflater, container, savedInstanceState);
            var view = inflater.Inflate(Resource.Layout.NewGame, container, false);

            var adapter = new SpinnerAdapter(this.Activity, Resource.Layout.Row, mTeams.ToArray());

            // Set Home Team
            mHomeTeamName               = view.FindViewById <Spinner>(Resource.Id.homeTeam);
            mHomeTeamName.Adapter       = adapter;
            mHomeTeamName.ItemSelected += setTeam;

            // Set Away Team
            mAwayTeamName               = view.FindViewById <Spinner>(Resource.Id.awayTeam);
            mAwayTeamName.Adapter       = adapter;
            mAwayTeamName.ItemSelected += setTeam;

            // Set Overs
            mOvers               = view.FindViewById <Spinner>(Resource.Id.overs);
            mOvers.Adapter       = new SpinnerAdapter(this.Activity, Resource.Layout.Row, mOversArray);
            mOvers.ItemSelected += setOvers;

            // Set Location
            mLocation               = view.FindViewById <Spinner>(Resource.Id.location);
            mLocation.Adapter       = new SpinnerAdapter(this.Activity, Resource.Layout.Row, Locations.ToArray());
            mLocation.ItemSelected += setLocation;

            // Set Umpire one
            mUmpireOne               = view.FindViewById <Spinner>(Resource.Id.umpire1);
            mUmpireOne.Adapter       = new SpinnerAdapter(this.Activity, Resource.Layout.Row, Umpires.ToArray());
            mUmpireOne.ItemSelected += setUmpires;

            // Set Umpire two
            mUmpireTwo               = view.FindViewById <Spinner>(Resource.Id.umpire2);
            mUmpireTwo.Adapter       = new SpinnerAdapter(this.Activity, Resource.Layout.Row, Umpires.ToArray());
            mUmpireTwo.ItemSelected += setUmpires;

            // Create Match
            mCreateMatchBtn         = view.FindViewById <Button>(Resource.Id.createMatchButton);
            mCreateMatchBtn.Enabled = false;
            mCreateMatchBtn.Click  += (object sender, EventArgs e) =>
            {
                int matchId = AddMatch();
                if (matchId == 0)
                {
                    return;
                }
                var currentMatchActivity = new Intent(this.Activity, typeof(CurrentMatchActivity));
                currentMatchActivity.PutExtra("MatchId", matchId);
                StartActivity(currentMatchActivity);
                Fragment prev = (DialogFragment)FragmentManager.FindFragmentByTag("newgame dialog");
                if (prev != null)
                {
                    DialogFragment df = (DialogFragment)prev;
                    df.Dismiss();
                }
            };

            return(view);
        }
Пример #2
0
 /// <summary>
 /// Set Current Entity spinner adapter
 /// </summary>
 private void SetEntitySpinnerAdapter()
 {
     _entitySpinnerAdapter = new SpinnerAdapter(mActivity, Resource.Layout.spinner_row_item_lay,
                                                _entitySpinnerItemModelList);
     spin_current_entity.Adapter = _entitySpinnerAdapter;
     spin_current_entity.SetSelection(_selectedCurrentEntitysItemPosition);
 }
Пример #3
0
 /// <summary>
 /// Set User spinner adapter
 /// </summary>
 private void SetUserSpinnerAdapter()
 {
     _userSpinnerAdapter = new SpinnerAdapter(mActivity, Resource.Layout.spinner_row_item_lay,
                                              _userSpinnerItemModelList);
     spin_users.Adapter = _userSpinnerAdapter;
     spin_users.SetSelection(_selectedUserItemPosition);
 }
Пример #4
0
        public override Dialog OnCreateDialog(Bundle savedInstanceState)
        {
            var adapter = new SpinnerAdapter(this.Activity, Resource.Layout.SpinnerTextViewRow, _items.ToArray());

            LinearLayout container = new LinearLayout(this.Activity);

            LinearLayout.LayoutParams layoutparameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
            layoutparameters.SetMargins(15, 20, 15, 5);
            Spinner userInput = new Spinner(this.Activity, SpinnerMode.Dialog)
            {
                Focusable        = true,
                LayoutParameters = layoutparameters,
                Adapter          = adapter
            };

            container.AddView(userInput);

            AlertDialog.Builder inputDialog = new AlertDialog.Builder(this.Activity);
            inputDialog.SetTitle(_title);
            inputDialog.SetView(container);
            inputDialog.SetPositiveButton("Save", (senderAlert, args) => {
                _callback.OnSelectSpinnerItem(userInput.SelectedItem.ToString());
                Dismiss();
                Toast.MakeText(this.Activity, "Saved.", ToastLength.Short).Show();
            });
            inputDialog.SetNegativeButton("Cancel", (senderAlert, args) => {
                Dismiss();
                Toast.MakeText(this.Activity, "Canceled.", ToastLength.Short).Show();
            });
            return(inputDialog.Show());
        }
Пример #5
0
 /// <summary>
 /// Set Calendar Type spinner adapter
 /// </summary>
 private void SetCalendarTypeSpinnerAdapter()
 {
     _calendarTypeSpinnerAdapter = new SpinnerAdapter(mActivity, Resource.Layout.spinner_row_item_lay,
                                                      _calendarTypeSpinnerItemModelList);
     spin_calendar_type.Adapter = _calendarTypeSpinnerAdapter;
     spin_calendar_type.SetSelection(_selectedCalendarTypeItemPosition);
 }
 /// <summary>
 /// Set Customer spinner adapter
 /// </summary>
 private void SetTaxRatesSpinnerAdapter()
 {
     _taxRatesSpinnerAdapter = new SpinnerAdapter(mActivity, Resource.Layout.spinner_row_item_lay,
                                                  _taxRatesSpinnerItemModelList);
     spin_tax_rates_val.Adapter = _taxRatesSpinnerAdapter;
     // spin_tax_rates_val.SetSelection(_selectedTaxRatesItemPosition);
 }
Пример #7
0
 /// <summary>
 /// Set Account Code spinner adapter
 /// </summary>
 private void SetAccountCodeSpinnerAdapter()
 {
     _accountCodeSpinnerAdapter = new SpinnerAdapter(mActivity, Resource.Layout.spinner_row_item_lay,
                                                     _accountCodeSpinnerItemModelList);
     spin_account_code.Adapter = _accountCodeSpinnerAdapter;
     spin_account_code.SetSelection(_selectedAccountCodeItemPosition);
 }
Пример #8
0
        /// <summary>
        /// Set Account Code spinner adapter
        /// </summary>
        private void SetUserSpinnerAdapter()
        {
            _userSpinnerAdapter = new SpinnerAdapter(mActivity, Resource.Layout.spinner_row_item_lay,
                                                     _userSpinnerItemModelList);
            spin_users.Adapter = _userSpinnerAdapter;

            // Initialize listener for spinner
            InitializeListeners();
        }
        /// <summary>
        /// Set Customer spinner adapter
        /// </summary>
        private void SetRevenueAccountSpinnerAdapter()
        {
            _revenueAccountSpinnerAdapter = new SpinnerAdapter(mActivity, Resource.Layout.spinner_row_item_lay,
                                                               _revenueAccountSpinnerItemModelList);
            spin_revenue_account_val.Adapter = _revenueAccountSpinnerAdapter;
            spin_revenue_account_val.SetSelection(_selectedRevenueAccountItemPosition);

            // Initialize listener for spinner
            InitializeListeners();
        }
Пример #10
0
        /// <summary>
        /// Set Customer spinner adapter
        /// </summary>
        private void SetCustomerSpinnerAdapter()
        {
            _accountCodeSpinnerAdapter = new SpinnerAdapter(mActivity, Resource.Layout.spinner_row_item_lay,
                                                            _accountCodeSpinnerItemModelList);
            spin_account_code.Adapter = _accountCodeSpinnerAdapter;
            spin_account_code.SetSelection(_selectedAccountCodeItemPosition);

            // Initialize listener for spinner
            InitializeListeners();
        }
        private void setUmpires(object sender, AdapterView.ItemSelectedEventArgs e)
        {
            DisableCreateMatchButtonIf();
            if (e.Position != 1)
            {
                return;
            }
            var      inputDialog = new AlertDialog.Builder(this.Activity);
            EditText userInput   = new EditText(Activity);

            userInput.InputType = InputTypes.ClassText;
            inputDialog.SetTitle("Add Umpire (Optional):");
            inputDialog.SetView(userInput);
            inputDialog.SetPositiveButton(
                "Ok",
                (senderAlert, args) =>
            {
                var umpireValid = new UmpireValidator(Access.UmpireService.GetUmpires()).Validate(userInput.Text);
                if (umpireValid.Any())
                {
                    Toast.MakeText(this.Activity, string.Join(System.Environment.NewLine, umpireValid.ToArray()), ToastLength.Short)
                    .Show();
                    return;
                }
                else
                {
                    Umpires.Add(userInput.Text);
                    var adapter = new SpinnerAdapter(this.Activity, Resource.Layout.Row, Umpires.ToArray());
                    if (Resource.Id.umpire1 == e.Parent.Id)
                    {
                        mUmpireOne.Adapter = adapter;
                        mUmpireOne.SetSelection(Umpires.Count - 1);
                    }
                    else
                    {
                        mUmpireTwo.Adapter = adapter;
                        mUmpireTwo.SetSelection(Umpires.Count - 1);
                    }
                }
            });
            inputDialog.SetNegativeButton("Dismiss", (senderAlert, args) =>
            {
                if (Resource.Id.umpire1 == e.Parent.Id)
                {
                    mUmpireOne.SetSelection(0);
                }
                else
                {
                    mUmpireTwo.SetSelection(0);
                }
            });
            inputDialog.Show();
        }
Пример #12
0
        protected override void OnStart()
        {
            base.OnStart();
            Match = Access.MatchService.GetMatch(MatchId);
            Team battingTeam;
            Team bowlingTeam;

            if ((Play == "Batsman" && Match.HomeTeam.Id == TeamId) ||
                (Play == "Bowler" && Match.AwayTeam.Id == TeamId))
            {
                BattingteamId = Match.HomeTeam.Id;
                BowlingteamId = Match.AwayTeam.Id;
                battingTeam   = Match.HomeTeam;
                bowlingTeam   = Match.AwayTeam;
            }
            else
            {
                BattingteamId = Match.AwayTeam.Id;
                BowlingteamId = Match.HomeTeam.Id;
                battingTeam   = Match.AwayTeam;
                bowlingTeam   = Match.HomeTeam;
            }

            SupportActionBar.Title = battingTeam.Name + " Innings";

            var batsman        = battingTeam.Players.Where(o => o.HowOut == "not out").Select(p => new { p.Id, p.Name });
            var batsmanAdapter = new SpinnerAdapter(this, Resource.Layout.Row, batsman.Select(x => x.Name).ToArray());

            mActiveBatsman.Adapter = batsmanAdapter;
            if (Play == "Batsman")
            {
                mActiveBatsman.SetSelection(Array.IndexOf(batsman.Select(i => i.Id).ToArray(), PlayerId));
            }

            var bowler        = bowlingTeam.Players.Select(b => new { b.Id, b.Name, b.BallsBowled });
            var bowlerAdapter = new SpinnerAdapter(this, Resource.Layout.Row, bowler.Select(x => x.Name).ToArray());

            mActiveBowler.Adapter = bowlerAdapter;
            if (Play == "Bowler")
            {
                mActiveBowler.SetSelection(Array.IndexOf(bowler.Select(i => i.Id).ToArray(), PlayerId));
            }
            else
            {
                var currentBowler = bowler.Where(bow => Helper.ConvertBallstoOvers(bow.BallsBowled).Split('.')[1] != "0");
                if (currentBowler.Any())
                {
                    mActiveBowler.SetSelection(Array.IndexOf(bowler.Select(i => i.Id).ToArray(), currentBowler.First().Id));
                }
            }

            mFielder_Keeper.Adapter = bowlerAdapter;
        }
        private void setTeam(object sender, AdapterView.ItemSelectedEventArgs e)
        {
            DisableCreateMatchButtonIf();
            if (e.Position != 1)
            {
                return;
            }
            var      inputDialog = new AlertDialog.Builder(this.Activity);
            EditText userInput   = new EditText(Activity);

            userInput.InputType = InputTypes.ClassText;
            inputDialog.SetTitle("Add New Team:");
            inputDialog.SetView(userInput);
            inputDialog.SetPositiveButton(
                "Ok",
                (senderAlert, args) =>
            {
                var teamValid = new TeamValidator(Access.TeamService.GetTeams()).Validate(userInput.Text);
                if (teamValid.Any())
                {
                    Toast.MakeText(this.Activity, string.Join(System.Environment.NewLine, teamValid.ToArray()), ToastLength.Long).Show();
                    return;
                }
                else
                {
                    var teamId = Access.TeamService.AddTeam(userInput.Text);
                    mTeams.Add(Access.TeamService.GetTeam(teamId).Name);
                    var adapter = new SpinnerAdapter(this.Activity, Resource.Layout.Row, mTeams.ToArray());
                    if (Resource.Id.homeTeam == e.Parent.Id)
                    {
                        mHomeTeamName.Adapter = adapter;
                        mHomeTeamName.SetSelection(mTeams.Count - 1);
                    }
                    else
                    {
                        mAwayTeamName.Adapter = adapter;
                        mAwayTeamName.SetSelection(mTeams.Count - 1);
                    }
                }
            });
            inputDialog.SetNegativeButton("Dismiss", (senderAlert, args) => {
                if (Resource.Id.homeTeam == e.Parent.Id)
                {
                    mHomeTeamName.SetSelection(0);
                }
                else
                {
                    mAwayTeamName.SetSelection(0);
                }
            });
            inputDialog.Show();
        }
Пример #14
0
 protected override void OnInitializeAdapter()
 {
     base.OnInitializeAdapter();
     if (SupportView.IsAllowMultiSelect)
     {
         dropItemAdapter = new SpinnerMultiSelectAdapter(Context, SupportItemList, SupportView, this);
     }
     else
     {
         dropItemAdapter = new SpinnerAdapter(Context, SupportItemList, SupportView);
     }
     OriginalView.Adapter = dropItemAdapter;
 }
    protected override void OnCreate(Bundle bundle)
    {
        base.OnCreate(bundle);
        // Set our view from the "main" layout resource
        SetContentView(Resource.Layout.Main);
        mSpinner = FindViewById <Spinner>(Resource.Id.mSpinner);
        var            list    = InitList();
        SpinnerAdapter adapter = new SpinnerAdapter(this, list);

        tvResult               = FindViewById <TextView>(Resource.Id.tvResult);
        mSpinner.Adapter       = adapter;
        mSpinner.ItemSelected += MSpinner_ItemSelected;
    }
        public void OnEnteredText(string title, string inputText)
        {
            switch (title)
            {
            case "Add HomeTeam":
                var hometeam = driver.TeamListViewModel().AddTeam(inputText);
                Teams.Add(inputText);
                mHomeTeamName.Adapter = new SpinnerAdapter(this.Activity, Resource.Layout.SpinnerTextViewRow, Teams.ToArray());
                mHomeTeamName.SetSelection(Teams.Count - 1);
                break;

            case "Add AwayTeam":
                var awayteam = driver.TeamListViewModel().AddTeam(inputText);
                Teams.Add(inputText);
                mAwayTeamName.Adapter = new SpinnerAdapter(this.Activity, Resource.Layout.SpinnerTextViewRow, Teams.ToArray());
                mAwayTeamName.SetSelection(Teams.Count - 1);
                break;

            case "Custom Over":
                Overs.Add(inputText);
                var adapter = new SpinnerAdapter(this.Activity, Resource.Layout.SpinnerTextViewRow, Overs.ToArray());
                mOversOrTournaments.Adapter = adapter;
                mOversOrTournaments.SetSelection(Overs.Count - 1);
                break;

            case "Add Location":
                var addLocation = ViewModel.AddLocation(inputText);
                Locations.Add(inputText);
                mLocation.Adapter = new SpinnerAdapter(this.Activity, Resource.Layout.SpinnerTextViewRow, Locations.ToArray());
                mLocation.SetSelection(Locations.Count - 1);
                break;

            case "Add PrimaryUmpire":
                var primaryumpire = ViewModel.AddUmpire(inputText);
                Umpires.Add(inputText);
                mUmpireOne.Adapter = new SpinnerAdapter(this.Activity, Resource.Layout.SpinnerTextViewRow, Umpires.ToArray());
                mUmpireOne.SetSelection(Umpires.Count - 1);
                break;

            case "Add SecondaryUmpire":
                var secondaryumpire = ViewModel.AddUmpire(inputText);
                Umpires.Add(inputText);
                mUmpireTwo.Adapter = new SpinnerAdapter(this.Activity, Resource.Layout.SpinnerTextViewRow, Umpires.ToArray());
                mUmpireTwo.SetSelection(Umpires.Count - 1);
                break;
            }
        }
Пример #17
0
 private void SetApdater()
 {
     if (_dropDownView.ItemsSource != null)
     {
         //ArrayAdapter<String> adapter = new ArrayAdapter<String>(Android.App.Application.Context,
         //        Android.Resource.Layout.SimpleSpinnerItem, _dropDownView.ItemsSource);
         //adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleListItemSingleChoice);
         if (_adapter == null)
         {
             _adapter            = new SpinnerAdapter(_dropDownView.ItemsSource);
             _nativeView.Adapter = _adapter;
         }
         else
         {
             _adapter.SetData(_dropDownView.ItemsSource);
         }
     }
 }
Пример #18
0
        public override void OnViewCreated(View view, Bundle savedInstanceState)
        {
            if (IsInitialized)
            {
                return;
            }

            base.OnViewCreated(view, savedInstanceState);

            var toolbarHeight = (int)BitmapUtils.DpToPixel(10, Resources);

            _coordinator.LayoutParameters.Height = Style.ScreenWidth + Resources.DisplayMetrics.HeightPixels - toolbarHeight;
            _coordinator.SetTopViewParam(Style.ScreenWidth, toolbarHeight);
            _previewContainer.LayoutParameters = new LinearLayout.LayoutParams(Style.ScreenWidth, Style.ScreenWidth);

            InitBucket();
            InitGalery();

            var foldersAdapter = new SpinnerAdapter(Activity, Android.Resource.Layout.SimpleSpinnerDropDownItem, _buckets);

            _folders.Adapter       = foldersAdapter;
            _folders.ItemSelected += FoldersOnItemSelected;
            _folders.SetSelection(0);

            _gridAdapter = new GalleryGridAdapter();
            _gridAdapter.OnItemSelected += OnItemSelected;

            var gridLayoutManager = new GridLayoutManager(Activity, 3)
            {
                SmoothScrollbarEnabled = true
            };

            _gridView.SetLayoutManager(gridLayoutManager);
            _gridView.SetAdapter(_gridAdapter);
            _gridView.SetCoordinatorListener(_coordinator);

            _ratioBtn.Click       += RatioBtnOnClick;
            _rotateBtn.Click      += RotateBtnOnClick;
            _multiselectBtn.Click += MultiselectBtnOnClick;
            _backBtn.Click        += BackBtnOnClick;
            _nextBtn.Click        += NextBtnOnClick;

            _pickedItems = new List <GalleryMediaModel>();
        }
Пример #19
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View view = inflater.Inflate(Resource.Layout.Lab6Fragment, container, false);

            Spinner spinner = view.FindViewById <Spinner>(Resource.Id.spinner);

            spinner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(Spinner_ItemSelected);

            Adapter         = new SpinnerAdapter(inflater.Context, Android.Resource.Layout.SimpleSpinnerDropDownItem, Android.Resource.Layout.SimpleSpinnerItem);
            spinner.Adapter = Adapter;

            if (mapFragment == null)
            {
                mapFragment = (SupportMapFragment)ChildFragmentManager.FindFragmentById(Resource.Id.map);
                mapFragment.GetMapAsync(this);
            }

            Activity.SupportFragmentManager.BeginTransaction().Replace(Resource.Id.map, mapFragment).Commit();
            return(view);
        }
        public override void OnResume()
        {
            base.OnResume();

            //Set teams
            var adapter = new SpinnerAdapter(this.Activity, Resource.Layout.SpinnerTextViewRow, Teams.ToArray());

            mHomeTeamName.Adapter       = adapter;
            mHomeTeamName.ItemSelected += SetTeam;
            mAwayTeamName.Adapter       = adapter;
            mAwayTeamName.ItemSelected += SetTeam;

            // Set Overs or Tournaments
            if (isTournament)
            {
                mOversOrTournaments.Adapter       = new SpinnerAdapter(this.Activity, Resource.Layout.SpinnerTextViewRow, Tournaments.ToArray());
                mOversOrTournaments.ItemSelected += SetOvers;
            }
            else
            {
                mOversOrTournaments.Adapter       = new SpinnerAdapter(this.Activity, Resource.Layout.SpinnerTextViewRow, Overs.ToArray());
                mOversOrTournaments.ItemSelected += SetOvers;
            }

            // Set Location
            mLocation.Adapter = new SpinnerAdapter(this.Activity, Resource.Layout.SpinnerTextViewRow,
                                                   Locations.ToArray());
            mLocation.ItemSelected += SetLocation;

            // Set Umpire
            mUmpireOne.Adapter = new SpinnerAdapter(this.Activity, Resource.Layout.SpinnerTextViewRow,
                                                    Umpires.ToArray());
            mUmpireOne.ItemSelected += SetUmpires;

            mUmpireTwo.Adapter = new SpinnerAdapter(this.Activity, Resource.Layout.SpinnerTextViewRow,
                                                    Umpires.ToArray());
            mUmpireTwo.ItemSelected += SetUmpires;
        }
        private void setOvers(object sender, AdapterView.ItemSelectedEventArgs e)
        {
            DisableCreateMatchButtonIf();
            if (e.Position != 5)
            {
                return;
            }
            var      inputDialog = new AlertDialog.Builder(this.Activity);
            EditText userInput   = new EditText(Activity);

            userInput.InputType = InputTypes.ClassNumber;
            inputDialog.SetTitle("Enter Number Of Overs:");
            inputDialog.SetView(userInput);
            inputDialog.SetPositiveButton(
                "Ok",
                (senderAlert, args) =>
            {
                if (userInput.Text != string.Empty)
                {
                    Array.Resize(ref mOversArray, mOversArray.Length + 1);
                    mOversArray[mOversArray.Length - 1] = userInput.Text;
                    var adapter    = new SpinnerAdapter(this.Activity, Resource.Layout.Row, mOversArray);
                    mOvers.Adapter = adapter;
                    mOvers.SetSelection(mOversArray.Length - 1);
                }
                else
                {
                    Toast.MakeText(this.Activity, "Total Overs cannot be blank.", ToastLength.Short)
                    .Show();
                    return;
                }
            });
            inputDialog.SetNegativeButton("Dismiss", (senderAlert, args) =>
            {
                mOvers.SetSelection(1);
            });
            inputDialog.Show();
        }
Пример #22
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.AddExpensePopUpLayout);
            SetCancelable(true);

            var save = (Button)FindViewById(Resource.Id.addExpenseSave);

            save.Enabled = !Assignment.IsHistory;
            save.SetOnClickListener(this);

            deleteExpense         = (Button)FindViewById(Resource.Id.addExpenseDelete);
            deleteExpense.Enabled = !Assignment.IsHistory;
            deleteExpense.SetOnClickListener(this);

            var cancel = (Button)FindViewById(Resource.Id.addExpenseCancel);

            cancel.SetOnClickListener(this);

            expenseType                = (Spinner)FindViewById(Resource.Id.addExpenseType);
            expenseDescription         = (EditText)FindViewById(Resource.Id.addExpenseDescription);
            expenseDescription.Enabled = !Assignment.IsHistory;
            expenseAmount              = (TextView)FindViewById(Resource.Id.addExpenseAmount);
            expenseAmount.Enabled      = !Assignment.IsHistory;
            expensePhoto               = (ImageView)FindViewById(Resource.Id.addExpenseImage);
            expenseAddPhoto            = (Button)FindViewById(Resource.Id.addExpenseAddPhoto);
            expenseAddPhoto.Enabled    = !Assignment.IsHistory;
            expenseAddPhoto.SetOnClickListener(this);

            var adapter = new SpinnerAdapter <ExpenseCategory> (expenseTypes, Context, Resource.Layout.SimpleSpinnerItem);

            adapter.TextColor   = Color.Black;
            adapter.Background  = Color.White;
            expenseType.Adapter = adapter;
            expenseType.Enabled = !Assignment.IsHistory;
            expenseType.OnItemSelectedListener = this;
        }
        private void setLocation(object sender, AdapterView.ItemSelectedEventArgs e)
        {
            DisableCreateMatchButtonIf();
            if (e.Position != 1)
            {
                return;
            }
            var      inputDialog = new AlertDialog.Builder(this.Activity);
            EditText userInput   = new EditText(Activity);

            userInput.InputType = InputTypes.ClassText;
            inputDialog.SetTitle("Add New Location/Ground (Optional):");
            inputDialog.SetView(userInput);
            inputDialog.SetPositiveButton(
                "Ok",
                (senderAlert, args) =>
            {
                if (string.IsNullOrEmpty(userInput.Text))
                {
                    Toast.MakeText(this.Activity, "Location cannot be blank.", ToastLength.Short)
                    .Show();
                    return;
                }
                else
                {
                    Locations.Add(userInput.Text);
                    var adapter       = new SpinnerAdapter(this.Activity, Resource.Layout.Row, Locations.ToArray());
                    mLocation.Adapter = adapter;
                    mLocation.SetSelection(Locations.Count - 1);
                }
            });
            inputDialog.SetNegativeButton("Dismiss", (senderAlert, args) =>
            {
                mLocation.SetSelection(0);
            });
            inputDialog.Show();
        }
Пример #24
0
        private void ShowRunoutDialog()
        {
            ArrayAdapter extrasAdapter  = new SpinnerAdapter(this, Resource.Layout.Row, new[] { "0", "1", "2", "3", "4" });
            var          batsman        = Access.PlayerService.GetPlayersPerTeamPerMatch(BattingteamId, MatchId);
            var          batsmanAdapter = new SpinnerAdapter(this, Resource.Layout.Row,
                                                             batsman.Where(o => o.HowOut == "not out").Select(p => p.Name).ToArray());

            var  runoutDialog       = new Android.App.AlertDialog.Builder(this);
            View runoutdialoglayout = LayoutInflater.Inflate(Resource.Layout.DialogRunout, null);

            RunoutRuns               = runoutdialoglayout.FindViewById <Spinner>(Resource.Id.runoutruns);
            RunoutRuns.Adapter       = extrasAdapter;
            RunnerOut                = runoutdialoglayout.FindViewById <RadioGroup>(Resource.Id.runnerout);
            RunnerOut.CheckedChange += Runnerout_CheckedChange;
            RunnerBatsman            = runoutdialoglayout.FindViewById <Spinner>(Resource.Id.runnerbatsman);
            RunnerBatsman.Adapter    = batsmanAdapter;
            RunnerOut.Check(Resource.Id.norunnerout);

            runoutDialog.SetView(runoutdialoglayout);
            runoutDialog.SetPositiveButton("Ok",
                                           (senderAlert, args) =>
            {
                runoutDialog.Dispose();
                ThisBall.RunsScored = Convert.ToInt16(RunoutRuns.SelectedItem.ToString());
                if (RunnerBatsman.Enabled)
                {
                    ThisBall.RunnerBatsman = RunnerBatsman.SelectedItem.ToString();
                    ThisBall.RunnerHowOut  = $"runout({ThisBall.Fielder})";
                    ThisBall.HowOut        = "not out";
                }
                else
                {
                    ThisBall.HowOut = $"runout({ThisBall.Fielder})";
                }
            });
            runoutDialog.Show();
        }
Пример #25
0
        public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            base.OnCreateView (inflater, container, savedInstanceState);
            var view = inflater.Inflate (Resource.Layout.NavigationLayout, null, true);
            navigationListView = view.FindViewById<ListView> (Resource.Id.navigationListView);
            navigationStatus = view.FindViewById<Spinner> (Resource.Id.fragmentStatus);
            navigationStatusImage = view.FindViewById<ImageView> (Resource.Id.fragmentStatusImage);
            timerLayout = view.FindViewById<RelativeLayout> (Resource.Id.fragmentTimerTextLayout);
            navigationStatusLayout = view.FindViewById<LinearLayout> (Resource.Id.navigationStatusLayout);
            timer = view.FindViewById<ToggleButton> (Resource.Id.fragmentTimer);
            timerHours = view.FindViewById<TextView> (Resource.Id.fragmentHours);

            navigationStatusImage.SetImageResource (Resource.Drawable.HoldImage);
            var spinnerAdapter = new SpinnerAdapter<AssignmentStatus> (assignmentViewModel.AvailableStatuses, Activity, Resource.Layout.SimpleSpinnerItem);
            spinnerAdapter.TextColor = Color.White;
            navigationStatus.Adapter = spinnerAdapter;
            if (Assignment != null && !Assignment.IsHistory) {
                navigationStatus.ItemSelected += (sender, e) => {
                    var status = assignmentViewModel.AvailableStatuses [e.Position];
                    if (Assignment != null && Assignment.Status != status && Assignment.Status != AssignmentStatus.New) {
                        switch (status) {
                            case AssignmentStatus.Complete:
                                //go to confirmations screen
                                var currentPosition = navigationListView.SelectedItemPosition;
                                var confirmationPosition = Constants.Navigation.IndexOf ("Confirmations");
                                if (currentPosition != confirmationPosition) {
                                    navigationSelector.OnItemClick (navigationListView, navigationListView.GetChildAt (confirmationPosition), confirmationPosition, 0);
                                }
                                navigationStatus.SetSelection (assignmentViewModel.AvailableStatuses.ToList ().IndexOf (Assignment.Status));
                                break;
                            default:
                                Assignment.Status = status;
                                SaveAssignment ();
                                break;
                        }
                    }
                };
            }
            timerLayout.Visibility = ViewStates.Gone;

            var adapter = new NavigationAdapter (Activity, Resource.Layout.NavigationListItemLayout, Constants.Navigation);
            if (Assignment != null && Assignment.IsHistory) {
                adapter = new NavigationAdapter (Activity, Resource.Layout.NavigationListItemLayout, Constants.HistoryNavigation);
            }
            navigationListView.OnItemClickListener = navigationSelector;
            navigationListView.Adapter = adapter;

            timer.CheckedChange += (sender, e) => {
                if (e.IsChecked != assignmentViewModel.Recording) {
                    if (assignmentViewModel.Recording) {
                        assignmentViewModel.PauseAsync ();
                    } else {
                        assignmentViewModel.RecordAsync ();
                    }
                }
            };

            SetActiveAssignment ();

            return view;
        }
Пример #26
0
        //public void setAdapter(SpinnerAdapter adapter) { }

        // members and types are to be extended by jsc at release build

        //public override void setAdapter(SpinnerAdapter adapter)
        public void setAdapter(SpinnerAdapter adapter)
        {
        }
Пример #27
0
        // @TargetApi(Build.VERSION_CODES.HONEYCOMB)
        public SpringConfiguratorView(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle)
        {
            SpringSystem springSystem = SpringSystem.create();

            springConfigRegistry = SpringConfigRegistry.getInstance();
            spinnerAdapter       = new SpinnerAdapter(context);

            Resources resources = this.Resources;

            mRevealPx = Util.dpToPx(40, resources);
            mStashPx  = Util.dpToPx(280, resources);

            mRevealerSpring = springSystem.createSpring();
            mRevealerSpring
            .setCurrentValue(1)
            .setEndValue(1)
            .addListener(new SimpleSpringListener()
            {
                SpringUpdate = (spring) =>
                {
                    float val          = (float)spring.getCurrentValue();
                    float minTranslate = mRevealPx;
                    float maxTranslate = mStashPx;
                    float range        = maxTranslate - minTranslate;
                    float yTranslate   = (val * range) + minTranslate;
                    this.TranslationY  = yTranslate;
                }
            });

            AddView(generateHierarchy(context));

            SeekbarListener seekbarListener = new SeekbarListener()
            {
                ProgressChanged = (seekBar, val, b) =>
                {
                    float tensionRange  = MAX_TENSION - MIN_TENSION;
                    float frictionRange = MAX_FRICTION - MIN_FRICTION;
                    if (seekBar == mTensionSeekBar)
                    {
                        float scaledTension = ((val) * tensionRange) / MAX_SEEKBAR_VAL + MIN_TENSION;
                        mSelectedSpringConfig.tension =
                            OrigamiValueConverter.tensionFromOrigamiValue(scaledTension);
                        string roundedTensionLabel = DECIMAL_FORMAT.Format(scaledTension);
                        mTensionLabel.Text = "T:" + roundedTensionLabel;
                    }

                    if (seekBar == mFrictionSeekBar)
                    {
                        float scaledFriction = ((val) * frictionRange) / MAX_SEEKBAR_VAL + MIN_FRICTION;
                        mSelectedSpringConfig.friction =
                            OrigamiValueConverter.frictionFromOrigamiValue(scaledFriction);
                        string roundedFrictionLabel = DECIMAL_FORMAT.Format(scaledFriction);
                        mFrictionLabel.Text = "F:" + roundedFrictionLabel;
                    }
                }
            };

            mTensionSeekBar.Max = MAX_SEEKBAR_VAL;
            mTensionSeekBar.SetOnSeekBarChangeListener(seekbarListener);

            mFrictionSeekBar.Max = MAX_SEEKBAR_VAL;
            mFrictionSeekBar.SetOnSeekBarChangeListener(seekbarListener);

            mSpringSelectorSpinner.Adapter = spinnerAdapter;
            mSpringSelectorSpinner.OnItemSelectedListener = new SpringSelectedListener()
            {
                ItemSelected = (ad, v, i, l) =>
                {
                    mSelectedSpringConfig = mSpringConfigs[i];
                    updateSeekBarsForSpringConfig(mSelectedSpringConfig);
                }
            };
            refreshSpringConfigurations();
            this.TranslationY = mStashPx;
        }
Пример #28
0
        //public void setAdapter(SpinnerAdapter adapter) { }

        // members and types are to be extended by jsc at release build

        public override void setAdapter(SpinnerAdapter adapter)
        {
        }
Пример #29
0
 /// <summary>
 /// Set Account Code spinner adapter
 /// </summary>
 private void SetAccountCodeSpinnerAdapter()
 {
     _accountCodeSpinnerAdapter = new SpinnerAdapter(mActivity, Resource.Layout.spinner_row_item_lay,
                                                     _accountCodeSpinnerItemModelList);
     spin_account_code.Adapter = _accountCodeSpinnerAdapter;
 }
Пример #30
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate (savedInstanceState);

            SetContentView (Resource.Layout.AddExpensePopUpLayout);
            SetCancelable (true);

            var save = (Button)FindViewById (Resource.Id.addExpenseSave);
            save.Enabled = !Assignment.IsHistory;
            save.SetOnClickListener (this);

            deleteExpense = (Button)FindViewById (Resource.Id.addExpenseDelete);
            deleteExpense.Enabled = !Assignment.IsHistory;
            deleteExpense.SetOnClickListener (this);

            var cancel = (Button)FindViewById (Resource.Id.addExpenseCancel);
            cancel.SetOnClickListener (this);

            expenseType = (Spinner)FindViewById (Resource.Id.addExpenseType);
            expenseDescription = (EditText)FindViewById (Resource.Id.addExpenseDescription);
            expenseDescription.Enabled = !Assignment.IsHistory;
            expenseAmount = (TextView)FindViewById (Resource.Id.addExpenseAmount);
            expenseAmount.Enabled = !Assignment.IsHistory;
            expensePhoto = (ImageView)FindViewById (Resource.Id.addExpenseImage);
            expenseAddPhoto = (Button)FindViewById (Resource.Id.addExpenseAddPhoto);
            expenseAddPhoto.Enabled = !Assignment.IsHistory;
            expenseAddPhoto.SetOnClickListener (this);

            var adapter = new SpinnerAdapter<ExpenseCategory> (expenseTypes, Context, Resource.Layout.SimpleSpinnerItem);
            adapter.TextColor = Color.Black;
            adapter.Background = Color.White;
            expenseType.Adapter = adapter;
            expenseType.Enabled = !Assignment.IsHistory;
            expenseType.OnItemSelectedListener = this;
        }
        /// <summary>
        /// Gets the leave parameters.
        /// </summary>
        /// <param name="userId">The user unique identifier.</param>
        private async void GetLeaveParams(string userId)
        {
            if (ApplicationData.LeaveParameters == null)
            {
                ApplicationData.LeaveParameters = await leaveRequestRepository.RetrieveLeave(ApplicationData.User.Token, userId);
            }

            leaveParams = ApplicationData.LeaveParameters;
            var spinnerArrayAdapter = new SpinnerAdapter(this, Android.Resource.Layout.SimpleSpinnerItem, leaveParams.DayTypes);
            spinnerArrayAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            fromSpinner.Adapter = toSpinner.Adapter = spinnerArrayAdapter;
        }
Пример #32
0
        //public void setAdapter(SpinnerAdapter adapter) { }

        // members and types are to be extended by jsc at release build

        //public override void setAdapter(SpinnerAdapter adapter)
        public void setAdapter(SpinnerAdapter adapter)
        {
        }
Пример #33
0
		/// <summary>
		/// Sets the current active assignment
		/// </summary>
		/// <param name="visible"></param>
		void SetAssignment (bool visible)
		{
			if (!visible) {
				assignmentMapViewLayout.Visibility = ViewStates.Gone;
				return;
			}

			assignmentMapViewLayout.Visibility = ViewStates.Visible;
			assignment = assignmentViewModel.ActiveAssignment;

			buttonLayout.Visibility = ViewStates.Gone;
			timerLayout.Visibility = ViewStates.Visible;

			var adapter = new SpinnerAdapter<AssignmentStatus> (assignmentViewModel.AvailableStatuses, this, Resource.Layout.SimpleSpinnerItem);
			adapter.TextColor = Resources.GetColor (Resource.Color.greyspinnertext);
			adapter.Background = Resources.GetColor (Resource.Color.assignmentblue);
			activeSpinner.Adapter = adapter;
			activeSpinner.SetSelection (assignmentViewModel.AvailableStatuses.ToList ().IndexOf (assignment.Status));
			activeSpinner.SetBackgroundResource (Resource.Drawable.triangleblue);
			spinnerImage.SetImageResource (Resource.Drawable.EnrouteImage);

			number.Text = assignment.Priority.ToString ();
			job.Text = string.Format ("#{0} {1}\n{2}", assignment.JobNumber, assignment.StartDate.ToShortDateString (), assignment.CompanyName);
			name.Text = assignment.ContactName;
			phone.Text = assignment.ContactPhone;
			address.Text = string.Format ("{0}\n{1}, {2} {3}", assignment.Address, assignment.City, assignment.State, assignment.Zip);
			timerText.Text = assignmentViewModel.Hours.ToString (@"hh\:mm\:ss");
		}
Пример #34
0
 /// <summary>
 /// Set Language spinner adapter
 /// </summary>
 private void SetLanguageSpinnerAdapter()
 {
     _languageSpinnerAdapter = new SpinnerAdapter(mActivity, Resource.Layout.spinner_row_item_lay,
                                                  _languageSpinnerItemModelList);
     spin_language.Adapter = _languageSpinnerAdapter;
 }
Пример #35
0
 /// <summary>
 /// Set Current Entity spinner adapter
 /// </summary>
 private void SetEntitySpinnerAdapter()
 {
     _entitySpinnerAdapter = new SpinnerAdapter(mActivity, Resource.Layout.spinner_row_item_lay,
                                                _entitySpinnerItemModelList);
     spin_current_entity.Adapter = _entitySpinnerAdapter;
 }