View createPickerView() {
    View contentView = View.inflate(getActivity(), R.layout.cpv_dialog_color_picker, null);
    colorPicker = (ColorPickerView) contentView.findViewById(R.id.cpv_color_picker_view);
    ColorPanelView oldColorPanel = (ColorPanelView) contentView.findViewById(R.id.cpv_color_panel_old);
    newColorPanel = (ColorPanelView) contentView.findViewById(R.id.cpv_color_panel_new);
    ImageView arrowRight = (ImageView) contentView.findViewById(R.id.cpv_arrow_right);
    hexEditText = (EditText) contentView.findViewById(R.id.cpv_hex);

    try {
      final TypedValue value = new TypedValue();
      TypedArray typedArray =
          getActivity().obtainStyledAttributes(value.data, new int[] { android.R.attr.textColorPrimary });
      int arrowColor = typedArray.getColor(0, Color.BLACK);
      typedArray.recycle();
      arrowRight.setColorFilter(arrowColor);
    } catch (Exception ignored) {
    }

    colorPicker.setAlphaSliderVisible(showAlphaSlider);
    oldColorPanel.setColor(getArguments().getInt(ARG_COLOR));
    colorPicker.setColor(color, true);
    newColorPanel.setColor(color);
    setHex(color);

    if (!showAlphaSlider) {
      hexEditText.setFilters(new InputFilter[] { new InputFilter.LengthFilter(6) });
    }

    newColorPanel.setOnClickListener(new View.OnClickListener() {
      @Override public void onClick(View v) {
        if (newColorPanel.getColor() == color) {
          onColorSelected(color);
          dismiss();
        }
      }
    });

    contentView.setOnTouchListener(onPickerTouchListener);
    colorPicker.setOnColorChangedListener(this);
    hexEditText.addTextChangedListener(this);

    hexEditText.setOnFocusChangeListener(new View.OnFocusChangeListener() {
      @Override public void onFocusChange(View v, boolean hasFocus) {
        if (hasFocus) {
          InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
          imm.showSoftInput(hexEditText, InputMethodManager.SHOW_IMPLICIT);
        }
      }
    });

    return contentView;
  }
View createPickerView ( ) { View contentView = View . inflate ( getActivity ( ) , R . layout . cpv_dialog_color_picker , null ) ; colorPicker = ( ColorPickerView ) contentView . findViewById ( R . id . cpv_color_picker_view ) ; ColorPanelView oldColorPanel = ( ColorPanelView ) contentView . findViewById ( R . id . cpv_color_panel_old ) ; newColorPanel = ( ColorPanelView ) contentView . findViewById ( R . id . cpv_color_panel_new ) ; ImageView arrowRight = ( ImageView ) contentView . findViewById ( R . id . cpv_arrow_right ) ; hexEditText = ( EditText ) contentView . findViewById ( R . id . cpv_hex ) ; try { final TypedValue value = new TypedValue ( ) ; TypedArray typedArray = getActivity ( ) . obtainStyledAttributes ( value . data , new int [ ] { android . R . attr . textColorPrimary } ) ; int arrowColor = typedArray . getColor ( 0 , Color . BLACK ) ; typedArray . recycle ( ) ; arrowRight . setColorFilter ( arrowColor ) ; } catch ( Exception ignored ) { } colorPicker . setAlphaSliderVisible ( showAlphaSlider ) ; oldColorPanel . setColor ( getArguments ( ) . getInt ( ARG_COLOR ) ) ; colorPicker . setColor ( color , true ) ; newColorPanel . setColor ( color ) ; setHex ( color ) ; if ( ! showAlphaSlider ) { hexEditText . setFilters ( new InputFilter [ ] { new InputFilter . LengthFilter ( 6 ) } ) ; } newColorPanel . setOnClickListener ( new View . OnClickListener ( ) { @ Override public void onClick ( View v ) { if ( newColorPanel . getColor ( ) == color ) { onColorSelected ( color ) ; dismiss ( ) ; } } } ) ; contentView . setOnTouchListener ( onPickerTouchListener ) ; colorPicker . setOnColorChangedListener ( this ) ; hexEditText . addTextChangedListener ( this ) ; hexEditText . setOnFocusChangeListener ( new View . OnFocusChangeListener ( ) { @ Override public void onFocusChange ( View v , boolean hasFocus ) { if ( hasFocus ) { InputMethodManager imm = ( InputMethodManager ) getActivity ( ) . getSystemService ( Context . INPUT_METHOD_SERVICE ) ; imm . showSoftInput ( hexEditText , InputMethodManager . SHOW_IMPLICIT ) ; } } } ) ; return contentView ; }
region Custom Picker