Fixed
Status Update
Comments
ap...@gmail.com <ap...@gmail.com> #2
Project: platform/frameworks/support
Branch: androidx-main
commit 9082f62682f853ad5251a1c79dde9eccba7abdd9
Author: Max Alfonso-Ying <maxying@google.com>
Date: Thu Apr 18 00:34:40 2024
[M2 text field] Apply background to decoration box
...instead of to the BasicTextField, so changing the
backgroundColor will properly change the decoration
box's background color.
Fixes: b/307694651
Test: added unit tests
Relnote: "Fix backgroundColor not applying to
TextFieldDecorationBox and OutlinedTextFieldDecorationBox.
Decoration boxes now accept a `shape` parameter."
Change-Id: I371c26718597cb36ac537e9412ce476532afb40d
M compose/material/material/api/current.txt
M compose/material/material/api/restricted_current.txt
M compose/material/material/integration-tests/material-demos/src/main/java/androidx/compose/material/demos/TextFieldDecorationBoxDemos.kt
M compose/material/material/src/androidInstrumentedTest/kotlin/androidx/compose/material/textfield/TextFieldDecorationBoxTest.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/OutlinedTextField.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/TextField.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/TextFieldDefaults.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/TextFieldImpl.kt
https://android-review.googlesource.com/3046833
Branch: androidx-main
commit 9082f62682f853ad5251a1c79dde9eccba7abdd9
Author: Max Alfonso-Ying <maxying@google.com>
Date: Thu Apr 18 00:34:40 2024
[M2 text field] Apply background to decoration box
...instead of to the BasicTextField, so changing the
backgroundColor will properly change the decoration
box's background color.
Fixes:
Test: added unit tests
Relnote: "Fix backgroundColor not applying to
TextFieldDecorationBox and OutlinedTextFieldDecorationBox.
Decoration boxes now accept a `shape` parameter."
Change-Id: I371c26718597cb36ac537e9412ce476532afb40d
M compose/material/material/api/current.txt
M compose/material/material/api/restricted_current.txt
M compose/material/material/integration-tests/material-demos/src/main/java/androidx/compose/material/demos/TextFieldDecorationBoxDemos.kt
M compose/material/material/src/androidInstrumentedTest/kotlin/androidx/compose/material/textfield/TextFieldDecorationBoxTest.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/OutlinedTextField.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/TextField.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/TextFieldDefaults.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/TextFieldImpl.kt
ch...@google.com <ch...@google.com> #3
Some quick analysis between dev13 and dev14:
resources.arsc
increased from 21KB to 256KBres/
increased from 73KB to 136KBclasses.dex
increased from 468KB to 651KB
The key difference is that dev13 doesn't contain AppCompat, whereas dev14 does.
+Andrey: We did that to force AppCompat users to use the latest version which fixes some font issues (iirc). Maybe we shouldn't force all Compose apps to use AppCompat, and just put this in the docs instead?
an...@google.com <an...@google.com> #4
yes, we have to add dependencies on appcompat and fragments even if we don't use them.
well, no-one is reading the documentations. if we remove it and user has older version of appcompat everything will compile but the app crash in runtime with some weird issue.
I think we should explore how studio can help to verify the versions for us. We can also write a clear error message so when it will crash in runtime we will ask to update the dependency.
For now, before we reach beta I think it is fine for us to include these dependencies, and it also gives people time to start using this never versions.
well, no-one is reading the documentations. if we remove it and user has older version of appcompat everything will compile but the app crash in runtime with some weird issue.
I think we should explore how studio can help to verify the versions for us. We can also write a clear error message so when it will crash in runtime we will ask to update the dependency.
For now, before we reach beta I think it is fine for us to include these dependencies, and it also gives people time to start using this never versions.
an...@google.com <an...@google.com>
an...@google.com <an...@google.com> #5
Context:
Previously we had to add
implementation "androidx.fragment:fragment:1.3.0-alpha07"
implementation "androidx.appcompat:appcompat:1.3.0-alpha01"
dependencies to compose:ui:ui module inhttps://aosp/1311537 in order to make sure our view always have correct ViewTreeLifecycleOwner and ViewTreeSavedStateRegistryOwner. We use them in AndroidComposeView.onAttachedToWindow() and in ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed
Why we need appcompat:
a) because there was a bug where AppCompatActivity even that it extends ComponentActivity were not populating the lifecycle owner:http://aosp/1261719
b) we also introduced ViewTreeViewModelStoreOwner in the same release, so it is not populated before that release:http://aosp/1300264
Why we need fragment:
a) we populate SavedStateRegistryOwner only starting from that release: aosp/1298680
b) this bug fix is pretty important for the state restoration to work correctly in fragments:http://aosp/1326611
In order to remove these dependencies we should:
1) Make a clear crash message mentioning something like "If you use ComposeView from Appcompat activity make sure you have this version, if you use from Fragment make sure...". We should do it in AbstractComposeView.onAttachedToWindow(). It is a bit weird that we should do it there, and not in AndroidComposeView.onAttachedToWindow() as we currently have a duplication of this logic and do it both in AndroidComposeView and for AbstractComposeView via ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed.
2) ComponentActivity.setContent(from androidx.activity.compose) can hack it a bit via doing
ViewTreeLifecycleOwner.set(getWindow().getDecorView(), this);
ViewTreeSavedStateRegistryOwner.set(getWindow().getDecorView(), this);
ViewTreeViewModelStoreOwner.set(getWindow().getDecorView(), this);
if we detect the issue - any of these owner are nulls.
It can be tested via tests we currently have in ui module: LifecycleOwnerIn*Test and SavedStateRegistryOwnerIn*Test. They currently pass only because we add these dependencies. Once you remove it the tests should fail
Previously we had to add
implementation "androidx.fragment:fragment:1.3.0-alpha07"
implementation "androidx.appcompat:appcompat:1.3.0-alpha01"
dependencies to compose:ui:ui module in
Why we need appcompat:
a) because there was a bug where AppCompatActivity even that it extends ComponentActivity were not populating the lifecycle owner:
b) we also introduced ViewTreeViewModelStoreOwner in the same release, so it is not populated before that release:
Why we need fragment:
a) we populate SavedStateRegistryOwner only starting from that release: aosp/1298680
b) this bug fix is pretty important for the state restoration to work correctly in fragments:
In order to remove these dependencies we should:
1) Make a clear crash message mentioning something like "If you use ComposeView from Appcompat activity make sure you have this version, if you use from Fragment make sure...". We should do it in AbstractComposeView.onAttachedToWindow(). It is a bit weird that we should do it there, and not in AndroidComposeView.onAttachedToWindow() as we currently have a duplication of this logic and do it both in AndroidComposeView and for AbstractComposeView via ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed.
2) ComponentActivity.setContent(from androidx.activity.compose) can hack it a bit via doing
ViewTreeLifecycleOwner.set(getWindow().getDecorView(), this);
ViewTreeSavedStateRegistryOwner.set(getWindow().getDecorView(), this);
ViewTreeViewModelStoreOwner.set(getWindow().getDecorView(), this);
if we detect the issue - any of these owner are nulls.
It can be tested via tests we currently have in ui module: LifecycleOwnerIn*Test and SavedStateRegistryOwnerIn*Test. They currently pass only because we add these dependencies. Once you remove it the tests should fail
ap...@google.com <ap...@google.com> #6
Project: platform/frameworks/support
Branch: androidx-main
commit 6c629e61be259d61a7f8b8ca7df8101643b1b74d
Author: Louis Pullen-Freilich <lpf@google.com>
Date: Tue Feb 23 21:54:21 2021
Removes Appcompat and Fragment dependencies from compose:ui:ui
Fixes: b/161814404
Test: Existing owners tests
Relnote: "compose:ui:ui no longer depends on AppCompat or Fragment. If you are using a ComposeView in your application, and you are using Fragment and/or AppCompat, make sure that you are using AppCompat 1.3+ / Fragment 1.3+ - these versions are needed to correctly set lifecycle and saved state owners required for ComposeView."
Change-Id: I1d6fa61deebc7771082d19a8268bd37b5f99194d
M activity/activity-compose/src/main/java/androidx/activity/compose/ComponentActivity.kt
M compose/material/material-icons-extended/build.gradle
M compose/ui/ui/build.gradle
M compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/ComposeView.android.kt
M lifecycle/lifecycle-viewmodel-compose/build.gradle
https://android-review.googlesource.com/1603516
Branch: androidx-main
commit 6c629e61be259d61a7f8b8ca7df8101643b1b74d
Author: Louis Pullen-Freilich <lpf@google.com>
Date: Tue Feb 23 21:54:21 2021
Removes Appcompat and Fragment dependencies from compose:ui:ui
Fixes:
Test: Existing owners tests
Relnote: "compose:ui:ui no longer depends on AppCompat or Fragment. If you are using a ComposeView in your application, and you are using Fragment and/or AppCompat, make sure that you are using AppCompat 1.3+ / Fragment 1.3+ - these versions are needed to correctly set lifecycle and saved state owners required for ComposeView."
Change-Id: I1d6fa61deebc7771082d19a8268bd37b5f99194d
M activity/activity-compose/src/main/java/androidx/activity/compose/ComponentActivity.kt
M compose/material/material-icons-extended/build.gradle
M compose/ui/ui/build.gradle
M compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/ComposeView.android.kt
M lifecycle/lifecycle-viewmodel-compose/build.gradle
Description
Version of Gradle Plugin: 4.2.0-alpha05
Version of Gradle: 6.5
Version of Java: 1.8
OS: Linux
Version of Compose: 0.1.0-dev14
The minified APK size increased to ~1.1 MB in dev13 it was ~600 KB before.
Steps to Reproduce:
1. clone git repo: git clone git@gitlab.com:compose1/compose-minimal-hello-world.git
2. compile the release APK (Key already included)
3. See that the APK size is about 600 KB
4. change compose_version to 0.1.0-dev14 in build.gradle file
5. compile the release APK
6. APK size is about 1.1 MB