Skip to content

Instantly share code, notes, and snippets.

View stoichoandreev's full-sized avatar

Stoycho Andreev stoichoandreev

View GitHub Profile
@stoichoandreev
stoichoandreev / ApiService.kt
Last active March 18, 2020 09:42
Gist 2 - Android example
class ApiService {
fun requestDataFromBackend(): Observable<MyRawDataModel> {
return BackendAPI().returnSomeDummyData()
}
fun readCachedUserName(rawDataModel: MyRawDataModel) : Observable<Pair<MyRawDataModel, String>> {
val cachedUserName = PreferenceManager.getDefaultSharedPreferences(MyApplication.INSTANCE).getString("USER_NAME", "") ?: ""
return Observable.just(Pair(rawDataModel, cachedUserName))
}
@stoichoandreev
stoichoandreev / AndroidLifeCycleComponent.kt
Last active March 18, 2020 09:42
Gist 1 B None Android Example
class AndroidLifeCycleComponent {
fun start() {
System.out.println("Robot Start")
}
fun resume() {
System.out.println("Robot Resume")
}
@stoichoandreev
stoichoandreev / AndroidRobot.kt
Last active March 18, 2020 09:43
Gist 1 A - None Android Example
class AndroidRobot: BaseLifeCycle() {
fun onCreate() {
start()
}
fun onResume() {
resume()
}