Merge branch 'master' into Setup

This commit is contained in:
ユタ氏 2024-06-11 14:17:00 +09:00 committed by GitHub
commit 5a33390c86
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
23 changed files with 395 additions and 205 deletions

View File

@ -1,5 +1,6 @@
<?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">
<application <application
@ -15,7 +16,21 @@
<activity <activity
android:name=".SetUpActivity" android:name=".SetUpActivity"
android:exported="false" /> android:exported="false" />
<!--
xmlns:tools="http://schemas.android.com/tools">
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Oplogy"
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:
@ -25,7 +40,7 @@
Once you have your API key (it starts with "AIza"), define a new property in your 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 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}". "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" />
@ -45,10 +60,48 @@
android:exported="true"> android:exported="true">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<activity
android:name=".Maps"
android:exported="false"
android:label="@string/title_activity_maps" />
<activity
android:name=".TutorialActivity"
android:exported="false" />
<activity
android:name=".SubmissionActivity"
android:exported="false" />
<activity
android:name=".RootSearchActivity"
android:exported="false" />
<activity
android:name=".SetupActivity"
android:exported="false" />
<activity
android:name=".CreateUUID"
android:exported="false" />
<activity
android:name="com.example.oplogy.DialogFragment"
android:exported="false"
/>
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
</application> </application>
</manifest> </manifest>

View File

@ -0,0 +1,14 @@
package com.example.oplogy;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class CreateUUID extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.create_uuid);
}
}

View File

@ -0,0 +1,13 @@
package com.example.oplogy;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class DialogFragment extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.dialog_fragment);
}
}

View File

@ -1,143 +1,91 @@
package com.example.oplogy; package com.example.oplogy;
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import com.google.firebase.firestore.FirebaseFirestore; import android.content.Intent;
import com.google.firebase.firestore.QueryDocumentSnapshot; import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity implements View.OnClickListener{
// 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; //元の画像のインデックス
public class MainActivity extends AppCompatActivity implements View.OnClickListener { // セットアップのTextViewとImageView
private TextView textView; private TextView root;
private Button btnShow; private ImageView imageRoot;
private Button btnAdd; private int previousRoot = 0; //元の画像のインデックス
private EditText number; // 提出状況のTextViewとImageView
private EditText address; private TextView submission;
private EditText date;
private EditText time;
private FirebaseFirestore db = FirebaseFirestore.getInstance();
Button button;
// TextView textView;
EditText editText;
@SuppressLint("MissingInflatedId")
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main); setContentView(R.layout.main);
// ID作成用のインテント
creatUUID = findViewById(R.id.creatUUID);
creatUUID.setOnClickListener(this);
imageUuid = findViewById(R.id.imageUuid);
textView=findViewById(R.id.showText); // セットアップ用のインテント
btnShow=findViewById(R.id.btnShow); setUp = findViewById(R.id.setUp);
btnAdd=findViewById(R.id.btnAdd); setUp.setOnClickListener(this);
imageSetup = findViewById(R.id.imageSetup);
number=findViewById(R.id.editNumber); // ルート作成用のインテント
address=findViewById(R.id.editAddress); root = findViewById(R.id.root);
date=findViewById(R.id.editDate); root.setOnClickListener(this);
time=findViewById(R.id.editTime); imageRoot = findViewById(R.id.imageRoot);
// 提出状況のインテント
submission = findViewById(R.id.submission);
submission.setOnClickListener(this);
//データの追加(適当なデータを追加しています実際にはデータベースに保存したいデータを追加してください)
findViewById(R.id.btnAdd).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
User user = new User(number.getText().toString(), address.getText().toString(),date.getText().toString(),time.getText().toString());
db.collection("users")
.add(user)
.addOnSuccessListener(documentReference -> Log.d("@FB1", "DocumentSnapshot added with ID: " + documentReference.getId()))
.addOnFailureListener(e -> Log.w("@FB1", "Error adding document", e));
}
});
btnShow.setOnClickListener(v -> {
// Read Data
// Firestoreのコレクションusersのドキュメント一覧を取得する
// 非同期で取得処理が動作する結果を受け取るために処理完了時のリスナーをセットする
db.collection("users").get().addOnCompleteListener(task -> {
String data = "";
if (task.isSuccessful()) {
for (QueryDocumentSnapshot document : task.getResult()) {
Log.d("@FB1", document.getId() + "=>" + document.getData());
User user = document.toObject(User.class);
data += user + "\n";
}
} else {
data = "Error getting documents." + task.getException().getMessage();
}
textView.setText(data);//編集したデータを画面下部に表示
});
});
findViewById(R.id.mapmapcreate).setOnClickListener(
view->{
}
);
} }
// クリック処理
@Override @Override
public void onClick(View v) { public void onClick(View view) {
// ID作成のクリック処理
if(view == creatUUID){
imageUuid.setImageResource(R.drawable.ischecked_uuid);
Intent toCreateUUID = new Intent(MainActivity.this, CreateUUID.class);
startActivity(toCreateUUID);
}
// セットアップのクリック処理
if(view == setUp){
imageSetup.setImageResource(R.drawable.ischecked_uuid);
Intent toSetup = new Intent(MainActivity.this,SetupActivity.class);
startActivity(toSetup);
}
// ルート作成のクリック処理
if(view == root){
imageRoot.setImageResource(R.drawable.pin);
Intent toRoot = new Intent(MainActivity.this,RootSearchActivity.class);
startActivity(toRoot);
}
// 提出状況のクリック処理
if(view == submission){
Intent toSubmission = new Intent(MainActivity.this,SubmissionActivity.class);
startActivity(toSubmission);
}
} }
}
class User {
private String number;
private String address;
private String date;
private String time;
public User() {
}
public User(String number, String address, String data, String time) {
this.number = number;
this.address = address;
this.date = data;
this.time = time;
}
//getterとsetter
public String getNumber() {
return number;
}
public String getAddress() {
return address;
}
public String getDate() {
return date;
}
public String getTime() {
return time;
}
public void setNumber(String number) {
this.number = number;
}
public void setAddress(String address) {
this.address = address;
}
public void setDate(String date) {
this.date = date;
}
public void setTime(String time) {
this.time = time;
}
} }

View File

@ -10,19 +10,18 @@ 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.LatLng; import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions; import com.google.android.gms.maps.model.MarkerOptions;
import com.example.oplogy.databinding.ActivityMapsBinding; import com.example.oplogy.databinding.MapsBinding;
//import com.google.type.LatLng;
public class MapsActivity extends FragmentActivity implements OnMapReadyCallback { public class Maps extends FragmentActivity implements OnMapReadyCallback {
private GoogleMap mMap; private GoogleMap mMap;
private ActivityMapsBinding binding; private MapsBinding binding;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
binding = ActivityMapsBinding.inflate(getLayoutInflater()); binding = MapsBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot()); setContentView(binding.getRoot());
// Obtain the SupportMapFragment and get notified when the map is ready to be used. // Obtain the SupportMapFragment and get notified when the map is ready to be used.
@ -45,13 +44,8 @@ public class MapsActivity extends FragmentActivity implements OnMapReadyCallback
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);
LatLng loc = new LatLng(35.17260398479137, 136.88635173557998); mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney"));
/// マーカーオプションを設定情報ウィンドウ mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
mMap.addMarker(new MarkerOptions().position(loc).title("トライデントコンピュータ専門学校"));
/// 表示位置を地図に指定
mMap.moveCamera(CameraUpdateFactory.newLatLng(loc));
/// 地図の倍率を指定
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(loc, 17));
} }
} }

View File

@ -0,0 +1,14 @@
package com.example.oplogy;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class RootSearchActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.root_search);
}
}

View File

@ -0,0 +1,14 @@
package com.example.oplogy;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class SetupActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.setup);
}
}

View File

@ -0,0 +1,14 @@
package com.example.oplogy;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class SubmissionActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.submission);
}
}

View File

@ -0,0 +1,14 @@
package com.example.oplogy;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class TutorialActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.tutorial);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

View File

@ -1,69 +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=".MainActivity"
android:orientation="vertical">
<EditText
android:id="@+id/editNumber"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="番号" />
<EditText
android:id="@+id/editAddress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="住所" />
<EditText
android:id="@+id/editDate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="日付" />
<EditText
android:id="@+id/editTime"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="時間" />
<Button
android:id="@+id/btnAdd"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="追加"/>
<Button
android:id="@+id/btnShow"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="表示" />
<TextView
android:id="@+id/showText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="" />
=======
<Button
android:id="@+id/mapmapcreate"
android:text="マップ生成"
android:textSize="50px"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
<EditText
android:id="@+id/textview1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="100px"
android:hint="ここだよ"
android:text=""
/>
</LinearLayout>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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=".CreateUUID">
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".DialogFragment">
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,126 @@
<?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="20"
tools:context=".MainActivity">
<Space
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="2"/>
<!-- ID作成のレイアウト-->
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="3"
android:weightSum="2"
android:orientation="horizontal">
<ImageView
android:id="@+id/imageUuid"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:src="@drawable/checked_image"
android:layout_weight="1"
/>
<TextView
android:id="@+id/creatUUID"
android:layout_width="99dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="left"
android:text="ID作成"
android:textSize="50dp"
/>
</LinearLayout>
<!-- セットアップのレイアウト-->
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="3"
android:weightSum="2"
android:orientation="horizontal">
<ImageView
android:id="@+id/imageSetup"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:src="@drawable/checked_image"
android:layout_weight="1"
/>
<TextView
android:id="@+id/setUp"
android:layout_width="99dp"
android:layout_height="wrap_content"
android:text="セットアップ"
android:textSize="40dp"
android:textStyle="bold"
android:layout_weight="1"
android:gravity="left"
android:layout_gravity="center"/>
</LinearLayout>
<!-- ルート表示のレイアウト-->
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="3"
android:weightSum="2"
android:orientation="horizontal">
<ImageView
android:id="@+id/imageRoot"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:src="@drawable/box_root"
android:layout_weight="1"
/>
<TextView
android:id="@+id/root"
android:layout_width="99dp"
android:layout_height="wrap_content"
android:text="ルート表示"
android:textSize="40dp"
android:textStyle="bold"
android:layout_weight="1"
android:gravity="left"
android:layout_gravity="center"/>
</LinearLayout>
<Space
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="2"/>
<!-- 提出状況のレイアウト-->
<TextView
android:id="@+id/submission"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="提出状況"
android:textSize="40dp"
android:layout_weight="1"
android:gravity="center"
android:layout_gravity="center"/>
</LinearLayout>

View File

@ -6,4 +6,4 @@
android:name="com.google.android.gms.maps.SupportMapFragment" 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=".MapsActivity" /> tools:context=".Maps" />

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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=".RootSearchActivity">
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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">
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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=".SubmissionActivity">
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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=".TutorialActivity">
</androidx.constraintlayout.widget.ConstraintLayout>