protected override void OnBindDialogView(View view)
        {
            base.OnBindDialogView(view);

            var currentValue = GetPersistedInt(SettingsScreen.DefaultRadiusValue);

            if (BuildVersionCodes.Honeycomb > Build.VERSION.SdkInt)
            {
                _radioGroup = (RadioGroup)view;
                foreach (var distance in Constants.AlarmRadiusValues)
                {
                    var radioButton = new RadioButton(Context);
                    radioButton.SetText(string.Format(Context.GetString(Resource.String.settings_default_radius_sum), distance), TextView.BufferType.Normal);
                    radioButton.Checked = distance == currentValue;
                    radioButton.Id = distance;
                    _radioGroup.AddView(radioButton);
                }
            }
            else
            {
                _numberPicker = (NumberPicker)view;
                SetNumberPickerTextColor(_numberPicker, Context.Resources.GetColor(Resource.Color.dark));
                _numberPicker.DescendantFocusability = DescendantFocusability.BlockDescendants;
                _numberPicker.SetDisplayedValues(Constants.AlarmRadiusValues.Select(v => v.ToString()).ToArray());
                _numberPicker.MinValue = 0;
                _numberPicker.MaxValue = Constants.AlarmRadiusValues.Count() - 1;
                _numberPicker.WrapSelectorWheel = false;
                _numberPicker.Value = Constants.AlarmRadiusValues.IndexOf(currentValue);
            }
        }
예제 #2
0
        void KeepMe()
        {
            var txt = new TextView(null);
            txt.Text = txt.Text;

            var iv = new ImageView(null);
            var obj = iv.Drawable;

            var prog = new ProgressBar(null);
            prog.Progress = prog.Progress;

            var cb = new RadioButton(null);
            cb.Checked = cb.Checked;

            var np = new NumberPicker(null);
            np.Value = np.Value;

            var rb = new RatingBar(null);
            rb.Rating = rb.Rating;

            var cv = new CalendarView(null);
            cv.Date = cv.Date;

            var th = new TabHost(null);
            th.CurrentTab = th.CurrentTab;

            var tp = new TimePicker(null);
            tp.CurrentHour = tp.CurrentHour;
            tp.CurrentMinute = tp.CurrentMinute;

            
        }
 public NumberPickerDialogFragment(Context context, int min, int max, int current, NumberPicker.IOnValueChangeListener listener)
 {
     _context = context;
     _min = min;
     _max = max;
     _current = current;
     _listener = listener;
 }
        void CreateDialog()
        {
            _picker          = new APicker(_context);
            _picker.MinValue = _min;
            _picker.MaxValue = _max;
            if (_NumberPickerCell.Number.HasValue)
            {
                _picker.Value = _NumberPickerCell.Number.Value;
            }

            if (!String.IsNullOrEmpty(_NumberPickerCell.Unit))
            {
                _picker.SetFormatter(new UnitFormatter(_NumberPickerCell.Unit));
                ApplyInitialFormattingBugfix(_picker);
            }

            if (_dialog == null)
            {
                using (var builder = new AlertDialog.Builder(_context)) {
                    builder.SetTitle(_title);

                    Android.Widget.FrameLayout parent = new Android.Widget.FrameLayout(_context);
                    parent.AddView(_picker, new Android.Widget.FrameLayout.LayoutParams(
                                       ViewGroup.LayoutParams.WrapContent,
                                       ViewGroup.LayoutParams.WrapContent,
                                       GravityFlags.Center));
                    builder.SetView(parent);


                    builder.SetNegativeButton(global::Android.Resource.String.Cancel, (o, args) =>
                    {
                        ClearFocus();
                    });
                    builder.SetPositiveButton(global::Android.Resource.String.Ok, (o, args) =>
                    {
                        _NumberPickerCell.Number = _picker.Value;
                        _command?.Execute(_picker.Value);
                        ClearFocus();
                    });

                    _dialog = builder.Create();
                }
                _dialog.SetCanceledOnTouchOutside(true);
                _dialog.DismissEvent += (ss, ee) =>
                {
                    DestroyDialog();
                };

                _dialog.Show();
            }
        }
예제 #5
0
        private void CreateDialog()
        {
            if (_TextPickerCell.Items == null ||
                _TextPickerCell.Items.Count == 0)
            {
                return;
            }

            _Picker?.Dispose();
            _Picker = new ANumberPicker(AndroidContext)
            {
                DescendantFocusability = DescendantFocusability.BlockDescendants,
                MinValue          = 0,
                MaxValue          = _TextPickerCell.Items.Count - 1,
                WrapSelectorWheel = _TextPickerCell.IsCircularPicker,
                Value             = Math.Max(_TextPickerCell.Items.IndexOf(_TextPickerCell.SelectedItem), 0),
            };

            _Picker.SetBackgroundColor(_TextPickerCell.Prompt.BackgroundColor.ToAndroid());
            _Picker.SetTextColor(_TextPickerCell.Prompt.ItemColor.ToAndroid());
            _Picker.SetDisplayedValues(_TextPickerCell.Items.ToArray());

            if (_Dialog != null)
            {
                return;
            }
            using (var builder = new AlertDialog.Builder(AndroidContext))
            {
                builder.SetTitle(_PopupTitle);

                var parent = new FrameLayout(AndroidContext);
                parent.SetBackgroundColor(_TextPickerCell.Prompt.BackgroundColor.ToAndroid());

                parent.AddView(_Picker, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent, GravityFlags.Center));

                builder.SetView(parent);
                builder.SetNegativeButton(_TextPickerCell.Prompt.Cancel, CancelAndClosePopup);
                builder.SetPositiveButton(_TextPickerCell.Prompt.Accept, AcceptAndClosePopup);

                _Dialog = builder.Create();
            }

            if (_Dialog is null)
            {
                return;
            }
            _Dialog.SetCanceledOnTouchOutside(true);
            _Dialog.DismissEvent += OnDialogOnDismissEvent;

            _Dialog.Show();
        }
 // see bug https://stackoverflow.com/questions/17708325/android-numberpicker-with-formatter-doesnt-format-on-first-rendering/54083214#54083214
 // and https://issuetracker.google.com/issues/36952035
 private static void ApplyInitialFormattingBugfix(APicker picker)
 {
     try
     {
         Class klass = Java.Lang.Class.FromType(typeof(NumberPicker));
         Field f     = klass.GetDeclaredField("mInputText");
         f.Accessible = true;
         EditText inputText = (EditText)f.Get(picker);
         inputText.SetFilters(new IInputFilter[0]);
     }
     catch (Exception)
     {
         // silently ignore this
     }
 }
 void DestroyDialog()
 {
     if (_dialog != null)
     {
         // Set _dialog to null to avoid racing attempts to destroy dialog - e.g. in response to dismiss event
         var dialog = _dialog;
         _dialog = null;
         _picker.RemoveFromParent();
         _picker.Dispose();
         _picker = null;
         // Dialog.Dispose() does not close an open dialog view so explicitly dismiss it before disposing
         dialog.Dismiss();
         dialog.Dispose();
     }
 }
        static void SetNumberPickerTextColor(NumberPicker numberPicker, Color color)
        {
            try
            {
                int count = numberPicker.ChildCount;
                for (int i = 0; i < count; i++)
                {
                    View child = numberPicker.GetChildAt(i);
                    if (child is EditText)
                    {
                        try
                        {
                            Field selectorWheelPaintField = numberPicker.Class
                                .GetDeclaredField("mSelectorWheelPaint");
                            selectorWheelPaintField.Accessible = true;
                            ((Paint)selectorWheelPaintField.Get(numberPicker)).Color = color;

                            Field selectionDivider = numberPicker.Class.GetDeclaredField("mSelectionDivider");
                            selectionDivider.Accessible = true;
                            selectionDivider.Set(numberPicker, numberPicker.Context.Resources.GetDrawable(Resource.Drawable.numberpicker_selection_divider));
                            
                            ((EditText)child).SetTextColor(color);
                        }
                        catch (NoSuchFieldException e)
                        {
                            Log.Debug("setNumberPickerTextColor", e.Message);
                        }
                        catch (IllegalAccessException e)
                        {
                            Log.Debug("setNumberPickerTextColor", e.Message);
                        }
                        catch (Resources.NotFoundException e)
                        {
                            Log.Debug("setNumberPickerTextColor", e.Message);
                        }
                    }
                }

                numberPicker.Invalidate();
            }
            catch
            {

            }
        }
예제 #9
0
        protected override void OnPrepareDialogBuilder(Android.App.AlertDialog.Builder builder)
        {
            base.OnPrepareDialogBuilder(builder);

            mNumberPicker                  = new NumberPicker(Context);
            mNumberPicker.MinValue         = 1000;
            mNumberPicker.MaxValue         = 20000;
            mNumberPicker.Value            = mValue;
            mNumberPicker.LayoutParameters = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WrapContent, LinearLayout.LayoutParams.WrapContent);

            var linearLayout = new LinearLayout(Context);

            linearLayout.LayoutParameters = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.MatchParent);
            linearLayout.SetGravity(Android.Views.GravityFlags.Center);
            linearLayout.AddView(mNumberPicker);

            builder.SetView(linearLayout);
        }
예제 #10
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            SetContentView (Resource.Layout.Combat);

            Save = FindViewById<Button> (Resource.Id.btnSave);
            Reset = FindViewById<Button> (Resource.Id.btnReset);

            nmbPerso = FindViewById<NumberPicker> (Resource.Id.pickPerso);
            nmbPeriph = FindViewById<NumberPicker> (Resource.Id.pickPeriph);
            nmbWillpower= FindViewById<NumberPicker> (Resource.Id.pickWill);

            Save.Click += delegate {
                SaveValues();
            };

            Reset.Click += delegate {
                LoadValues();
            };

            FindViewById<Button> (Resource.Id.btnIniUpOne).Click += delegate {
                GainInitiative(1);
            };

            FindViewById<Button> (Resource.Id.btnIniUp5).Click += delegate {
                GainInitiative(5);
            };

            FindViewById<Button> (Resource.Id.btnIniDownOne).Click += delegate {
                LoseInitiative(1);
            };

            FindViewById<Button> (Resource.Id.btnIniDown5).Click += delegate {
                LoseInitiative(5);
            };

            Preferences = Application.Context.GetSharedPreferences("PreferencesImmaculate", FileCreationMode.Private);
            LoadValues ();
        }
예제 #11
0
        protected void CreateDialog()
        {
            _Picker = new ANumberPicker(AndroidContext)
            {
                MinValue = _Min,
                MaxValue = _Max,
                Value    = _NumberPickerCell.Number
            };

            if (_Dialog is not null)
            {
                return;
            }
            using (var builder = new AlertDialog.Builder(AndroidContext))
            {
                builder.SetTitle(_Popup_Title);

                var parent = new FrameLayout(AndroidContext);
                parent.AddView(_Picker, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent, GravityFlags.Center));
                builder.SetView(parent);

                builder.SetNegativeButton(Android.Resource.String.Cancel, Cancel);
                builder.SetPositiveButton(Android.Resource.String.Ok, Accept);

                _Dialog = builder.Create();
            }

            if (_Dialog is null)
            {
                return;
            }
            _Dialog.SetCanceledOnTouchOutside(true);
            _Dialog.DismissEvent += OnDialogOnDismissEvent;

            _Dialog.Show();
        }
예제 #12
0
 public void OnValueChange(NumberPicker picker, int oldVal, int newVal)
 {
     ValueChange.Invoke(picker, new ValueChangeEventArgs(oldVal, newVal));
 }
예제 #13
0
 public void OnScrollStateChange(NumberPicker view, int scrollState)
 {
     ScrollStateChanged.Invoke(view, new ScrollStateChangedEventArgs((ScrollState)scrollState));
 }
예제 #14
0
 public void OnValueChange(NumberPicker picker, int oldVal, int newVal)
 {
     ValueChange.Invoke(picker, new ValueChangeEventArgs(oldVal, newVal));
 }
예제 #15
0
 public void OnScrollStateChange(NumberPicker view, int scrollState)
 {
     ScrollStateChanged.Invoke(view, new ScrollStateChangedEventArgs((ScrollState)scrollState));
 }
		void NumberPicker.IOnValueChangeListener.OnValueChange (NumberPicker picker, int oldVal, int newVal)
		{
			if (picker.Value == 1)  // PM
			{
				if ((int)_timePicker.CurrentHour < 12)
					_timePicker.CurrentHour=(Integer)((int)_timePicker.CurrentHour + 12);
			}
			else  // AM
			{
				if ((int)_timePicker.CurrentHour >= 12)
					_timePicker.CurrentHour=(Integer)((int)_timePicker.CurrentHour - 12);
			}

			_callback.OnTimeChanged((int)_timePicker.CurrentHour,(int)_timePicker.CurrentMinute);
		}
예제 #17
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

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

            _hoursPicker = FindViewById<NumberPicker>(Resource.Id.testHoursNumberPicker);
            _minutesPicker = FindViewById<NumberPicker>(Resource.Id.testMinutesNumberPicker);

            _hoursPicker.ValueChanged += (sender, args) => ValidateFieldsAndEnableButton();
            _minutesPicker.ValueChanged += (sender, args) => ValidateFieldsAndEnableButton();

            _hoursPicker.MaxValue = 12;
            _hoursPicker.MinValue = 0;

            _minutesPicker.MaxValue = 59;
            _minutesPicker.MinValue = 0;

            _inputManager = (InputMethodManager)GetSystemService(Context.InputMethodService);

            EditText hoursEditText = (EditText)_hoursPicker.GetChildAt(0);
            hoursEditText.Focusable = true;
            hoursEditText.FocusableInTouchMode = true;

            hoursEditText.FocusChange += HandleEditTextFocusChangedForKeyboard;

            //_inputManager.ShowSoftInput(hoursEditText, ShowFlags.Implicit);

            EditText minutesEditText = (EditText)_hoursPicker.GetChildAt(0);
            minutesEditText.Focusable = true;
            minutesEditText.FocusableInTouchMode = true;

            minutesEditText.FocusChange += HandleEditTextFocusChangedForKeyboard;

            //_inputManager.ShowSoftInput(minutesEditText, ShowFlags.Implicit);

            _totalQuestionsTextBox = FindViewById<EditText>(Resource.Id.totalQuestionsTextBox);
            _totalQuestionsTextBox.TextChanged += (sender, args) => ValidateFieldsAndEnableButton();
            //_inputManager.ShowSoftInput(_totalQuestionsTextBox, ShowFlags.Implicit);

            _totalQuestionsTextBox.FocusChange += HandleEditTextFocusChangedForKeyboard;

            _startTimeButton = FindViewById<Button>(Resource.Id.startTimerButton);

            _startTimeButton.Click += delegate
            {
                int numberOfQuestions = !string.IsNullOrEmpty(_totalQuestionsTextBox.Text)
                    ? Convert.ToInt32(_totalQuestionsTextBox.Text)
                    : 0;

                if (_hoursPicker.Value == 0 && _minutesPicker.Value == 0 || numberOfQuestions == 0)
                {
                    return;
                }

                var intent = new Intent(this, typeof(TimerViewActivity));
                intent.PutExtra("hours", _hoursPicker.Value);
                intent.PutExtra("minutes", _minutesPicker.Value);
                intent.PutExtra("questions", numberOfQuestions);
                StartActivity(intent);
            };

            ValidateFieldsAndEnableButton();
        }
 public void OnValueChange(NumberPicker picker, int oldVal, int newVal)
 {
     Toast.MakeText(Activity, string.Format("Value changed from: {0} to {1}", oldVal, newVal), ToastLength.Short).Show();
 }
예제 #19
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            //ActionBar.SetDisplayShowHomeEnabled(true);
            //ActionBar.SetIcon(Resource.Drawable.App_icon);

            // Prefix
            var resourcePrefix = "Math_App.Droid.";

            // set vibration
            Vibrator v = (Vibrator)this.GetSystemService(Context.VibratorService);

            // NumberPicker values
            string pickerB = "";
            string pickerC = "";

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

            // Set button animation
            Animation animAlpha = AnimationUtils.LoadAnimation(this, Resource.Layout.ButtonAnimation);

            // Set calculation textview
            TextView textviewCalc = FindViewById<TextView>(Resource.Id.textView1);

            // Next page
            Button button = FindViewById<Button>(Resource.Id.ShowMe);
            button.Click += (sender, args) => button.StartAnimation(animAlpha);
            button.Click += delegate
            {
                string text = textviewCalc.Text.ToString();
                if (text.Length > 0 && val.lastChar(text.Substring(Math.Max(0, text.Length - 1)) ))
                {
                    // new page
                    var second = new Intent(this, typeof(SecondPage));
                    Bundle extras = new Bundle();
                    extras.PutString("calculation", textviewCalc.Text.ToString());
                    second.PutExtras(extras);
                    StartActivity(second);
                    // set memory
                    sto.AddEquation(text);
                }
                else
                {
                    // Vibrate for 500 milliseconds
                    v.Vibrate(200);
                }
            };

            // Remove all input
            Button buttonRevert = FindViewById<Button>(Resource.Id.Revert);
            buttonRevert.Click += (sender, args) => buttonRevert.StartAnimation(animAlpha);
            buttonRevert.Click += delegate
            {
                string text = textviewCalc.Text.ToString();
                if (text.Length > 0)
                {
                    text = text.Remove(text.Length - 1);
                    textviewCalc.Text = text;
                }                
            };

            // Remove last input
            Button buttonDelete = FindViewById<Button>(Resource.Id.Delete);
            buttonDelete.Click += (sender, args) => buttonDelete.StartAnimation(animAlpha);
            buttonDelete.Click += delegate
            {
                string text = textviewCalc.Text.ToString();
                if (text.Length > 0)
                {
                    textviewCalc.Text = "";
                }
            };

            // Number input
            Button buttonZero = FindViewById<Button>(Resource.Id.Zero);
            buttonZero.Click += (sender, args) => buttonZero.StartAnimation(animAlpha);
            buttonZero.Click += delegate
            {
                if (val.checkZero(textviewCalc.Text))
                {
                    textviewCalc.Text += "0";
                }
            };

            Button buttonOne = FindViewById<Button>(Resource.Id.One);
            buttonOne.Click += (sender, args) => buttonOne.StartAnimation(animAlpha);
            buttonOne.Click += delegate
            {
                textviewCalc.Text += "1";
            };

            Button buttonTwo = FindViewById<Button>(Resource.Id.Two);
            buttonTwo.Click += (sender, args) => buttonTwo.StartAnimation(animAlpha);
            buttonTwo.Click += delegate
            {
                textviewCalc.Text += "2";
            };

            Button buttonThree = FindViewById<Button>(Resource.Id.Three);
            buttonThree.Click += (sender, args) => buttonThree.StartAnimation(animAlpha);
            buttonThree.Click += delegate
            {
                textviewCalc.Text += "3";
            };

            Button buttonFour = FindViewById<Button>(Resource.Id.Four);
            buttonFour.Click += (sender, args) => buttonFour.StartAnimation(animAlpha);
            buttonFour.Click += delegate
            {
                textviewCalc.Text += "4";
            };

            Button buttonFive = FindViewById<Button>(Resource.Id.Five);
            buttonFive.Click += (sender, args) => buttonFive.StartAnimation(animAlpha);
            buttonFive.Click += delegate
            {
                textviewCalc.Text += "5";
            };

            Button buttonSix = FindViewById<Button>(Resource.Id.Six);
            buttonSix.Click += (sender, args) => buttonSix.StartAnimation(animAlpha);
            buttonSix.Click += delegate
            {
                textviewCalc.Text += "6";
            };

            Button buttonSeven = FindViewById<Button>(Resource.Id.Seven);
            buttonSeven.Click += (sender, args) => buttonSeven.StartAnimation(animAlpha);
            buttonSeven.Click += delegate
            {
                textviewCalc.Text += "7";
            };

            Button buttonEight = FindViewById<Button>(Resource.Id.Eight);
            buttonEight.Click += (sender, args) => buttonEight.StartAnimation(animAlpha);
            buttonEight.Click += delegate
            {
                textviewCalc.Text += "8";
            };

            Button buttonNine = FindViewById<Button>(Resource.Id.Nine);
            buttonNine.Click += (sender, args) => buttonNine.StartAnimation(animAlpha);
            buttonNine.Click += delegate
            {
                textviewCalc.Text += "9";
            };

            // Equation type input
            Button buttonMinus = FindViewById<Button>(Resource.Id.Minus);
            buttonMinus.Click += (sender, args) => buttonMinus.StartAnimation(animAlpha);
            buttonMinus.Click += delegate
            {
                string text = textviewCalc.Text.ToString();
                if (text.Length > 0)
                {
                    char cLastCharacter = textviewCalc.Text.ToString()[textviewCalc.Text.ToString().Length - 1];
                    if (val.checkCharacters(cLastCharacter.ToString(), "-"))
                    {
                        textviewCalc.Text += "-";
                    }
                }
            };

            Button buttonMultiply = FindViewById<Button>(Resource.Id.Multiply);
            buttonMultiply.Click += (sender, args) => buttonMultiply.StartAnimation(animAlpha);
            buttonMultiply.Click += delegate
            {
                string text = textviewCalc.Text.ToString();
                if (text.Length > 0)
                {
                    char cLastCharacter = textviewCalc.Text.ToString()[textviewCalc.Text.ToString().Length - 1];
                    if (val.checkCharacters(cLastCharacter.ToString(), "x"))
                    {
                        textviewCalc.Text += "x";
                    }
                }
            };

            Button buttonDevide = FindViewById<Button>(Resource.Id.Devide);
            buttonDevide.Click += (sender, args) => buttonDevide.StartAnimation(animAlpha);
            buttonDevide.Click += delegate
            {
                string text = textviewCalc.Text.ToString();
                if (text.Length > 0)
                {
                    char cLastCharacter = textviewCalc.Text.ToString()[textviewCalc.Text.ToString().Length - 1];
                    if (val.checkCharacters(cLastCharacter.ToString(), "÷"))
                    {
                        textviewCalc.Text += "÷";
                    }
                }
            };

            Button buttonAddition = FindViewById<Button>(Resource.Id.Addition);
            buttonAddition.Click += (sender, args) => buttonAddition.StartAnimation(animAlpha);
            buttonAddition.Click += delegate
            {
                string text = textviewCalc.Text.ToString();
                if (text.Length > 0)
                {
                    char cLastCharacter = textviewCalc.Text.ToString()[textviewCalc.Text.ToString().Length - 1];
                    if (val.checkCharacters(cLastCharacter.ToString(), "+"))
                    {
                        textviewCalc.Text += "+";
                    }
                }
            };

            // Bracket type input
            Button buttonBracketLeft = FindViewById<Button>(Resource.Id.BracketLeft);
            buttonBracketLeft.Click += (sender, args) => buttonBracketLeft.StartAnimation(animAlpha);
            buttonBracketLeft.Click += delegate
            {
                string text = textviewCalc.Text.ToString();
                if (text.Length > 0)
                {
                    char cLastCharacter = textviewCalc.Text.ToString()[textviewCalc.Text.ToString().Length - 1];
                    if (val.checkCharacters(cLastCharacter.ToString(), "("))
                    {
                        textviewCalc.Text += "(";
                    }
                }
            };          
            
            Button buttonBracketRight = FindViewById<Button>(Resource.Id.BracketRight);
            buttonBracketRight.Click += (sender, args) => buttonBracketRight.StartAnimation(animAlpha);
            buttonBracketRight.Click += delegate
            {
                string text = textviewCalc.Text.ToString();
                if (text.Length > 0)
                {
                    char cLastCharacter = textviewCalc.Text.ToString()[textviewCalc.Text.ToString().Length - 1];
                    if (val.checkCharacters(cLastCharacter.ToString(), ")"))
                    {
                        textviewCalc.Text += ")";
                    }
                }
            };

            // NumberPicker dialogs
            Button FracB = FindViewById<Button>(Resource.Id.FracionB);
            FracB.Click += (sender, args) => buttonBracketRight.StartAnimation(animAlpha);
            FracB.Click += delegate
            {
                NumberPicker picker = new NumberPicker(this);
                picker.MaxValue = 10;
                picker.MinValue = 1;
                AlertDialog.Builder builder = new AlertDialog.Builder(this).SetView(picker);
                builder.SetTitle("Number");
                builder.SetNegativeButton(Resource.String.Dialog_Cancel, (s, a) => { });
                builder.SetPositiveButton(Resource.String.Dialog_Ok, (s, a) => {
                    pickerB = Convert.ToString(picker.Value);
                    FracB.Text = Convert.ToString(picker.Value);
                });
                builder.Show();
            };

            Button FracC = FindViewById<Button>(Resource.Id.FracionC);
            FracC.Click += (sender, args) => buttonBracketRight.StartAnimation(animAlpha);
            FracC.Click += delegate
            {
                NumberPicker picker = new NumberPicker(this);
                picker.MaxValue = 10;
                picker.MinValue = 1;
                AlertDialog.Builder builder = new AlertDialog.Builder(this).SetView(picker);
                builder.SetTitle("Number");
                builder.SetNegativeButton(Resource.String.Dialog_Cancel, (s, a) => { });
                builder.SetPositiveButton(Resource.String.Dialog_Ok, (s, a) => {
                    pickerC = Convert.ToString(picker.Value);
                    FracC.Text = Convert.ToString(picker.Value);
                    
                });
                builder.Show();
            };

            Button FracAdd = FindViewById<Button>(Resource.Id.FracionAdd);
            FracAdd.Click += (sender, args) => buttonBracketRight.StartAnimation(animAlpha);
            FracAdd.Click += delegate
            {
                textviewCalc.Text += val.CreateFraction(pickerB, pickerC);                
                pickerC = "";
                pickerB = "";
            };

            // Memory buttons
            int counter = 0;
            ImageButton MemBack = FindViewById<ImageButton>(Resource.Id.memBack);
            ImageButton MemNext = FindViewById<ImageButton>(Resource.Id.memNext);
            MemNext.Enabled = false;

            MemBack.Click += (sender, args) => MemBack.StartAnimation(animAlpha);
            MemBack.Click += delegate
            {
                if (counter < 4 && sto.CheckIfEmpty(counter + 1))
                {
                    MemNext.Enabled = true;
                    counter += 1;
                    Console.WriteLine(counter);
                    textviewCalc.Text = sto.ReturnEquation(counter);
                    if(counter == 4)
                    {
                        MemBack.Enabled = false;
                    }
                }                
            };            
           
            MemNext.Click += (sender, args) => MemNext.StartAnimation(animAlpha);
            MemNext.Click += delegate
            {
                if (counter > 0 && sto.CheckIfEmpty(counter -1))
                {
                    MemBack.Enabled = true;
                    counter -= 1;
                    Console.WriteLine(counter);
                    textviewCalc.Text = sto.ReturnEquation(counter);
                    if(counter == 0)
                    {
                        MemNext.Enabled = false;
                    }
                }                
            };
        }
예제 #20
0
 void SetMinMax(NumberPicker picker, int min, int max)
 {
     picker.MinValue = min;
     picker.MaxValue = max;
 }
        public void OnValueChange(NumberPicker picker, int oldVal, int newVal)
        {
            if (picker.Value == 1) {
                if (mTimePicker.CurrentHour.IntValue() < 12 ){
                    mTimePicker.CurrentHour = new Java.Lang.Integer(mTimePicker.CurrentHour.IntValue() + 12);
                }
            } else {
                if (mTimePicker.CurrentHour.IntValue() >= 12) {
                    mTimePicker.CurrentHour = new Java.Lang.Integer(mTimePicker.CurrentHour.IntValue() - 12);
                }
            }

            mCallBack.OnTimeChanged(mTimePicker.CurrentHour.IntValue(), mTimePicker.CurrentMinute.IntValue());
        }