Skip to content

Splitties v2.0.0-alpha2

Pre-release
Pre-release
Compare
Choose a tag to compare
@LouisCAD LouisCAD released this 21 May 14:42

9 new library modules (amounting to a total of 42 splits):

  • Activities: Start activities with minimal boilerplate
  • Collections: forEach for Lists without Iterator allocation
  • Fragments: Start activities from fragments and do transactions with minimal boilerplate
  • Intents: Transform companion objects 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 and switchMapNotNull extension functions for LiveData.
  • activityScope and fragmentScope extension functions to get a ViewModel now accept an optional
    lambda (which creates a ViewModelProvider under the hood. This allows to pass arguments to your ViewModel when it's first created.
  • observe and observeNotNull now return the created Observer so it can be unregistered manually later if needed.

Arch Room

  • The new inTransaction { … } extension function for RoomDatabases does the same as transaction { … } but also returns the value of the last expression of the lambda.
  • New onCreate { … } and onOpen { … } extension functions for RoomDatabase.Builder.

Bundle

  • BundleHelper has been renamed to BundleSpec, 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 Uis can depend on it (probably indirectly) without breaking preview!

Views

  • New Gravity flags aliases (e.g. gravityStartCenter instead of Gravity.START or Gravity.CENTER_VERTICAL).
  • Change case of imageBitMap to imageBitmap to make it more consistent with the class name Bitmap

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'
    }
}