diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 1c28d34..53aecf0 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -41,13 +41,12 @@ android:name=".SignUpActivity" android:exported="true" android:label="@string/title_activity_sign_up"> - - - + + - - + + - - + + - - + + { + Log.d("debug", "currentbutton, 現在地にカメラを移動"); + //現在地にカメラを移動 + zoomMap(currentLatlng.latitude, currentLatlng.longitude); + }); + + if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) { @@ -93,9 +92,9 @@ double latitude = 34.7308032; double longitude = 135.2630272; - //テスト用 - latlng = new LatLng(latitude, longitude); - latlng2 = new LatLng(34.74, 135.26); + //テスト用,仮ピン立て + testLatlng = new LatLng(latitude, longitude); + testLatlng2 = new LatLng(34.74, 135.26); //標準のマーカー(店用のピン) setMarker(latitude, longitude); @@ -168,12 +167,12 @@ MarkerOptions markerOptions = new MarkerOptions(); MarkerOptions markerOptions2 = new MarkerOptions(); - markerOptions.position(latlng); + markerOptions.position(testLatlng); markerOptions.title("ntlab"); mMap.addMarker(markerOptions); //テスト用 - markerOptions2.position(latlng2); + markerOptions2.position(testLatlng2); markerOptions2.title(null); mMap.addMarker(markerOptions2); @@ -189,6 +188,8 @@ double north = latitude * (1+0.00005); double east = longitude * (1+0.00005); + LatLng latlng = new LatLng(latitude,longitude); + // LatLngBounds (LatLng southwest, LatLng northeast) //左下、右上 LatLngBounds bounds = LatLngBounds.builder() @@ -207,11 +208,12 @@ mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latlng, 15f)); } + //現在地の表示 private void setIcon(double latitude, double longitude){ //Drawable ic_current = ResourcesCompat.getDrawable(getResources(),R.drawable.icon_current,null); //更新前の現在地アイコンを消去 - if(current_overlay != null) { - current_overlay.remove(); + if(currentOverlay != null) { + currentOverlay.remove(); } LatLng current_location = new LatLng(latitude,longitude); @@ -233,14 +235,14 @@ overlayOptions.position(current_location, 200f, 200f); // マップに貼り付け・アルファを設定 - current_overlay = mMap.addGroundOverlay(overlayOptions); + currentOverlay = mMap.addGroundOverlay(overlayOptions); // カメラを移動 - zoomMap(latitude, longitude); + //zoomMap(latitude, longitude); // 透明度 - assert current_overlay != null; - current_overlay.setTransparency(0.8F); + assert currentOverlay != null; + currentOverlay.setTransparency(0.8F); } @@ -301,7 +303,7 @@ public void onLocationChanged(Location location) { //現在地が変更されるたびに現在地アイコンを移動 //LatLng型で一応受け取っておく - latlng = new LatLng(location.getLatitude(), location.getLongitude()); + currentLatlng = new LatLng(location.getLatitude(), location.getLongitude()); /* テスト用。現在座標を画面に表示 @@ -320,6 +322,8 @@ setIcon(location.getLatitude(),location.getLongitude()); } + + @Override public void onProviderEnabled(String provider) { @@ -329,4 +333,5 @@ public void onProviderDisabled(String provider) { } + } diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index da513fb..5736918 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -19,7 +19,7 @@