本文整理了Java中com.koolearn.klibrary.text.view.ZLTextWordCursor.<init>()
方法的一些代码示例,展示了ZLTextWordCursor.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZLTextWordCursor.<init>()
方法的具体详情如下:
包路径:com.koolearn.klibrary.text.view.ZLTextWordCursor
类名称:ZLTextWordCursor
方法名:<init>
暂无
代码示例来源:origin: Jiangzqts/EpubRead
Buffer(ZLTextWordCursor cursor) {
Cursor = new ZLTextWordCursor(cursor);
}
代码示例来源:origin: ydcx/KooReader
Buffer(ZLTextWordCursor cursor) {
Cursor = new ZLTextWordCursor(cursor);
}
代码示例来源:origin: ydcx/KooReader
public final void initPosition() {
if (StartPosition == null) {
StartPosition = new ZLTextWordCursor(getReader().getTextView().getStartCursor());
}
}
代码示例来源:origin: Jiangzqts/EpubRead
public final void initPosition() {
if (StartPosition == null) {
StartPosition = new ZLTextWordCursor(getReader().getTextView().getStartCursor());
}
}
代码示例来源:origin: ydcx/KooReader
public void addInvisibleBookmark(ZLTextWordCursor cursor) {
if (cursor == null) {
return;
}
cursor = new ZLTextWordCursor(cursor);
if (cursor.isNull()) {
return;
}
final ZLTextView textView = getTextView();
final ZLTextModel textModel;
final Book book;
final AutoTextSnippet snippet;
// textView.model will not be changed inside synchronised block
synchronized (textView) {
textModel = textView.getModel();
final BookModel model = Model;
book = model != null ? model.Book : null;
if (book == null || textView != BookTextView || textModel == null) {
return;
}
snippet = new AutoTextSnippet(cursor, 30);
}
updateInvisibleBookmarksList(new Bookmark(
Collection, book, textModel.getId(), snippet, false
));
}
代码示例来源:origin: Jiangzqts/EpubRead
public AutoTextSnippet getFootnoteData(String id) {
if (Model == null) {
return null;
}
final BookModel.Label label = Model.getLabel(id);
if (label == null) {
return null;
}
final ZLTextModel model;
if (label.ModelId != null) {
model = Model.getFootnoteModel(label.ModelId);
} else {
model = Model.getTextModel();
}
if (model == null) {
return null;
}
final ZLTextWordCursor cursor =
new ZLTextWordCursor(new ZLTextParagraphCursor(model, label.ParagraphIndex));
final AutoTextSnippet longSnippet = new AutoTextSnippet(cursor, 140);
if (longSnippet.IsEndOfText) {
return longSnippet;
} else {
return new AutoTextSnippet(cursor, 100);
}
}
代码示例来源:origin: Jiangzqts/EpubRead
public void addInvisibleBookmark(ZLTextWordCursor cursor) {
if (cursor == null) {
return;
}
cursor = new ZLTextWordCursor(cursor);
if (cursor.isNull()) {
return;
}
final ZLTextView textView = getTextView();
final ZLTextModel textModel;
final Book book;
final AutoTextSnippet snippet;
// textView.model will not be changed inside synchronised block
synchronized (textView) {
textModel = textView.getModel();
final BookModel model = Model;
book = model != null ? model.Book : null;
if (book == null || textView != BookTextView || textModel == null) {
return;
}
snippet = new AutoTextSnippet(cursor, 30);
}
updateInvisibleBookmarksList(new Bookmark(
Collection, book, textModel.getId(), snippet, false
));
}
代码示例来源:origin: ydcx/KooReader
public AutoTextSnippet getFootnoteData(String id) {
if (Model == null) {
return null;
}
final BookModel.Label label = Model.getLabel(id);
if (label == null) {
return null;
}
final ZLTextModel model;
if (label.ModelId != null) {
model = Model.getFootnoteModel(label.ModelId);
} else {
model = Model.getTextModel();
}
if (model == null) {
return null;
}
final ZLTextWordCursor cursor =
new ZLTextWordCursor(new ZLTextParagraphCursor(model, label.ParagraphIndex));
final AutoTextSnippet longSnippet = new AutoTextSnippet(cursor, 140);
if (longSnippet.IsEndOfText) {
return longSnippet;
} else {
return new AutoTextSnippet(cursor, 100);
}
}
代码示例来源:origin: ydcx/KooReader
private ZLTextWordCursor findStart(ZLTextPage page, ZLTextWordCursor end, int unit, int height) {
final ZLTextWordCursor start = new ZLTextWordCursor(end);
ParagraphSize size = paragraphSize(page, start, true, unit);
height -= size.Height;
boolean sameStart = start.samePositionAs(end);
if (!sameStart && start.isEndOfParagraph() && end.isStartOfParagraph()) {
ZLTextWordCursor startCopy = new ZLTextWordCursor(start);
startCopy.nextParagraph();
sameStart = startCopy.samePositionAs(end);
代码示例来源:origin: Jiangzqts/EpubRead
private ZLTextWordCursor findStart(ZLTextPage page, ZLTextWordCursor end, int unit, int height) {
final ZLTextWordCursor start = new ZLTextWordCursor(end);
ParagraphSize size = paragraphSize(page, start, true, unit);
height -= size.Height;
boolean sameStart = start.samePositionAs(end);
if (!sameStart && start.isEndOfParagraph() && end.isStartOfParagraph()) {
ZLTextWordCursor startCopy = new ZLTextWordCursor(start);
startCopy.nextParagraph();
sameStart = startCopy.samePositionAs(end);
代码示例来源:origin: Jiangzqts/EpubRead
public final synchronized void gotoPage(int page) {
if (myModel == null || myModel.getParagraphsNumber() == 0) {
return;
}
final float factor = computeCharsPerPage();
final float textSize = page * factor;
int intTextSize = (int) textSize;
int paragraphIndex = myModel.findParagraphByTextLength(intTextSize);
if (paragraphIndex > 0 && myModel.getTextLength(paragraphIndex) > intTextSize) {
--paragraphIndex;
}
intTextSize = myModel.getTextLength(paragraphIndex);
int sizeOfTextBefore = myModel.getTextLength(paragraphIndex - 1);
while (paragraphIndex > 0 && intTextSize == sizeOfTextBefore) {
--paragraphIndex;
intTextSize = sizeOfTextBefore;
sizeOfTextBefore = myModel.getTextLength(paragraphIndex - 1);
}
final int paragraphLength = intTextSize - sizeOfTextBefore;
final int wordIndex;
if (paragraphLength == 0) {
wordIndex = 0;
} else {
preparePaintInfo(myCurrentPage);
final ZLTextWordCursor cursor = new ZLTextWordCursor(myCurrentPage.EndCursor);
cursor.moveToParagraph(paragraphIndex);
wordIndex = cursor.getParagraphCursor().getParagraphLength();
}
gotoPositionByEnd(paragraphIndex, wordIndex, 0);
}
代码示例来源:origin: ydcx/KooReader
public final synchronized void gotoPage(int page) {
if (myModel == null || myModel.getParagraphsNumber() == 0) {
return;
}
final float factor = computeCharsPerPage();
final float textSize = page * factor;
int intTextSize = (int) textSize;
int paragraphIndex = myModel.findParagraphByTextLength(intTextSize);
if (paragraphIndex > 0 && myModel.getTextLength(paragraphIndex) > intTextSize) {
--paragraphIndex;
}
intTextSize = myModel.getTextLength(paragraphIndex);
int sizeOfTextBefore = myModel.getTextLength(paragraphIndex - 1);
while (paragraphIndex > 0 && intTextSize == sizeOfTextBefore) {
--paragraphIndex;
intTextSize = sizeOfTextBefore;
sizeOfTextBefore = myModel.getTextLength(paragraphIndex - 1);
}
final int paragraphLength = intTextSize - sizeOfTextBefore;
final int wordIndex;
if (paragraphLength == 0) {
wordIndex = 0;
} else {
preparePaintInfo(myCurrentPage);
final ZLTextWordCursor cursor = new ZLTextWordCursor(myCurrentPage.EndCursor);
cursor.moveToParagraph(paragraphIndex);
wordIndex = cursor.getParagraphCursor().getParagraphLength();
}
gotoPositionByEnd(paragraphIndex, wordIndex, 0);
}
代码示例来源:origin: Jiangzqts/EpubRead
return;
cursor = new ZLTextWordCursor(cursor);
cursor.moveTo(bookmark);
代码示例来源:origin: ydcx/KooReader
public AutoTextSnippet(ZLTextWordCursor start, int maxChars) {
System.err.println("AutoTextSnippet " + maxChars);
final ZLTextWordCursor cursor = new ZLTextWordCursor(start);
代码示例来源:origin: Jiangzqts/EpubRead
public AutoTextSnippet(ZLTextWordCursor start, int maxChars) {
System.err.println("AutoTextSnippet " + maxChars);
final ZLTextWordCursor cursor = new ZLTextWordCursor(start);
代码示例来源:origin: ydcx/KooReader
return;
cursor = new ZLTextWordCursor(cursor);
cursor.moveTo(bookmark);
代码示例来源:origin: Jiangzqts/EpubRead
case PaintStateEnum.TO_SCROLL_FORWARD:
if (!page.EndCursor.isEndOfText()) {
final ZLTextWordCursor startCursor = new ZLTextWordCursor();
switch (myScrollingMode) {
case ScrollingMode.NO_OVERLAPPING:
final ZLTextWordCursor endCursor = new ZLTextWordCursor();
buildInfos(page, startCursor, endCursor);
if (!page.isEmptyPage() && (myScrollingMode != ScrollingMode.KEEP_LINES || !endCursor.samePositionAs(page.EndCursor))) {
break;
case ScrollingMode.KEEP_LINES: {
ZLTextWordCursor endCursor = new ZLTextWordCursor();
page.findLineFromStart(endCursor, myOverlappingValue);
if (!endCursor.isNull() && endCursor.samePositionAs(page.EndCursor)) {
代码示例来源:origin: ydcx/KooReader
case PaintStateEnum.TO_SCROLL_FORWARD:
if (!page.EndCursor.isEndOfText()) {
final ZLTextWordCursor startCursor = new ZLTextWordCursor();
switch (myScrollingMode) {
case ScrollingMode.NO_OVERLAPPING:
final ZLTextWordCursor endCursor = new ZLTextWordCursor();
buildInfos(page, startCursor, endCursor);
if (!page.isEmptyPage() && (myScrollingMode != ScrollingMode.KEEP_LINES || !endCursor.samePositionAs(page.EndCursor))) {
break;
case ScrollingMode.KEEP_LINES: {
ZLTextWordCursor endCursor = new ZLTextWordCursor();
page.findLineFromStart(endCursor, myOverlappingValue);
if (!endCursor.isNull() && endCursor.samePositionAs(page.EndCursor)) {
内容来源于网络,如有侵权,请联系作者删除!