diff --git a/app/src/main/java/com/example/nemophila/MainActivity.java b/app/src/main/java/com/example/nemophila/MainActivity.java index 91e9e6e..c0cf3f9 100644 --- a/app/src/main/java/com/example/nemophila/MainActivity.java +++ b/app/src/main/java/com/example/nemophila/MainActivity.java @@ -156,22 +156,25 @@ */ //初期画面の座標(現在地をロードするまで表示) - initialLatlng = new LatLng(39,138); + //initialLatlng = new LatLng(39,138); + initialLatlng = new LatLng(nemophila.getCameraLatitude(),nemophila.getCameraLongitude()); //初期画面に移動 - mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(initialLatlng, 15f)); + //mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(initialLatlng, 15f)); + mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(initialLatlng, nemophila.getZoom())); + //画面が動いたとき mMap.setOnCameraIdleListener(() -> { //カメラの座標とZOOM倍率を保存 - nowCamera = mMap.getCameraPosition(); - nemophila.setCameraLatitude(nowCamera.target.latitude); - nemophila.setCameraLongitude(nowCamera.target.longitude); - nemophila.setZoom(nowCamera.zoom); + //nowCamera = mMap.getCameraPosition(); + nemophila.setCameraLatitude(mMap.getCameraPosition().target.latitude); + nemophila.setCameraLongitude(mMap.getCameraPosition().target.longitude); + nemophila.setZoom(mMap.getCameraPosition().zoom); - nowLatlng = new LatLng(nowCamera.target.latitude, nowCamera.target.longitude); + //nowLatlng = new LatLng(nowCamera.target.latitude, nowCamera.target.longitude); //nowZoom = nowCamera.zoom; //Shopの描画範囲を指定 - shopsViewModel.setViewArea(nowLatlng.longitude+1, nowLatlng.latitude+1, nowLatlng.longitude-1, nowLatlng.latitude-1); + shopsViewModel.setViewArea(nemophila.getCameraLongitude()+1, nemophila.getCameraLatitude()+1, nemophila.getCameraLongitude()-1, nemophila.getCameraLatitude()-1); }); /* @@ -361,7 +364,7 @@ public void onLocationChanged(Location location) { //初期画面は現在地を中心にするため... if (currentLatlng == null){ - zoomMap(location.getLatitude(), location.getLongitude()); + //zoomMap(location.getLatitude(), location.getLongitude()); findViewById(R.id.LL_Load).setVisibility(View.GONE); }