Fixed
Status Update
Comments
ja...@google.com <ja...@google.com>
ra...@google.com <ra...@google.com>
ap...@google.com <ap...@google.com> #3
Thank you for the quick fix.
Is there an ETA for the next release?
Is there an ETA for the next release?
ap...@google.com <ap...@google.com> #4
2.2.0-rc01 should be out this week.
ap...@google.com <ap...@google.com> #5
Project: platform/frameworks/support
Branch: androidx-master-dev
commit a1957df3709a06f4e6482fb0e4d39ded4f230a70
Author: Rahul Ravikumar <rahulrav@google.com>
Date: Mon Jul 29 09:48:05 2019
Workaround NPE in PersistableBundle.getExtras().
Test: Existing unit tests pass. Ran integration test app.
Fixes: b/138441699
Change-Id: I0b48e0009a7d83c343a3d26112b94c057470c281
M work/workmanager/src/main/java/androidx/work/impl/background/systemjob/SystemJobService.java
https://android-review.googlesource.com/1092870
https://goto.google.com/android-sha1/a1957df3709a06f4e6482fb0e4d39ded4f230a70
Branch: androidx-master-dev
commit a1957df3709a06f4e6482fb0e4d39ded4f230a70
Author: Rahul Ravikumar <rahulrav@google.com>
Date: Mon Jul 29 09:48:05 2019
Workaround NPE in PersistableBundle.getExtras().
Test: Existing unit tests pass. Ran integration test app.
Fixes:
Change-Id: I0b48e0009a7d83c343a3d26112b94c057470c281
M work/workmanager/src/main/java/androidx/work/impl/background/systemjob/SystemJobService.java
Description
val constraints = Constraints.Builder()
.setRequiresCharging(true)
.setRequiredNetworkType(NetworkType.CONNECTED)
.build()
The default parameters approach is trivial using a data class and named parameters could be used when being constructed.
data class Constraints(
val requiredNetworkType: NetworkType = NetworkType.NOT_REQUIRED,
val requiresCharging: Boolean = false
)
val constraints = Constraints(requiredNetworkType = NetworkType.METERED)
For converting the builder from java to a more idiomatic Kotlin, we could also write a function that uses a method with a receiver on the builder.
inline fun constraints(builder: Constraints.Builder.() -> Unit): Constraints {
return Constraints.Builder().apply { builder() }.build()
}
val constraints = constraints {
setRequiredNetworkType(NetworkType.CONNECTED)
setRequiresCharging(true)
}
The naming of these could probably be renamed, just a nicer way to write builder like classes in kotlin.