Splitties v2.0.0-alpha5
Pre-releaseThis release is breaking if you come from version 2.0.0-alpha4, especially if you were using
View DSL. It's highly recommended to directly migrate from version 2.0.0-alpha4 to 2.0.0-alpha6,
which has a smoother migration path, and a guide to do so.
Project wide changes
- Add consumer proguard rules for splits with optional dependencies.
- Update to Kotlin 1.2.71
- Update kotlinx.coroutines to version 0.30.2
Changes per module
Collections
Add allocation-free reverse List
forEach extensions: forEachReversedByIndex
and
forEachReversedWithIndex
.
Intents
Add toPendingActivities()
extension function for Array<Intent>
.
Material Lists
- The following previously deprecated classes have been removed:
SingleLineIconListItem
(useIconOneLineListItem
instead)TwoLinesIconListItem
(useIconTwoLinesListItem
instead)TwoLinesIconSwitchListItem
(useIconTwoLinesSwitchListItem
instead)
- All the xml files (except
view_ids.xml
) have been removed.
Preferences
Enhancements
- The preferences are now loaded in
Dispatchers.IO
when usingSuspendPrefsAccessor
. - Fix clash with private property name and non imported extension for Preferences. (#96).
Breaking changes (in experimental API)
The SuspendPrefsAccessor
constructor parameter of type CoroutineDispatcher
has been removed
now that Dispatchers.IO
is always used.
If you didn't specify a custom dispatcher, you don't need to do anything.
Selectable Views (all variants)
All the final methods have been opened up, and now have the @CallSuper
annotation instead. This
makes the classes more useful to develop custom views, like the extended Floating Action Button with
SelectableConstraintLayout
where you need to clip the view in onDraw(…)
.
The dispatchDrawableHotspotChanged
overridden method in the classes of the Selectable Views splits
family was annotated with @TargetApi
, but is not correctly annotated with @RequiresApi
. This
likely caused no issue as you usually don't call this method directly but let Android do, but now,
it's fixed!
UI Thread -> Main Thread
The UI Thread split has been renamed to Main thread (for the same reasons kotlinx.coroutines
replaced UI
by Dispatchers.Main
).
While the artifact has been changed, the old symbols have only been deprecated in favor of new
ones defined in new package, with new names (ui
->main
).
If you use a library that depends on the old artifact, see "Removed splits and versions sync"
in version 2.0.0-alpha6 release notes.
View DSL (and additional modules)
The API of View DSL (and its additional modules) has been improved, and there's some new features,
along with some deprecations.
However, this release (2.0.0-alpha5) is breaking when updating from previous versions. This
has been fixed in 2.0.0-alpha6, so please skip this release if you are upgrading, and follow
thoroughly the migration guide.
Regardless, there has been improvements in View DSL additional modules. Please, review them below.
View DSL AppCompat Styles -> View DSL AppCompat
The View DSL AppCompat Styles split has been merged into View DSL AppCompat.
If you use a library that depends on the old artifact, see "Removed splits and versions sync"
in version 2.0.0-alpha6 release notes.
View DSL ConstraintLayout
Probably the best change in this split is that now, you no longer need to specify any View
id.
If there's none and you add a constraint using extension functions from this split, an id that can't
clash with aapt/xml ids will be generated and assigned to the view so constraints work. Keep in mind
you may still want to use stable ids defined in xml or elsewhere in cases where you use views that
need to have their state saved, like a RecyclerView
, an EditText
or a CheckBox
.
Added support for chains with the two horizontalChain
and verticalChain
new extension functions
for ConstraintLayout
. Also added horizontalMargin
and verticalMargin
extension properties for
List<View>
that are designed for use in a ConstraintLayout
when you made a chain with the two
new methods that take a list of views.
View DSL Design
When instantiating an AppBarLayout
or a CollapsingToolbarLayout
with the new appBarLayout
and
collapsingToolbarLayout
functions, you'll automatically get instances that have known bugs in the
design support library fixed, including config changes handling (supports rotation or layout changes
without recreating the Activity).
View DSL RecyclerView
The setSingleView
extension function for RecyclerView
has been deprecated. Use the
wrapInRecyclerView
extension function for View
instead, it is simpler to use and supports
horizontal scrolling.
Views
- Deprecated View visibility extension properties and functions in favor of Android KTX ones.
- Added
lines
write only extension property forTextView
. - Change the signature of the lambda of the
onClick
extension function forView
. It no longer
passes the clickedview
. This is to avoidit
shadowing when you nest lambdas, and has been done
because this parameter is almost never used. - Add 1 extension function, 1 extension property and 1 top level function, related to
View
id
generation:View.assignAndGetGeneratedId()
,View.existingOrNewId
andgenerateViewId()
.
Upcoming APIs preview in the sample
The sample of Splitties is a place where you can preview several extensions or other work that can
be integrated into Splitties as a library later.
In addition to what was already present in the sample, there has been an important addition:
An example of how to request a dangerous permission with a single suspend call, plus a try/catch
to handle user deny.
New artifact
This release has a new artifact:
implementation "com.louiscad.splitties:splitties-mainthread:$splitties_version"
Removed artifacts
This release removes these two artifacts:
implementation "com.louiscad.splitties:splitties-uithread:$splitties_version"
implementation "com.louiscad.splitties:splitties-viewdsl-appcompat-styles:$splitties_version"