Merge "Fix crash after smart selection animation" into pi-dev

am: 6df95fa087

Change-Id: Ie37f7c1809c71c6ffa44bc20090493d90b4a8c41
This commit is contained in:
Mihai Popa
2018-05-22 04:26:56 -07:00
committed by android-build-merger

View File

@@ -284,7 +284,12 @@ public final class SelectionActionModeHelper {
@Nullable SelectionResult result) {
final Layout layout = mTextView.getLayout();
final Runnable onAnimationEndCallback = () -> startSelectionActionMode(result);
final Runnable onAnimationEndCallback = () -> {
if (result.mStart >= 0 && result.mEnd <= getText(mTextView).length()
&& result.mStart <= result.mEnd) {
startSelectionActionMode(result);
}
};
// TODO do not trigger the animation if the change included only non-printable characters
final boolean didSelectionChange =
result != null && (mTextView.getSelectionStart() != result.mStart