Git Product home page Git Product logo

kotlin-workshop's Introduction

Kotlin Workshop

This workshop will have you build a modern notepad app using the Kotlin language.

It will also lean on other modern tools such as Room for persistence, RxJava for observing, and ThreeTenABP for date handling.

Preparation

Android Studio

Before the session begins, please install Android Studio 3.0 Beta 2 and make sure this repo builds successfully.

Android Device / Emulator

Please make sure you either have a device and cable to run the application, or that you have an emulator set up and running ahead of time.

Open Documentation

We will occasionally be referring directly to the Room documentation. We will also be taking a quick look at Anko:

In the first section, we get our tools set up, fire up the emulator, and introduce everybody to our excellent helpers: Tre Murillo, Steven Anyanwu, Enrique Portillo, and Josh Shin. We will examine our gradle configuration, and also create a basic main activity, and go over some of the auto-generated Kotlin code.

Topics Covered

  • Tools
  • Kotlin's Gradle plugins
  • Basic syntax
  • Lambdas
  • Death to findViewById!

Moving on, we will look into the Kotlin annotation processor. We'll also create our Note data object, complete with JSR-310 date field.

After that we'll set up all of Room's required scaffolding, such as TypeConverter, RoomDatabase, and our DAO. We'll create a couple of query functions as well!

Topics Covered

  • Annotation Processing
  • Java->Kotlin autoconversion
  • Nullability
  • Type Inference
  • @JvmStatic and singletons
  • varargs

Now that we've set up the core of our persistence logic, let's write a quick smoke test to make sure everything is hooked up properly. We'll demonstrate the power of the Kotlin auto-converter by directly converting a sample test from the Room website.

Topics Covered

  • Testing with Kotlin
  • lateinit
  • The apply function
  • Foo::class.java

Here we set up our recycler adapter, abstract out our database objects into the DataStore singleton, and introduce RxJava!

Topics Covered

  • How Kotlin handles inner classes
  • Secondary & primary constructors
  • Null coalescing
  • Subscript operator for collections
  • private setters

The final stretch! Let's add some convenience extensions to LayoutInflater and RxJava, set up our composition Activity, and introduce Anko for easy async execution.

Topics Covered

  • Convenience extensions
  • when expression
  • Anko for async

What a pretty app!

kotlin-workshop's People

Contributors

androidsummit avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.