First kotlin

Convert one class to kotlin and provide a slight amount of guidance.

Test: existing tests
Change-Id: Ie8659765b674ac7b2d82ed3d343f387195c07d83
This commit is contained in:
Jason Monk
2018-08-22 16:56:58 -04:00
parent d5796dd4f1
commit ae7ced2f95
8 changed files with 258 additions and 145 deletions

View File

@@ -0,0 +1,22 @@
# Kotlin in SystemUI
Queue "it's happening" gif.
Kotlin is probably going to be a bit of a wild west for a while, but please
try to follow these guidelines as much as possible.
- No semi-colons: they are optional, we probably don't want them in the
future, so let's just not add them.
- No DSLs: sysui is complicated enough as is, let's not add more layers at
the moment.
- Only use extension functions for keeping complex code locality: Don't use
extension functions to add methods to android classes that you always wished
were there, instead add them directly to the class and save us the extension.
- inline, reified, and de-compisition can all be great things: just make sure
you know what they do and why you are using them.
# Recommended reading
- [Kotlin](https://kotlinlang.org/)
- [AndroidX-KTX](https://www.youtube.com/watch?v=st1XVfkDWqk)
- [Performance and Kotlin tricks](https://www.youtube.com/watch?v=6P20npkvcb8)