Status Update
Comments
il...@google.com <il...@google.com> #2
but the fontStyle and fontFamily parameters are not. I expected "World" to display as bold, italic and monospace.
+1, it sounds like a bug and agree that fontStyle
and fontFamily
should be carried as long as they are note overridden
Note also how textDecoration = TextDecoration.LineThrough from the annotated string and TextDecoration.Underline on the Text combine
This also sounds like a bug (especially for a case where Text has LineThrough, AnnotatedString has TextDecoration.None, where the intention is "this part of the text should not have a text decoration)
sa...@gmail.com <sa...@gmail.com> #3
Branch: androidx-main
commit 28810a41432e2fc8713e0a4b59ac311d9db77eb3
Author: Haoyu Zhang <haoyuchang@google.com>
Date: Fri Apr 09 16:04:52 2021
Read global font attributes when resolve font attributes on AnnotatedString
Also introduced screenshot test for styled text.
Bug: 184760917
Test: ./gradlew test
Change-Id: I8f21298ffd551f0963e11b059412f0c582dc9dd6
A compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/BasicTextScreenshotTest.kt
M compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/platform/SpannableExtensionsTest.kt
M compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/AndroidParagraphHelper.android.kt
M compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/AndroidParagraphIntrinsics.android.kt
M compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/extensions/SpannableExtensions.android.kt
ch...@google.com <ch...@google.com> #4
Branch: androidx-main
commit eeff527b7ec6ca2accb0163696098d2765076262
Author: Haoyu Zhang <haoyuchang@google.com>
Date: Thu Apr 29 11:13:41 2021
Make SpanStyle merge logic on AnnotatedString consistent
Bug: 184760917
Test: ./gradlew test
Test: ./gradlew compose:ui:ui-text:connectedAndroidTest
RelNote: "TextGeomerticTransform and TextDecoration on AnnotatedString
will be applied as given."
Change-Id: I61900b749deafc1570dc329a64d1050fd52b20a2
M compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/platform/AndroidParagraphTest.kt
M compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/AndroidAccessibilitySpannableString.android.kt
M compose/ui/ui-text/src/androidMain/kotlin/androidx/compose/ui/text/platform/extensions/SpannableExtensions.android.kt
A text/text/src/main/java/androidx/compose/ui/text/android/style/TextDecorationSpan.kt
ki...@gmail.com <ki...@gmail.com> #5
I tried this on beta06 (assuming that's where the fix went) and fontStyle
and fontFamily
now apply as expected. However, I still get underlining AND linethrough on "World". I wanted to confirm that it is your intention to combine them, based on the comments above.
Playing with the example further:
- Changing the
Text
toTextDecoration.None
results in no decoration on "Hello" but a linethrough on "World" (seems reasonable -- annotated overrides Text) - Changing the annotated "World" to
TextDecoration.None
and theText
toTextDecoration.LineThrough
(as suggested in the comments above) results in a linethrough on "Hello World" (seems inconsistent -- shouldn't "World" have no decoration?)
(And sometimes, oddly, I have to uninstall the test app manually in the emulator before the new code will take effect.)
il...@google.com <il...@google.com> #6
Hi, thanks for your report! The fixing CL for TextDeocration and LineThrough was just merged recently. And it's probably not included in the beta-06, can you please check it again in next release?
ki...@gmail.com <ki...@gmail.com> #7
OK, I will. (I had assumed that since the result had changed from the last time I ran the testcase that this fix was applied, but maybe some other change was responsible.)
ap...@google.com <ap...@google.com> #8
The fix works as expected in beta07.
(I still occasionally have to uninstall the test app manually in the emulator before the new code will take effect. I'm sure this is an AS issue but it seems to hit mostly (only?) when I've been running this test.)
il...@google.com <il...@google.com> #9
Thanks for the confirmation! I'll mark it as verified for now. :)
g....@gmail.com <g....@gmail.com> #10
The only reason why I'm using Animation
is that I need to use percent values, as in the animation of FragmentTransaction
(and by extension Navigation
) only accepts @AnimatorRes
and @AnimRes
, I can't create the animation programmatically.
Is there any alternative to Animation
in this case?
il...@google.com <il...@google.com> #11
Re #10 - note that even when you do not pass a resource ID, you can still override onCreateAnimation()
or onCreateAnimator()
on your Fragment and return any custom Animation
or Animator
you want - there is no requirement that you only use Animations/Animators inflated from XML when using Fragments (and by extension, when using Navigation).
g....@gmail.com <g....@gmail.com> #12
Thank you, that does the trick. I even used to patch animations on the fly before you fixed all the issues I had with FragmentContainerView
, how could not I think of doing that.
For those reading that might be in a similar situation:
I have few animations that I use throughout the applications and they are all defined in the actions of the navigation graph. Since I have a common base Fragment class, I added something like the following to that base class (using the animation in
@Nullable
@Override
public Animator onCreateAnimator(int transit, boolean enter, int nextAnim) {
if (nextAnim == R.anim.transition_slide_left_show) {
int width = requireActivity().getWindow().getDecorView().getWidth();
ObjectAnimator anim = ObjectAnimator.ofFloat(getView(), View.TRANSLATION_X, -width, 0);
anim.setStartDelay(300);
anim.setDuration(300);
anim.setInterpolator(new DecelerateInterpolator());
return anim;
} else {
return super.onCreateAnimator(transit, enter, nextAnim);
}
}
This is probably not ideal given that now the XML animation is ignored, that could be not very obvious (you could also not outright ignore it), but it's a quick and easy solution to turn several XML based Animation
s into Animator
s.
il...@google.com <il...@google.com> #13
For full screen slides, you should strongly consider using a Slide
Transition
yc...@gmail.com <yc...@gmail.com> #14
I have got this bug with 'sharedElementReturnTransition', it causes blinking too. Also it doesn't happens with FragmentManager.enableNewStateManager(false). Any ideas? I don't want to use it unless I have to.
il...@google.com <il...@google.com> #15
Re #14 - Transitions do not use Animations so that would be unrelated to this issue. Please file a new issue with a sample project that reproduces your issue using the latest Fragment 1.3.2.
yc...@gmail.com <yc...@gmail.com> #16
I have tried to make a sample depends in
but I can't found the blinking, maybe there is something wrong in my project, I will try more, anyway ,thanks for reply!
yc...@gmail.com <yc...@gmail.com> #17
Re #15 - I have figured out the problem! It's just because I did some Job at "onPause()" in the return blinking Fragment!
Description
Component used: Fragment
Version used: 1.3.0-Snapshot (Build Id: 6743994)
Devices/Android versions reproduced on: Samsung Galaxy S10 running Android 10
When using "setCustomAnimations" on Fragment Transitions, the animations are broken (flashing) when using the new state manager.
Steps:
FragmentManager.enableNewStateManager(false)
inMainActivity
and re-run the appAttached is a sample and 2 videos detailing the difference in animations with the state manager being turned on and off