変数名とコメントの調整(未完) #31

Merged
Utahshi merged 2 commits from CreateRoot2 into master 2024-07-03 06:12:53 +00:00
14 changed files with 334 additions and 140 deletions
Showing only changes of commit 1d8115a448 - Show all commits

View File

@ -1,6 +1,6 @@
<project version="4"> <project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" /> <component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="jbr-17" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" /> <output url="file://$PROJECT_DIR$/build/classes" />
</component> </component>
<component name="ProjectType"> <component name="ProjectType">

View File

@ -3,7 +3,7 @@ package com.example.oplogy;
import androidx.room.Database; import androidx.room.Database;
import androidx.room.RoomDatabase; import androidx.room.RoomDatabase;
@Database(entities = {SetUpTable.class}, version = 3, exportSchema = false) @Database(entities = {SetUpTable.class}, version = 2, exportSchema = false)
public abstract class AppDatabase extends RoomDatabase { public abstract class AppDatabase extends RoomDatabase {
// データベースにアクセスするためのメソッドを提供する // データベースにアクセスするためのメソッドを提供する
public abstract SetUpTableDao setUpTableDao(); public abstract SetUpTableDao setUpTableDao();

View File

@ -5,12 +5,12 @@ import java.util.List;
public class CreateUUID { public class CreateUUID {
public static int generateUUID(List<Integer> classIdList ){ public static int generateUUID(List<String> classIdList ){
while (true){ while (true){
int uuid = (int) (Math.random() * 100000); String uuid = String.valueOf((int)(Math.random() * 1000000));
boolean isDuplicate = false; boolean isDuplicate = false;
for(int classId : classIdList){ for(String classId : classIdList){
if(classId==uuid){ if(classId.equals(uuid)){
//重複があればフラグを立てループを抜ける //重複があればフラグを立てループを抜ける
isDuplicate = true; isDuplicate = true;
break; break;
@ -19,11 +19,9 @@ public class CreateUUID {
//重複がなければ生成したUUIDを返す //重複がなければ生成したUUIDを返す
if (!isDuplicate) { if (!isDuplicate) {
//firestoreに挿入処理 //firestoreに挿入処理
InsertClassIdforFirebase insertClassIdforFirebase = new InsertClassIdforFirebase();
insertClassIdforFirebase.insertClassId(uuid);
//テスト用 //テスト用
uuid=100; uuid="100";
return uuid; return Integer.parseInt(uuid);
} }
} }
} }

View File

@ -0,0 +1,35 @@
package com.example.oplogy;
import android.app.DatePickerDialog;
import android.app.Dialog;
import android.os.Bundle;
import android.widget.DatePicker;
import androidx.annotation.NonNull;
import androidx.fragment.app.DialogFragment;
import java.util.Calendar;
import java.util.Objects;
public class DatePick extends DialogFragment implements
DatePickerDialog.OnDateSetListener {
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstantState) {
//デフォルトのタイムゾーンおよびロケールを使用してカレンダを取得
final Calendar c = Calendar.getInstance();
int year = c.get(Calendar.YEAR);
int month = c.get(Calendar.MONTH);
int day = c.get(Calendar.DAY_OF_MONTH);
return new DatePickerDialog(requireActivity(), (DatePickerDialog.OnDateSetListener) getActivity(), year, month, day);
}
@Override
public void onDateSet(DatePicker datePicker, int year, int month, int day) {
}
}

View File

@ -17,14 +17,14 @@ import java.util.List;
import java.util.Map; import java.util.Map;
public class FirestoreReception_classIdDatabase { public class FirestoreReception_classIdDatabase {
private FirebaseFirestore db; private FirebaseFirestore db;
private List<Integer> classIdList= new ArrayList<>(); private List<String> classIdList= new ArrayList<>();
public FirestoreReception_classIdDatabase() { public FirestoreReception_classIdDatabase() {
db = FirebaseFirestore.getInstance(); db = FirebaseFirestore.getInstance();
} }
public List<Integer> getAllDocumentsFromClassIdDatabase() { public List<String> getAllDocumentsFromClassIdDatabase() {
db.collection("classId_Database") db.collection("classId_Database")
.get() .get()
.addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() { .addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
@ -34,7 +34,8 @@ public class FirestoreReception_classIdDatabase {
for (QueryDocumentSnapshot document : task.getResult()) { for (QueryDocumentSnapshot document : task.getResult()) {
Log.d("結果", document.getId() + " => " + document.getData()); Log.d("結果", document.getId() + " => " + document.getData());
//データをListに追加 //データをListに追加
classIdList.add(((Long) document.get("classId")).intValue()); } classIdList.add((String) document.get("classId"));
}
} else { } else {
Log.d("結果", "Error getting documents: ", task.getException()); Log.d("結果", "Error getting documents: ", task.getException());
} }
@ -44,7 +45,7 @@ public class FirestoreReception_classIdDatabase {
return classIdList; return classIdList;
} }
public List<Integer> getClassIdList() { public List<String> getClassIdList() {
return classIdList; return classIdList;
} }
} }

View File

@ -1,19 +0,0 @@
package com.example.oplogy;
import com.google.firebase.firestore.FirebaseFirestore;
import java.util.HashMap;
import java.util.Map;
public class InsertClassIdforFirebase {
public void insertClassId(int classId) {
FirebaseFirestore db = FirebaseFirestore.getInstance();
Map<String, Object> data = new HashMap<>();
data.put("classId", classId); // classId is inserted as a number
db.collection("classId_Database").add(data)
.addOnSuccessListener(documentReference -> System.out.println("DocumentSnapshot added with ID: " + documentReference.getId()))
.addOnFailureListener(e -> System.err.println("Error adding document: " + e));
}
}

View File

@ -162,7 +162,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
//UUIDを表示するかのダイアログ //UUIDを表示するかのダイアログ
private void showUUIDYesNoDialog() { private void showUUIDYesNoDialog() {
firestoreReception_classIdDatabase = new FirestoreReception_classIdDatabase(); firestoreReception_classIdDatabase = new FirestoreReception_classIdDatabase();
List<Integer> classIdList = firestoreReception_classIdDatabase.getAllDocumentsFromClassIdDatabase(); List<String> classIdList = firestoreReception_classIdDatabase.getAllDocumentsFromClassIdDatabase();
AlertDialog.Builder builder = new AlertDialog.Builder(this); AlertDialog.Builder builder = new AlertDialog.Builder(this);
@ -197,9 +197,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
// タスク1: ローカルDBから生徒数を取得してtotalStudentと比較 // タスク1: ローカルDBから生徒数を取得してtotalStudentと比較
executor.execute(() -> { executor.execute(() -> {
AppDatabase db = Room.databaseBuilder(getApplicationContext(), AppDatabase.class, "SetUpTable") AppDatabase db = Room.databaseBuilder(getApplicationContext(), AppDatabase.class, "SetUpTable").build();
.fallbackToDestructiveMigration()
.build();
SetUpTableDao setUpTableDao = db.setUpTableDao(); SetUpTableDao setUpTableDao = db.setUpTableDao();
Log.d("MainActivity", "db" + setUpTableDao.getAll()); Log.d("MainActivity", "db" + setUpTableDao.getAll());

View File

@ -1,23 +1,44 @@
package com.example.oplogy; package com.example.oplogy;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ImageView;
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.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.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
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.Marker;
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 View.OnClickListener { import java.util.Locale;
import java.util.Map;
private WebView webView; public class Maps extends FragmentActivity implements OnMapReadyCallback,View.OnClickListener{
// ボタンの戻る処理
ImageView backMain; ImageView backMain;
private GoogleMap mMap;
private MapsBinding binding; private MapsBinding binding;
private LatLng loc;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -25,50 +46,74 @@ public class Maps extends FragmentActivity implements View.OnClickListener {
binding = MapsBinding.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.
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
backMain = findViewById(R.id.BackMain); backMain = findViewById(R.id.BackMain);
backMain.setOnClickListener(this); backMain.setOnClickListener(this);
webView = findViewById(R.id.webView);
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webView.setWebViewClient(new WebViewClient());
// ここにデータを入れておいてください処理は[/]で区切っています
loadMapInWebView("35.09050879999539,136.87845379325216/35.09284820618655,136.88165119390393/35.09364708442631,136.88171563326418");
} }
// WebViewの処理ですMapの中の処理をやっています
private void loadMapInWebView(String locations) {
// 区切ることで追加の地点を入れて最終地点にピンを打ってある状態です
String[] locArray = locations.split("/");
// URLで経路案内での表示をしています
StringBuilder urlBuilder = new StringBuilder("https://www.google.com/maps/dir/?api=1&travelmode=driving");
if (locArray.length > 0) {
urlBuilder.append("&origin=").append(locArray[0]);
if (locArray.length > 1) { /**
urlBuilder.append("&destination=").append(locArray[locArray.length - 1]); * Manipulates the map once available.
* This callback is triggered when the map is ready to be used.
* This is where we can add markers or lines, add listeners or move the camera. In this case,
* we just add a marker near Sydney, Australia.
* If Google Play services is not installed on the device, the user will be prompted to install
* it inside the SupportMapFragment. This method will only be triggered once the user has
* installed Google Play services and returned to the app.
*/
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
if (locArray.length > 2) { /// 地図の倍率を指定
urlBuilder.append("&waypoints=");
for (int i = 1; i < locArray.length - 1; i++) { // ここに地点の処理を書いておく
urlBuilder.append(locArray[i]); // Add a marker in Sydney and move the camera
if (i < locArray.length - 2) { loc = new LatLng(35.09050879999539, 136.87845379325216);
urlBuilder.append("|"); mMap.addMarker(new MarkerOptions().position(loc).title("名古屋港水族館"));
} /// 表示位置を地図に指定
} 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);
} }
webView.loadUrl(urlBuilder.toString()); private void drowRoute(LatLng startLatLng,LatLng secondLatLung,LatLng thirdLatLng){
GeoApiContext context = new GeoApiContext.Builder()
.apiKey("AIzaSyBQ1Ak-I2NL5TP4K59ZI0VgzKk6HNZuusw")
.build();
} }
@Override @Override
public void onClick(View view) { public void onClick(View view) {
if (view == backMain) { if(view == backMain){
Intent backMain = new Intent(Maps.this, MainActivity.class); Intent backMain = new Intent(Maps.this,MainActivity.class);
startActivity(backMain); startActivity(backMain);
} }
} }

View File

@ -2,14 +2,17 @@ package com.example.oplogy;
import static android.content.ContentValues.TAG; import static android.content.ContentValues.TAG;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.DatePickerDialog;
import android.app.TimePickerDialog; import android.app.TimePickerDialog;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences;
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.DatePicker;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.RadioButton; import android.widget.RadioButton;
import android.widget.TextView; import android.widget.TextView;
@ -26,10 +29,13 @@ import java.util.concurrent.Executors;
public class SetUpActivity extends FragmentActivity public class SetUpActivity extends FragmentActivity
implements TimePickerDialog.OnTimeSetListener { implements TimePickerDialog.OnTimeSetListener, DatePickerDialog.OnDateSetListener {
String teacherName; String teacherName;
String startPoint; String startPoint;
String firstDay;
String secondDay;
String thirdDay;
String startTime; String startTime;
String endTime; String endTime;
String intervalTime; String intervalTime;
@ -43,17 +49,22 @@ public class SetUpActivity extends FragmentActivity
private TextView setStartBreakTime; private TextView setStartBreakTime;
private TextView setEndBreakTime; private TextView setEndBreakTime;
private TextView setTotalStudent; private TextView setTotalStudent;
private int isDateSelected;
private int isStartTimeSelected; private int isStartTimeSelected;
String stringYear;
String stringMonth;
String stringDayOfMonth;
String stringHourOfDay; String stringHourOfDay;
String stringMinute; String stringMinute;
Button setFirstDay;
Button setSecondDay;
Button setThirdDay;
Button setStartTimeButton;
Button startTimeSetButton; Button setEndTimeButton;
Button endTimeSetButton;
@ -68,10 +79,14 @@ public class SetUpActivity extends FragmentActivity
setTeacherName = findViewById(R.id.teacherName); //先生の名前 setTeacherName = findViewById(R.id.teacherName); //先生の名前
setStartPoint = findViewById(R.id.startPoint); //開始地点 setStartPoint = findViewById(R.id.startPoint); //開始地点
setStartTime = findViewById(R.id.startTime); //開始時刻 setFirstDay = findViewById(R.id.setFirstDayButton); //1日目の日付
setStartTime.setPaintFlags(Paint.UNDERLINE_TEXT_FLAG); //下線を引く setSecondDay = findViewById(R.id.setSecondDayButton); //2日目の日付
setEndTime = findViewById(R.id.endTime); //終了時刻 setThirdDay = findViewById(R.id.setThirdDayButton); //3日目の日付
setEndTime.setPaintFlags(Paint.UNDERLINE_TEXT_FLAG);
setStartTimeButton = findViewById(R.id.startTimeSetButton); //開始時刻を設定するボタン
setStartTime = findViewById(R.id.startTime); //開始時刻を出力するTextView
setEndTimeButton = findViewById(R.id.endTimeSetButton); //終了時刻を設定するボタン
setEndTime = findViewById(R.id.endTime); //終了時刻を出力するTextView
RadioButton setTenMinute = findViewById(R.id.tenMinute); //訪問間隔10分 RadioButton setTenMinute = findViewById(R.id.tenMinute); //訪問間隔10分
RadioButton setFifteenMinute = findViewById(R.id.fifteenMinute); //訪問間隔15分 RadioButton setFifteenMinute = findViewById(R.id.fifteenMinute); //訪問間隔15分
@ -84,9 +99,6 @@ public class SetUpActivity extends FragmentActivity
setTotalStudent = findViewById(R.id.totalStudent); //クラスの人数 setTotalStudent = findViewById(R.id.totalStudent); //クラスの人数
startTimeSetButton = findViewById(R.id.startTimeSetButton); //開始時刻を設定するためのボタン
endTimeSetButton = findViewById(R.id.endTimeSetButton); //終了時刻を設定するためのボタン
ImageView toMain = findViewById(R.id.toMain); 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);
@ -95,7 +107,6 @@ public class SetUpActivity extends FragmentActivity
Intent intent = new Intent(SetUpActivity.this,MainActivity.class); //main画面へ戻る処理 Intent intent = new Intent(SetUpActivity.this,MainActivity.class); //main画面へ戻る処理
startActivity(intent); startActivity(intent);
}); });
//TODO:.SetUpの際にclassIdを挿入すること
setUp.setOnClickListener(view -> { setUp.setOnClickListener(view -> {
@ -103,6 +114,9 @@ public class SetUpActivity extends FragmentActivity
Log.d(TAG, "Teacher Name: " + teacherName); Log.d(TAG, "Teacher Name: " + teacherName);
startPoint = setStartPoint.getText().toString(); startPoint = setStartPoint.getText().toString();
Log.d(TAG, "Start Point: " + startPoint); Log.d(TAG, "Start Point: " + startPoint);
Log.d(TAG, "First Day:" + firstDay);
Log.d(TAG, "Second Day:" + secondDay);
Log.d(TAG, "Third Day:" + thirdDay);
Log.d(TAG, "Start Time" + startTime); Log.d(TAG, "Start Time" + startTime);
Log.d(TAG, "End Time" + endTime); Log.d(TAG, "End Time" + endTime);
if (setTenMinute.isChecked()){ //ラジオボタンの状態を取得 if (setTenMinute.isChecked()){ //ラジオボタンの状態を取得
@ -157,17 +171,42 @@ public class SetUpActivity extends FragmentActivity
setUpTableDao.insertAll(setUpTable); setUpTableDao.insertAll(setUpTable);
runOnUiThread(() -> Toast.makeText(SetUpActivity.this, "登録しました", Toast.LENGTH_SHORT).show()); runOnUiThread(() -> Toast.makeText(SetUpActivity.this, "登録しました", Toast.LENGTH_SHORT).show());
} }
//家庭訪問日を保存する共有プリファレンス
SharedPreferences sharedPreferences=getSharedPreferences("visitingDate",MODE_PRIVATE);
SharedPreferences.Editor editor= sharedPreferences.edit();
editor.putString("day1",firstDay);
editor.putString("day2",secondDay);
editor.putString("day3",thirdDay);
editor.apply();
}); });
}); });
startTimeSetButton.setOnClickListener(v -> {
setFirstDay.setOnClickListener(v ->{
isDateSelected = 1;
showDatePickerDialog(); //DatePickerの表示
});
setSecondDay.setOnClickListener(v ->{
isDateSelected = 2;
showDatePickerDialog();
});
setThirdDay.setOnClickListener(v ->{
isDateSelected = 3;
showDatePickerDialog();
});
setStartTimeButton.setOnClickListener(v -> {
isStartTimeSelected = 1; //ボタンの判別 isStartTimeSelected = 1; //ボタンの判別
showTimePickerDialog(); //TimePeckerの表示 showTimePickerDialog(); //TimePickerの表示
}); });
endTimeSetButton.setOnClickListener(v -> { setEndTimeButton.setOnClickListener(v -> {
isStartTimeSelected = 2; isStartTimeSelected = 2;
showTimePickerDialog(); showTimePickerDialog();
}); });
@ -187,8 +226,6 @@ public class SetUpActivity extends FragmentActivity
reset.setOnClickListener(v -> { //テキストとラジオボタンの選択を消去 reset.setOnClickListener(v -> { //テキストとラジオボタンの選択を消去
setTeacherName.setText(""); setTeacherName.setText("");
setStartPoint.setText(""); setStartPoint.setText("");
setStartTime.setText("");
setEndTime.setText("");
setTenMinute.setChecked(false); setTenMinute.setChecked(false);
setFifteenMinute.setChecked(false); setFifteenMinute.setChecked(false);
setThirtyMinute.setChecked(false); setThirtyMinute.setChecked(false);
@ -205,22 +242,51 @@ public class SetUpActivity extends FragmentActivity
}); });
} }
@Override
public void onDateSet(DatePicker datePicker, int year, int month, int dayOfMonth) { //Dateを成形する
// DatePickerDialogで選択された日付を処理する
String str = String.format(Locale.JAPAN, "%02d/%02d", month + 1, dayOfMonth); // TextViewに表示する日付の形式を設定
if (isDateSelected == 1) {
stringYear = String.valueOf(year); //
stringMonth = String.format(Locale.JAPAN, "%02d", month + 1); //
stringDayOfMonth = String.format(Locale.JAPAN, "%02d", dayOfMonth); //
firstDay = stringYear + stringMonth + stringDayOfMonth;
setFirstDay.setText(str);
} else if (isDateSelected == 2) {
stringYear = String.valueOf(year);
stringMonth = String.format(Locale.JAPAN, "%02d", month + 1);
stringDayOfMonth = String.format(Locale.JAPAN, "%02d", dayOfMonth);
secondDay = stringYear + stringMonth + stringDayOfMonth;
setSecondDay.setText(str);
} else if (isDateSelected == 3) {
stringYear = String.valueOf(year);
stringMonth = String.format(Locale.JAPAN, "%02d", month + 1);
stringDayOfMonth = String.format(Locale.JAPAN, "%02d", dayOfMonth);
thirdDay = stringYear + stringMonth + stringDayOfMonth;
setThirdDay.setText(str);
}
}
@SuppressLint({"DefaultLocale", "SetTextI18n"}) @SuppressLint({"DefaultLocale", "SetTextI18n"})
@Override @Override
public void onTimeSet(TimePicker view, int hourOfDay, int minute) { public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
String str = String.format(Locale.US, "%02d:%02d", hourOfDay, minute); // Textviewに保存する形式を設定 String str = String.format(Locale.JAPAN, "%02d:%02d", hourOfDay, minute); // Textviewに保存する形式を設定
if (isStartTimeSelected == 1) { //押した場所を判定して押したほうにだけ挿入する if (isStartTimeSelected == 1) {
stringHourOfDay = String.format("%02d", hourOfDay); //時を取得 stringHourOfDay = String.format("%02d", hourOfDay);
stringMinute = String.format("%02d", minute); //分を取得 stringMinute = String.format("%02d", minute);
startTime = stringHourOfDay + stringMinute; //時と分を結合し四桁の文字列に startTime = stringHourOfDay + stringMinute;
setStartTime.setText(" " + str + " "); //画面に出力 setStartTime.setText(str);
} else if (isStartTimeSelected == 2) { } else if (isStartTimeSelected == 2) {
stringHourOfDay = String.format("%02d", hourOfDay); stringHourOfDay = String.format("%02d", hourOfDay);
stringMinute = String.format("%02d", minute); stringMinute = String.format("%02d", minute);
endTime = stringHourOfDay + stringMinute; endTime = stringHourOfDay + stringMinute;
setEndTime.setText(" " + str + " "); setEndTime.setText(str);
} else if (isStartTimeSelected == 3) { } else if (isStartTimeSelected == 3) {
stringHourOfDay = String.format("%02d", hourOfDay); stringHourOfDay = String.format("%02d", hourOfDay);
@ -236,9 +302,14 @@ public class SetUpActivity extends FragmentActivity
} }
} }
private void showDatePickerDialog() {
DialogFragment newFragment = new DatePick();
newFragment.show(getSupportFragmentManager(), "datePicker");
}
private void showTimePickerDialog() { // Dialogを表示する private void showTimePickerDialog() { // Dialogを表示する
DialogFragment newFragment = new TimePick(); DialogFragment newFragment = new TimePick();
newFragment.show(getSupportFragmentManager(), "timePicker"); newFragment.show(getSupportFragmentManager(), "timePicker");
} }
} }

Binary file not shown.

View File

@ -21,17 +21,16 @@
<ImageView <ImageView
android:id="@+id/toMain" android:id="@+id/toMain"
android:layout_width="100dp" android:layout_width="60dp"
android:layout_height="90dp" android:layout_height="60dp"
android:layout_gravity="left" android:layout_gravity="left"
android:layout_marginLeft="20dp" android:layout_marginLeft="10dp"
android:src="@drawable/back_button"/> android:src="@drawable/back_button"/>
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="25dp"
android:text="@string/setUp" android:text="@string/setUp"
android:textSize="30sp"/> android:textSize="30sp"/>
@ -82,6 +81,59 @@
</LinearLayout> </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="日付設定"
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/setFirstDayButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1日目"
android:layout_marginStart="7sp"
android:layout_marginEnd="7sp"
tools:ignore="DuplicateIds" />
<Button
android:id="@+id/setSecondDayButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2日目"
android:layout_marginStart="7sp"
android:layout_marginEnd="7sp"
tools:ignore="DuplicateIds" />
<Button
android:id="@+id/setThirdDayButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="3日目"
android:layout_marginStart="7sp"
android:layout_marginEnd="7sp"
tools:ignore="DuplicateIds" />
</LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -99,20 +151,20 @@
android:id="@+id/startTime" android:id="@+id/startTime"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="   " android:hint="未設定"
android:textSize="20sp" android:textSize="20sp"
android:textAlignment="center" android:textAlignment="center"
android:autofillHints="" android:autofillHints=""
android:inputType="" android:inputType=""
tools:ignore="HardcodedText,LabelFor"/> tools:ignore="LabelFor"/>
<Button <Button
android:id="@+id/startTimeSetButton" android:id="@+id/startTimeSetButton"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/timeSet"
android:layout_marginStart="65dp" android:layout_marginStart="65dp"
android:layout_marginEnd="65dp" android:layout_marginEnd="65dp"
android:text="@string/timeSet"
tools:ignore="DuplicateIds" /> tools:ignore="DuplicateIds" />
</LinearLayout> </LinearLayout>
@ -134,7 +186,7 @@
android:id="@+id/endTime" android:id="@+id/endTime"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="   " android:hint="未設定"
android:textSize="20sp" android:textSize="20sp"
android:textAlignment="center" android:textAlignment="center"
android:autofillHints="" android:autofillHints=""
@ -149,6 +201,7 @@
android:layout_marginStart="65dp" android:layout_marginStart="65dp"
android:layout_marginEnd="65dp" android:layout_marginEnd="65dp"
tools:ignore="DuplicateIds" /> tools:ignore="DuplicateIds" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout

View File

@ -10,7 +10,7 @@
<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="3"/> android:layout_weight="2"/>
<!-- ID作成のレイアウト--> <!-- ID作成のレイアウト-->
@ -43,7 +43,6 @@
</LinearLayout> </LinearLayout>
<!-- セットアップのレイアウト--> <!-- セットアップのレイアウト-->
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -73,15 +72,8 @@
</LinearLayout> </LinearLayout>
<Space
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="3"/>
<!-- ルート表示のレイアウト-->
<!-- ルート表示のレイアウト-->
<LinearLayout <LinearLayout
android:layout_width="400dp" android:layout_width="400dp"
android:layout_height="0dp" android:layout_height="0dp"
@ -110,6 +102,12 @@
android:layout_gravity="center"/> android:layout_gravity="center"/>
</LinearLayout> </LinearLayout>
<Space
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="3"/>
<!-- 提出状況のレイアウト--> <!-- 提出状況のレイアウト-->
<LinearLayout <LinearLayout
android:layout_width="350dp" android:layout_width="350dp"

View File

@ -1,12 +1,20 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:weightSum="10" android:weightSum="10"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical" android:orientation="vertical"
tools:context=".Maps"> 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 <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -20,28 +28,34 @@
android:layout_width="40dp" android:layout_width="40dp"
android:layout_height="90dp" android:layout_height="90dp"
android:src="@drawable/back_button" android:src="@drawable/back_button"
android:layout_weight="5" /> android:layout_weight="5"
/>
<TextView <TextView
android:id="@+id/date"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="4" android:layout_weight="4"
android:id="@+id/date"
android:hint="今日の日付" android:hint="今日の日付"
android:textSize="40dp" /> android:textSize="40dp"
/>
</LinearLayout> </LinearLayout>
<!-- Webの処理 --> <fragment
<WebView android:id="@+id/map"
android:id="@+id/webView" android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="6" /> android:layout_weight="6"
tools:context=".Maps" />
<ScrollView <ScrollView
android:id="@+id/scrollable" android:id="@+id/scrollable"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="3" /> android:layout_weight="3"
/>
</LinearLayout> </LinearLayout>

View File

@ -5,7 +5,7 @@ buildscript {
} }
}// Top-level build file where you can add configuration options common to all sub-projects/modules. }// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins { plugins {
id 'com.android.application' version '8.0.2' apply false id 'com.android.application' version '8.1.4' apply false
id 'com.android.library' version '8.0.2' apply false id 'com.android.library' version '8.1.4' apply false
id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin' version '2.0.1' apply false id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin' version '2.0.1' apply false
} }