Status Update
Comments
ju...@google.com <ju...@google.com> #2
@ezio1497@gmail.com Could you please insert the code snippet that you've used?
Meanwhile I tried a few examples. If we change the layout direction by changing the locale (or setting the developer option "Force RTL layout direction"), it works. But if instead we set the layout direction via the ambient (Providers (LayoutDirectionAmbient provides LayoutDirection.Rtl) { Popup() }
), then the layout direction won't be propagated to the content of the Popup
If I understand correctly, the value of the layout direction set via ambient should have been propagated. So it seems like there is an issue with the ambient. Below is the minimum repro:
- Define a new ambient
val MyAmbient = ambientOf<Int>()
- Use it for Popup content size
Providers(MyAmbient provides 200) {
Popup(alignment = Alignment.CenterStart) {
val sizeDp = with(DensityAmbient.current) { MyAmbient.current.toDp() }
Box(Modifier.preferredSize(sizeDp).background(Color.Gray))
}
}
-
Run example and notice the result - Popup size is 200
-
Set the value of MyAmbient in ProvideCommonAmbients to 10
internal fun ProvideCommonAmbients(...) {
Providers(
...,
MyAmbient provides 10,
children = content
)
}
- Rerun using the same code snippet from step 2 and notice that the Popup size becomes 10. So even though we provided 200 on step 2, the content of the Popup still uses the one set on step 4.
Chuck, could you please take a look?
Description
var ssb = new SpannableStringBuilder("test");
ssb.setSpan(new TypefaceSpan((Typeface)null), 0, 3, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
var html = Html.toHtml(ssb, Html.TO_HTML_PARAGRAPH_LINES_CONSECUTIVE);
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.Object.equals(java.lang.Object)' on a null object reference
at android.text.Html.withinParagraph(Html.java:617)
at android.text.Html.withinBlockquoteConsecutive(Html.java:490)
at android.text.Html.withinBlockquote(Html.java:401)
at android.text.Html.withinDiv(Html.java:338)
at android.text.Html.encodeTextAlignmentByDiv(Html.java:319)
at android.text.Html.withinHtml(Html.java:284)
at android.text.Html.toHtml(Html.java:269)
Crashes here:
I understand that one should not create a TypefaceSpan with a null reference, but in some cases, this is out of our control. In my particular case, the Spanned string comes from another app via the system clipboard