diff --git a/app/src/main/java/com/example/nemophila/Nemophila.java b/app/src/main/java/com/example/nemophila/Nemophila.java index 6637ff6..26e5d77 100644 --- a/app/src/main/java/com/example/nemophila/Nemophila.java +++ b/app/src/main/java/com/example/nemophila/Nemophila.java @@ -4,16 +4,25 @@ import android.content.SharedPreferences; import com.example.nemophila.entities.Shop; +import com.google.type.LatLng; public class Nemophila extends Application { + //アカウントのデータ private String name; private String uid; private String token; + + //ショップのデータ private Shop currentShop; private double currentLongitude; private double currentLatitude; private Shop dummyShop; + //カメラのデータ + private Float cameraLatitude; + private Float cameraLongitude; + private float zoom; + //Getter public String getName() { @@ -49,6 +58,27 @@ public Shop getDummyShop() { return dummyShop; } + public Float getCameraLatitude() { + if(cameraLatitude == 0){ + SharedPreferences preferences = getSharedPreferences("prefData", MODE_PRIVATE); + cameraLatitude = preferences.getFloat("cameraLatitude", 0); + } + return cameraLatitude; + } + public Float getCameraLongitude() { + if(cameraLongitude == 0){ + SharedPreferences preferences = getSharedPreferences("prefData", MODE_PRIVATE); + cameraLongitude = preferences.getFloat("cameraLongitude", 0); + } + return cameraLongitude; + } + public float getZoom() { + if(zoom == 0.0){ + SharedPreferences preferences = getSharedPreferences("prefData", MODE_PRIVATE); + zoom = preferences.getFloat("zoom", 0); + } + return zoom; + } //Setter public void setName(String name) { @@ -84,4 +114,22 @@ public void setDummyShop(Shop dummyShop) { this.dummyShop = dummyShop; } + public void setCameraLatitude(Float cameraLatitude) { + SharedPreferences preferences = getSharedPreferences("prefData", MODE_PRIVATE); + SharedPreferences.Editor editor = preferences.edit(); + editor.putFloat("cameraLatitude", cameraLatitude); + this.cameraLatitude = cameraLatitude; + } + public void setCameraLongitude(Float cameraLongitude) { + SharedPreferences preferences = getSharedPreferences("prefData", MODE_PRIVATE); + SharedPreferences.Editor editor = preferences.edit(); + editor.putFloat("cameraLongitude", cameraLongitude); + this.cameraLongitude = cameraLongitude; + } + public void setZoom(float zoom) { + SharedPreferences preferences = getSharedPreferences("prefData", MODE_PRIVATE); + SharedPreferences.Editor editor = preferences.edit(); + editor.putFloat("zoom", zoom); + this.zoom = zoom; + } }