Merge pull request 'CreateMapsetc' (#11) from CreateMapsetc into master

Reviewed-on: #11
This commit is contained in:
Utahshi 2024-06-21 01:53:19 +00:00
commit 412add9c61
8 changed files with 182 additions and 439 deletions

View File

@ -51,21 +51,26 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
creatUUID = findViewById(R.id.creatUUID); creatUUID = findViewById(R.id.creatUUID);
creatUUID.setOnClickListener(this); creatUUID.setOnClickListener(this);
imageUuid = findViewById(R.id.imageUuid); imageUuid = findViewById(R.id.imageUuid);
imageUuid.setOnClickListener(this);
// セットアップ用のインテント // セットアップ用のインテント
setUp = findViewById(R.id.setUp); setUp = findViewById(R.id.setUp);
setUp.setOnClickListener(this); setUp.setOnClickListener(this);
imageSetup = findViewById(R.id.imageSetup); imageSetup = findViewById(R.id.imageSetup);
imageSetup.setOnClickListener(this);
// ルート作成用のインテント // ルート作成用のインテント
root = findViewById(R.id.root); root = findViewById(R.id.root);
root.setOnClickListener(this); root.setOnClickListener(this);
imageRoot = findViewById(R.id.imageRoot); imageRoot = findViewById(R.id.imageRoot);
imageRoot.setOnClickListener(this);
// 提出状況のインテント // 提出状況のインテント
submission = findViewById(R.id.submission); submission = findViewById(R.id.submission);
submission.setOnClickListener(this); submission.setOnClickListener(this);
imageSubmission = findViewById(R.id.imageSubmission); imageSubmission = findViewById(R.id.imageSubmission);
imageSubmission.setOnClickListener(this);
// firestoreの受信関連 // firestoreの受信関連
db = FirebaseFirestore.getInstance(); db = FirebaseFirestore.getInstance();
@ -83,15 +88,27 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
if(view == creatUUID){ if(view == creatUUID){
imageUuid.setImageResource(R.drawable.ischecked_uuid); imageUuid.setImageResource(R.drawable.ischecked_uuid);
showUUIDYesNoDialog();//UUIDを表示するかのダイアログ showUUIDYesNoDialog();//UUIDを表示するかのダイアログ
finish(); // 画面遷移後元の状態に戻す
}
if(view == imageUuid){
imageUuid.setImageResource(R.drawable.ischecked_uuid);
showUUIDYesNoDialog();//UUIDを表示するかのダイアログ
finish();
} }
// セットアップのクリック処理 // セットアップのクリック処理
if(view == setUp){ if(view == setUp){
imageSetup.setImageResource(R.drawable.ischecked_uuid); imageSetup.setImageResource(R.drawable.ischecked_uuid);
Intent toSetup = new Intent(MainActivity.this,SetUpActivity.class); Intent toSetup = new Intent(MainActivity.this,SetUpActivity.class);
startActivity(toSetup); startActivity(toSetup);
finish(); // 画面遷移後元の状態に戻す
} }
if (view == imageSetup){
imageSetup.setImageResource(R.drawable.ischecked_uuid);
Intent toSetup = new Intent(MainActivity.this,SetUpActivity.class);
startActivity(toSetup);
finish(); // 画面遷移後元の状態に戻す
}
// ルート作成のクリック処理 // ルート作成のクリック処理
if(view == root){ if(view == root){
imageRoot.setImageResource(R.drawable.pin); imageRoot.setImageResource(R.drawable.pin);
@ -138,11 +155,20 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
executor.shutdown(); executor.shutdown();
} }
if(view == imageRoot){
imageRoot.setImageResource(R.drawable.pin);
Intent toRoot = new Intent(MainActivity.this,Maps.class);
startActivity(toRoot);
}
// 提出状況のクリック処理 // 提出状況のクリック処理
if(view == submission){ if(view == submission){
Intent toSubmission = new Intent(MainActivity.this,SubmissionActivity.class); Intent toSubmission = new Intent(MainActivity.this,SubmissionActivity.class);
startActivity(toSubmission); startActivity(toSubmission);
} }
if(view == imageSubmission){
Intent toSubmission = new Intent(MainActivity.this,SubmissionActivity.class);
startActivity(toSubmission);
}
} }
private void showUUIDYesNoDialog() { private void showUUIDYesNoDialog() {
//ダイアログの表示 //ダイアログの表示

View File

@ -1,20 +1,43 @@
package com.example.oplogy; package com.example.oplogy;
import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentActivity;
import android.content.Intent;
import android.graphics.Color;
import android.media.Image;
import android.os.Bundle; import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.TextView;
import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback; import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions; import com.google.android.gms.maps.model.MarkerOptions;
import com.example.oplogy.databinding.MapsBinding; import com.example.oplogy.databinding.MapsBinding;
import com.google.android.gms.maps.model.Polyline;
import com.google.android.gms.maps.model.PolylineOptions;
import com.google.maps.DirectionsApi;
import com.google.maps.DirectionsApiRequest;
import com.google.maps.GeoApiContext;
import com.google.maps.model.DirectionsResult;
public class Maps extends FragmentActivity implements OnMapReadyCallback { import java.util.Locale;
import java.util.Map;
public class Maps extends FragmentActivity implements OnMapReadyCallback,View.OnClickListener{
// ボタンの戻る処理
ImageView backMain;
private GoogleMap mMap; private GoogleMap mMap;
private MapsBinding binding; private MapsBinding binding;
private LatLng loc;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@ -27,8 +50,13 @@ private MapsBinding binding;
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map); .findFragmentById(R.id.map);
mapFragment.getMapAsync(this); mapFragment.getMapAsync(this);
backMain = findViewById(R.id.BackMain);
backMain.setOnClickListener(this);
} }
/** /**
* Manipulates the map once available. * Manipulates the map once available.
* This callback is triggered when the map is ready to be used. * This callback is triggered when the map is ready to be used.
@ -42,9 +70,51 @@ private MapsBinding binding;
public void onMapReady(GoogleMap googleMap) { public void onMapReady(GoogleMap googleMap) {
mMap = googleMap; mMap = googleMap;
/// 地図の倍率を指定
// ここに地点の処理を書いておく
// Add a marker in Sydney and move the camera // Add a marker in Sydney and move the camera
LatLng sydney = new LatLng(-34, 151); loc = new LatLng(35.09050879999539, 136.87845379325216);
mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney")); mMap.addMarker(new MarkerOptions().position(loc).title("名古屋港水族館"));
mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney)); /// 表示位置を地図に指定
mMap.moveCamera(CameraUpdateFactory.newLatLng(loc));
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(loc, 17));
LatLng startLatLng = new LatLng(35.09050879999539, 136.87845379325216);
LatLng secandLatLng = new LatLng(35.09284820618655, 136.88165119390393);
LatLng thirdLatLng = new LatLng(35.09364708442631, 136.88171563326418);
Marker startMaker = mMap.addMarker(new MarkerOptions()
.position(startLatLng)
.title("名古屋港水族館")
);
Marker secondMaker = mMap.addMarker(new MarkerOptions()
.position(secandLatLng)
.title("2番目")
);
Marker thirdMaker = mMap.addMarker(new MarkerOptions()
.position(thirdLatLng)
.title("3番目")
);
drowRoute(startLatLng,secandLatLng,thirdLatLng);
}
private void drowRoute(LatLng startLatLng,LatLng secondLatLung,LatLng thirdLatLng){
GeoApiContext context = new GeoApiContext.Builder()
.apiKey("AIzaSyBQ1Ak-I2NL5TP4K59ZI0VgzKk6HNZuusw")
.build();
}
@Override
public void onClick(View view) {
if(view == backMain){
Intent backMain = new Intent(Maps.this,MainActivity.class);
startActivity(backMain);
}
} }
} }

View File

@ -6,9 +6,11 @@ import android.annotation.SuppressLint;
import android.app.TimePickerDialog; import android.app.TimePickerDialog;
import android.content.Intent; import android.content.Intent;
import android.graphics.Paint; import android.graphics.Paint;
import android.media.Image;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
import android.widget.Button; import android.widget.Button;
import android.widget.ImageView;
import android.widget.RadioButton; import android.widget.RadioButton;
import android.widget.TextView; import android.widget.TextView;
import android.widget.TimePicker; import android.widget.TimePicker;
@ -81,11 +83,11 @@ public class SetUpActivity extends FragmentActivity
startTimeSetButton = findViewById(R.id.startTimeSetButton); //開始時刻を設定するためのボタン startTimeSetButton = findViewById(R.id.startTimeSetButton); //開始時刻を設定するためのボタン
endTimeSetButton = findViewById(R.id.endTimeSetButton); //終了時刻を設定するためのボタン endTimeSetButton = findViewById(R.id.endTimeSetButton); //終了時刻を設定するためのボタン
TextView backMain = findViewById(R.id.backMain); ImageView toMain = findViewById(R.id.toMain);
Button setUp = findViewById(R.id.setUpButton); //画面下の設定ボタン Button setUp = findViewById(R.id.setUpButton); //画面下の設定ボタン
Button reset = findViewById(R.id.resetButton); Button reset = findViewById(R.id.resetButton);
backMain.setOnClickListener(view -> { toMain.setOnClickListener(view -> {
Intent intent = new Intent(SetUpActivity.this,MainActivity.class); //main画面へ戻る処理 Intent intent = new Intent(SetUpActivity.this,MainActivity.class); //main画面へ戻る処理
startActivity(intent); startActivity(intent);
}); });

View File

@ -1,60 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="10"
tools:context=".MapsActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="horizontal"
android:weightSum="10">
<ImageView
android:id="@+id/toMain"
android:layout_width="40dp"
android:layout_height="90dp"
android:src="@drawable/back_button"
android:layout_weight="5"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="4"
android:id="@+id/date"
android:hint="今日の日付"
android:textSize="40dp"
/>
</LinearLayout>
<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="0dp"
android:id="@+id/map_fragment_container"
tools:context=".Map"
android:layout_weight="6"
android:name="com.google.android.gms.maps.SupportMapFragment"
/>
<ScrollView
android:id="@+id/scrollName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="3"
/>
</LinearLayout>

View File

@ -9,15 +9,24 @@
android:gravity="center"> android:gravity="center">
<TextView <!-- <TextView-->
android:id="@+id/backMain" <!-- android:id="@+id/backMain"-->
android:layout_width="wrap_content" <!-- android:layout_width="wrap_content"-->
android:layout_height="wrap_content" <!-- android:layout_height="wrap_content"-->
<!-- android:layout_gravity="left"-->
<!-- android:paddingStart="20dp"-->
<!-- android:text="@string/Back"-->
<!-- android:textSize="50sp"-->
<!-- tools:ignore="RtlCompat,RtlHardcoded,RtlSymmetry" />-->
<ImageView
android:id="@+id/toMain"
android:layout_width="100dp"
android:layout_height="90dp"
android:layout_gravity="left" android:layout_gravity="left"
android:paddingStart="20dp" android:layout_marginLeft="20dp"
android:text="@string/Back" android:src="@drawable/back_button"/>
android:textSize="50sp"
tools:ignore="RtlCompat,RtlHardcoded,RtlSymmetry" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"

View File

@ -1,60 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="10"
tools:context=".Map_Activity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="horizontal"
android:weightSum="10">
<ImageView
android:id="@+id/toMain"
android:layout_width="40dp"
android:layout_height="90dp"
android:src="@drawable/back_button"
android:layout_weight="5"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="4"
android:id="@+id/date"
android:hint="今日の日付"
android:textSize="40dp"
/>
</LinearLayout>
<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="0dp"
android:id="@+id/map_fragment_container"
tools:context=".Map"
android:layout_weight="6"
android:name="com.google.android.gms.maps.SupportMapFragment"
/>
<ScrollView
android:id="@+id/scrollName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="3"
/>
</LinearLayout>

View File

@ -1,9 +1,61 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:map="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:id="@+id/map" android:weightSum="10"
tools:context=".Maps" xmlns:tools="http://schemas.android.com/tools"
android:name="com.google.android.gms.maps.SupportMapFragment"/> android:orientation="vertical"
tools:context=".Maps">
<!-- <fragment xmlns:android="http://schemas.android.com/apk/res/android"-->
<!-- xmlns:tools="http://schemas.android.com/tools"-->
<!-- xmlns:map="http://schemas.android.com/apk/res-auto"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:id="@+id/map"-->
<!-- android:name="com.google.android.gms.maps.SupportMapFragment"/>-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="horizontal"
android:weightSum="10">
<ImageView
android:id="@+id/BackMain"
android:layout_width="40dp"
android:layout_height="90dp"
android:src="@drawable/back_button"
android:layout_weight="5"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="4"
android:id="@+id/date"
android:hint="今日の日付"
android:textSize="40dp"
/>
</LinearLayout>
<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="6"
tools:context=".Maps" />
<ScrollView
android:id="@+id/scrollable"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="3"
/>
</LinearLayout>

View File

@ -1,296 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".SetUpActivity"
android:orientation="vertical"
android:gravity="center">
<TextView
android:id="@+id/toMain"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:paddingStart="20dp"
android:text="@string/Back"
android:textSize="50sp"
tools:ignore="RtlCompat,RtlHardcoded,RtlSymmetry" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="25dp"
android:text="@string/setUp"
android:textSize="30sp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="10dp"
android:gravity="center">
<TextView
android:layout_width="90sp"
android:layout_height="wrap_content"
android:text="@string/teacherName"
android:gravity="center"/>
<EditText
android:id="@+id/teacherName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints=""
android:inputType=""
tools:ignore="LabelFor" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="10dp"
android:gravity="center">
<TextView
android:layout_width="90sp"
android:layout_height="wrap_content"
android:text="@string/startPoint"
android:gravity="center"/>
<EditText
android:id="@+id/startPoint"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/startpoint"
android:autofillHints=""
android:inputType=""
tools:ignore="LabelFor" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="10dp"
android:gravity="center">
<TextView
android:layout_width="90sp"
android:layout_height="wrap_content"
android:text="@string/startTime"
android:gravity="center"/>
<TextView
android:id="@+id/startTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="   "
android:textSize="20sp"
android:textAlignment="center"
android:autofillHints=""
android:inputType=""
tools:ignore="HardcodedText,LabelFor"/>
<Button
android:id="@+id/startTimeSetButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="65dp"
android:layout_marginEnd="65dp"
android:text="@string/timeSet"
tools:ignore="DuplicateIds" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="10dp"
android:gravity="center">
<TextView
android:layout_width="90sp"
android:layout_height="wrap_content"
android:text="@string/endTime"
android:gravity="center"/>
<TextView
android:id="@+id/endTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="   "
android:textSize="20sp"
android:textAlignment="center"
android:autofillHints=""
android:inputType=""
tools:ignore="LabelFor"/>
<Button
android:id="@+id/endTimeSetButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/timeSet"
android:layout_marginStart="65dp"
android:layout_marginEnd="65dp"
tools:ignore="DuplicateIds" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="10dp"
android:gravity="center">
<TextView
android:layout_width="90sp"
android:layout_height="wrap_content"
android:text="@string/intervalTime"
android:gravity="center"/>
<RadioGroup
android:id="@+id/timeInterval"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="3">
<RadioButton
android:id="@+id/tenMinute"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/tenMinute"
android:paddingEnd="20dp"
tools:ignore="RtlSymmetry" />
<RadioButton
android:id="@+id/fifteenMinute"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/fifteenMinute"
android:paddingEnd="20dp"
tools:ignore="RtlSymmetry" />
<RadioButton
android:id="@+id/thirtyMinute"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/thirtyMinute"
android:paddingEnd="20dp"
tools:ignore="RtlSymmetry" />
</RadioGroup>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="5dp"
android:orientation="horizontal"
android:weightSum="10"
android:gravity="center">
<TextView
android:layout_width="90sp"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_weight="1"
android:text="@string/breakTime" />
<TextView
android:id="@+id/startBreakTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint=" から "
android:textSize="20sp"
android:textAlignment="center"
android:autofillHints=""
android:layout_weight="4"
android:inputType=""
tools:ignore="LabelFor"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textSize="30sp"
android:paddingStart="30dp"
android:paddingEnd="30dp" />
<TextView
android:id="@+id/endBreakTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20sp"
android:hint=" まで "
android:textAlignment="center"
android:autofillHints=""
android:layout_weight="4"
android:inputType=""
tools:ignore="LabelFor"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="10dp"
android:gravity="center">
<TextView
android:layout_width="90sp"
android:layout_height="wrap_content"
android:text="@string/totalStudent"
android:gravity="center"/>
<EditText
android:id="@+id/totalStudent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="例30人➝30"
android:autofillHints=""
android:inputType=""
tools:ignore="LabelFor"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="2"
android:layout_marginTop="20sp">
<Button
android:id="@+id/resetButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reset"
android:layout_marginEnd="100dp"
style="?android:attr/buttonBarButtonStyle" />
<Button
android:id="@+id/setUpButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/setUp"
style="?android:attr/buttonBarButtonStyle" />
</LinearLayout>
</LinearLayout>