StickerView icon indicating copy to clipboard operation
StickerView copied to clipboard

How to load sticker from drawable folder and set it to StickerView.

Open rahul107 opened this issue 7 years ago • 0 comments

when i change color of first sticker it replaces with second and both have same text and color when i and joint one another, they look-like only one sticker but when we close on another still on canvas how to solve it?

my code example is here

public static void AddTextColor(@NonNull Sticker sticker, int color) {

    if (sticker instanceof TextSticker) {
        ((TextSticker) sticker).setTextColor(color);
    }   
}

private void viewColorPicker() {

    ColorPickerDialogBuilder
            .with(this)
            .setTitle("Text Color")
            .initialColor(Color.parseColor("#ffffff"))
            .wheelType(ColorPickerView.WHEEL_TYPE.FLOWER)
            .density(12)
            .setOnColorSelectedListener(new OnColorSelectedListener() {
                @Override
                public void onColorSelected(int selectedColor) {

                }
            })
            .setPositiveButton("ok", new ColorPickerClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int selectedColor, Integer[] allColors) {
                    AddTextColor(sticker11, selectedColor);
                    stickerView.replace(sticker11);
                    if (allColors != null) {
                        StringBuilder sb = null;

                        for (Integer color : allColors) {
                            if (color == null)
                                continue;
                            if (sb == null)
                                sb = new StringBuilder("Color List:");
                            sb.append("\r\n#" + Integer.toHexString(color).toUpperCase());
                        }
                    }
                }
            })
            .setNegativeButton("cancel", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                }
            })
            .showColorEdit(true)
            .setColorEditTextColor(ContextCompat.getColor(this, android.R.color.holo_blue_bright))
            .build()
            .show();
}

Thank you

rahul107 avatar Aug 08 '17 06:08 rahul107