菊池
メインの作成開始と、全体の名前の変更
This commit is contained in:
parent
4e65216874
commit
455e903026
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<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
|
||||
android:allowBackup="true"
|
||||
|
@ -11,7 +11,29 @@
|
|||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.Oplogy"
|
||||
tools:targetApi="31">
|
||||
tools:targetApi="31" >
|
||||
<activity
|
||||
android:name=".Main"
|
||||
android:exported="false" />
|
||||
<!--
|
||||
TODO: Before you run your application, you need a Google Maps API key.
|
||||
|
||||
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}".
|
||||
-->
|
||||
<meta-data
|
||||
android:name="com.google.android.geo.API_KEY"
|
||||
android:value="YOUR_API_KEY" />
|
||||
|
||||
<activity
|
||||
android:name=".Maps"
|
||||
android:exported="false"
|
||||
android:label="@string/title_activity_maps" />
|
||||
<activity
|
||||
android:name=".TutorialActivity"
|
||||
android:exported="false" />
|
||||
|
@ -28,27 +50,12 @@
|
|||
android:name=".SetupActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".CreateUuidActivity"
|
||||
android:name=".CreateUUID"
|
||||
android:exported="false" />
|
||||
<!--
|
||||
TODO: Before you run your application, you need a Google Maps API key.
|
||||
|
||||
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}".
|
||||
-->
|
||||
<meta-data
|
||||
android:name="com.google.android.geo.API_KEY"
|
||||
android:value="AIzaSyBQ1Ak-I2NL5TP4K59ZI0VgzKk6HNZuusw" />
|
||||
|
||||
<activity
|
||||
android:name=".MapsActivity"
|
||||
android:exported="true"
|
||||
android:label="@string/title_activity_maps">
|
||||
android:label="@string/title_activity_maps" >
|
||||
|
||||
<!-- <intent-filter> -->
|
||||
<!-- <action android:name="android.intent.action.MAIN" /> -->
|
||||
|
@ -57,7 +64,7 @@
|
|||
</activity>
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true">
|
||||
android:exported="true" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
|
|
|
@ -4,11 +4,11 @@ import androidx.appcompat.app.AppCompatActivity;
|
|||
|
||||
import android.os.Bundle;
|
||||
|
||||
public class CreateUuidActivity extends AppCompatActivity {
|
||||
public class CreateUUID extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_create_uuid);
|
||||
setContentView(R.layout.create_uuid);
|
||||
}
|
||||
}
|
14
app/src/main/java/com/example/oplogy/Main.java
Normal file
14
app/src/main/java/com/example/oplogy/Main.java
Normal file
|
@ -0,0 +1,14 @@
|
|||
package com.example.oplogy;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
public class Main extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.main);
|
||||
}
|
||||
}
|
|
@ -1,143 +0,0 @@
|
|||
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 com.google.firebase.firestore.FirebaseFirestore;
|
||||
import com.google.firebase.firestore.QueryDocumentSnapshot;
|
||||
|
||||
|
||||
|
||||
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
|
||||
private TextView textView;
|
||||
private Button btnShow;
|
||||
private Button btnAdd;
|
||||
private EditText number;
|
||||
private EditText address;
|
||||
private EditText date;
|
||||
private EditText time;
|
||||
private FirebaseFirestore db = FirebaseFirestore.getInstance();
|
||||
|
||||
|
||||
Button button;
|
||||
// TextView textView;
|
||||
EditText editText;
|
||||
@SuppressLint("MissingInflatedId")
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
|
||||
textView=findViewById(R.id.showText);
|
||||
btnShow=findViewById(R.id.btnShow);
|
||||
btnAdd=findViewById(R.id.btnAdd);
|
||||
|
||||
number=findViewById(R.id.editNumber);
|
||||
address=findViewById(R.id.editAddress);
|
||||
date=findViewById(R.id.editDate);
|
||||
time=findViewById(R.id.editTime);
|
||||
|
||||
|
||||
//データの追加(適当なデータを追加しています。実際にはデータベースに保存したいデータを追加してください。)
|
||||
|
||||
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
|
||||
public void onClick(View v) {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
|
@ -10,19 +10,18 @@ import com.google.android.gms.maps.OnMapReadyCallback;
|
|||
import com.google.android.gms.maps.SupportMapFragment;
|
||||
import com.google.android.gms.maps.model.LatLng;
|
||||
import com.google.android.gms.maps.model.MarkerOptions;
|
||||
import com.example.oplogy.databinding.ActivityMapsBinding;
|
||||
//import com.google.type.LatLng;
|
||||
import com.example.oplogy.databinding.MapsBinding;
|
||||
|
||||
public class MapsActivity extends FragmentActivity implements OnMapReadyCallback {
|
||||
public class Maps extends FragmentActivity implements OnMapReadyCallback {
|
||||
|
||||
private GoogleMap mMap;
|
||||
private ActivityMapsBinding binding;
|
||||
private MapsBinding binding;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
binding = ActivityMapsBinding.inflate(getLayoutInflater());
|
||||
binding = MapsBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
|
||||
// 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;
|
||||
|
||||
// Add a marker in Sydney and move the camera
|
||||
/// 緯度経度
|
||||
LatLng loc = new LatLng(35.17260398479137, 136.88635173557998);
|
||||
/// マーカーオプションを設定(情報ウィンドウ)
|
||||
mMap.addMarker(new MarkerOptions().position(loc).title("トライデントコンピュータ専門学校"));
|
||||
/// 表示位置を地図に指定
|
||||
mMap.moveCamera(CameraUpdateFactory.newLatLng(loc));
|
||||
/// 地図の倍率を指定
|
||||
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(loc, 17));
|
||||
LatLng sydney = new LatLng(-34, 151);
|
||||
mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney"));
|
||||
mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
|
||||
}
|
||||
}
|
|
@ -9,6 +9,6 @@ public class NotSubmissionActivity extends AppCompatActivity {
|
|||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_not_submission);
|
||||
setContentView(R.layout.not_submission);
|
||||
}
|
||||
}
|
|
@ -9,6 +9,6 @@ public class RootSearchActivity extends AppCompatActivity {
|
|||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_root_search);
|
||||
setContentView(R.layout.root_search);
|
||||
}
|
||||
}
|
|
@ -9,6 +9,6 @@ public class SetupActivity extends AppCompatActivity {
|
|||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_setup);
|
||||
setContentView(R.layout.setup);
|
||||
}
|
||||
}
|
|
@ -9,6 +9,6 @@ public class SubmissionActivity extends AppCompatActivity {
|
|||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_submission);
|
||||
setContentView(R.layout.submission);
|
||||
}
|
||||
}
|
|
@ -9,6 +9,6 @@ public class TutorialActivity extends AppCompatActivity {
|
|||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_tutorial);
|
||||
setContentView(R.layout.tutorial);
|
||||
}
|
||||
}
|
|
@ -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>
|
|
@ -1,9 +0,0 @@
|
|||
<?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=".NotSubmimissionActivity">
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@ -4,6 +4,6 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".CreateUuidActivity">
|
||||
tools:context=".CreateUUID">
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
59
app/src/main/res/layout/main.xml
Normal file
59
app/src/main/res/layout/main.xml
Normal file
|
@ -0,0 +1,59 @@
|
|||
<?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=".Main">
|
||||
<Space
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="5"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/creatUUID"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="ID作成"
|
||||
android:textSize="30dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center"
|
||||
android:paddingTop="30dp"
|
||||
android:paddingBottom="20dp"/>
|
||||
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/setUp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="セットアップ"
|
||||
android:textSize="30dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/root"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="ルート表示"
|
||||
android:textSize="30dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="提出状況"
|
||||
android:textSize="30dp"
|
||||
android:layout_weight="1"
|
||||
android:tgravity="center"
|
||||
android:layout_gravity="center"/>
|
||||
|
||||
|
||||
</LinearLayout>
|
|
@ -6,4 +6,4 @@
|
|||
android:name="com.google.android.gms.maps.SupportMapFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".MapsActivity" />
|
||||
tools:context=".Maps" />
|
Loading…
Reference in New Issue
Block a user