Instead of the verbose setOnClickListener:
RxView.clicks(submitButton).subscribe(o -> log("submit button clicked!"));Observable
.just(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)| private val PARTICLE_COLOR = Color.White | |
| private val LINE_COLOR = Color.White | |
| private const val PARTICLE_QUANTITY = 100 | |
| private const val DEFAULT_SPEED = 2 | |
| private const val VARIANT_SPEED = 1 | |
| private const val DEFAULT_RADIUS = 4 | |
| private const val VARIANT_RADIUS = 2 | |
| private const val LINK_RADIUS = 200 | |
| // TODO: 30/09/2020 These should be measured but are only used to calculate | |
| // the initial position |
| # Java Gradle CircleCI 2.0 configuration file | |
| # | |
| # Check https://circleci.com/docs/2.0/language-java/ for more details | |
| version: 2 | |
| # References are blocks of configurations that we can reference and reuse. | |
| references: | |
| # Workspaces represent the spaces we work on & are useful for sharing data between jobs. |
| data class SimpleDemoState(val listing: Async<Listing> = Uninitialized) | |
| class SimpleDemoViewModel(override val initialState: SimpleDemoState) : MvRxViewModel<SimpleDemoState>() { | |
| init { | |
| fetchListing() | |
| } | |
| private fun fetchListing() { | |
| // This automatically fires off a request and maps its response to Async<Listing> | |
| // which is a sealed class and can be: Unitialized, Loading, Success, and Fail. |
| // Generate a minor version code from git commit count (for prod builds) | |
| static def generateVersionCode() { | |
| def result = "git rev-list HEAD --count".execute().text.trim() //unix | |
| if(result.empty) result = "PowerShell -Command git rev-list HEAD --count".execute().text.trim() //windows | |
| if(result.empty) throw new RuntimeException("Could not generate versioncode on this platform? Cmd output: ${result.text}") | |
| return result.toInteger() | |
| } | |
| def majorVersion = 1 |
| # Fancy Terminal Prompt ---------------------------------------------------------- | |
| txtcyn=$'\e[0;36m' # Cyan | |
| txtred=$'\e[0;31m' # Red | |
| txtwht=$'\e[0;37m' # White | |
| txtrst=$'\e[0m' # Text Reset | |
| function parse_git_branch() { | |
| git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
| } |
| @file:Suppress("NOTHING_TO_INLINE") | |
| import android.util.Log | |
| import io.reactivex.* | |
| inline fun <reified T> printEvent(tag: String, success: T?, error: Throwable?) = | |
| when { | |
| success == null && error == null -> Log.d(tag, "Complete") /* Only with Maybe */ | |
| success != null -> Log.d(tag, "Success $success") | |
| error != null -> Log.d(tag, "Error $error") |
| import org.simpleframework.xml.Attribute; | |
| import org.simpleframework.xml.Element; | |
| import org.simpleframework.xml.ElementList; | |
| import org.simpleframework.xml.Namespace; | |
| import org.simpleframework.xml.NamespaceList; | |
| import org.simpleframework.xml.Root; | |
| import org.simpleframework.xml.Text; | |
| import java.util.List; |
| package com.pascalwelsch.extensions | |
| import android.app.Activity | |
| import android.content.Context | |
| import android.content.Intent | |
| import android.os.Build | |
| import android.os.Bundle | |
| /** | |
| * Extensions for simpler launching of Activities |
Centralize the support libraries dependencies in gradle
Working with multi-modules project, it is very useful to centralize the dependencies, especially the support libraries.
A very good way is to separate gradle build files, defining something like:
root
--gradleScript
----dependencies.gradle