Fixed
Status Update
Comments
su...@google.com <su...@google.com>
ap...@google.com <ap...@google.com> #2
Another option is to provide a setContent
like API specifically for Fragments.
E.g., an extension like:
fun Fragment.content(content: @Composable () -> Unit): ComposeView {
return ComposeView(requireContext()).apply {
setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed)
setContent(content)
}
}
which would let you write a Fragment like:
class ExampleFragment : Fragment() {
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
) = content {
// Write your @Composable content here
val viewModel: ExampleViewModel = viewModel()
// or extract it into a separate, testable method
ExampleComposable(viewModel)
}
}
Description
Version used: 1.0.0-beta02
Devices/Android versions reproduced on: Nexus 5X API 28 Emulator (28.1.3-5243232) and Samsung J5 phone with 8.1.0
Steps to reproduce:
- Run application, monitoring logcat
- Press Enqueue
- Toast will be displayed and the log should indicate the worker started, failed and requested a retry
- Monitor the logcat for a few minutes and observe that no worker has been retried
This is intermittent but happens 90% of the time. If the Worker does retry, hit Enqueue again and it will likely fail to retry the new worker.
Expected Behaviour:
The worker should be retried after 10 seconds and up to 5 times in total before failing.