All snippets tagged with kotlin

Page 1 of 2
 

Check for ARCore before launching a Unity module on Android.

Kotlin extension functions for Views

Kotlin extension functions for Numbers

Kotlin extension functions for Arrays and Lists

Common kotlin extensions

Kotlin extension functions for Bitmaps

View with a hook to add draw operations

This view allows draw operations to be executed in a different class. This makes it easier to draw onto a canvas without having to create a custom view for every different use case.

Read more…

GIF compatible EditText

Shrinkin/growing ViewPager

When iOS-ifying a ViewPager, it is often needed to animate the pages when they come into view. The following snippet shrinks the offscreen pages a little bit, and grows them to regular size when swiping them to the center of the display.

Read more…

Handle links in a TextView

The Ultimate Sharing snippet for social platforms

Picking a contact using the Contacts app

There are to ways (besides implementing your own UI) to pick contact details through the Contacts app. One of them needs read access to your contacts list, the other does not.

Read more…

Glide bitmap transformations

Connectivity live data

Turn timestamps into "time ago" strings

This recipe creates a “time ago” string from any timestamp, often used to display how long ago a comment was posted or a notification was received. We’re creating an extension method, so any Long timestamp can be converted like so: 12313131.timeAgo(arr) where arr is a list of labels. This list can be retrieved from a string-array in the strings.xml to make it localizable.

Read more…