This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val spanned = spannable{ bold("some") + italic(" formatted") + color(Color.RED, " text") } | |
| val nested = spannable{ bold(italic("nested ")) + url("www.google.com", "text") } | |
| val noWrapping = bold("no ") + sub("wrapping ) + sup("also ") + "works" | |
| text_view.text = spanned + nested + noWrapping |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Do { | |
| enum class duration { | |
| SECONDS, MILLISECONDS | |
| } | |
| infix fun seconds(function: () -> Unit) { | |
| Do.mFormat = duration.SECONDS | |
| Do.handle(function) | |
| } | |
| infix fun milliseconds(function: () -> Unit) { | |
| Do.mFormat = duration.MILLISECONDS |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Locally(val variable: Any) { | |
| infix fun into(location: Any) { | |
| val sharedPref = Locally.context?.getSharedPreferences("locallyPrefs", Context.MODE_PRIVATE) | |
| val editor = sharedPref?.edit() | |
| editor?.let { | |
| when (this.variable) { | |
| is Boolean -> it.putBoolean(location as String, this.variable) | |
| is Float -> it.putFloat(location as String, this.variable) | |
| is Double -> it.putFloat(location as String, this.variable.toFloat()) | |
| is Long -> it.putLong(location as String, this.variable) |