diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 691fcea..5e88377 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -24,11 +24,11 @@
android:name=".ShopCreateActivity"
android:exported="true"
android:label="@string/title_activity_shop_create">
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
{
Log.d("debug", "currentbutton, 現在地にカメラを移動");
+ shopsViewModel.setViewArea(currentLatlng.longitude+20, currentLatlng.latitude+20.0, currentLatlng.longitude-20.0, currentLatlng.latitude-20.0);
+ System.out.println(shopsViewModel.getShopsLiveData().getValue());
//現在地にカメラを移動
zoomMap(currentLatlng.latitude, currentLatlng.longitude);
});
@@ -105,10 +110,9 @@
mMap = googleMap;
//ViewModelへのアクセス
- ShopsViewModel shopsViewModel = new ViewModelProvider(this).get(ShopsViewModel.class);
+ shopsViewModel = new ViewModelProvider(this).get(ShopsViewModel.class);
//ダミーショップaとcが返される座標にしておく
- //画面スクロールに応じて以下の1行を実行するようにする
- shopsViewModel.setViewArea(20.0, 40.0, 10.0, 30.0);
+ shopsViewModel.setViewArea(40.0, 140.0, 20.0, 100.0);
// LiveDataへの購読
shopsViewModel.getShopsLiveData().observe(this, shops -> {
@@ -116,6 +120,7 @@
//対応するMarkerがなければMarkerを立てる
for(Shop shop:shops) {
if(shopsViewModel.getMarker(shop)==null){
+
shopLatlng = new LatLng(shop.getLatitude(), shop.getLongitude());
System.out.println(shopLatlng);
Marker createMaker = mMap.addMarker(new MarkerOptions().position(shopLatlng).title(""));
@@ -138,9 +143,9 @@
testLatlng2 = new LatLng(34.74, 135.26);
//初期画面の座標(現在地をロードするまで)
-// initialLatlng = new LatLng(39,138);
+ initialLatlng = new LatLng(39,138);
//店Cの座標にカメラ移動
- initialLatlng = new LatLng(34.5,12.3);
+// initialLatlng = new LatLng(34.5,12.3);
//初期画面に移動
// mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(initialLatlng, 5f));
@@ -169,7 +174,7 @@
//長押し時に店を作成し、その座標にピンを立てる
//長押し時にその座標を保存し、投稿画面に移り、Shop作成完了時にはピンを立て、Shop画面に移行
mMap.setOnMapLongClickListener(longpushLocation -> {
- // Nemophila nemophila = (Nemophila) this.getApplication();
+ // Nemophila nemophila = (Nemophila) this.getApplication();
//長押しされた位置の緯度経度を取得
//LatLng newlocation = new LatLng(longpushLocation.latitude, longpushLocation.longitude);
//Nemophilaに座標を保存
@@ -202,12 +207,17 @@
//店の詳細と投稿一覧を表示
//ここでshopActivityを呼び出す
+
+
//下からクリックしたことを通知
Toast.makeText(MainActivity.this, "ピンクリック", Toast.LENGTH_SHORT).show();
- //選んだ店をsetする(現状はnullになっているが後で直す)
- nemophila.setCurrentShop((Shop)marker.getTag());
- System.out.println(nemophila.getCurrentShop().getName());
+// //選んだ店をsetする(現状はnullになっているが後で直す)
+// nemophila.setCurrentShop((Shop)marker.getTag());
+// System.out.println(nemophila.getCurrentShop().getName());
+ //テスト用
+ //画面スクロールに応じて以下の1行を実行するようにする
+ shopsViewModel.setViewArea(41.0, 140.0, 20.0, 100.0);
return false;
}
@@ -356,7 +366,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);
}
@@ -394,4 +404,4 @@
}
-}
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/nemophila/ShopCreateActivity.java b/app/src/main/java/com/example/nemophila/ShopCreateActivity.java
index c1b74e3..ada41a8 100644
--- a/app/src/main/java/com/example/nemophila/ShopCreateActivity.java
+++ b/app/src/main/java/com/example/nemophila/ShopCreateActivity.java
@@ -32,9 +32,10 @@
shopsViewModel.getCurrentLiveData().observe(this, shop -> {
// ShopActivityでどこの店についての投稿かを管理できるように更新する
nemophila.setCurrentShop(shop);
+ shopsViewModel.setShopAndMarker(shop,null);
// ShopActivityへ画面遷移する
- Intent intent = new Intent(getApplication(), ShopActivity.class);
+ Intent intent = new Intent(getApplication(), MainActivity.class);
startActivity(intent);
});