@Override protected View onCreateDialogView() { View view = LayoutInflater.from(getContext()).inflate(R.layout.dialog_colorpicker, null); mColorPickerView = (ColorPicker) view.findViewById(R.id.pk_colorPicker); OpacityBar mOpacityBar = (OpacityBar) view.findViewById(R.id.pk_opacityBar); SVBar svBar = (SVBar) view.findViewById(R.id.pk_svBar); mOpacityBar.setColorPicker(mColorPickerView); svBar.setColorPicker(mColorPickerView); mColorPickerView.addOpacityBar(mOpacityBar); mColorPickerView.addSVBar(svBar); mOpacityBar.setVisibility(mAlphaAllowed ? View.VISIBLE : View.GONE); svBar.setVisibility(mSVAllowed ? View.VISIBLE : View.GONE); return view; }
/** * Add a Saturation/Value bar to the color wheel. * * @param bar The instance of the Saturation/Value bar. */ public void addSVBar(SVBar bar) { mSVbar = bar; // Give an instance of the color picker to the Saturation/Value bar. mSVbar.setColorPicker(this); mSVbar.setColor(mColor); }