lightningkite/kotlin-anko


Download


Step 1. Add the JitPack repository to your build file

Add it in your root settings.gradle at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url 'https://jitpack.io' }
		}
	}

Add it in your settings.gradle.kts at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url = uri("https://jitpack.io") }
		}
	}

Add to pom.xml

	<repositories>
		<repository>
		    <id>jitpack.io</id>
		    <url>https://jitpack.io</url>
		</repository>
	</repositories>

Add it in your build.sbt at the end of resolvers:

 
    resolvers += "jitpack" at "https://jitpack.io"
        
    

Add it in your project.clj at the end of repositories:

 
    :repositories [["jitpack" "https://jitpack.io"]]
        
    

Step 2. Add the dependency

	dependencies {
		implementation 'com.github.lightningkite:kotlin-anko:'
	}
	dependencies {
		implementation("com.github.lightningkite:kotlin-anko:")
	}
	<dependency>
	    <groupId>com.github.lightningkite</groupId>
	    <artifactId>kotlin-anko</artifactId>
	    <version></version>
	</dependency>

                            
    libraryDependencies += "com.github.lightningkite" % "kotlin-anko" % ""
        
        

                            
    :dependencies [[com.github.lightningkite/kotlin-anko ""]]
        
        

Readme


kotlin-anko

This repository is Android specific, and is not cross-platform. For a good example of use, take a look at kotlin-components-starter.

This repository contains a slew of things that we did not have from Anko.

Anko

This framework is based on Anko, a UI building library that uses Kotlin DSL instead of XML.
This allows your layout and associated code to be mixed, allowing greater cohesion in your apps.
While you should separate out business logic from display logic, now the display logic can actually
be where the layout is.

Note that Anko is still based on Android views, so everything should still be compatible.

Overview

There are such a large number of functions, you're better off exploring the repository. It's all designed to be easily read. All of them, however, are Android specific. Some of the really important points:

View.lifecycle - This gives lifecycle capabilities to Android views. Lifecycles are objects that allow listening to the creation and destruction of things. These are really useful with the observable package we've created; the package that helps in using the two together is kotlin-anko-observable. I highly recommend it.

Async - This gives a way to tell the kotlin-core package what the UI thread is and how to post something to it. This is automatically enabled if also using kotlin-anko-view-controllers, which I highly recommend.