1

I integrated the following library in my Android app project successfully. That works well, Thanks to the author dankito !

RichTextEditor

However, I would like to remove some buttons from the toolbar. (Heading 1 - 6, Body Text, Preformatted, Block quot, Insert Checkbox ..)

But I do not understand how to do it. It's written in Kotlin.

Is it possible to do it simply? I am stuck ...

I would also like to change the strings of characters to translate them into French. Is it possible ?

Here is the code of the library that I obviously can not modify.

package net.dankito.richtexteditor.android.toolbar

import android.content.Context
import android.util.AttributeSet
import net.dankito.richtexteditor.android.command.*


class AllCommandsEditorToolbar : EditorToolbar {

    constructor(context: Context) : super(context) { initToolbar() }
    constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) { initToolbar() }
    constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) { initToolbar() }
    constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes) { initToolbar() }



    private fun initToolbar() {
        addCommand(BoldCommand())
        addCommand(ItalicCommand())
        addCommand(UnderlineCommand())
        addCommand(StrikeThroughCommand())
        addCommand(SuperscriptCommand())
        addCommand(SubscriptCommand())
        addCommand(RemoveFormatCommand())

        addCommand(UndoCommand())
        addCommand(RedoCommand())

        addCommand(BlockQuoteCommand())
        addCommand(SetTextFormatCommand())
        addCommand(SetFontNameCommand())
        addCommand(SetFontSizeCommand())
        addCommand(SwitchTextColorOnOffCommand())
        addCommand(SetTextColorCommand())
        addCommand(SwitchTextBackgroundColorOnOffCommand())
        addCommand(SetTextBackgroundColorCommand())

        addCommand(DecreaseIndentCommand())
        addCommand(IncreaseIndentCommand())

        addCommand(AlignLeftCommand())
        addCommand(AlignCenterCommand())
        addCommand(AlignRightCommand())
        addCommand(AlignJustifyCommand())

        addCommand(InsertBulletListCommand())
        addCommand(InsertNumberedListCommand())

        addCommand(InsertLinkCommand())
        addCommand(InsertImageCommand())
        addCommand(InsertCheckboxCommand())

        addSearchView()
    }

}

Thanks for your help

Joel
  • 192
  • 12

1 Answers1

1

In order to modify the library, you'll need to remove the dependency of the current library from the Build.gradle and then, adding the library as a module in Android Studio.

This answer already explained how to do that.

About your modification on the library, in initToolbar method (or maybe other methods, depends on the library implementation), you'll need to remove the Button (or anything you want) plus related codes inside the library.

i.e: Remove : addCommand(UndoCommand()) to remove UndoCommand from the library then look for related codes in the library and remove them too.

ʍѳђઽ૯ท
  • 16,646
  • 7
  • 53
  • 108