diff --git a/app/src/main/java/com/example/nemophila/viewmodels/ShopsViewModel.java b/app/src/main/java/com/example/nemophila/viewmodels/ShopsViewModel.java new file mode 100644 index 0000000..e1aae7e --- /dev/null +++ b/app/src/main/java/com/example/nemophila/viewmodels/ShopsViewModel.java @@ -0,0 +1,43 @@ +package com.example.nemophila.viewmodels; + +import androidx.lifecycle.ViewModel; + +import com.example.nemophila.entities.Shop; +import com.example.nemophila.resources.ShopsRest; + +import java.util.Collection; + +import retrofit2.Call; +import retrofit2.Callback; +import retrofit2.Response; +import retrofit2.Retrofit; +import retrofit2.converter.jackson.JacksonConverterFactory; + +public class ShopsViewModel extends ViewModel { + final private ShopsRest shopsRest; + final private Retrofit retrofit; + + public ShopsViewModel(){ + this.retrofit = new Retrofit.Builder() + .baseUrl("http://nitta-lab-www.is.konan-u.ac.jp/nemophila/") + .addConverterFactory(JacksonConverterFactory.create()) + .build(); + this.shopsRest = retrofit.create(ShopsRest.class); + } + + public void setViewArea(double ux, double uy, double lx, double ly){ + Call> call = shopsRest.getShops(ux, uy, lx, ly); + + call.enqueue(new Callback>() { + @Override + public void onResponse(Call> call, Response> response) { + + } + + @Override + public void onFailure(Call> call, Throwable t) { + + } + }); + } +}