A collection of hand-crafted extensions for your Kotlin projects.
APACHE-2.0 License
Bot releases are hidden (Show)
Published by LouisCAD almost 6 years ago
This release breaks binary and source compatibility.
This is not just a compiler update for Splitties. This release already takes advantage of Kotlin 1.3
features, beyond stable coroutines:
XmlStyle
class from Views DSL is now inline, for minimal footprint at runtime.SuspendPrefsAccessor
from Preferences is no longer experimental as coroutines graduated.lParams
functions) have a contract. ThiswithExtras
, putExtras
and with
from Bundle have a contract. This allows to initializeBundle
passing through a BundleSpec
naturally!verticalListLayoutParams
and horizontalListLayoutParams
extension functions forRecyclerView.LayoutManager
are experimental for now, but this could change, especially in alpha,Published by LouisCAD almost 6 years ago
This release breaks binary and source compatibility.
It renames several package names and modules, for more consistency across the project.
View DSL has a new name: Views DSL. That also applies to its additional modules.
Just like an extra s
can make a new generation of smartphones, it can also make a new version of
Splitties.
The artifact names of all Selectable Views and View DSL changed, and so did the package
names.
Consequently, after updating the artifact names and the version,
you'll need to update the imports. Fortunately, this is easily done with the "Replace in Path"
IDE option present in IntelliJ IDEA and Android Studio.
All you need to do is find an old import (import splitties.viewdsl.
), select it, select the
"Replace in Path" option paste (import splitties.views.dsl.
) in the second input field, and
validate.
Then, you just have to do the same for Selectable Views with import splitties.selectableviews.
and
import splitties.views.selectable.
… and voilà! You just migrated to latest Splitties version!
implementation "com.louiscad.splitties:splitties-views-dsl:$splitties_version"
implementation "com.louiscad.splitties:splitties-views-dsl-appcompat:$splitties_version"
implementation "com.louiscad.splitties:splitties-views-dsl-constraintlayout:$splitties_version"
implementation "com.louiscad.splitties:splitties-views-dsl-design:$splitties_version"
debugImplementation "com.louiscad.splitties:splitties-views-dsl-ide-preview:$splitties_version"
implementation "com.louiscad.splitties:splitties-views-dsl-recyclerview:$splitties_version"
implementation "com.louiscad.splitties:splitties-views-selectable:$splitties_version"
implementation "com.louiscad.splitties:splitties-views-selectable-appcompat:$splitties_version"
implementation "com.louiscad.splitties:splitties-views-selectable-constraintlayout:$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-alpha9
as shown in this snippet:
allProjects {
ext {
splitties_version = '2.0.0-alpha9'
}
}
This release removes all these artifacts:
implementation "com.louiscad.splitties:splitties-selectableviews:$splitties_version"
implementation "com.louiscad.splitties:splitties-selectableviews-appcompat:$splitties_version"
implementation "com.louiscad.splitties:splitties-selectableviews-constraintlayout:$splitties_version"
implementation "com.louiscad.splitties:splitties-viewdsl:$splitties_version"
implementation "com.louiscad.splitties:splitties-viewdsl-appcompat:$splitties_version"
implementation "com.louiscad.splitties:splitties-viewdsl-constraintlayout:$splitties_version"
implementation "com.louiscad.splitties:splitties-viewdsl-design:$splitties_version"
debugImplementation "com.louiscad.splitties:splitties-viewdsl-ide-preview:$splitties_version"
implementation "com.louiscad.splitties:splitties-viewdsl-recyclerview:$splitties_version"
Published by LouisCAD almost 6 years ago
This release breaks binary compatibility.
It removes all deprecated symbols that had their deprecation level raised to error in 2.0.0-alpha7.
Make sure you don't rely on any library that uses an old version of a Splitties artifact that relies
on these previously deprecated and now removed symbols, or your app is likely not build, or to
crash at runtime because of not found classes.
Published by LouisCAD almost 6 years ago
Raise all deprecated symbols deprecation level to error.
Use this version to make sure you don't use them in your projects, next version will remove them!
Published by LouisCAD almost 6 years ago
Version 2.0.0-alpha5 broke the API, this version fixes this.
This release is mostly the same as 2.0.0-alpha5, but also has 2 very important things:
Version 2.0.0-alpha5 technically removed 2 splits (one was actually a renaming, the other one
a merging).
Consequently, you have to make sure your dependencies no longer reference these removed artifacts.
Easily done.
Problems arise when you depend on libraries that themselves depend on Splitties, which may be older
versions. These libraries may bring transitive dependencies to old modules that will clash with
ones from newer versions, and the versions they rely on may also mismatch with the ones you need,
and these older versions will take precedence if they are in library modules of your project that
don't depend explicitly on a newer version.
Fortunately, Gradle dependency resolution strategy allows to easily fix these issues all over your
project.
All you need to do is to make sure you have the following snippet into your root project's
build.gradle
file:
allprojects {
ext {
splitties_version = '2.0.0-alpha6'
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def req = details.requested
if (req.group != "com.louiscad.splitties") return
if (req.name == "splitties-uithread") {
details.useTarget(
group: req.group,
name: "splitties-mainthread",
version: splitties_version
)
details.because("Splitties uithread has been renamed to mainthread")
} else if (req.name == "splitties-viewdsl-appcompat-styles") {
details.useTarget(
group: req.group,
name: "splitties-viewdsl-appcompat",
version: splitties_version
)
details.because("[Splitties] Split merged and removed")
} else {
details.useTarget(group: req.group, name: req.name, version: splitties_version)
details.because("Transitive dependencies could take precedence otherwise")
}
}
}
}
The snippet above, for all sub-projects (aka. modules):
ext
property so it can be used in all build.gradle
files.implementation
or api
) which:splitties-mainthread
artifact to the newsplitties-mainthread
one.splitties-viewdsl-appcompat-styles
artifact to the one it hassplitties-viewdsl-appcompat
.If you don't do this but have a library using an old artifact in your dependencies, you'll
encounter gradle sync issues, or runtime issues, and the real cause may not appear clearly
(because of bugs in tooling).
uiLazy
has been deprecated in favor of mainThreadLazy
.
The wrapInRecyclerView
extension function now accepts an optional lambda to configure the wrapping
RecyclerView
easily.
Published by LouisCAD almost 6 years ago
This 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.
Add allocation-free reverse List
forEach extensions: forEachReversedByIndex
and
forEachReversedWithIndex
.
Add toPendingActivities()
extension function for Array<Intent>
.
SingleLineIconListItem
(use IconOneLineListItem
instead)TwoLinesIconListItem
(use IconTwoLinesListItem
instead)TwoLinesIconSwitchListItem
(use IconTwoLinesSwitchListItem
instead)view_ids.xml
) have been removed.Dispatchers.IO
when using SuspendPrefsAccessor
.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.
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!
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.
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.
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.
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.
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).
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.
lines
write only extension property for TextView
.onClick
extension function for View
. It no longerview
. This is to avoid it
shadowing when you nest lambdas, and has been doneView
idView.assignAndGetGeneratedId()
, View.existingOrNewId
and generateViewId()
.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.
This release has a new artifact:
implementation "com.louiscad.splitties:splitties-mainthread:$splitties_version"
This release removes these two artifacts:
implementation "com.louiscad.splitties:splitties-uithread:$splitties_version"
implementation "com.louiscad.splitties:splitties-viewdsl-appcompat-styles:$splitties_version"
Published by LouisCAD over 6 years ago
ReplaceWith
migrations for add
methods deprecated in version 2.0.0-alpha2.startActivity(action: String…)
methods.Published by LouisCAD over 6 years ago
There are 2 new methods: bundleOrDefault(…)
and bundleOrElse { … }
to allow default values in BundleSpec
delegated properties.
Like for BundleSpec
, there are 2 new methods: argOrDefault(…)
and argOrElse { … }
to allow default values in Fragment
delegated argument properties.
bundle()
and bundleOrNull()
are no longer part of the public API and have been replaced by the ReadWriteProperty
interface.arg()
and argOrNull()
functions have moved out of the support
subpackage as there's no longer any ambiguity since platform Fragments are deprecated and going away. Auto-import should import the versions from the new package for you.arg()
and argOrNull()
are no longer part of the public API and have been replaced by the ReadWriteProperty
interface.Published by LouisCAD over 6 years ago
forEach
for List
s without Iterator
allocationcompanion object
s into powerful typesafe intent specscontentPadding
propertyThe consume { … }
utility function from the splitties.init
package has been deprecated. Replace it with true.also { _ -> … }
or false.also { _ -> … }
.
mapNotNull
, switchMap
and switchMapNotNull
extension functions for LiveData
.activityScope
and fragmentScope
extension functions to get a ViewModel
now accept an optionalViewModelProvider
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.inTransaction { … }
extension function for RoomDatabase
s does the same as transaction { … }
but also returns the value of the last expression of the lambda.onCreate { … }
and onOpen { … }
extension functions for RoomDatabase.Builder
.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!Allow disabling default icon tint on list items with optional constructor parameter.
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.
The str
extension functions formatArgs
now accept null
arguments.
The higher order function add
has been deprecated because it went in the way of promoting a view to a property easily.
Added flatButton
, imgActionButton
and largeProgressBar
.
Add baselineToBaselineOf(…)
extension function for ConstraintLayout.LayoutParams
.
UiPreView
injects a valid value into appCtx
so your Ui
s can depend on it (probably indirectly) without breaking preview!
gravityStartCenter
instead of Gravity.START or Gravity.CENTER_VERTICAL
).imageBitMap
to imageBitmap
to make it more consistent with the class name Bitmap
tooltipTxt
now accepts null to remove any tooltip previously set on the view.
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'
}
}
Published by LouisCAD over 6 years ago
ViewModel
s, use LiveData
and observe Lifecycle
shasFlag
, withFlag
and minusFlag
extensions on Long
, Int
, Short
and Byte
BundleHelper
to use Bundle
with property syntax for Intent
extrasdp
extensions for View
and Context
. Particularly handyillegal(…)
and similar functions that return Nothing
, handy forwhen
branchesContentProvider
s used for automatic initializationmainHandler
property to stop allocating multiple Handler
s forLooper
snack(…)
and longSnack(…)
context.getSystemService(NAME_OF_SERVICE) as NameOfManager
toast(yourText)
, and dodge API 25BadTokenException
checkUiThread()
preconditionView
sImageView
ActionBar
and tooltipxyz.louiscad.splitties
to com.louiscad.splitties
. Check dependencies list below.ViewHolder
class from the Typesafe RecyclerView module that can't be written in Kotlin at the moment due to hiding super fields not being supported.injectAsAppCtx()
method, that uses the new canLeakMemory()
extension function on Context
that is also public.StringPref
and stringPref
don't allow null values anymore. Use StringOrNullPref
and stringOrNullPref
if you need nullable strings. Same for StringSetPref
and stringSetPref
.isUiThread
property moved from the old "Concurrency" module to the "UI Thread" module.foreground
xml attribute from app namespace anymore, but there's a new foregroundSelector
property.implementation "com.louiscad.splitties:splitties-alertdialog:$splitties_version"
implementation "com.louiscad.splitties:splitties-alertdialog-appcompat:$splitties_version"
implementation "com.louiscad.splitties:splitties-appctx:$splitties_version"
implementation "com.louiscad.splitties:splitties-arch-lifecycle:$splitties_version"
implementation "com.louiscad.splitties:splitties-arch-room:$splitties_version"
implementation "com.louiscad.splitties:splitties-bitflags:$splitties_version"
implementation "com.louiscad.splitties:splitties-bundle:$splitties_version"
implementation "com.louiscad.splitties:splitties-checkedlazy:$splitties_version"
implementation "com.louiscad.splitties:splitties-dimensions:$splitties_version"
implementation "com.louiscad.splitties:splitties-exceptions:$splitties_version"
implementation "com.louiscad.splitties:splitties-initprovider:$splitties_version"
implementation "com.louiscad.splitties:splitties-mainhandler:$splitties_version"
implementation "com.louiscad.splitties:splitties-material-lists:$splitties_version"
implementation "com.louiscad.splitties:splitties-preferences:$splitties_version"
implementation "com.louiscad.splitties:splitties-resources:$splitties_version"
implementation "com.louiscad.splitties:splitties-fragmentargs:$splitties_version"
implementation "com.louiscad.splitties:splitties-selectableviews:$splitties_version"
implementation "com.louiscad.splitties:splitties-selectableviews-appcompat:$splitties_version"
implementation "com.louiscad.splitties:splitties-selectableviews-constraintlayout:$splitties_version"
debugImplementation "com.louiscad.splitties:splitties-stetho-init:$splitties_version"
implementation "com.louiscad.splitties:splitties-systemservices:$splitties_version"
implementation "com.louiscad.splitties:splitties-toast:$splitties_version"
implementation "com.louiscad.splitties:splitties-typesaferecyclerview:$splitties_version"
implementation "com.louiscad.splitties:splitties-uithread:$splitties_version"
implementation "com.louiscad.splitties:splitties-snackbar:$splitties_version"
implementation "com.louiscad.splitties:splitties-viewdsl:$splitties_version"
implementation "com.louiscad.splitties:splitties-viewdsl-appcompat:$splitties_version"
implementation "com.louiscad.splitties:splitties-viewdsl-appcompat-styles:$splitties_version"
implementation "com.louiscad.splitties:splitties-viewdsl-constraintlayout:$splitties_version"
implementation "com.louiscad.splitties:splitties-viewdsl-design:$splitties_version"
debugImplementation "com.louiscad.splitties:splitties-viewdsl-ide-preview:$splitties_version"
implementation "com.louiscad.splitties:splitties-views:$splitties_version"
implementation "com.louiscad.splitties:splitties-views-appcompat:$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-alpha1
as shown in this snippet:
allProjects {
ext {
splitties_version = '2.0.0-alpha1'
}
}
Published by LouisCAD over 7 years ago
Context
everywherelazy
implementations, with reporting via Timber supportSelectableTextView
. Made to use it on simple, single-line list items.ItemViewHolder
helper class for simple but common use cases.Published by LouisCAD about 8 years ago
This version adds the setHost(Host host)
method in ViewWrapper.Binder
interface where Host
can be any type you want you can use from the implementing item View to communicate with your Activity, Fragment, Presenter, or whatever. Note this adds a third type parameter to the ViewWrapper
class, and a second one for the ViewWrapper.Binder
class.
Published by LouisCAD about 8 years ago
This version adds the setViewHolder(ViewWrapper holder)
method in ViewWrapper.Binder
interface so list item View
s can now get a reference to their ViewHolder
, and call getAdapterPosition()
on it for example.
Published by LouisCAD about 8 years ago
This is the first release of Splitties. It included two independent modules:
For gradle projects from jcenter()
repo:
compile 'xyz.louiscad.splitties:selectableviewgroups:1.0'
compile 'xyz.louiscad.splitties:typesaferecyclerview:1.0'