예제 #1
0
            public TimeUnitPicker(Context context, EditDurationView parentView, TimeUnits unit, int value) : base(context)
            {
                Unit  = unit;
                Value = value;

                _valuePicker = new NumberPicker(Context)
                {
                    WrapSelectorWheel = true,
                    MinValue          = 0,
                    MaxValue          = GetMaxValue(unit),
                    Value             = value
                };
                _valuePicker.SetBackgroundColor(parentView.ValueTextColor);
                _valuePicker.SetOnLongPressUpdateInterval(PICKER_SPEED);
                _valuePicker.ValueChanged += (s, args) => Value = args.NewVal;

                _unitLabel = new TextView(Context)
                {
                    Typeface = FontHelper.GetTypeface(Context, CustomFonts.RobotoCondensedRegular),
                    Text     = GetUnitText(unit)
                };
                _unitLabel.SetTextColor(parentView.UnitTextColor);
                _unitLabel.SetTextSize(ComplexUnitType.Dip, parentView.UnitTextSize);

                AddView(_valuePicker, GenerateDefaultLayoutParams());
                AddView(_unitLabel, GenerateDefaultLayoutParams());
            }
        protected override View OnCreateDialogView()
        {
            _picker = new NumberPicker(Context)
            {
                WrapSelectorWheel = true,
                MinValue = MinValue,
                MaxValue = MaxValue
            };

            _picker.Value = _initialValue;
            _picker.SetOnLongPressUpdateInterval(PICKER_SPEED);

            return _picker;
        }