Beispiel #1
0
        private View CreatePresetsView()
        {
            var contentView = View.Inflate(Activity, Resource.Layout.cpv_dialog_presets, null);

            _shadesLayout         = contentView.FindViewById <LinearLayout>(Resource.Id.shades_layout);
            _transparencySeekBar  = contentView.FindViewById <SeekBar>(Resource.Id.transparency_seekbar);
            _transparencyPercText = contentView.FindViewById <TextView>(Resource.Id.transparency_text);
            var gridView = contentView.FindViewById <GridView>(Resource.Id.gridView);

            LoadPresets();

            if (_showColorShades)
            {
                CreateColorShades(_color);
            }
            else
            {
                _shadesLayout.Visibility = ViewStates.Gone;
                contentView.FindViewById(Resource.Id.shades_divider).Visibility = ViewStates.Gone;
            }

            _adapter = new ColorPaletteAdapter(new OnColorSelectedListener(newColor =>
            {
                if (_color == newColor)
                {
                    OnColorSelected();
                    Dismiss();
                    return;
                }

                _color = newColor;
                if (_showColorShades)
                {
                    CreateColorShades(_color);
                }
            }), _presets, GetSelectedItemPosition(), _colorShape);

            gridView.Adapter = _adapter;

            if (_showAlphaSlider)
            {
                SetupTransparency();
            }
            else
            {
                contentView.FindViewById(Resource.Id.transparency_layout).Visibility = ViewStates.Gone;
                contentView.FindViewById(Resource.Id.transparency_title).Visibility  = ViewStates.Gone;
            }

            return(contentView);
        }
            public ViewHolder(Context context, ColorPaletteAdapter colorpaletteadapter)
            {
                _colorPaletteAdapter = colorpaletteadapter;

                var layoutResId = _colorPaletteAdapter._colorShape == ColorShape.Square
                    ? Resource.Layout.cpv_color_item_square
                    : Resource.Layout.cpv_color_item_circle;

                view                 = View.Inflate(context, layoutResId, null);
                _colorPanelView      = view.FindViewById <ColorPanelView>(Resource.Id.cpv_color_panel_view);
                _imageView           = view.FindViewById <ImageView>(Resource.Id.cpv_color_image_view);
                _originalBorderColor = _colorPanelView.GetBorderColor();
                view.Tag             = this;
            }