diff --git a/app/src/main/java/com/example/cosmosclient/entities/AreaInformation.java b/app/src/main/java/com/example/cosmosclient/entities/AreaInformation.java index 8149215..96b512a 100644 --- a/app/src/main/java/com/example/cosmosclient/entities/AreaInformation.java +++ b/app/src/main/java/com/example/cosmosclient/entities/AreaInformation.java @@ -6,16 +6,12 @@ public class AreaInformation { private CosmosLocation location = new CosmosLocation(); - //private ArrayList shops = new ArrayList<>(); private HashMap> feature = new HashMap<>(); private Time lastUpdated; - private double latitude; - private double longitude; public void setLatitude(double latitude) { location.setLatitude(latitude); } - public void setLongitude(double longitude) { location.setLongitude(longitude); } @@ -41,10 +37,4 @@ return lastUpdated; } -// public void setShops(ArrayList shops) { -// this.shops = shops; -// } -// public ArrayList getShops() { -// return shops; -// } } diff --git a/app/src/main/java/com/example/cosmosclient/entities/Feature.java b/app/src/main/java/com/example/cosmosclient/entities/Feature.java index 6334026..7a00f80 100644 --- a/app/src/main/java/com/example/cosmosclient/entities/Feature.java +++ b/app/src/main/java/com/example/cosmosclient/entities/Feature.java @@ -4,8 +4,6 @@ private String genre; private int code; private CosmosLocation location = new CosmosLocation(); - private double latitude; - private double longitude; public void setLatitude(double latitude) { location.setLatitude(latitude); diff --git a/app/src/main/java/com/example/cosmosclient/entities/ShopsResponse.java b/app/src/main/java/com/example/cosmosclient/entities/ShopsResponse.java deleted file mode 100644 index ded01e5..0000000 --- a/app/src/main/java/com/example/cosmosclient/entities/ShopsResponse.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.example.cosmosclient.entities; - -import java.util.ArrayList; - -public class ShopsResponse { - public ArrayList shops = new ArrayList<>(); - - -} diff --git a/app/src/main/java/com/example/cosmosclient/entities/shops.java b/app/src/main/java/com/example/cosmosclient/entities/shops.java deleted file mode 100644 index a7191cc..0000000 --- a/app/src/main/java/com/example/cosmosclient/entities/shops.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.example.cosmosclient.entities; - -public class shops { - public String genre; - public int code; - public double latitude; - public double longitude; -} diff --git a/app/src/main/java/com/example/cosmosclient/resources/LocationRest.java b/app/src/main/java/com/example/cosmosclient/resources/LocationRest.java index e3c6110..0d181ae 100644 --- a/app/src/main/java/com/example/cosmosclient/resources/LocationRest.java +++ b/app/src/main/java/com/example/cosmosclient/resources/LocationRest.java @@ -1,20 +1,20 @@ package com.example.cosmosclient.resources; import com.example.cosmosclient.entities.AreaInformation; -import com.example.cosmosclient.entities.ShopsResponse; +import com.example.cosmosclient.entities.Feature; + +import java.util.ArrayList; import retrofit2.Call; import retrofit2.http.GET; -import retrofit2.http.Field; -import retrofit2.http.FormUrlEncoded; import retrofit2.http.Query; public interface LocationRest { @GET("shops") - Call LocationService(@Query("leftLatitude") String leftLat, - @Query("leftLongitude") String leftLon, - @Query("rightLatitude") String rightLat, - @Query("rightLongitude") String rightLon); + Call> LocationService(@Query("leftLatitude") String leftLat, + @Query("leftLongitude") String leftLon, + @Query("rightLatitude") String rightLat, + @Query("rightLongitude") String rightLon); } diff --git a/app/src/main/java/com/example/cosmosclient/services/CosomosBackgroundService.java b/app/src/main/java/com/example/cosmosclient/services/CosomosBackgroundService.java index a0f6422..911ee68 100644 --- a/app/src/main/java/com/example/cosmosclient/services/CosomosBackgroundService.java +++ b/app/src/main/java/com/example/cosmosclient/services/CosomosBackgroundService.java @@ -25,16 +25,17 @@ import com.example.cosmosclient.R; import com.example.cosmosclient.app.Cosmos; import com.example.cosmosclient.entities.AreaInformation; +import com.example.cosmosclient.entities.Feature; import com.example.cosmosclient.entities.Group; import com.example.cosmosclient.entities.GroupListResponse; import com.example.cosmosclient.entities.RequestList; -import com.example.cosmosclient.entities.ShopsResponse; import com.example.cosmosclient.entities.jsons.GroupJson; import com.example.cosmosclient.entities.CosmosLocation; import com.example.cosmosclient.resources.GroupsRest; import com.example.cosmosclient.resources.LocationRest; import java.io.IOException; +import java.util.ArrayList; import java.util.TimeZone; import java.util.Timer; import java.util.TimerTask; @@ -197,20 +198,20 @@ rightLon = Math.floor((location.getLongitude() + 0.1) * 10.0) / 10.0; //API呼び出しのための値入力 - Call call = LocationService.LocationService(String.valueOf(leftLat), + Call> call = LocationService.LocationService(String.valueOf(leftLat), String.valueOf(leftLon),String.valueOf(rightLat),String.valueOf(rightLon)); //サーバからデータ受け取り - call.enqueue(new Callback() { + call.enqueue(new Callback>() { //成功時 @Override - public void onResponse(Call call, Response response) { + public void onResponse(Call> call, Response> response) { if (response.isSuccessful()) { - ShopsResponse result = response.body(); + ArrayList result = response.body(); //app/Cosmosに情報保存 Cosmos app = (Cosmos) getApplication(); -// app.setAreaInfo(result.getLocation().hashCode(),result); +// app.setAreaInfo(); } else { //onFailureでキャッチできないエラー用 @@ -221,7 +222,7 @@ //失敗時 @Override - public void onFailure(Call call, Throwable t) { + public void onFailure(Call> call, Throwable t) { t.printStackTrace(); Toast.makeText(CosomosBackgroundService.this, "区画情報の更新に失敗しました", Toast.LENGTH_SHORT).show();