Merge remote-tracking branch 'origin/master'
# Conflicts: # app/src/main/res/layout/setup.xml
This commit is contained in:
commit
a599489e9c
|
@ -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"
|
||||
}
|
|
@ -1,8 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
|
||||
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
|
@ -13,27 +15,30 @@
|
|||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.Oplogy"
|
||||
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-->
|
||||
|
||||
<!-- 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}".-->
|
||||
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}".
|
||||
-->
|
||||
<meta-data
|
||||
android:name="com.google.android.geo.API_KEY"
|
||||
android:value="AIzaSyBQ1Ak-I2NL5TP4K59ZI0VgzKk6HNZuusw" />
|
||||
|
||||
|
||||
<activity
|
||||
android:name=".Maps"
|
||||
android:exported="false"
|
||||
android:label="@string/title_activity_maps" />
|
||||
<activity
|
||||
android:name=".Map_Activity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".TutorialActivity"
|
||||
android:exported="false" />
|
||||
|
@ -49,16 +54,13 @@
|
|||
<activity
|
||||
android:name=".CreateUUID"
|
||||
android:exported="false" />
|
||||
|
||||
<activity
|
||||
android:name="com.example.oplogy.DialogFragment"
|
||||
android:name=".DialogFragment"
|
||||
android:exported="false" />
|
||||
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
tools:ignore="DuplicateActivity">
|
||||
|
||||
tools:ignore="DuplicateActivity" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
|
@ -69,10 +71,3 @@
|
|||
|
||||
</manifest>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ public class FirestoreReception {
|
|||
}
|
||||
|
||||
//ClassIdを引数にデータの作成を行う
|
||||
public void getDocumentsByClassId(int classId) {
|
||||
public void getDocumentsByClassId(int classId, MainActivity context) {
|
||||
CollectionReference collectionRef = db.collection("QuestionnaireForms");
|
||||
|
||||
// classIdが引数のものを取得する
|
||||
|
@ -34,8 +34,8 @@ public class FirestoreReception {
|
|||
Map<String, Object> data = document.getData();
|
||||
|
||||
// CreateRootクラスのインスタンスを作成し、dataを引数として渡す
|
||||
GeoCoding geoCoding = new GeoCoding();
|
||||
geoCoding.processData(data);
|
||||
GeoCoder geoCoder = new GeoCoder();
|
||||
geoCoder.processData(data, context);
|
||||
}
|
||||
} else {
|
||||
Log.w("FirestoreReception", "Error getting documents.", task.getException());
|
||||
|
|
|
@ -1,26 +1,25 @@
|
|||
package com.example.oplogy;
|
||||
|
||||
import android.content.Context;
|
||||
import android.location.Address;
|
||||
import android.location.Geocoder;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.android.gms.maps.model.LatLng;
|
||||
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.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
public class GeoCoding {
|
||||
private GeoApiContext geoApiContext;
|
||||
public void processData(Map<String, Object> data) {
|
||||
public class GeoCoder {
|
||||
private Context context;
|
||||
|
||||
public void processData(Map<String, Object> data, Context context) {
|
||||
try {
|
||||
// Google Cloud Platformで作成したAPIキーを設定します
|
||||
geoApiContext = new GeoApiContext.Builder()
|
||||
.apiKey("AIzaSyBQ1Ak-I2NL5TP4K59ZI0VgzKk6HNZuusw")
|
||||
.build();
|
||||
this.context = context;
|
||||
|
||||
//家庭訪問先の住所
|
||||
List<String> address = (List<String>) data.get("address");
|
||||
//家庭訪問の第一希望日(配列0が希望時間帯のはじめ、配列1がおわり)
|
||||
|
@ -41,18 +40,20 @@ public class GeoCoding {
|
|||
Log.e("NullPointerException", "getの中身がnull" + e);
|
||||
}
|
||||
}
|
||||
|
||||
private LatLng geocodeAddress(String address) {
|
||||
try {
|
||||
Log.d("Geocodingtry", "tryに入った");
|
||||
GeocodingResult[] results = GeocodingApi.geocode(geoApiContext, address).await();
|
||||
Log.d("GeocodingResult", "Results: " + Arrays.toString(results));
|
||||
if (results != null && results.length > 0) {
|
||||
return new LatLng(results[0].geometry.location.lat, results[0].geometry.location.lng);
|
||||
Geocoder geocoder = new Geocoder(context, Locale.getDefault());
|
||||
List<Address> addresses = geocoder.getFromLocationName(address, 1);
|
||||
if (addresses != null && !addresses.isEmpty()) {
|
||||
Address addressResult = addresses.get(0);
|
||||
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);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -19,20 +19,18 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
|
|||
// ID作成のTextViewとImageView
|
||||
private TextView creatUUID;
|
||||
private ImageView imageUuid;
|
||||
private int previousCreateUUid = 0; //元の画像のインデックス
|
||||
|
||||
|
||||
// セットアップのTextViewとImageView
|
||||
private TextView setUp;
|
||||
private ImageView imageSetup;
|
||||
private int previousSetUp = 0; //元の画像のインデックス
|
||||
|
||||
// セットアップのTextViewとImageView
|
||||
private TextView root;
|
||||
private ImageView imageRoot;
|
||||
private int previousRoot = 0; //元の画像のインデックス
|
||||
// 提出状況のTextViewとImageView
|
||||
private TextView submission;
|
||||
private ImageView imageSubmission;
|
||||
|
||||
//firestoreの受信関連
|
||||
private FirebaseFirestore db;
|
||||
|
@ -61,12 +59,13 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
|
|||
// 提出状況のインテント
|
||||
submission = findViewById(R.id.submission);
|
||||
submission.setOnClickListener(this);
|
||||
imageSubmission = findViewById(R.id.imageSubmission);
|
||||
|
||||
// firestoreの受信関連
|
||||
db = FirebaseFirestore.getInstance();
|
||||
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){
|
||||
imageRoot.setImageResource(R.drawable.pin);
|
||||
Intent toRoot = new Intent(MainActivity.this,RootSearchActivity.class);
|
||||
Intent toRoot = new Intent(MainActivity.this, Map_Activity.class);
|
||||
startActivity(toRoot);
|
||||
}
|
||||
// 提出状況のクリック処理
|
||||
|
|
50
app/src/main/java/com/example/oplogy/Map_Activity.java
Normal file
50
app/src/main/java/com/example/oplogy/Map_Activity.java
Normal 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();
|
||||
|
||||
}
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
package com.example.oplogy;
|
||||
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.google.android.gms.maps.CameraUpdateFactory;
|
||||
|
@ -15,7 +14,7 @@ import com.example.oplogy.databinding.MapsBinding;
|
|||
public class Maps extends FragmentActivity implements OnMapReadyCallback {
|
||||
|
||||
private GoogleMap mMap;
|
||||
private MapsBinding binding;
|
||||
private MapsBinding binding;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
|
BIN
app/src/main/res/drawable/back_button.png
Normal file
BIN
app/src/main/res/drawable/back_button.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
BIN
app/src/main/res/drawable/submission.png
Normal file
BIN
app/src/main/res/drawable/submission.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 46 KiB |
|
@ -75,17 +75,18 @@
|
|||
|
||||
<!-- ルート表示のレイアウト-->
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="400dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="3"
|
||||
android:weightSum="2"
|
||||
android:layout_gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageRoot"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/box_root"
|
||||
android:src="@drawable/pin"
|
||||
android:layout_weight="1"
|
||||
/>
|
||||
|
||||
|
@ -104,18 +105,37 @@
|
|||
<Space
|
||||
android:layout_width="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
|
||||
android:id="@+id/submission"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="99dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="提出状況"
|
||||
android:textSize="40dp"
|
||||
android:textStyle="bold"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:gravity="left"
|
||||
android:layout_gravity="center"/>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
|
|
60
app/src/main/res/layout/map_activity.xml
Normal file
60
app/src/main/res/layout/map_activity.xml
Normal 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>
|
|
@ -1,9 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<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"
|
||||
android:id="@+id/map"
|
||||
android:name="com.google.android.gms.maps.SupportMapFragment"
|
||||
xmlns:map="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="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"/>
|
Loading…
Reference in New Issue
Block a user