コード例 #1
0
 protected override void OnClick()
 {
     base.OnClick();
     if (_onShowDialogListener != null)
     {
         _onShowDialogListener.OnShowColorPickerDialog(Title, _color);
     }
     else if (_showDialog)
     {
         var dialog = ColorPickerDialog.NewBuilder()
                      .SetDialogType(_dialogType)
                      .SetDialogTitle(_dialogTitle)
                      .SetColorShape(_colorShape)
                      .SetPresets(_presets)
                      .SetAllowPresets(_allowPresets)
                      .SetAllowCustom(_allowCustom)
                      .SetShowAlphaSlider(_showAlphaSlider)
                      .SetShowColorShades(_showColorShades)
                      .SetColor(_color)
                      .Create();
         dialog.SetColorPickerDialogListener(this);
         var activity = (Activity)Context;
         dialog.Show(activity.FragmentManager, GetFragmentTag());
     }
 }
コード例 #2
0
            /**
             * Create the {@link ColorPickerDialog} instance.
             *
             * @return A new {@link ColorPickerDialog}.
             * @see #show(Activity)
             */
            public ColorPickerDialog Create()
            {
                var dialog = new ColorPickerDialog();
                var args   = new Bundle();

                args.PutInt(ARG_ID, _dialogId);
                args.PutInt(ARG_TYPE, (int)_dialogType);
                args.PutInt(ARG_COLOR, _color);
                args.PutIntArray(ARG_PRESETS, _presets.Select(d => d.ToArgb()).ToArray());
                args.PutBoolean(ARG_ALPHA, _showAlphaSlider);
                args.PutBoolean(ARG_ALLOW_CUSTOM, _allowCustom);
                args.PutBoolean(ARG_ALLOW_PRESETS, _allowPresets);
                args.PutInt(ARG_DIALOG_TITLE, _dialogTitle);
                args.PutString(ARG_DIALOG_TITLE_STRING, _dialogTitleString);
                args.PutBoolean(ARG_SHOW_COLOR_SHADES, _showColorShades);
                args.PutInt(ARG_COLOR_SHAPE, (int)_colorShape);
                args.PutInt(ARG_PRESETS_BUTTON_TEXT, _presetsButtonText);
                args.PutInt(ARG_CUSTOM_BUTTON_TEXT, _customButtonText);
                args.PutInt(ARG_SELECTED_BUTTON_TEXT, _selectedButtonText);
                dialog.Arguments = args;
                return(dialog);
            }