Android-Rich-text-Editor icon indicating copy to clipboard operation
Android-Rich-text-Editor copied to clipboard

Change toolbar selection color

Open quangas opened this issue 6 years ago • 8 comments

Is there a way to change the color selection on the toolbar? The default seems to be a pink color for the AREditText.

quangas avatar May 30 '19 11:05 quangas

Sorry there is no easy way to do this for now. What worth a try based on current code is to extends the current ToolItems and override the getToolItemUpdater

public class ARE_ToolItem_Bold extends ARE_ToolItem_Abstract {

    @Override
    public IARE_ToolItem_Updater getToolItemUpdater() {
        if (mToolItemUpdater == null) {
            mToolItemUpdater = new ARE_ToolItem_UpdaterDefault(this, Constants.CHECKED_COLOR /* Change this color*/, Constants.UNCHECKED_COLOR);
            setToolItemUpdater(mToolItemUpdater);
        }
        return mToolItemUpdater;
    }
  ...
}

For example:

public class My_ARE_ToolItem_Bold extends ARE_ToolItem_Bold {

    @Override
    public IARE_ToolItem_Updater getToolItemUpdater() {
        if (mToolItemUpdater == null) {
            mToolItemUpdater = new ARE_ToolItem_UpdaterDefault(this, MY_CHECKED_COLOR, Constants.UNCHECKED_COLOR);
            setToolItemUpdater(mToolItemUpdater);
        }
        return mToolItemUpdater;
    }

And afterwards you can use My_ARE_ToolItem_Bold instead of ARE_ToolItem_Bold

chinalwb avatar May 30 '19 13:05 chinalwb

You have to do this for every single control?

Is there no theme that can be applied?

On May 30, 2019, at 2:21 PM, Rain Liu [email protected] wrote:

Sorry there is no easy way to do this. What worth a try based on current code is to extends the current ToolItems and override the getToolItemUpdater

public class ARE_ToolItem_Bold extends ARE_ToolItem_Abstract {

@Override
public IARE_ToolItem_Updater getToolItemUpdater() {
    if (mToolItemUpdater == null) {
        mToolItemUpdater = new ARE_ToolItem_UpdaterDefault(this, Constants.CHECKED_COLOR /* Change this color*/, Constants.UNCHECKED_COLOR);
        setToolItemUpdater(mToolItemUpdater);
    }
    return mToolItemUpdater;
}

... } For example:

public class My_ARE_ToolItem_Bold extends ARE_ToolItem_Bold {

@Override
public IARE_ToolItem_Updater getToolItemUpdater() {
    if (mToolItemUpdater == null) {
        mToolItemUpdater = new ARE_ToolItem_UpdaterDefault(this, MY_CHECKED_COLOR, Constants.UNCHECKED_COLOR);
        setToolItemUpdater(mToolItemUpdater);
    }
    return mToolItemUpdater;
}

And afterwards you can use My_ARE_ToolItem_Bold instead of ARE_ToolItem_Bold

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

quangas avatar May 31 '19 09:05 quangas

Sorry, I could have that done but not yet..

chinalwb avatar May 31 '19 10:05 chinalwb

Hi this is not highlighting all buttons i want to update all buttons like bullets, numbers, align left , align right so if there any way to do this let me know.. Only working in (Bold,italic,quotes)

chiragnahartops avatar Jul 04 '19 13:07 chiragnahartops

@chiragdabhi0007 that needs some improvements from the code, simply speaking the work is to update the button style (high lighting) when cursor moving and code detects the corresponding span has been applied at the cursor position.

Sorry about the defect, I could do but I can't make a fix date promise..

chinalwb avatar Jul 04 '19 13:07 chinalwb

Sorry there is no easy way to do this for now. What worth a try based on current code is to extends the current ToolItems and override the getToolItemUpdater

public class ARE_ToolItem_Bold extends ARE_ToolItem_Abstract {

    @Override
    public IARE_ToolItem_Updater getToolItemUpdater() {
        if (mToolItemUpdater == null) {
            mToolItemUpdater = new ARE_ToolItem_UpdaterDefault(this, Constants.CHECKED_COLOR /* Change this color*/, Constants.UNCHECKED_COLOR);
            setToolItemUpdater(mToolItemUpdater);
        }
        return mToolItemUpdater;
    }
  ...
}

For example:

public class My_ARE_ToolItem_Bold extends ARE_ToolItem_Bold {

    @Override
    public IARE_ToolItem_Updater getToolItemUpdater() {
        if (mToolItemUpdater == null) {
            mToolItemUpdater = new ARE_ToolItem_UpdaterDefault(this, MY_CHECKED_COLOR, Constants.UNCHECKED_COLOR);
            setToolItemUpdater(mToolItemUpdater);
        }
        return mToolItemUpdater;
    }

And afterwards you can use My_ARE_ToolItem_Bold instead of ARE_ToolItem_Bold

You can do it without extending a new class, just set the toolItemUpdater for example :

IARE_ToolItem bold = new ARE_ToolItem_Bold();
bold.setToolItemUpdater(new ARE_ToolItem_UpdaterDefault(bold, MY_CHECKED_COLOR, Constants.UNCHECKED_COLOR));

MY_CHECKED_COLOR in format 0xaaRRGGBB

Hamahmi avatar Dec 14 '20 18:12 Hamahmi

Hi @Hamahmi , thanks for the comment! It amazed me! I cannot imagine there are really some guys would read the f**k code, but obviously you, are the one! Thank you!

chinalwb avatar Dec 15 '20 03:12 chinalwb

@chinalwb Thanks man, your work is amazing btw, and I'd like to contribute and change some stuff when I get some free time

Hamahmi avatar Dec 16 '20 11:12 Hamahmi