com.flask.colorpicker.ColorPickerView Java Examples

The following examples show how to use com.flask.colorpicker.ColorPickerView. 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_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 #2
Source File: ColorPickerDialogBuilder.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
private ColorPickerDialogBuilder(Context context, int theme) {
	defaultMargin = getDimensionAsPx(context, R.dimen.default_slider_margin);
	final int dialogMarginBetweenTitle = getDimensionAsPx(context, R.dimen.default_slider_margin_btw_title);

	builder = new AlertDialog.Builder(context, theme);
	pickerContainer = new LinearLayout(context);
	pickerContainer.setOrientation(LinearLayout.VERTICAL);
	pickerContainer.setGravity(Gravity.CENTER_HORIZONTAL);
	pickerContainer.setPadding(defaultMargin, dialogMarginBetweenTitle, defaultMargin, defaultMargin);

	LinearLayout.LayoutParams layoutParamsForColorPickerView = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0);
	layoutParamsForColorPickerView.weight = 1;
	colorPickerView = new ColorPickerView(context);

	pickerContainer.addView(colorPickerView, layoutParamsForColorPickerView);

	builder.setView(pickerContainer);
}
 
Example #3
Source File: ColorPickerDialogBuilder.java    From timecat with Apache License 2.0 6 votes vote down vote up
private ColorPickerDialogBuilder(Context context, int theme) {
	defaultMargin = getDimensionAsPx(context, R.dimen.default_slider_margin);
	final int dialogMarginBetweenTitle = getDimensionAsPx(context, R.dimen.default_slider_margin_btw_title);

	builder = new AlertDialog.Builder(context, theme);
	pickerContainer = new LinearLayout(context);
	pickerContainer.setOrientation(LinearLayout.VERTICAL);
	pickerContainer.setGravity(Gravity.CENTER_HORIZONTAL);
	pickerContainer.setPadding(defaultMargin, dialogMarginBetweenTitle, defaultMargin, defaultMargin);

	LinearLayout.LayoutParams layoutParamsForColorPickerView = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0);
	layoutParamsForColorPickerView.weight = 1;
	colorPickerView = new ColorPickerView(context);

	pickerContainer.addView(colorPickerView, layoutParamsForColorPickerView);

	builder.setView(pickerContainer);
}
 
Example #4
Source File: ColorPickerDialogBuilder.java    From openlauncher with Apache License 2.0 6 votes vote down vote up
private ColorPickerDialogBuilder(Context context, int theme) {
	defaultMargin = getDimensionAsPx(context, R.dimen.default_slider_margin);
	defaultMarginTop = getDimensionAsPx(context, R.dimen.default_margin_top);

	builder = new AlertDialog.Builder(context, theme);
	pickerContainer = new LinearLayout(context);
	pickerContainer.setOrientation(LinearLayout.VERTICAL);
	pickerContainer.setGravity(Gravity.CENTER_HORIZONTAL);
	pickerContainer.setPadding(defaultMargin, defaultMarginTop, defaultMargin, 0);

	LinearLayout.LayoutParams layoutParamsForColorPickerView = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0);
	layoutParamsForColorPickerView.weight = 1;
	colorPickerView = new ColorPickerView(context);

	pickerContainer.addView(colorPickerView, layoutParamsForColorPickerView);

	builder.setView(pickerContainer);
}
 
Example #5
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 #6
Source File: ColorPickerDialogBuilder.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
private ColorPickerDialogBuilder(Context context, int theme) {
	defaultMargin = getDimensionAsPx(context, R.dimen.default_slider_margin);
	final int dialogMarginBetweenTitle = getDimensionAsPx(context, R.dimen.default_slider_margin_btw_title);

	builder = new AlertDialog.Builder(context, theme);
	pickerContainer = new LinearLayout(context);
	pickerContainer.setOrientation(LinearLayout.VERTICAL);
	pickerContainer.setGravity(Gravity.CENTER_HORIZONTAL);
	pickerContainer.setPadding(defaultMargin, dialogMarginBetweenTitle, defaultMargin, defaultMargin);

	LinearLayout.LayoutParams layoutParamsForColorPickerView = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0);
	layoutParamsForColorPickerView.weight = 1;
	colorPickerView = new ColorPickerView(context);

	pickerContainer.addView(colorPickerView, layoutParamsForColorPickerView);

	builder.setView(pickerContainer);
}
 
Example #7
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 #8
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 #9
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 #10
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 #11
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 #12
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 #13
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 #14
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 #15
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 #16
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 #17
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 #18
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();
}
 
Example #19
Source File: ColorWheelRendererBuilder.java    From droidddle with Apache License 2.0 5 votes vote down vote up
public static ColorWheelRenderer getRenderer(ColorPickerView.WHEEL_TYPE wheelType) {
    switch (wheelType) {
        case CIRCLE:
            return new SimpleColorWheelRenderer();
        case FLOWER:
            return new FlowerColorWheelRenderer();
    }
    throw new IllegalArgumentException("wrong WHEEL_TYPE");
}
 
Example #20
Source File: ColorPickerDialogBuilder.java    From droidddle with Apache License 2.0 5 votes vote down vote up
private ColorPickerDialogBuilder(Context context) {
    builder = new AlertDialog.Builder(context);
    pickerContainer = new LinearLayout(context);
    pickerContainer.setOrientation(LinearLayout.VERTICAL);
    pickerContainer.setGravity(Gravity.CENTER_HORIZONTAL);
    defaultMargin = getDimensionAsPx(context, R.dimen.default_slider_margin);

    LinearLayout.LayoutParams layoutParamsForColorPickerView = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0);
    layoutParamsForColorPickerView.weight = 1;
    colorPickerView = new ColorPickerView(context);

    pickerContainer.addView(colorPickerView, layoutParamsForColorPickerView);

    builder.setView(pickerContainer);
}
 
Example #21
Source File: ColorWheelRendererBuilder.java    From openlauncher with Apache License 2.0 5 votes vote down vote up
public static ColorWheelRenderer getRenderer(ColorPickerView.WHEEL_TYPE wheelType) {
	switch (wheelType) {
		case CIRCLE:
			return new SimpleColorWheelRenderer();
		case FLOWER:
			return new FlowerColorWheelRenderer();
	}
	throw new IllegalArgumentException("wrong WHEEL_TYPE");
}
 
Example #22
Source File: ColorWheelRendererBuilder.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
public static ColorWheelRenderer getRenderer(ColorPickerView.WHEEL_TYPE wheelType) {
	switch (wheelType) {
		case CIRCLE:
			return new SimpleColorWheelRenderer();
		case FLOWER:
			return new FlowerColorWheelRenderer();
	}
	throw new IllegalArgumentException("wrong WHEEL_TYPE");
}
 
Example #23
Source File: ColorWheelRendererBuilder.java    From timecat with Apache License 2.0 5 votes vote down vote up
public static ColorWheelRenderer getRenderer(ColorPickerView.WHEEL_TYPE wheelType) {
	switch (wheelType) {
		case CIRCLE:
			return new SimpleColorWheelRenderer();
		case FLOWER:
			return new FlowerColorWheelRenderer();
	}
	throw new IllegalArgumentException("wrong WHEEL_TYPE");
}
 
Example #24
Source File: ColorWheelRendererBuilder.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
public static ColorWheelRenderer getRenderer(ColorPickerView.WHEEL_TYPE wheelType) {
	switch (wheelType) {
		case CIRCLE:
			return new SimpleColorWheelRenderer();
		case FLOWER:
			return new FlowerColorWheelRenderer();
	}
	throw new IllegalArgumentException("wrong WHEEL_TYPE");
}
 
Example #25
Source File: LightnessSlider.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
public void setColorPicker(ColorPickerView colorPicker) {
	this.colorPicker = colorPicker;
}
 
Example #26
Source File: AlphaSlider.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
public void setColorPicker(ColorPickerView colorPicker) {
	this.colorPicker = colorPicker;
}
 
Example #27
Source File: AlphaSlider.java    From openlauncher with Apache License 2.0 4 votes vote down vote up
public void setColorPicker(ColorPickerView colorPicker) {
	this.colorPicker = colorPicker;
}
 
Example #28
Source File: LightnessSlider.java    From openlauncher with Apache License 2.0 4 votes vote down vote up
public void setColorPicker(ColorPickerView colorPicker) {
	this.colorPicker = colorPicker;
}
 
Example #29
Source File: LightnessSlider.java    From timecat with Apache License 2.0 4 votes vote down vote up
public void setColorPicker(ColorPickerView colorPicker) {
	this.colorPicker = colorPicker;
}
 
Example #30
Source File: AlphaSlider.java    From timecat with Apache License 2.0 4 votes vote down vote up
public void setColorPicker(ColorPickerView colorPicker) {
	this.colorPicker = colorPicker;
}