Merge remote-tracking branch 'origin/master'

# Conflicts:
#	app/src/main/res/layout/setup.xml
This commit is contained in:
it232115 2024-06-18 14:02:16 +09:00
commit a599489e9c
12 changed files with 193 additions and 98 deletions

View File

@ -1,29 +0,0 @@
{
"project_info": {
"project_number": "317219128586",
"project_id": "oplogy-b6971",
"storage_bucket": "oplogy-b6971.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:317219128586:android:c29583456e8fbd5f12a6f3",
"android_client_info": {
"package_name": "com.example.oplogy"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyDaULi2TFHLiscR7DSZBCKS08d76Rtb49c"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": []
}
}
}
],
"configuration_version": "1"
}

View File

@ -1,8 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"> xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<application <application
android:allowBackup="true" android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules" android:dataExtractionRules="@xml/data_extraction_rules"
@ -15,25 +17,28 @@
tools:ignore="ExtraText" tools:ignore="ExtraText"
tools:targetApi="31" > tools:targetApi="31" >
<!-- TODO: Before you run your application, you need a Google Maps API key.--> <!--
TODO: Before you run your application, you need a Google Maps API key.
<!-- To get one, follow the directions here:--> To get one, follow the directions here:
<!-- https://developers.google.com/maps/documentation/android-sdk/get-api-key--> https://developers.google.com/maps/documentation/android-sdk/get-api-key
<!-- Once you have your API key (it starts with "AIza"), define a new property in your-->
<!-- project's local.properties file (e.g. MAPS_API_KEY=Aiza...), and replace the-->
<!-- "YOUR_API_KEY" string in this file with "${MAPS_API_KEY}".-->
Once you have your API key (it starts with "AIza"), define a new property in your
project's local.properties file (e.g. MAPS_API_KEY=Aiza...), and replace the
"YOUR_API_KEY" string in this file with "${MAPS_API_KEY}".
-->
<meta-data <meta-data
android:name="com.google.android.geo.API_KEY" android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyBQ1Ak-I2NL5TP4K59ZI0VgzKk6HNZuusw" /> android:value="AIzaSyBQ1Ak-I2NL5TP4K59ZI0VgzKk6HNZuusw" />
<activity <activity
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" />
@ -49,16 +54,13 @@
<activity <activity
android:name=".CreateUUID" android:name=".CreateUUID"
android:exported="false" /> android:exported="false" />
<activity <activity
android:name="com.example.oplogy.DialogFragment" android:name=".DialogFragment"
android:exported="false" /> android:exported="false" />
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:exported="true" android:exported="true"
tools:ignore="DuplicateActivity" > tools:ignore="DuplicateActivity" >
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
@ -69,10 +71,3 @@
</manifest> </manifest>

View File

@ -20,7 +20,7 @@ public class FirestoreReception {
} }
//ClassIdを引数にデータの作成を行う //ClassIdを引数にデータの作成を行う
public void getDocumentsByClassId(int classId) { public void getDocumentsByClassId(int classId, MainActivity context) {
CollectionReference collectionRef = db.collection("QuestionnaireForms"); CollectionReference collectionRef = db.collection("QuestionnaireForms");
// classIdが引数のものを取得する // classIdが引数のものを取得する
@ -34,8 +34,8 @@ public class FirestoreReception {
Map<String, Object> data = document.getData(); Map<String, Object> data = document.getData();
// CreateRootクラスのインスタンスを作成しdataを引数として渡す // CreateRootクラスのインスタンスを作成しdataを引数として渡す
GeoCoding geoCoding = new GeoCoding(); GeoCoder geoCoder = new GeoCoder();
geoCoding.processData(data); geoCoder.processData(data, context);
} }
} else { } else {
Log.w("FirestoreReception", "Error getting documents.", task.getException()); Log.w("FirestoreReception", "Error getting documents.", task.getException());

View File

@ -1,26 +1,25 @@
package com.example.oplogy; package com.example.oplogy;
import android.content.Context;
import android.location.Address;
import android.location.Geocoder;
import android.util.Log; import android.util.Log;
import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.LatLng;
import com.google.firebase.Timestamp; import com.google.firebase.Timestamp;
import com.google.maps.GeoApiContext;
import com.google.maps.GeocodingApi;
import com.google.maps.model.GeocodingResult;
import java.util.Arrays; import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.Locale;
import java.util.Map; import java.util.Map;
public class GeoCoding { public class GeoCoder {
private GeoApiContext geoApiContext; private Context context;
public void processData(Map<String, Object> data) {
public void processData(Map<String, Object> data, Context context) {
try { try {
// Google Cloud Platformで作成したAPIキーを設定します this.context = context;
geoApiContext = new GeoApiContext.Builder()
.apiKey("AIzaSyBQ1Ak-I2NL5TP4K59ZI0VgzKk6HNZuusw")
.build();
//家庭訪問先の住所 //家庭訪問先の住所
List<String> address = (List<String>) data.get("address"); List<String> address = (List<String>) data.get("address");
//家庭訪問の第一希望日(配列0が希望時間帯のはじめ配列1がおわり) //家庭訪問の第一希望日(配列0が希望時間帯のはじめ配列1がおわり)
@ -41,18 +40,20 @@ public class GeoCoding {
Log.e("NullPointerException", "getの中身がnull" + e); Log.e("NullPointerException", "getの中身がnull" + e);
} }
} }
private LatLng geocodeAddress(String address) { private LatLng geocodeAddress(String address) {
try { try {
Log.d("Geocodingtry", "tryに入った"); Geocoder geocoder = new Geocoder(context, Locale.getDefault());
GeocodingResult[] results = GeocodingApi.geocode(geoApiContext, address).await(); List<Address> addresses = geocoder.getFromLocationName(address, 1);
Log.d("GeocodingResult", "Results: " + Arrays.toString(results)); if (addresses != null && !addresses.isEmpty()) {
if (results != null && results.length > 0) { Address addressResult = addresses.get(0);
return new LatLng(results[0].geometry.location.lat, results[0].geometry.location.lng); double latitude = addressResult.getLatitude();
double longitude = addressResult.getLongitude();
return new LatLng(latitude, longitude);
} }
} catch (Exception e) { } catch (IOException e) {
Log.e("GeocodingException", "Error geocoding address: " + address, e); Log.e("GeocodingException", "Error geocoding address: " + address, e);
} }
return null; return null;
} }
} }

View File

@ -19,20 +19,18 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
// ID作成のTextViewとImageView // ID作成のTextViewとImageView
private TextView creatUUID; private TextView creatUUID;
private ImageView imageUuid; private ImageView imageUuid;
private int previousCreateUUid = 0; //元の画像のインデックス
// セットアップのTextViewとImageView // セットアップのTextViewとImageView
private TextView setUp; private TextView setUp;
private ImageView imageSetup; private ImageView imageSetup;
private int previousSetUp = 0; //元の画像のインデックス
// セットアップのTextViewとImageView // セットアップのTextViewとImageView
private TextView root; private TextView root;
private ImageView imageRoot; private ImageView imageRoot;
private int previousRoot = 0; //元の画像のインデックス
// 提出状況のTextViewとImageView // 提出状況のTextViewとImageView
private TextView submission; private TextView submission;
private ImageView imageSubmission;
//firestoreの受信関連 //firestoreの受信関連
private FirebaseFirestore db; private FirebaseFirestore db;
@ -61,12 +59,13 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
// 提出状況のインテント // 提出状況のインテント
submission = findViewById(R.id.submission); submission = findViewById(R.id.submission);
submission.setOnClickListener(this); submission.setOnClickListener(this);
imageSubmission = findViewById(R.id.imageSubmission);
// firestoreの受信関連 // firestoreの受信関連
db = FirebaseFirestore.getInstance(); db = FirebaseFirestore.getInstance();
firestoreReception = new FirestoreReception(); firestoreReception = new FirestoreReception();
firestoreReception.getDocumentsByClassId(100); firestoreReception.getDocumentsByClassId(100,MainActivity.this);
@ -93,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,RootSearchActivity.class); Intent toRoot = new Intent(MainActivity.this, Map_Activity.class);
startActivity(toRoot); startActivity(toRoot);
} }
// 提出状況のクリック処理 // 提出状況のクリック処理

View File

@ -0,0 +1,50 @@
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();
}
}

View File

@ -1,7 +1,6 @@
package com.example.oplogy; package com.example.oplogy;
import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentActivity;
import android.os.Bundle; import android.os.Bundle;
import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.CameraUpdateFactory;

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

View File

@ -75,17 +75,18 @@
<!-- ルート表示のレイアウト--> <!-- ルート表示のレイアウト-->
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="400dp"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="3" android:layout_weight="3"
android:weightSum="2" android:weightSum="2"
android:layout_gravity="center"
android:orientation="horizontal"> android:orientation="horizontal">
<ImageView <ImageView
android:id="@+id/imageRoot" android:id="@+id/imageRoot"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:src="@drawable/box_root" android:src="@drawable/pin"
android:layout_weight="1" android:layout_weight="1"
/> />
@ -104,18 +105,37 @@
<Space <Space
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="2"/> android:layout_weight="3"/>
<!-- 提出状況のレイアウト--> <!-- 提出状況のレイアウト-->
<LinearLayout
android:layout_width="350dp"
android:layout_height="0dp"
android:layout_weight="3"
android:layout_gravity="center"
android:weightSum="2"
android:orientation="horizontal">
<ImageView
android:id="@+id/imageSubmission"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:src="@drawable/submission"
android:layout_weight="1"
/>
<TextView <TextView
android:id="@+id/submission" android:id="@+id/submission"
android:layout_width="wrap_content" android:layout_width="99dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="提出状況" android:text="提出状況"
android:textSize="40dp" android:textSize="40dp"
android:textStyle="bold"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center" android:gravity="left"
android:layout_gravity="center"/> android:layout_gravity="center"/>
</LinearLayout>

View File

@ -0,0 +1,60 @@
<?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,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android" <fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map" xmlns:map="http://schemas.android.com/apk/res-auto"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".Maps" /> android:id="@+id/map"
tools:context=".Maps"
android:name="com.google.android.gms.maps.SupportMapFragment"/>