use of biz.source_code.miniTemplator.MiniTemplator in project ForPDA by RadiationX.
the class ForumRx method transform.
public static Announce transform(Announce announce, boolean withHtml) throws Exception {
if (withHtml) {
MiniTemplator t = App.get().getTemplate(App.TEMPLATE_ANNOUNCE);
App.setTemplateResStrings(t);
t.setVariableOpt("style_type", App.get().getCssStyleType());
t.setVariableOpt("body", announce.getHtml());
announce.setHtml(t.generateOutput());
t.reset();
}
return announce;
}
use of biz.source_code.miniTemplator.MiniTemplator in project ForPDA by RadiationX.
the class ForumRx method transform.
public static ForumRules transform(ForumRules rules, boolean withHtml) throws Exception {
if (withHtml) {
MiniTemplator t = App.get().getTemplate(App.TEMPLATE_FORUM_RULES);
App.setTemplateResStrings(t);
t.setVariableOpt("style_type", App.get().getCssStyleType());
for (ForumRules.Item item : rules.getItems()) {
t.setVariableOpt("type", item.isHeader() ? "header" : "");
t.setVariableOpt("number", item.getNumber());
t.setVariableOpt("text", item.getText());
t.addBlockOpt("rules_item");
}
rules.setHtml(t.generateOutput());
t.reset();
}
return rules;
}
use of biz.source_code.miniTemplator.MiniTemplator in project ForPDA by RadiationX.
the class QmsChatFragment method showMoreMess.
@JavascriptInterface
public void showMoreMess() {
if (getContext() == null)
return;
MiniTemplator t = App.get().getTemplate(App.TEMPLATE_QMS_CHAT_MESS);
App.setTemplateResStrings(t);
int endIndex = currentChat.getShowedMessIndex();
int startIndex = Math.max(endIndex - 30, 0);
currentChat.setShowedMessIndex(startIndex);
QmsRx.generateMess(t, currentChat.getMessages(), startIndex, endIndex);
String messagesSrc = t.generateOutput();
t.reset();
messagesSrc = QmsRx.transformMessageSrc(messagesSrc);
webView.evalJs("showMoreMess('" + messagesSrc + "')");
}
use of biz.source_code.miniTemplator.MiniTemplator in project ForPDA by RadiationX.
the class QmsChatFragment method onNewMessages.
private void onNewMessages(ArrayList<QmsMessage> qmsMessage) {
Log.d(LOG_TAG, "Returned messages " + qmsMessage.size());
if (!qmsMessage.isEmpty()) {
MiniTemplator t = App.get().getTemplate(App.TEMPLATE_QMS_CHAT_MESS);
App.setTemplateResStrings(t);
for (int i = 0; i < qmsMessage.size(); i++) {
QmsMessage message = qmsMessage.get(i);
for (QmsMessage viewmessage : currentChat.getMessages()) {
if (viewmessage.getId() == message.getId()) {
return;
}
}
currentChat.addMessage(message);
QmsRx.generateMess(t, message);
}
String messagesSrc = t.generateOutput();
t.reset();
messagesSrc = QmsRx.transformMessageSrc(messagesSrc);
webView.evalJs("showNewMess('".concat(messagesSrc).concat("', true)"));
}
}
use of biz.source_code.miniTemplator.MiniTemplator in project ForPDA by RadiationX.
the class QmsChatFragment method loadBaseWebContainer.
// Chat
private void loadBaseWebContainer() {
MiniTemplator t = App.get().getTemplate(App.TEMPLATE_QMS_CHAT);
App.setTemplateResStrings(t);
t.setVariableOpt("style_type", App.get().getCssStyleType());
t.setVariableOpt("body_type", "qms");
t.setVariableOpt("messages", "");
String html = t.generateOutput();
t.reset();
webView.loadDataWithBaseURL("https://4pda.ru/forum/", html, "text/html", "utf-8", null);
}
Aggregations