Splitties v2.0.0-alpha2
Pre-release9 new library modules (amounting to a total of 42 splits):
- Activities: Start activities with minimal boilerplate
- Collections:
forEach
forList
s withoutIterator
allocation - Fragments: Start activities from fragments and do transactions with minimal boilerplate
- Intents: Transform
companion object
s into powerful typesafe intent specs - Material Colors: 2014 Material Design color palettes as color resources
- View DSL RecyclerView: RecyclerView extension of View DSL
- Views CardView: CardView extension of Views. Provides a
contentPadding
property - View Design: Design Support library extension of Views
- Views RecyclerView: RecyclerView extension of Views
Other changes:
AppCtx
The consume { … }
utility function from the splitties.init
package has been deprecated. Replace it with true.also { _ -> … }
or false.also { _ -> … }
.
Arch Lifecycle
- New
mapNotNull
,switchMap
andswitchMapNotNull
extension functions forLiveData
. activityScope
andfragmentScope
extension functions to get aViewModel
now accept an optional
lambda (which creates aViewModelProvider
under the hood. This allows to pass arguments to yourViewModel
when it's first created.observe
andobserveNotNull
now return the createdObserver
so it can be unregistered manually later if needed.
Arch Room
- The new
inTransaction { … }
extension function forRoomDatabase
s does the same astransaction { … }
but also returns the value of the last expression of the lambda. - New
onCreate { … }
andonOpen { … }
extension functions forRoomDatabase.Builder
.
Bundle
BundleHelper
has been renamed toBundleSpec
, but a typealias keeps the source compatibility. However, there's no binary compatibility, which means you'll need to recompile any library using it.BundleSpec
and the methods relying on it can now be used safely on any thread!
Material Lists
Allow disabling default icon tint on list items with optional constructor parameter.
Preferences
A new experimental SuspendPrefsAccessor
for coroutines users allows you to ensure you can't load the preferences (which does I/O) on the UI thread.
Resources
The str
extension functions formatArgs
now accept null
arguments.
View DSL
The higher order function add
has been deprecated because it went in the way of promoting a view to a property easily.
View DSL AppCompat styles
Added flatButton
, imgActionButton
and largeProgressBar
.
View DSL ConstraintLayout
Add baselineToBaselineOf(…)
extension function for ConstraintLayout.LayoutParams
.
View DSL IDE Preview
UiPreView
injects a valid value into appCtx
so your Ui
s can depend on it (probably indirectly) without breaking preview!
Views
- New Gravity flags aliases (e.g.
gravityStartCenter
instead ofGravity.START or Gravity.CENTER_VERTICAL
). - Change case of
imageBitMap
toimageBitmap
to make it more consistent with the class nameBitmap
Views AppCompat
tooltipTxt
now accepts null to remove any tooltip previously set on the view.
New artifacts
Here are all the artifacts added in this version. Just use the ones you need. (Click to expand)
implementation "com.louiscad.splitties:splitties-activities:$splitties_version"
implementation "com.louiscad.splitties:splitties-collections:$splitties_version"
implementation "com.louiscad.splitties:splitties-fragments:$splitties_version"
implementation "com.louiscad.splitties:splitties-intents:$splitties_version"
implementation "com.louiscad.splitties:splitties-material-colors:$splitties_version"
implementation "com.louiscad.splitties:splitties-viewdsl-recyclerview:$splitties_version"
implementation "com.louiscad.splitties:splitties-views-cardview:$splitties_version"
implementation "com.louiscad.splitties:splitties-views-design:$splitties_version"
implementation "com.louiscad.splitties:splitties-views-recyclerview:$splitties_version"
All the lines above assume you defined the splitties_version
ext property in your
root project's build.gradle
file to 2.0.0-alpha2
as shown in this snippet:
allProjects {
ext {
splitties_version = '2.0.0-alpha2'
}
}