Status Update
Comments
il...@google.com <il...@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?
po...@gmail.com <po...@gmail.com> #3
Providers(
LayoutDirectionAmbient provides LayoutDirection.Rtl,
) {
AlertDialog(
onDismissRequest = {
showDialog = false
},
text = {
Text(
"هل تريد مسح كافة الطلب؟",
)
},
title = {
Text(
"مسح الطلب",
)
},
confirmButton = {
TextButton(onClick = {
viewModel.clear()
showDialog = false
}) {
Text("نعم", textAlign = TextAlign.Right)
}
},
dismissButton = {
TextButton(onClick = {
showDialog = false
}) {
Text("لا", textAlign = TextAlign.Right)
}
},
)
}
kr...@gmail.com <kr...@gmail.com> #4
Yeah, this is exactly an example I figured out doesn't work. Thanks!
Description
Version used: Navigation 1.0.0-alpha08, Fragment 1.1.0-alpha02
Devices/Android versions reproduced on: Device - Pixel 1, Android Ver - 9
If this is a bug in the library, we would appreciate if you could attach:
My scenario is that between fragments I open an activity then comes back again. Until now it's normal works. But when I open the activity again that will cause a crash.
The error message as below:
2018-12-11 20:18:46.610 E: FATAL EXCEPTION: main
Process: com.cloverlab.karitoke, PID: 22006
java.lang.IllegalStateException: Failure saving state: active CollectionResultV2Fragment{497828d (878deff6-3700-4a61-b490-7f854474fdf6) id=0x7f0a013d} was removed from the FragmentManager
at androidx.fragment.app.FragmentManagerImpl.saveAllState(FragmentManagerImpl.java:2315)
at androidx.fragment.app.Fragment.performSaveInstanceState(Fragment.java:2629)
at androidx.fragment.app.FragmentManagerImpl.saveFragmentBasicState(FragmentManagerImpl.java:2267)
at androidx.fragment.app.FragmentManagerImpl.saveAllState(FragmentManagerImpl.java:2326)
at androidx.fragment.app.Fragment.performSaveInstanceState(Fragment.java:2629)
at androidx.fragment.app.FragmentManagerImpl.saveFragmentBasicState(FragmentManagerImpl.java:2267)
at androidx.fragment.app.FragmentManagerImpl.saveAllState(FragmentManagerImpl.java:2326)
at androidx.fragment.app.Fragment.performSaveInstanceState(Fragment.java:2629)
at androidx.fragment.app.FragmentManagerImpl.saveFragmentBasicState(FragmentManagerImpl.java:2267)
at androidx.fragment.app.FragmentManagerImpl.saveAllState(FragmentManagerImpl.java:2326)
at androidx.fragment.app.FragmentController.saveAllState(FragmentController.java:150)
at androidx.fragment.app.FragmentActivity.onSaveInstanceState(FragmentActivity.java:496)
at androidx.appcompat.app.AppCompatActivity.onSaveInstanceState(AppCompatActivity.java:511)
at android.app.Activity.performSaveInstanceState(Activity.java:1549)
at android.app.Instrumentation.callActivityOnSaveInstanceState(Instrumentation.java:1443)
at android.app.ActivityThread.callActivityOnSaveInstanceState(ActivityThread.java:4809)
at android.app.ActivityThread.callActivityOnStop(ActivityThread.java:4157)
at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:4121)
at android.app.ActivityThread.handleStopActivity(ActivityThread.java:4196)
at android.app.servertransaction.StopActivityItem.execute(StopActivityItem.java:41)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:145)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)