Tutorials ▶ Android Things
ATHome

Android Things Development

When Googles IoT platform, Android Things was launched, it caused some rethinking for time-served Android developers. 

This was necessary in order to adapt to all the anticipated hardware applications it will be used for, and it meant many familar features had to be removed. The most radical of these was the default UI, since the UI is now optional. This doesn't mean there isn't one, it just means you have to roll your own entirely. Of course you do this using the standard Android View framework you're used to in its entirety, but by default, the system supplies nothing. That means there's no status bar, no navigation bar, no back button etc - and your device has no home screen.

The idea with Android Things is you're creating a hardware applicance. Typically, this runs only one app and it's this app which starts up when your device is booted, That's the production scenario which is the one your end user expects. For development, this can be a little restrictive. You can certainly install many different apps onto Android Things devices, and developers often do this to try multiple versions of their apps, run small self-contained test apps or measure performance variants of the same one, for example. This is cumbersome without a home screen or some kind of launcher, because each has to be built and installed fresh so it "wins" in the boot race.

Tutorials ▶ UI ▶ Layout
Beautiful Animations with ContraintLayout

Minimal coding required

ConstraintLayout seems to be the hot new thing nowadays. Flattening your view hierarchy, improving performance, supporting arbitrary bounding rules — it promises to fix all of the shortcomings of some previous layout files (*cough* I’m looking at you RelativeLayout *cough*) and more. But there is one other benefit of ConstraintLayout that most people are unaware of and the official documentation curiously doesn’t mention anything about: performing cool animations on your ConstraintLayout views with very little code.

How?

I’m going to assume that you know the basics of ConstraintLayout (e.g. you know what is app:layout_constraintLeft_toLeftOf and its relatives). Most of the tutorials on ConstraintLayout focus on using the newly improved Android Studio layout design panel where you can drag/drop/visualize the various constraints. For the purposes of animations, it’s also good to take a peek at the generated XML to get a better understanding of the various constraint attributes so you know how to manipulate them.

Full article


Tutorials ▶ Build ▶ Gradle
Gradle Script Kotlin

Yup - use Kotlin in Gradle Script

As you know, we use Groovy to write our Gradle build scripts and it has pros and cons. Groovy is a dynamic language which means that it’s not statically typed, making difficult to write or modify our gradle scripts without making many mistakes as we don’t have autocomplete there.

Last year, Gradle decided to start using Kotlin to writing Gradle build scripts creating, what they call, Gradle Kotlin Script. The project is moving fast (0.9.0 version at the time of writing this article) but, on the other hand, there is practically no documentation.

So, I want to show you how to use Gradle Kotlin Script to create Gradle build scripts written in Kotlin in one Android project.

Full article


Tutorials ▶ Language ▶ Kotlin
Kotlin

First class support throughout

Hardcore Android developers have been aware Koltin could be used alongside Java for some time, but many have been held back by the lack of official support. That ended at Google I/O 2017, when it was announced it will now be fuly supported from Android Studio 3.0 onwards, and that's right through from the IDE syntax checkers to the Gradle build system and beyond.

How has Kotlin been implemented on Android?

Since Android is powered at it's heart by a JVM, that's Java Virtual Machine, in theory, anything which can create the bytecode it expects can be used to run software on it. Koltin is such a beast, and AS 3.0 now has the toolchain needed to generate it. So it's a hat tip to the designers of the original JVM for creating a system with such longevity.

Uniquely, Kotlin is not an "all or nothing" swap in for Java, the way other languages would be (or at least not without a few very complicated hoops to jump through). It actually sits side by side in the source tree and is even interoperable with Java, so it can call Java methods directly and vice-versa. Migrating existing projects over just lost what is traditionally the largest hurdle they face.

Tutorials ▶ Security
Fingerprint authentication

Place your fingertip on the fingerprint reader

There are a number of ways to authenticate a user to access an application, or a certain feature within an application, such as checkout, and fingerprint is one of them. For this post instead of going through the code step by step, i have added in-code comments, and will be letting the code speak for itself.

First things first, the permission.

The good thing is that we do not need to ask for this permission at runtime.

This project only has one activity, the MainActivity. Lets take a look at the code.

Full article


Tutorials ▶ UI ▶ Animation
Spring

SpringAnimation with examples

Have you ever wanted to do a bouncy animation like one of these on Android? If you have, you’re in for a treat!

Dynamic-animation is a new module introduced in revision 25.3.0 of the Android Support Library. It provides a small set of classes for making realistic physics-based view animations.

You might say “whatever, I’m just gonna slap a BounceInterpolator or an OvershootInterpolator on my animation and be good”Well, in reality these two often don’t look that great. Of course, you could always write your own interpolator or implement a whole custom animation – but now there’s a much easier way.

Full article