public void Annotate(long position) { if (annTask != null) { annTask.Cancel(true); } lines.Clear(); linesAdapter.NotifyDataSetChanged(); linesAdapter.ShowHeader = false; linesAdapter.ShowFooter = true; wPopup.dismiss(); startPos = 0; curPos = 0; endPos = 0; isFirstFileAnnotation = true; if (annoMode == ANNOTATE_FILE) { startPos = Math.Max(0, GetPreferences(FileCreationMode.Private).GetInt(curFilePath, 0)); if (startPos >= textLen) { startPos = 0; } endPos = startPos; mBookmarks = Bookmark.ReadFromFile(curFilePath + ".bookmarks"); mFoundBookmarks.Clear(); } else if (annoMode == ANNOTATE_STARRED) { curFilePath = ""; curSaveName = "ChineseReader_Starred"; } else { curFilePath = ""; curSaveName = ""; } if (position >= 0) { startPos = endPos = position; } if (startPos == 0) { linesAdapter.ShowHeader = false; } //System.Console.WriteLine("THIS IS RIGHT BEFORE EXECUTE!!!!!!!!!!"); annTask = new AnnTask(this, AnnTask.TASK_ANNOTATE, annoMode, curPos, startPos, endPos, 5, 0, lines, new List <object>(), pastedText, textLen, openedFile, testView, UpdateLinesAnnInterface, true, mBookmarks); annTask.ExecuteWrapper(); }
private void SplitButton_Click(object sender, EventArgs e) { WordPopup view = sender as WordPopup; view.dismiss(); List <object> subWords = BreakWord(Dict.GetCh(entry)); int lineIndex = mContext.lines.IndexOf(line); mContext.linesAdapter.NotifyDataSetChanged(); object firstWord = subWords[0]; if (mContext.annoMode == AnnotationActivity.ANNOTATE_FILE) { mContext.curPos = 0; mContext.endPos = mContext.GetPosition(mContext.lines, lineIndex + 1, wordIndex, true) + (firstWord is int?Dict.GetLength((int)firstWord) : ((string)firstWord).Length) * 3; } else { mContext.endPos = (int)mContext.GetPosition(mContext.lines, lineIndex + 1, wordIndex, false) + (firstWord is int?Dict.GetLength((int)firstWord) : ((string)firstWord).Length); } List <object> curLine = (List <object>)line; int toRemove = curLine.Count - wordIndex; while (toRemove-- > 0) { curLine.RemoveAt(wordIndex); } curLine.Add(subWords[0]); int curWidth = 5; foreach (object word in curLine) { curWidth += mContext.testView.GetWordWidth((string)word); } mContext.SplitAnnotation(lineIndex, curWidth, curLine); }