Beispiel #1
0
        public TimePicker(android.content.Context context, android.util.AttributeSet attrs
                          , int defStyle) : base(context, attrs, defStyle)
        {
            setCurrentLocale(System.Globalization.CultureInfo.CurrentCulture);
            android.content.res.TypedArray attributesArray = context.obtainStyledAttributes(attrs
                                                                                            , [email protected], defStyle, 0);
            int layoutResourceId = attributesArray.getResourceId([email protected]
                                                                 .TimePicker_layout, [email protected]_picker);

            attributesArray.recycle();
            android.view.LayoutInflater inflater = (android.view.LayoutInflater)context.getSystemService
                                                       (android.content.Context.LAYOUT_INFLATER_SERVICE);
            inflater.inflate(layoutResourceId, this, true);
            mHourSpinner = (android.widget.NumberPicker)findViewById([email protected]
                                                                     );
            mHourSpinner.setOnValueChangedListener(new _OnValueChangeListener_147(this));
            mHourSpinnerInput = (android.widget.EditText)mHourSpinner.findViewById([email protected]
                                                                                   .id.numberpicker_input);
            mHourSpinnerInput.setImeOptions(android.view.inputmethod.EditorInfo.IME_ACTION_NEXT
                                            );
            mDivider = (android.widget.TextView)findViewById([email protected]);
            if (mDivider != null)
            {
                mDivider.setText([email protected][email protected]_picker_separator);
            }
            mMinuteSpinner = (android.widget.NumberPicker)findViewById([email protected]
                                                                       .minute);
            mMinuteSpinner.setMinValue(0);
            mMinuteSpinner.setMaxValue(59);
            mMinuteSpinner.setOnLongPressUpdateInterval(100);
            mMinuteSpinner.setFormatter(android.widget.NumberPicker.TWO_DIGIT_FORMATTER);
            mMinuteSpinner.setOnValueChangedListener(new _OnValueChangeListener_175(this));
            mMinuteSpinnerInput = (android.widget.EditText)mMinuteSpinner.findViewById([email protected]
                                                                                       .id.numberpicker_input);
            mMinuteSpinnerInput.setImeOptions(android.view.inputmethod.EditorInfo.IME_ACTION_NEXT
                                              );
            mAmPmStrings = new java.text.DateFormatSymbols().getAmPmStrings();
            android.view.View amPmView = findViewById([email protected]);
            if (amPmView is android.widget.Button)
            {
                mAmPmSpinner      = null;
                mAmPmSpinnerInput = null;
                mAmPmButton       = (android.widget.Button)amPmView;
                mAmPmButton.setOnClickListener(new _OnClickListener_210(this));
            }
            else
            {
                mAmPmButton  = null;
                mAmPmSpinner = (android.widget.NumberPicker)amPmView;
                mAmPmSpinner.setMinValue(0);
                mAmPmSpinner.setMaxValue(1);
                mAmPmSpinner.setDisplayedValues(mAmPmStrings);
                mAmPmSpinner.setOnValueChangedListener(new _OnValueChangeListener_223(this));
                mAmPmSpinnerInput = (android.widget.EditText)mAmPmSpinner.findViewById([email protected]
                                                                                       .id.numberpicker_input);
                mAmPmSpinnerInput.setImeOptions(android.view.inputmethod.EditorInfo.IME_ACTION_DONE
                                                );
            }
            // update controls to initial state
            updateHourControl();
            updateAmPmControl();
            setOnTimeChangedListener(NO_OP_CHANGE_LISTENER);
            // set to current time
            setCurrentHour(mTempCalendar.get(java.util.Calendar.HOUR_OF_DAY));
            setCurrentMinute(mTempCalendar.get(java.util.Calendar.MINUTE));
            if (!isEnabled())
            {
                setEnabled(false);
            }
            // set the content descriptions
            setContentDescriptions();
        }