Skip to content

Instantly share code, notes, and snippets.

View castasat's full-sized avatar
❤️
Fast programming methods

Denis Dmitrienko castasat

❤️
Fast programming methods
  • DOO "Lorem Ipsum"
  • Herceg Novi, Montenegro
View GitHub Profile
@castasat
castasat / SharedString
Created November 29, 2019 07:49
Usage in activity or fragment: private var variableName by SharedString { requireContext() }
import android.annotation.SuppressLint
import android.content.Context
import android.content.Context.MODE_PRIVATE
import kotlin.properties.ReadWriteProperty
import kotlin.reflect.KProperty
class SharedString(private val context: () -> Context) : ReadWriteProperty<Any, String?> {
private val sharedPreferences by lazy {
with(context()) {
@castasat
castasat / Variable.java
Created November 19, 2018 22:49
Observe any object variable value change with RxJava2 PublishSubject wrapper written in Java
package net.cargo.reactive;
import android.support.annotation.Nullable;
import io.reactivex.Observable;
import io.reactivex.subjects.PublishSubject;
import static net.cargo.application.Cargo.check;
/**
* Usage: