Fixed
Status Update
Comments
ki...@google.com <ki...@google.com>
te...@google.com <te...@google.com> #2
Or when changing to textView.textMetricsParamsCompat still crash.
private fun setAsyncText(textView: AppCompatTextView, text: String?) {
if (!text.isNullOrEmpty()) {
val textFuture = PrecomputedTextCompat.getTextFuture(text!!, textView.textMetricsParamsCompat, null)
textView.setTextFuture(textFuture) //Crash
}
}
private fun setAsyncText(textView: AppCompatTextView, text: String?) {
if (!text.isNullOrEmpty()) {
val textFuture = PrecomputedTextCompat.getTextFuture(text!!, textView.textMetricsParamsCompat, null)
textView.setTextFuture(textFuture) //Crash
}
}
al...@google.com <al...@google.com>
ap...@google.com <ap...@google.com> #3
add this line :
textView.setLayoutDirection(ViewCompat.getLayoutDirection(textView));
before :
setTextFuture(....)
textView.setLayoutDirection(ViewCompat.getLayoutDirection(textView));
before :
setTextFuture(....)
Description
Component used: AppCompat Version used: appcompat-1.2.0 Devices/Android versions reproduced on: Oreo, API level 26 & 27
To reproduce:
This arises from the fact that
AppCompatTextView.setCustomActionModeCallback
accepts nullables, but internally calls toTextViewCompat.wrapCustomSelectionActionModeCallback
, which requires a non-null callback.Offending lines:
To fix this, the OreoCallback wrapping should be skipped if the callback is null.