Log.v(“ThreeTips”, “#17”)

1 — Operator Overloading in Kotlin

Kotlin allows us to provide implementations for a predefined set of operators on our types. These operators have symbolic representation like *,-,+ etc. Lets examine it with a little snippet.

val disposables = CompositeDisposable()
val observable1 = your_observable
operator fun CompositeDisposable.plusAssign(disposable: Disposable){
disposables += observable1

2 — Using font in Support Library (As of 26.0.0)

As of Android Support Library 26.0, you must declare both sets of attributes to ensure your fonts load on devices running Android 8.0 (API level 26) or lower. Otherwise your app crashes with following error.

Caused by: java.lang.NullPointerException
at android.graphics.FontFamily.nAddFontFromAssetManager

app:fontWeight="400" />

3 — Gradle 3.0: “api” vs “implementations”

If you upgraded your gradle plugin to 3.0, you might have seen “compile” is deprecated. You can also see that some documentations are already updated with “implementation”.

//before gradle 3.0
//After gradle 3.0

Basically you can use “api” instead of “compile”.

But if you want faster build time in your app, you can do following.



Software Engineer at Storytel

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store