com.flask.colorpicker.builder.ColorPickerDialogBuilder Java Examples

The following examples show how to use com.flask.colorpicker.builder.ColorPickerDialogBuilder. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AdaptiveColorsActivity.java    From PercentageChartView with Apache License 2.0 6 votes vote down vote up
@OnClick(R.id.color_two)
public void colorTwoAction() {
    ColorPickerDialogBuilder
            .with(this)
            .setTitle("Choose second color")
            .initialColor(Color.WHITE)
            .wheelType(ColorPickerView.WHEEL_TYPE.FLOWER)
            .density(6)
            .setPositiveButton("SET", (dialog, selectedColor, allColors) -> {
                colorTwo = selectedColor;
                mColorTwo.setBackgroundTintList(ColorStateList.valueOf(colorTwo));
            })
            .setNegativeButton("DISMISS", (dialog, which) -> {
            })
            .build()
            .show();
}
 
Example #2
Source File: ColorPickerPreference.java    From droidddle with Apache License 2.0 6 votes vote down vote up
@Override
protected void onClick() {
    ColorPickerDialogBuilder builder = ColorPickerDialogBuilder
            .with(getContext())
            .setTitle(pickerTitle)
            .initialColor(selectedColor)
            .wheelType(wheelType)
            .density(density)
            .setPositiveButton(pickerButtonOk, new ColorPickerClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int selectedColorFromPicker, Integer[] allColors) {
                    setValue(selectedColorFromPicker);
                }
            })
            .setNegativeButton(pickerButtonCancel, null);

    if (!alphaSlider && !lightSlider) builder.noSliders();
    else if (!alphaSlider) builder.lightnessSliderOnly();
    else if (!lightSlider) builder.alphaSliderOnly();


    builder
            .build()
            .show();
}
 
Example #3
Source File: ColorSearchActivity.java    From droidddle with Apache License 2.0 6 votes vote down vote up
@OnClick(R.id.color_picker)
void onPickColorClick(View view) {
    ColorPickerDialogBuilder.with(this)
            .setTitle(getString(R.string.pick_color_title))
            .initialColor(getIntColor())
            .wheelType(ColorPickerView.WHEEL_TYPE.FLOWER)
            .density(12)
            .lightnessSliderOnly()
            .setPositiveButton(getString(android.R.string.ok), new ColorPickerClickListener() {
                @Override
                public void onClick(DialogInterface d, int lastSelectedColor, Integer[] allColors) {
                    mQuery = String.format("%06X", 0xFFFFFF & lastSelectedColor);
                    updateColor();
                }
            })
            .setNegativeButton(getString(android.R.string.cancel), new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {

                }
            })
            .build().show();
}
 
Example #4
Source File: ColorPickerPreference.java    From openlauncher with Apache License 2.0 6 votes vote down vote up
@Override
protected void onClick() {
	ColorPickerDialogBuilder builder = ColorPickerDialogBuilder
		.with(getContext())
		.setTitle(pickerTitle)
		.initialColor(selectedColor)
		.showBorder(border)
		.wheelType(wheelType)
		.density(density)
		.showColorEdit(pickerColorEdit)
		.setPositiveButton(pickerButtonOk, new ColorPickerClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int selectedColorFromPicker, Integer[] allColors) {
				setValue(selectedColorFromPicker);
			}
		})
		.setNegativeButton(pickerButtonCancel, null);

	if (!alphaSlider && !lightSlider) builder.noSliders();
	else if (!alphaSlider) builder.lightnessSliderOnly();
	else if (!lightSlider) builder.alphaSliderOnly();

	builder
		.build()
		.show();
}
 
Example #5
Source File: ColorPickerPreference.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onClick() {
	ColorPickerDialogBuilder builder = ColorPickerDialogBuilder
		.with(getContext())
		.setTitle(pickerTitle)
		.initialColor(selectedColor)
		.wheelType(wheelType)
		.density(density)
		.setPositiveButton(pickerButtonOk, new ColorPickerClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int selectedColorFromPicker, Integer[] allColors) {
				setValue(selectedColorFromPicker);
			}
		})
		.setNegativeButton(pickerButtonCancel, null);

	if (!alphaSlider && !lightSlider) builder.noSliders();
	else if (!alphaSlider) builder.lightnessSliderOnly();
	else if (!lightSlider) builder.alphaSliderOnly();


	builder
		.build()
		.show();
}
 
Example #6
Source File: ColorPickerPreference.java    From timecat with Apache License 2.0 6 votes vote down vote up
@Override
protected void onClick() {
	ColorPickerDialogBuilder builder = ColorPickerDialogBuilder
		.with(getContext())
		.setTitle(pickerTitle)
		.initialColor(selectedColor)
		.wheelType(wheelType)
		.density(density)
		.setPositiveButton(pickerButtonOk, new ColorPickerClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int selectedColorFromPicker, Integer[] allColors) {
				setValue(selectedColorFromPicker);
			}
		})
		.setNegativeButton(pickerButtonCancel, null);

	if (!alphaSlider && !lightSlider) builder.noSliders();
	else if (!alphaSlider) builder.lightnessSliderOnly();
	else if (!lightSlider) builder.alphaSliderOnly();


	builder
		.build()
		.show();
}
 
Example #7
Source File: ColorPickerPreference.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
@Override
protected void onClick() {
	ColorPickerDialogBuilder builder = ColorPickerDialogBuilder
		.with(getContext())
		.setTitle(pickerTitle)
		.initialColor(selectedColor)
		.wheelType(wheelType)
		.density(density)
		.setPositiveButton(pickerButtonOk, new ColorPickerClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int selectedColorFromPicker, Integer[] allColors) {
				setValue(selectedColorFromPicker);
			}
		})
		.setNegativeButton(pickerButtonCancel, null);

	if (!alphaSlider && !lightSlider) builder.noSliders();
	else if (!alphaSlider) builder.lightnessSliderOnly();
	else if (!lightSlider) builder.alphaSliderOnly();


	builder
		.build()
		.show();
}
 
Example #8
Source File: CustomThemeActivity.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
private void setColorForView(@IdRes final int id) {
    final View view = findViewById(id);
    int color = Color.WHITE;
    Drawable background = view.getBackground();
    if (background instanceof ColorDrawable)
        color = ((ColorDrawable) background).getColor();

    ColorPickerDialogBuilder.with(this)
            .showAlphaSlider(false)
            .initialColor(color)
            .setPositiveButton(android.R.string.ok,
                    new ColorPickerClickListener() {
                        @Override
                        public void onClick(DialogInterface d, int lastSelectedColor, Integer[] allColors) {
                            view.setBackgroundColor(lastSelectedColor);
                            setColor(id, lastSelectedColor);
                        }
                    })
            .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialogInterface, int i) {
                    dialogInterface.cancel();
                }
            }).build().show();
}
 
Example #9
Source File: AdaptiveColorsActivity.java    From PercentageChartView with Apache License 2.0 6 votes vote down vote up
@OnClick(R.id.color_four)
public void colorFourAction() {
    ColorPickerDialogBuilder
            .with(this)
            .setTitle("Choose four color")
            .initialColor(Color.WHITE)
            .wheelType(ColorPickerView.WHEEL_TYPE.FLOWER)
            .density(6)
            .setPositiveButton("SET", (dialog, selectedColor, allColors) -> {
                colorFour = selectedColor;
                mColorFour.setBackgroundTintList(ColorStateList.valueOf(colorFour));
            })
            .setNegativeButton("DISMISS", (dialog, which) -> {
            })
            .build()
            .show();
}
 
Example #10
Source File: AdaptiveColorsActivity.java    From PercentageChartView with Apache License 2.0 6 votes vote down vote up
@OnClick(R.id.color_three)
public void colorThreeAction() {
    ColorPickerDialogBuilder
            .with(this)
            .setTitle("Choose three color")
            .initialColor(Color.WHITE)
            .wheelType(ColorPickerView.WHEEL_TYPE.FLOWER)
            .density(6)
            .setPositiveButton("SET", (dialog, selectedColor, allColors) -> {
                colorThree = selectedColor;
                mColorThree.setBackgroundTintList(ColorStateList.valueOf(colorThree));
            })
            .setNegativeButton("DISMISS", (dialog, which) -> {
            })
            .build()
            .show();
}
 
Example #11
Source File: BackgroundSubFragment.java    From PercentageChartView with Apache License 2.0 6 votes vote down vote up
@OnClick(R.id.background_color)
void backgroundAction() {
    ColorPickerDialogBuilder
            .with(getActivity())
            .setTitle("Choose background color")
            .initialColor(Color.WHITE)
            .wheelType(ColorPickerView.WHEEL_TYPE.FLOWER)
            .density(6)
            .setPositiveButton("SET", (dialog, selectedColor, allColors) -> {
                mBackgroundColor.setBackgroundTintList(ColorStateList.valueOf(selectedColor));
                if (mListener != null) {
                    mListener.onBackgroundColorChanged(selectedColor);
                }
            })
            .setNegativeButton("DISMISS", (dialog, which) -> {
            })
            .build()
            .show();
}
 
Example #12
Source File: AdaptiveColorsActivity.java    From PercentageChartView with Apache License 2.0 6 votes vote down vote up
@OnClick(R.id.color_one)
public void colorOneAction() {
    ColorPickerDialogBuilder
            .with(this)
            .setTitle("Choose first color")
            .initialColor(Color.WHITE)
            .wheelType(ColorPickerView.WHEEL_TYPE.FLOWER)
            .density(6)
            .setPositiveButton("SET", (dialog, selectedColor, allColors) -> {
                colorOne = selectedColor;
                mColorOne.setBackgroundTintList(ColorStateList.valueOf(colorOne));
            })
            .setNegativeButton("DISMISS", (dialog, which) -> {
            })
            .build()
            .show();
}
 
Example #13
Source File: GradientColorsActivity.java    From PercentageChartView with Apache License 2.0 6 votes vote down vote up
@OnClick(R.id.color_four)
public void colorFourAction() {
    ColorPickerDialogBuilder
            .with(this)
            .setTitle("Choose four color")
            .initialColor(Color.WHITE)
            .wheelType(ColorPickerView.WHEEL_TYPE.FLOWER)
            .density(6)
            .setPositiveButton("SET", (dialog, selectedColor, allColors) -> {
                colorFour = selectedColor;
                mColorFour.setBackgroundTintList(ColorStateList.valueOf(colorFour));
                setGradientColors(gradientType, new int[]{colorOne, colorTwo, colorThree, colorFour}, null, gradientAngle);
            })
            .setNegativeButton("DISMISS", (dialog, which) -> {
            })
            .build()
            .show();
}
 
Example #14
Source File: GradientColorsActivity.java    From PercentageChartView with Apache License 2.0 6 votes vote down vote up
@OnClick(R.id.color_three)
public void colorThreeAction() {
    ColorPickerDialogBuilder
            .with(this)
            .setTitle("Choose three color")
            .initialColor(Color.WHITE)
            .wheelType(ColorPickerView.WHEEL_TYPE.FLOWER)
            .density(6)
            .setPositiveButton("SET", (dialog, selectedColor, allColors) -> {
                colorThree = selectedColor;
                mColorThree.setBackgroundTintList(ColorStateList.valueOf(colorThree));
                setGradientColors(gradientType, new int[]{colorOne, colorTwo, colorThree, colorFour}, null, gradientAngle);
            })
            .setNegativeButton("DISMISS", (dialog, which) -> {
            })
            .build()
            .show();
}
 
Example #15
Source File: GradientColorsActivity.java    From PercentageChartView with Apache License 2.0 6 votes vote down vote up
@OnClick(R.id.color_two)
public void colorTwoAction() {
    ColorPickerDialogBuilder
            .with(this)
            .setTitle("Choose second color")
            .initialColor(Color.WHITE)
            .wheelType(ColorPickerView.WHEEL_TYPE.FLOWER)
            .density(6)
            .setPositiveButton("SET", (dialog, selectedColor, allColors) -> {
                colorTwo = selectedColor;
                mColorTwo.setBackgroundTintList(ColorStateList.valueOf(colorTwo));
                setGradientColors(gradientType, new int[]{colorOne, colorTwo, colorThree, colorFour}, null, gradientAngle);
            })
            .setNegativeButton("DISMISS", (dialog, which) -> {
            })
            .build()
            .show();
}
 
Example #16
Source File: GradientColorsActivity.java    From PercentageChartView with Apache License 2.0 6 votes vote down vote up
@OnClick(R.id.color_one)
public void colorOneAction() {
    ColorPickerDialogBuilder
            .with(this)
            .setTitle("Choose first color")
            .initialColor(Color.WHITE)
            .wheelType(ColorPickerView.WHEEL_TYPE.FLOWER)
            .density(6)
            .setPositiveButton("SET", (dialog, selectedColor, allColors) -> {
                colorOne = selectedColor;
                mColorOne.setBackgroundTintList(ColorStateList.valueOf(colorOne));
                setGradientColors(gradientType, new int[]{colorOne, colorTwo, colorThree, colorFour}, null, gradientAngle);
            })
            .setNegativeButton("DISMISS", (dialog, which) -> {
            })
            .build()
            .show();
}
 
Example #17
Source File: BackgroundBarSubFragment.java    From PercentageChartView with Apache License 2.0 6 votes vote down vote up
@OnClick(R.id.bg_bar_color)
void bgBarColorAction() {
    ColorPickerDialogBuilder
            .with(getActivity())
            .setTitle("Choose Background bar color")
            .initialColor(Color.WHITE)
            .wheelType(ColorPickerView.WHEEL_TYPE.FLOWER)
            .density(6)
            .setPositiveButton("SET", (dialog, selectedColor, allColors) -> {
                mBgBarColor.setBackgroundTintList(ColorStateList.valueOf(selectedColor));
                if (mListener != null) {
                    mListener.onBgBarColorChanged(selectedColor);
                }
            })
            .setNegativeButton("DISMISS", (dialog, which) -> {
            })
            .build()
            .show();
}
 
Example #18
Source File: TextSubFragment.java    From PercentageChartView with Apache License 2.0 6 votes vote down vote up
@OnClick(R.id.shadow_color)
void shadowColorAction() {
    ColorPickerDialogBuilder
            .with(getActivity())
            .setTitle("Choose shadow color")
            .initialColor(Color.WHITE)
            .wheelType(ColorPickerView.WHEEL_TYPE.FLOWER)
            .density(6)
            .setPositiveButton("SET", (dialog, selectedColor, allColors) -> {
                shadowColor = selectedColor;
                mShadowColor.setBackgroundTintList(ColorStateList.valueOf(selectedColor));
                if (mListener != null) {
                    mListener.onShadowChanged(shadowColor,
                            Float.parseFloat(mRadiusValue.getText().toString()),
                            Float.parseFloat(mDistXValue.getText().toString()),
                            Float.parseFloat(mDistYValue.getText().toString()));
                }
            })
            .setNegativeButton("DISMISS", (dialog, which) -> {
            })
            .build()
            .show();
}
 
Example #19
Source File: TextSubFragment.java    From PercentageChartView with Apache License 2.0 6 votes vote down vote up
@OnClick(R.id.text_color)
void textColorAction() {
    ColorPickerDialogBuilder
            .with(getActivity())
            .setTitle("Choose text color")
            .initialColor(Color.WHITE)
            .wheelType(ColorPickerView.WHEEL_TYPE.FLOWER)
            .density(6)
            .setPositiveButton("SET", (dialog, selectedColor, allColors) -> {
                mTextColor.setBackgroundTintList(ColorStateList.valueOf(selectedColor));
                if (mListener != null) {
                    mListener.onTextColorChanged(selectedColor);
                }
            })
            .setNegativeButton("DISMISS", (dialog, which) -> {
            })
            .build()
            .show();
}
 
Example #20
Source File: ProgressSubFragment.java    From PercentageChartView with Apache License 2.0 6 votes vote down vote up
@OnClick(R.id.progress_color)
void progressAction() {
    ColorPickerDialogBuilder
            .with(getActivity())
            .setTitle("Choose progress color")
            .initialColor(Color.WHITE)
            .wheelType(ColorPickerView.WHEEL_TYPE.FLOWER)
            .density(6)
            .setPositiveButton("SET", (dialog, selectedColor, allColors) -> {
                mProgressColor.setBackgroundTintList(ColorStateList.valueOf(selectedColor));
                if (mListener != null) {
                    mListener.onProgressColorChanged(selectedColor);
                }
            })
            .setNegativeButton("DISMISS", (dialog, which) -> {
            })
            .build()
            .show();
}