Skip to content

LightCycle lets self-contained classes respond to Android’s lifecycle events

License

Notifications You must be signed in to change notification settings

soundcloud/lightcycle

Repository files navigation

LightCycle

Maven Central Hex.pm Platform

LightCycle is an Android library that helps break logic out of Activity and Fragment classes into small, self-contained components called LightCycles.

Fields that are annotated @LightCycle and implement the LightCycle API within a LightCycleActivity or LightCycleFragment will be bound to that Activity or Fragment lifecycle.

For more information please see the website.

Examples

Build integration

Gradle:

ext.lightCycleVersion=<LATEST_VERSION>

dependencies {
  compile "com.soundcloud.lightcycle:lightcycle-lib:$lightCycleVersion"
  annotationProcessor "com.soundcloud.lightcycle:lightcycle-processor:$lightCycleVersion"
}

Or if you're using a version of the Android gradle plugin below 2.2.0

buildscript {
  dependencies {
    classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
  }
}

apply plugin: 'com.neenbedankt.android-apt'

ext.lightCycleVersion=<LATEST_VERSION>

dependencies {
  compile "com.soundcloud.lightcycle:lightcycle-lib:$lightCycleVersion"
  apt "com.soundcloud.lightcycle:lightcycle-processor:$lightCycleVersion"
}