From 38a565c3923a9f5aa365890bd04733ec1ff0514b Mon Sep 17 00:00:00 2001 From: it232115 Date: Tue, 18 Jun 2024 17:20:34 +0900 Subject: [PATCH] =?UTF-8?q?gitea=E3=81=B8=E3=81=AE=E5=A4=89=E6=9B=B4?= =?UTF-8?q?=E3=81=AE=E3=81=9F=E3=82=81=E3=81=AE=E3=82=B3=E3=83=9F=E3=83=83?= =?UTF-8?q?=E3=83=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/example/oplogy/CreateRoot.java | 28 +++++++++++++++++-- .../java/com/example/oplogy/GeoCoder.java | 9 ++++-- .../java/com/example/oplogy/MainActivity.java | 2 +- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/example/oplogy/CreateRoot.java b/app/src/main/java/com/example/oplogy/CreateRoot.java index 1fa50bf..d8890d5 100644 --- a/app/src/main/java/com/example/oplogy/CreateRoot.java +++ b/app/src/main/java/com/example/oplogy/CreateRoot.java @@ -1,5 +1,29 @@ package com.example.oplogy; -public class CreateRoot { +import android.util.Log; -} +import com.google.android.gms.maps.model.LatLng; +import com.google.firebase.Timestamp; + +public class CreateRoot { + private String address; + private Timestamp startTimestamp; + private Timestamp endTimestamp; + private long studentNumber; + private LatLng latLng; + + public void receiveData(String address, Timestamp startTimestamp, Timestamp endTimestamp, long studentNumber, LatLng latLng) { + this.address = address; + this.startTimestamp = startTimestamp; + this.endTimestamp = endTimestamp; + this.studentNumber = studentNumber; + this.latLng = latLng; + + // 受け取ったデータを利用してログを出力 + Log.d("CreateRoot", "address: " + address); + Log.d("CreateRoot", "startTimestamp: " + startTimestamp); + Log.d("CreateRoot", "endTimestamp: " + endTimestamp); + Log.d("CreateRoot", "studentNumber: " + studentNumber); + Log.d("CreateRoot", "latLng: " + latLng); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/oplogy/GeoCoder.java b/app/src/main/java/com/example/oplogy/GeoCoder.java index 76d994a..ddff733 100644 --- a/app/src/main/java/com/example/oplogy/GeoCoder.java +++ b/app/src/main/java/com/example/oplogy/GeoCoder.java @@ -29,13 +29,18 @@ public class GeoCoder { // 住所を緯度経度に変換 LatLng latLng = geocodeAddress(address.get(0)); + //デバッグ用ログ Log.d("FirestoreReception", "address: " + address.get(0)); Log.d("FirestoreReception", "firstDay: " + firstDay.get(0)); Log.d("FirestoreReception", "firstDay: " + firstDay.get(1)); Log.d("FirestoreReception", "studentNumber: " + studentNumber); + Log.d("FirestoreReception", "latLng: "+latLng ); + + // CreateRootクラスのインスタンスを作成 + CreateRoot createRoot = new CreateRoot(); + // データを渡す + createRoot.receiveData(address.get(0), firstDay.get(0), firstDay.get(1), studentNumber, latLng); - // 緯度経度をLogに出力 - Log.d("緯度経度", "latLng: "+latLng ); } catch (NullPointerException e) { Log.e("NullPointerException", "getの中身がnull" + e); } diff --git a/app/src/main/java/com/example/oplogy/MainActivity.java b/app/src/main/java/com/example/oplogy/MainActivity.java index 7fc95ff..3506cf6 100644 --- a/app/src/main/java/com/example/oplogy/MainActivity.java +++ b/app/src/main/java/com/example/oplogy/MainActivity.java @@ -92,7 +92,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe // ルート作成のクリック処理 if(view == root){ imageRoot.setImageResource(R.drawable.pin); - Intent toRoot = new Intent(MainActivity.this,MapsActivity.class); + Intent toRoot = new Intent(MainActivity.this,Maps.class); startActivity(toRoot); } // 提出状況のクリック処理