本文整理汇总了Java中com.onegravity.rteditor.api.format.RTText类的典型用法代码示例。如果您正苦于以下问题:Java RTText类的具体用法?Java RTText怎么用?Java RTText使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RTText类属于com.onegravity.rteditor.api.format包,在下文中一共展示了RTText类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setRichTextEditing
import com.onegravity.rteditor.api.format.RTText; //导入依赖的package包/类
/**
* Sets the edit mode to plain or rich text and updates the content at the
* same time. The caller needs to make sure the content matches the correct
* format (if you pass in html code as plain text the editor will show the
* html code).
*
* @param useRTFormatting True if the edit mode should be rich text, False if the edit
* mode should be plain text
* @param content The new content
*/
public void setRichTextEditing(boolean useRTFormatting, String content) {
assertRegistration();
if (useRTFormatting != mUseRTFormatting) {
mUseRTFormatting = useRTFormatting;
if (mListener != null) {
mListener.onRichTextEditingChanged(this, mUseRTFormatting);
}
}
RTText rtText = useRTFormatting ?
new RTHtml<>(RTFormat.HTML, content) :
new RTPlainText(content);
setText(rtText);
}
示例2: setRichTextEditing
import com.onegravity.rteditor.api.format.RTText; //导入依赖的package包/类
/**
* Sets the edit mode to plain or rich text and updates the content at the
* same time. The caller needs to make sure the content matches the correct
* format (if you pass in html code as plain text the editor will show the
* html code).
*
* @param useRTFormatting True if the edit mode should be rich text, False if the edit
* mode should be plain text
* @param content The new content
*/
public void setRichTextEditing(boolean useRTFormatting, String content) {
assertRegistration();
if (useRTFormatting != mUseRTFormatting) {
mUseRTFormatting = useRTFormatting;
if (mListener != null) {
mListener.onRichTextEditingChanged(this, mUseRTFormatting);
}
}
RTText rtText = useRTFormatting ?
new RTHtml<RTImage, RTAudio, RTVideo>(RTFormat.HTML, content) :
new RTPlainText(content);
setText(rtText);
}
示例3: getRichText
import com.onegravity.rteditor.api.format.RTText; //导入依赖的package包/类
/**
* Same as "String getText(RTFormat format)" but this method returns the
* RTText instead of just the actual text.
*/
public RTText getRichText(RTFormat format) {
assertRegistration();
RTEditable rtEditable = new RTEditable(this);
return rtEditable.convertTo(format, mMediaFactory);
}