Merge pull request 'CreateRoot' (#2) from CreateRoot into master
Reviewed-on: #2
This commit is contained in:
commit
507cfc739c
|
@ -37,9 +37,6 @@
|
||||||
android:name=".Maps"
|
android:name=".Maps"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
android:label="@string/title_activity_maps" />
|
android:label="@string/title_activity_maps" />
|
||||||
<activity
|
|
||||||
android:name=".Map_Activity"
|
|
||||||
android:exported="false" />
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".TutorialActivity"
|
android:name=".TutorialActivity"
|
||||||
android:exported="false" />
|
android:exported="false" />
|
||||||
|
|
|
@ -1,5 +1,29 @@
|
||||||
package com.example.oplogy;
|
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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -29,13 +29,18 @@ public class GeoCoder {
|
||||||
// 住所を緯度経度に変換
|
// 住所を緯度経度に変換
|
||||||
LatLng latLng = geocodeAddress(address.get(0));
|
LatLng latLng = geocodeAddress(address.get(0));
|
||||||
|
|
||||||
|
//デバッグ用ログ
|
||||||
Log.d("FirestoreReception", "address: " + address.get(0));
|
Log.d("FirestoreReception", "address: " + address.get(0));
|
||||||
Log.d("FirestoreReception", "firstDay: " + firstDay.get(0));
|
Log.d("FirestoreReception", "firstDay: " + firstDay.get(0));
|
||||||
Log.d("FirestoreReception", "firstDay: " + firstDay.get(1));
|
Log.d("FirestoreReception", "firstDay: " + firstDay.get(1));
|
||||||
Log.d("FirestoreReception", "studentNumber: " + studentNumber);
|
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) {
|
} catch (NullPointerException e) {
|
||||||
Log.e("NullPointerException", "getの中身がnull" + e);
|
Log.e("NullPointerException", "getの中身がnull" + e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,7 +92,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
|
||||||
// ルート作成のクリック処理
|
// ルート作成のクリック処理
|
||||||
if(view == root){
|
if(view == root){
|
||||||
imageRoot.setImageResource(R.drawable.pin);
|
imageRoot.setImageResource(R.drawable.pin);
|
||||||
Intent toRoot = new Intent(MainActivity.this, Map_Activity.class);
|
Intent toRoot = new Intent(MainActivity.this,Maps.class);
|
||||||
startActivity(toRoot);
|
startActivity(toRoot);
|
||||||
}
|
}
|
||||||
// 提出状況のクリック処理
|
// 提出状況のクリック処理
|
||||||
|
|
|
@ -1,50 +0,0 @@
|
||||||
package com.example.oplogy;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
import androidx.fragment.app.Fragment;
|
|
||||||
import androidx.fragment.app.FragmentManager;
|
|
||||||
import androidx.fragment.app.FragmentTransaction;
|
|
||||||
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import com.google.android.gms.maps.GoogleMap;
|
|
||||||
import com.google.android.gms.maps.MapFragment;
|
|
||||||
import com.google.android.gms.maps.OnMapReadyCallback;
|
|
||||||
import com.google.android.gms.maps.SupportMapFragment;
|
|
||||||
|
|
||||||
public class Map_Activity extends AppCompatActivity implements View.OnClickListener, OnMapReadyCallback {
|
|
||||||
ImageView toMain;
|
|
||||||
private GoogleMap mMap;
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
setContentView(R.layout.map_activity);
|
|
||||||
|
|
||||||
|
|
||||||
// ボタンの戻る処理
|
|
||||||
toMain = findViewById(R.id.toMain);
|
|
||||||
toMain.setOnClickListener(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
if(view == toMain){
|
|
||||||
Intent toMain = new Intent(Map_Activity.this,MainActivity.class);
|
|
||||||
startActivity(toMain);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void onMapReady(@NonNull GoogleMap googleMap) {
|
|
||||||
mMap = googleMap;
|
|
||||||
|
|
||||||
FragmentManager fragmentManager = getSupportFragmentManager();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,52 +0,0 @@
|
||||||
package com.example.oplogy;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
import androidx.fragment.app.Fragment;
|
|
||||||
import androidx.fragment.app.FragmentManager;
|
|
||||||
import androidx.fragment.app.FragmentTransaction;
|
|
||||||
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import com.example.oplogy.databinding.MapsBinding;
|
|
||||||
import com.google.android.gms.maps.GoogleMap;
|
|
||||||
import com.google.android.gms.maps.MapFragment;
|
|
||||||
import com.google.android.gms.maps.OnMapReadyCallback;
|
|
||||||
import com.google.android.gms.maps.SupportMapFragment;
|
|
||||||
import com.google.common.collect.MapMaker;
|
|
||||||
|
|
||||||
public class MapsActivity extends AppCompatActivity implements View.OnClickListener, OnMapReadyCallback{
|
|
||||||
ImageView toMain;
|
|
||||||
private GoogleMap mMap;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
setContentView(R.layout.activity_maps);
|
|
||||||
|
|
||||||
// ボタンの戻る処理
|
|
||||||
toMain = findViewById(R.id.toMain);
|
|
||||||
toMain.setOnClickListener(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
// メイン画面に戻る
|
|
||||||
if(view == toMain){
|
|
||||||
Intent toMain = new Intent(MapsActivity.this,MainActivity.class);
|
|
||||||
startActivity(toMain);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void onMapReady(@NonNull GoogleMap googleMap) {
|
|
||||||
mMap = googleMap;
|
|
||||||
FragmentManager fragmentManager = getSupportFragmentManager();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user