Created
February 28, 2020 14:47
-
-
Save abbas-oveissi/43616c72637db17959e15b4508ccee20 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void drawCustomMethod(Canvas canvas) { | |
int startLine = getTouchedLine(startX, startY); | |
int startCharPos = getCharPositionByTouch(startX, startY, startLine); | |
int currentLine = getTouchedLine(currentX, currentY); | |
int currentCharPos = getCharPositionByTouch(currentX, currentY, currentLine); | |
if(startLine == currentLine) { | |
drawSelection(canvas,startCharPos,currentCharPos,startLine); | |
return; | |
} | |
for (int i = startLine; i <= currentLine; i++) { | |
if(startLine == i) { | |
drawSelection(canvas,startCharPos,getLayout().getLineEnd(i),i); | |
continue; | |
} | |
if(currentLine == i) { | |
drawSelection(canvas,getLayout().getLineStart(i),currentCharPos,i); | |
continue; | |
} | |
drawFullSelection(canvas,i); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment