Skip to content

Instantly share code, notes, and snippets.

I may be slow to respond.

Leopold Baik AgustaRC

I may be slow to respond.
Block or report user

Report or block AgustaRC

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Koap7.kt
class MyApplication : Application() {
override fun onCreate() {
Koap.serializer = GsonSerializer(Gson())
Koap.bind(this, SettingPreference, AccountPreference)
View Koap6.kt
Koap.serializer = GsonSerializer(Gson())
View koap_dependency3.groovy
implementation "com.github.AgustaRC.koap:koap-gson-serializer:1.0.1"
View koap_dependency2.groovy
implementation 'com.github.AgustaRC.koap:koap:1.0.1'
View koap_dependency1.groovy
repositories {
maven { url '' }
View Koap4.kt
object AccountPreference : PreferenceHolder(name = "account", cacheStrategy = CacheStrategy.LAZY) {
var name: String by ReadWriteString(predicate = { it.length > 2 })
var age: Int by ReadWriteInt(default = 1, caching = false)
var hireable: Boolean by ReadWriteBoolean()
var score: Float by ReadWriteFloat(default = 0.1f)
var repos: Long by ReadWriteLong()
var followers: ArrayList<User>? by ReadWriteSerializable(type = inferType<ArrayList<User>>())
var friend: User? by ReadWriteSerializable(type = inferType<User>())
public interface Account {
String getName();
void setName(@NotNull String var1);
int getAge();
void setAge(int var1);
View Koap2.kt
object AccountPreference : PreferenceHolder() {
var name: String by ReadWriteString(key = "pref_name", default = "leopold", predicate = { it.length > 2 })
var age: Int by ReadWriteInt()
var hireable: Boolean by ReadWriteBoolean()
View Koap1.kt
interface Account {
@PreferenceField(key = "pref_name", default = "leopold", predicate = { it.length > 2 })
var name: String
var age: Int
var hireable: Boolean
View Conventions23.kt
class Point(val x: Double, val y: Double) {
companion object {
fun fromPolar(angle: Double, radius: Double) = Point(...)
You can’t perform that action at this time.