Skip to content

Instantly share code, notes, and snippets.

@illuzor illuzor/ViewModelGallery.kt Secret
Created Sep 22, 2018

What would you like to do?
package com.illuzor.lesson.wallpapers.model
import com.illuzor.lesson.wallpapers.api.api
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
class ViewModelGallery : ViewModelBase() {
lateinit var data: List<String>
private set
fun load(category: String) {
state = State.PROGRESS : Callback<List<String>> {
override fun onResponse(call: Call<List<String>>, response: Response<List<String>>) {
data = response.body()!!
state = State.LOADED
override fun onFailure(call: Call<List<String>>, t: Throwable?) {
state = State.ERROR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.