Newer
Older
CitrusClient / app / src / main / java / com / example / citrusclient / viewmodels / TodosViewModel.java
package com.example.citrusclient.viewmodels;

import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;

import com.example.citrusclient.rest.TodosRest;

import retrofit2.Retrofit;
import retrofit2.converter.jackson.JacksonConverterFactory;

public class TodosViewModel extends ViewModel {

    private final Retrofit retrofit;
    private final TodosRest todosRest;

    //LiveData
    private final MutableLiveData<String> titleLiveData;

    //Constructor
    public TodosViewModel()
    {
        this.retrofit = new Retrofit.Builder()
                .baseUrl("http://nitta-lab-www.is.konan-u.ac.jp/citrus/")
                .addConverterFactory(JacksonConverterFactory.create())
                .build();
        this.todosRest = retrofit.create(TodosRest.class);
        this.titleLiveData = new MutableLiveData<>();
    }

    //getter
    public MutableLiveData<String> getTitleLiveData() {return titleLiveData;};

    public void getTodos()
    {

    }

    public void putTodo()
    {

    }

    public void deleteTodo()
    {

    }

}