Search in sources :

Example 1 with InsertHelper

use of forpdateam.ru.forpda.ui.views.messagepanel.inserthelper.InsertHelper in project ForPDA by RadiationX.

the class CodesPanelItem method quoteInsert.

private void quoteInsert(ButtonData item) {
    String selected = messagePanel.getSelectedText();
    int[] range = messagePanel.getSelectionRange();
    InsertHelper insertHelper = new InsertHelper(getContext());
    insertHelper.addHeader(App.get().getString(R.string.codes_block_title), "name");
    /*insertHelper.addHeader("Дата", "date");
        insertHelper.addHeader("ID поста", "post");*/
    if (selected.length() == 0)
        insertHelper.setBody(App.get().getString(R.string.codes_quote_text), null);
    insertHelper.setInsertListener((resultHeaders, bodyResult) -> {
        String[] bbcodes = createBbCode(item.getText(), resultHeaders, bodyResult);
        messagePanel.insertText(bbcodes[0], bbcodes[1], range[0], range[1]);
    });
    insertHelper.show();
}
Also used : InsertHelper(forpdateam.ru.forpda.ui.views.messagepanel.inserthelper.InsertHelper)

Example 2 with InsertHelper

use of forpdateam.ru.forpda.ui.views.messagepanel.inserthelper.InsertHelper in project ForPDA by RadiationX.

the class CodesPanelItem method urlInsert.

private void urlInsert(ButtonData item) {
    String selected = messagePanel.getSelectedText();
    int[] range = messagePanel.getSelectionRange();
    InsertHelper insertHelper = new InsertHelper(getContext());
    insertHelper.addHeader(App.get().getString(R.string.codes_link), null);
    if (selected.length() == 0)
        insertHelper.setBody(App.get().getString(R.string.codes_link_text), null);
    insertHelper.setInsertListener((resultHeaders, bodyResult) -> {
        String[] bbcodes = createBbCode(item.getText(), resultHeaders, bodyResult);
        messagePanel.insertText(bbcodes[0], bbcodes[1], range[0], range[1]);
    });
    insertHelper.show();
}
Also used : InsertHelper(forpdateam.ru.forpda.ui.views.messagepanel.inserthelper.InsertHelper)

Example 3 with InsertHelper

use of forpdateam.ru.forpda.ui.views.messagepanel.inserthelper.InsertHelper in project ForPDA by RadiationX.

the class CodesPanelItem method spoilerInsert.

private void spoilerInsert(ButtonData item) {
    String selected = messagePanel.getSelectedText();
    int[] range = messagePanel.getSelectionRange();
    InsertHelper insertHelper = new InsertHelper(getContext());
    insertHelper.addHeader(App.get().getString(R.string.codes_block_title), null);
    if (selected.length() == 0)
        insertHelper.setBody(App.get().getString(R.string.codes_spoiler_text), null);
    insertHelper.setInsertListener((resultHeaders, bodyResult) -> {
        String[] bbcodes = createBbCode(item.getText(), resultHeaders, bodyResult);
        messagePanel.insertText(bbcodes[0], bbcodes[1], range[0], range[1]);
    });
    insertHelper.show();
}
Also used : InsertHelper(forpdateam.ru.forpda.ui.views.messagepanel.inserthelper.InsertHelper)

Example 4 with InsertHelper

use of forpdateam.ru.forpda.ui.views.messagepanel.inserthelper.InsertHelper in project ForPDA by RadiationX.

the class CodesPanelItem method fontInsert.

private void fontInsert(ButtonData item) {
    String selected = messagePanel.getSelectedText();
    int[] range = messagePanel.getSelectionRange();
    InsertHelper insertHelper = new InsertHelper(getContext());
    insertHelper.addHeader(App.get().getString(R.string.codes_font), null);
    if (selected.length() == 0)
        insertHelper.setBody(App.get().getString(R.string.codes_font_text), null);
    insertHelper.setInsertListener((resultHeaders, bodyResult) -> {
        String[] bbcodes = createBbCode(item.getText(), resultHeaders, bodyResult);
        messagePanel.insertText(bbcodes[0], bbcodes[1], range[0], range[1]);
    });
    insertHelper.show();
}
Also used : InsertHelper(forpdateam.ru.forpda.ui.views.messagepanel.inserthelper.InsertHelper)

Example 5 with InsertHelper

use of forpdateam.ru.forpda.ui.views.messagepanel.inserthelper.InsertHelper in project ForPDA by RadiationX.

the class CodesPanelItem method codeInsert.

private void codeInsert(ButtonData item) {
    String selected = messagePanel.getSelectedText();
    int[] range = messagePanel.getSelectionRange();
    InsertHelper insertHelper = new InsertHelper(getContext());
    insertHelper.addHeader(App.get().getString(R.string.codes_block_title), null);
    if (selected.length() == 0)
        insertHelper.setBody(App.get().getString(R.string.codes_code_text), null);
    insertHelper.setInsertListener((resultHeaders, bodyResult) -> {
        String[] bbcodes = createBbCode(item.getText(), resultHeaders, bodyResult);
        messagePanel.insertText(bbcodes[0], bbcodes[1], range[0], range[1]);
    });
    insertHelper.show();
}
Also used : InsertHelper(forpdateam.ru.forpda.ui.views.messagepanel.inserthelper.InsertHelper)

Aggregations

InsertHelper (forpdateam.ru.forpda.ui.views.messagepanel.inserthelper.InsertHelper)5