Status Update
Comments
wi...@google.com <wi...@google.com> #2
private fun setAsyncText(textView: AppCompatTextView, text: String?) {
if (!text.isNullOrEmpty()) {
val textFuture = PrecomputedTextCompat.getTextFuture(text!!, textView.textMetricsParamsCompat, null)
textView.setTextFuture(textFuture) //Crash
}
}
re...@google.com <re...@google.com> #3
textView.setLayoutDirection(ViewCompat.getLayoutDirection(textView));
before :
setTextFuture(....)
ma...@google.com <ma...@google.com> #4
But I think it is better when set before this line
val textFuture = PrecomputedTextCompat.getTextFuture(text!!, textView.textMetricsParamsCompat, null)
Set android:layoutDirection="locale" or android:layoutDirection="inherit" for AppCompatTextView in the XML layout didn't this problem.
The new method btw re-set layoutDirector. Weird! This should handle in the AppcompatTextView.
private fun setAsyncText(textView: AppCompatTextView, text: String?) {
if (!text.isNullOrEmpty()) {
textView.layoutDirection = textView.layoutDirection
val textFuture = PrecomputedTextCompat.getTextFuture(text!!, textView.textMetricsParamsCompat, null)
textView.setTextFuture(textFuture) //Crash
}
}
wi...@google.com <wi...@google.com> #5
minSdk 21
targetSdk 28
Thanks #3 again.
fe...@gmail.com <fe...@gmail.com> #6
TextViewCompat.java:889
if (!param.equals(precomputed.getParams())) {
throw new IllegalArgumentException("Given text can not be applied to TextView.");
}
PrecomputedTextCompat.class:334
with : this.mTextDir != other.getTextDirection() == true
So,
TextDirection on TextView and TextDirection on Param is difference
maybe, it handled wrong or missing conditional on getTextDirectionHeuristic of TextViewCompat
ks...@google.com <ks...@google.com> #7
wi...@google.com <wi...@google.com> #8
But I think you should handle it in the AppcompatTextView. It is better. If a developer forgets testing with RTL. I think this is the nightmare(it is difficult to determine the bug) when they update their app on the Play Store.
I read this article, in the part databing he noted about set the direction
fun asyncText
..........
// first, set all measurement affecting properties of the text
// (size, locale, typeface, direction, etc)
But in the offical document isn't good (lack direction)
Anything layout related property changes, text size, typeface, letter spacing, etc after this method call will causes IllegalArgumentException during View measurement.
My view: Handling this in the AppcompatTextView is the best choice if you can do it.
Thanks!
ma...@google.com <ma...@google.com> #9
ma...@google.com <ma...@google.com> #10
ys...@google.com <ys...@google.com> #11
le...@google.com <le...@google.com> #12
Description shared by an external reporter:
================================
1.
Version used: androidx.appcompat:appcompat:1.1.0-alpha1
AppCompatTextView.setTextFuture
i found
2.
Non-fatal Exception: java.lang.IllegalArgumentException: Given text can not be applied to TextView.
at androidx.core.widget.TextViewCompat.retrieveField(Unknown Source:22)
at androidx.appcompat.widget.AppCompatTextView.consumeTextFutureAndSetBlocking(Unknown Source:15)
at androidx.appcompat.widget.AppCompatTextView.onMeasure(Unknown Source)
at com.bilibili.magicasakura.widgets.AppCompatTintTextView.onMeasure(Unknown Source)
at android.view.View.measure(View.java:22145)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6602)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1514)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:806)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:685)
at android.view.View.measure(View.java:22145)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6602)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at androidx.cardview.widget.CardView.onMeasure(Unknown Source:80)
at android.view.View.measure(View.java:22145)
at androidx.recyclerview.widget.RecyclerView$LayoutManager.measureChildWithMargins(Unknown Source:98)
at androidx.recyclerview.widget.LinearLayoutManager.generateDefaultLayoutParams(Unknown Source:60)
at androidx.recyclerview.widget.LinearLayoutManager.generateDefaultLayoutParams(Unknown Source:44)
at androidx.recyclerview.widget.LinearLayoutManager.findViewByPosition(Unknown Source:36)
at androidx.recyclerview.widget.LinearLayoutManager.setOrientation(Unknown Source:6)
at androidx.recyclerview.widget.RecyclerView.exceptionLabel(Unknown Source:39)
at androidx.recyclerview.widget.RecyclerView$ViewFlinger.run(Unknown Source:91)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:979)
at android.view.Choreographer.doCallbacks(Choreographer.java:791)
at android.view.Choreographer.doFrame(Choreographer.java:723)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:965)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6707)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:886)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:108)
device: meizu, Android 7 and 8
And you can see fabric detail
===========================================
Requesting team for initial inputs. Please let us know if this can be handled as a part of this bug else we will create a separate bug for this.
le...@google.com <le...@google.com> #13
ma...@google.com <ma...@google.com> #14
Thanks Todd.
It does not yet align with UX expectations.
The desired behavior is similar as
-
Launch transition uses Wear task launch transition.
↪ On the video: no transition visible -
The app icon should not move (position animation) within the app view.
↪ On the video: the icon animates up on the Y axis when fading in -
The app icon can be animated via AVD following the same guidelines
↪ Not able to verify -
We use the exit animation to gracefully reveal the app once loaded
↪ On the video: the icon animates down on Y axis and the reveal/fade isn't as polished as the one on Handset/the guidelines above.
For the last one specifically, I would like the possibility to explore a different reveal that is more suited to the form factor if there are opportunities to customize it for Wear.
le...@google.com <le...@google.com> #15
Thanks for the feedback Max - sorry, I should have specified the scope of the proposed change. This appears to be addressing only the size (allowing for smaller icon sizes - i.e. compare at the clip from
ma...@google.com <ma...@google.com> #16
App icon size is correct! Thanks
ap...@google.com <ap...@google.com> #17
Branch: androidx-main
commit 0f66a201003d4f9f1d74830376744d43ede0900d
Author: wilsonshih <wilsonshih@google.com>
Date: Wed Feb 22 16:47:48 2023
Provide default dimens for wear device.
Provide default dimensions for wear device
Bug: 256678037
Test: run test on wear device.
Relnote: Provide default dimensions for wear device with 48x48dp icon
Change-Id: Ib8de8f78ea1d1dbe67cbc2d8de0388f5cfeb6c7e
A core/core-splashscreen/src/main/res/values-watch/dimens.xml
ys...@google.com <ys...@google.com> #18
Tiny nit. Can we also change the default background to black? When we use @android:style/Theme.DeviceDefault it has a black background. But we need to override the background in the splash theme when using Theme.SplashScreen as a parent.
It seems like it goes
Theme.SplashScreen > Theme.SplashScreen.Common > Base.Theme.SplashScreen.DayNight > Base.Theme.SplashScreen.Light
Or maybe I'm reading it wrong? I know it's part of the docs to override, but I got the impression on mobile, apps could omit setting the background and it would take the right one from the dark/light theme default?
dl...@gmail.com <dl...@gmail.com> #19
dl...@gmail.com <dl...@gmail.com> #20
I've just tested the solution suggested above and it works brilliantly for WearOS .. try adding the below to your dimens.xml file
<dimen name="splashscreen_icon_size_no_background" tools:override="true">288dp</dimen>
<dimen name="splashscreen_icon_mask_size_no_background" tools:override="true">410dp</dimen>
<dimen name="splashscreen_icon_mask_stroke_no_background" tools:override="true">109dp</dimen>
<dimen name="splashscreen_icon_size_with_background" tools:override="true">48dp</dimen> <!-- icon size directive -->
<dimen name="splashscreen_icon_mask_size_with_background" tools:override="true">72dp</dimen>
<dimen name="splashscreen_icon_mask_stroke_with_background" tools:override="true">64dp</dimen>
wi...@google.com <wi...@google.com> #21
Re
res/values-watch
rg...@google.com <rg...@google.com> #22
Todd, could your team prepare a CL for the background and test that it works the way you want?
le...@google.com <le...@google.com> #23
ack - we actually resolved the dark background for wear here:
Based on the work already done to adjust the sizing here:
Shall we mark this closed?
rg...@google.com <rg...@google.com> #24
Yes, that looks done... Wei Sheng, please reopen and let us know if you had something beyond that in mind.
pr...@google.com <pr...@google.com> #25
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.core:core-splashscreen:1.1.0-alpha02
wi...@google.com <wi...@google.com> #26
The version 1.1.0-alpha02
update the core-splashscreen library to latest verson against SDK 34, what do you mean "partially addressed"?
ys...@google.com <ys...@google.com> #27
That's a template message for these automated updates. A commit was included in a release towards this fix, but without promising it is the final change.
But you can now use both 1.1.0-alpha02 and 1.0.1 on Wear.
ys...@google.com <ys...@google.com> #28
What does the minimal correct implementation of a Splashscreen for Wear 3 look like? Is it customised theme + dimens.xml + splashscreen.xml drawable? I'm wondering why it isn't just providing an icon?
Does the androidx codebase have a sample/demo/test showing how to use this on Wear. Following the docs gets the right results, but honestly there is way more setup than I would expect.
pa...@gmail.com <pa...@gmail.com> #29
Thanks!
na...@google.com <na...@google.com> #30
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.core:core-splashscreen:1.2.0-alpha01
Description
Description
Currently it's not possible to specify smaller dimensions for the icon (as perhttps://developer.android.com/reference/kotlin/androidx/core/splashscreen/SplashScreen#specs ), so the recommended implementation using
androidx.splashscreen
library doesn't work on Wear OS. Wear OS splash icon must be 48x48dp.Future Wear OS platform releases that will be based on Android12+ will need to comply with our Splash Screen changes and ideally follow our recommendations for mobile as desctibed athttps://developer.android.com/develop/ui/views/launch/splash-screen/migrate
So it's important to understand if this feature request is feasible, and if not what other options do we have for Wear developers.
Versions used
Component used:
androidx.core:core-splashscreen
Version used:
1.0.0-beta02
Devices/Android versions reproduced on: Wear OS emulator API 30 (Pixel watch)
Other details
Sample project to trigger the issue: seehttps://github.com/android/wear-os-samples/pull/573 for discussion and code, it's a part of public samples for Wear OS.
A screenrecord or screenshots showing the issue (if UI related): attached video demonstrating issue, it corresponds to following theme definition: