diff --git a/app/src/main/java/com/example/nemophila/MainActivity.java b/app/src/main/java/com/example/nemophila/MainActivity.java index c0cf3f9..922556b 100644 --- a/app/src/main/java/com/example/nemophila/MainActivity.java +++ b/app/src/main/java/com/example/nemophila/MainActivity.java @@ -71,16 +71,6 @@ nemophila = (Nemophila) this.getApplication(); - //現在地ボタン - ImageButton button1 = findViewById(R.id.currentButton); - // lambda式 - button1.setOnClickListener( v -> { - Log.d("debug", "currentbutton, 現在地にカメラを移動"); - System.out.println(shopsViewModel.getShopsLiveData().getValue()); - //現在地にカメラを移動 - zoomMap(currentLatlng.latitude, currentLatlng.longitude); - }); - ImageButton myPageButton = findViewById(R.id.myPageButton); // lambda式 myPageButton.setOnClickListener( v -> { @@ -298,9 +288,6 @@ // マップに貼り付け・アルファを設定 currentOverlay = mMap.addGroundOverlay(overlayOptions); - // カメラを移動 - //zoomMap(latitude, longitude); - // 透明度 assert currentOverlay != null; currentOverlay.setTransparency(0.8F); @@ -352,9 +339,6 @@ return; } - //解決しているはずの問題にエラーが起きています - //実行はできます - //勝手に治りました locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 50, this); @@ -364,9 +348,21 @@ public void onLocationChanged(Location location) { //初期画面は現在地を中心にするため... if (currentLatlng == null){ + //↓現在地ロード後画面中心を現在地にする場合 //zoomMap(location.getLatitude(), location.getLongitude()); + //ロード画面の終了 findViewById(R.id.LL_Load).setVisibility(View.GONE); + //現在地ボタンを表示 + findViewById(R.id.currentButton).setVisibility(View.VISIBLE); + ImageButton button1 = findViewById(R.id.currentButton); + + button1.setOnClickListener( v -> { + Log.d("debug", "currentbutton, 現在地にカメラを移動"); + System.out.println(shopsViewModel.getShopsLiveData().getValue()); + //現在地にカメラを移動 + zoomMap(currentLatlng.latitude, currentLatlng.longitude); + }); } //現在地が変更されるたびに現在地アイコンを移動