Compare commits

...

10 Commits

8 changed files with 415 additions and 207 deletions

View File

@ -1,7 +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"
@ -13,23 +12,20 @@
android:supportsRtl="true"
android:theme="@style/Theme.Oplogy"
tools:ignore="ExtraText"
tools:targetApi="31">
<!-- 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}".-->
tools:targetApi="31" >
<activity
android:name=".SetUpActivity"
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=".Maps"
android:exported="false"
@ -43,22 +39,16 @@
<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: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" />
@ -68,11 +58,3 @@
</application>
</manifest>

View File

@ -87,7 +87,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
// セットアップのクリック処理
if(view == setUp){
imageSetup.setImageResource(R.drawable.ischecked_uuid);
Intent toSetup = new Intent(MainActivity.this,SetupActivity.class);
Intent toSetup = new Intent(MainActivity.this, SetUpActivity.class);
startActivity(toSetup);
}

View File

@ -1,14 +1,164 @@
package com.example.oplogy;
import androidx.appcompat.app.AppCompatActivity;
import static android.content.ContentValues.TAG;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.DialogFragment;
import android.annotation.SuppressLint;
import android.graphics.Paint;
import android.os.Bundle;
import android.app.TimePickerDialog;
import android.util.Log;
import android.widget.Button;
import android.widget.RadioButton;
import android.widget.TextView;
import android.widget.TimePicker;
public class SetUpActivity extends AppCompatActivity {
import java.util.Locale;
public class SetUpActivity extends FragmentActivity
implements TimePickerDialog.OnTimeSetListener {
String teacherName;
String startPoint;
String startTime;
String endTime;
String intervalTime;
String startBreakTime;
String endBreakTime;
int totalStudent;
private TextView setTeacherName;
private TextView setStartPoint;
private TextView setStartTime;
private TextView setEndTime;
private TextView setStartBreakTime;
private TextView setEndBreakTime;
private TextView setTotalStudent;
private int isStartTimeSelected;
String stringHourOfDay;
String stringMinute;
Button startTimeSetButton;
Button endTimeSetButton;
@SuppressLint("MissingInflatedId")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_set_up);
setTeacherName = findViewById(R.id.teacherName); //先生の名前
setStartPoint = findViewById(R.id.startPoint); //開始地点
setStartTime = findViewById(R.id.startTime); //開始時刻
setStartTime.setPaintFlags(Paint.UNDERLINE_TEXT_FLAG); //下線を引く
setEndTime = findViewById(R.id.endTime); //終了時刻
setEndTime.setPaintFlags(Paint.UNDERLINE_TEXT_FLAG);
RadioButton setTenMinute = findViewById(R.id.tenMinute); //訪問間隔10分
RadioButton setFifteenMinute = findViewById(R.id.fifteenMinute); //訪問間隔15分
RadioButton setThirtyMinute = findViewById(R.id.thirtyMinute); //訪問間隔30分
setStartBreakTime = findViewById(R.id.startBreakTime); //休憩開始時刻
setStartBreakTime.setPaintFlags(Paint.UNDERLINE_TEXT_FLAG);
setEndBreakTime = findViewById(R.id.endBreakTime); //休憩終了時刻
setEndBreakTime.setPaintFlags(Paint.UNDERLINE_TEXT_FLAG);
setTotalStudent = findViewById(R.id.totalStudent); //クラスの人数
startTimeSetButton = findViewById(R.id.startTimeSetButton); //開始時刻を設定するためのボタン
endTimeSetButton = findViewById(R.id.endTimeSetButton); //終了時刻を設定するためのボタン
Button setUp = findViewById(R.id.setUpButton); //画面下の設定ボタン
setUp.setOnClickListener(view -> {
teacherName = setTeacherName.getText().toString(); //各変数に値を挿入
Log.d(TAG, "Teacher Name: " + teacherName);
startPoint = setStartPoint.getText().toString();
Log.d(TAG, "Start Point: " + startPoint);
Log.d(TAG, "Start Time" + startTime);
Log.d(TAG, "End Time" + endTime);
if (setTenMinute.isChecked()){ //ラジオボタンの状態を取得
intervalTime = "10";
} else if (setFifteenMinute.isChecked()) {
intervalTime = "15";
} else if (setThirtyMinute.isChecked()) {
intervalTime = "30";
} else {
intervalTime = "0";
}
Log.d(TAG, "Interval Time" + intervalTime);
Log.d(TAG, "Start Break Time" + startBreakTime);
Log.d(TAG, "End Break Time" + endBreakTime);
totalStudent = Integer.parseInt(setTotalStudent.getText().toString());
Log.d(TAG, "Total Student" + totalStudent);
Log.d(TAG, "onClick: できてるよ");
});
startTimeSetButton.setOnClickListener(v -> {
isStartTimeSelected = 1; //ボタンの判別
showTimePickerDialog(); //TimePeckerの表示
});
endTimeSetButton.setOnClickListener(v -> {
isStartTimeSelected = 2;
showTimePickerDialog();
});
setStartBreakTime.setOnClickListener(v -> {
isStartTimeSelected = 3;
showTimePickerDialog();
});
setEndBreakTime.setOnClickListener(v -> {
isStartTimeSelected = 4;
showTimePickerDialog();
});
}
@SuppressLint({"DefaultLocale", "SetTextI18n"})
@Override
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
String str = String.format(Locale.US, "%02d:%02d", hourOfDay, minute); // Textviewに保存する形式を設定
if (isStartTimeSelected == 1) { //押した場所を判定して押したほうにだけ挿入する
stringHourOfDay = String.format("%02d", hourOfDay); //時を取得
stringMinute = String.format("%02d", minute); //分を取得
startTime = stringHourOfDay + stringMinute; //時と分を結合し四桁の文字列に
setStartTime.setText(" " + str + " "); //画面に出力
} else if (isStartTimeSelected == 2) {
stringHourOfDay = String.format("%02d", hourOfDay);
stringMinute = String.format("%02d", minute);
endTime = stringHourOfDay + stringMinute;
setEndTime.setText(" " + str + " ");
} else if (isStartTimeSelected == 3) {
stringHourOfDay = String.format("%02d", hourOfDay);
stringMinute = String.format("%02d", minute);
startBreakTime =stringHourOfDay + stringMinute;
setStartBreakTime.setText(" " + str + " ");
} else if (isStartTimeSelected == 4) {
stringHourOfDay = String.format("%02d", hourOfDay);
stringMinute = String.format("%02d", minute);
endBreakTime = stringHourOfDay + stringMinute;
setEndBreakTime.setText(" " + str + " ");
}
}
private void showTimePickerDialog() { // Dialogを表示する
DialogFragment newFragment = new TimePick();
newFragment.show(getSupportFragmentManager(), "timePicker");
}
}

View File

@ -1,14 +0,0 @@
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,30 @@
package com.example.oplogy;
import androidx.annotation.NonNull;
import androidx.fragment.app.DialogFragment;
import android.app.Dialog;
import android.app.TimePickerDialog;
import android.content.Context;
import android.os.Bundle;
import android.widget.TimePicker;
import java.util.Calendar;
public class TimePick extends DialogFragment implements
TimePickerDialog.OnTimeSetListener{
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) { // TimePeckerの生成
final Calendar c = Calendar.getInstance();
int hour = c.get(Calendar.HOUR_OF_DAY);
int minute = c.get(Calendar.MINUTE);
return new TimePickerDialog((Context) getActivity(),
(TimePickerDialog.OnTimeSetListener) getActivity(), hour, minute, true);
}
@Override
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
}
}

View File

@ -1,12 +1,23 @@
<?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=".SetUpActivity"
android:orientation="vertical"
android:gravity="center"
android:layout_margin="25dp">
android:gravity="center">
<TextView
android:id="@+id/toMain"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:paddingStart="20dp"
android:text="@string/Back"
android:textSize="50sp"
tools:ignore="RtlCompat,RtlHardcoded,RtlSymmetry" />
<TextView
android:layout_width="wrap_content"
@ -22,19 +33,19 @@
android:padding="10dp"
android:gravity="center">
<TextView
android:layout_width="90sp"
android:layout_height="wrap_content"
android:text="@string/teacherName"
android:gravity="center"/>
<TextView
android:layout_width="90sp"
android:layout_height="wrap_content"
android:text="@string/teacherName"
android:gravity="center"/>
<EditText
android:id="@+id/teacherName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints=""
android:inputType=""
tools:ignore="LabelFor" />
<EditText
android:id="@+id/teacherName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints=""
android:inputType=""
tools:ignore="LabelFor" />
</LinearLayout>
@ -45,20 +56,20 @@
android:padding="10dp"
android:gravity="center">
<TextView
android:layout_width="90sp"
android:layout_height="wrap_content"
android:text="@string/startPoint"
android:gravity="center"/>
<TextView
android:layout_width="90sp"
android:layout_height="wrap_content"
android:text="@string/startPoint"
android:gravity="center"/>
<EditText
android:id="@+id/startPoint"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="住所"
android:autofillHints=""
android:inputType=""
tools:ignore="LabelFor" />
<EditText
android:id="@+id/startPoint"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/startpoint"
android:autofillHints=""
android:inputType=""
tools:ignore="LabelFor" />
</LinearLayout>
@ -69,19 +80,31 @@
android:padding="10dp"
android:gravity="center">
<TextView
android:layout_width="90sp"
android:layout_height="wrap_content"
android:text="@string/startTime"
android:gravity="center"/>
<TextView
android:layout_width="90sp"
android:layout_height="wrap_content"
android:text="@string/startTime"
android:gravity="center"/>
<EditText
android:id="@+id/startTime"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints=""
android:inputType=""
tools:ignore="LabelFor"/>
<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/startTimeSetButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="65dp"
android:layout_marginEnd="65dp"
android:text="@string/timeSet"
tools:ignore="DuplicateIds" />
</LinearLayout>
@ -92,19 +115,131 @@
android:padding="10dp"
android:gravity="center">
<TextView
android:layout_width="90sp"
android:layout_height="wrap_content"
android:text="@string/endTime"
android:gravity="center"/>
<TextView
android:layout_width="90sp"
android:layout_height="wrap_content"
android:text="@string/endTime"
android:gravity="center"/>
<TextView
android:id="@+id/endTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="   "
android:textSize="20sp"
android:textAlignment="center"
android:autofillHints=""
android:inputType=""
tools:ignore="LabelFor"/>
<Button
android:id="@+id/endTimeSetButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/timeSet"
android:layout_marginStart="65dp"
android:layout_marginEnd="65dp"
tools:ignore="DuplicateIds" />
</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="@string/intervalTime"
android:gravity="center"/>
<RadioGroup
android:id="@+id/timeInterval"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="3">
<RadioButton
android:id="@+id/tenMinute"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/tenMinute"
android:paddingEnd="20dp"
tools:ignore="RtlSymmetry" />
<RadioButton
android:id="@+id/fifteenMinute"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/fifteenMinute"
android:paddingEnd="20dp"
tools:ignore="RtlSymmetry" />
<RadioButton
android:id="@+id/thirtyMinute"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/thirtyMinute"
android:paddingEnd="20dp"
tools:ignore="RtlSymmetry" />
</RadioGroup>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="5dp"
android:orientation="horizontal"
android:weightSum="10"
android:gravity="center">
<TextView
android:layout_width="90sp"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_weight="1"
android:text="@string/breakTime" />
<TextView
android:id="@+id/startBreakTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint=" から "
android:textSize="20sp"
android:textAlignment="center"
android:autofillHints=""
android:layout_weight="4"
android:inputType=""
tools:ignore="LabelFor"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textSize="30sp"
android:paddingStart="30dp"
android:paddingEnd="30dp" />
<TextView
android:id="@+id/endBreakTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20sp"
android:hint=" まで "
android:textAlignment="center"
android:autofillHints=""
android:layout_weight="4"
android:inputType=""
tools:ignore="LabelFor"/>
<EditText
android:id="@+id/endTime"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints=""
android:inputType=""
tools:ignore="LabelFor"/>
</LinearLayout>
@ -115,94 +250,20 @@
android:padding="10dp"
android:gravity="center">
<TextView
android:layout_width="90sp"
android:layout_height="wrap_content"
android:text="@string/intervalTime"
android:gravity="center"/>
<TextView
android:layout_width="90sp"
android:layout_height="wrap_content"
android:text="@string/totalStudent"
android:gravity="center"/>
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="3">
<RadioButton
android:id="@+id/tenMinute"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="10分"
android:paddingEnd="20dp"
tools:ignore="RtlSymmetry" />
<RadioButton
android:id="@+id/fifteenMinute"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="15分"
android:paddingEnd="20dp"
tools:ignore="RtlSymmetry" />
<RadioButton
android:id="@+id/thirtyMinute"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="30分"
android:paddingEnd="20dp"
tools:ignore="RtlSymmetry" />
</RadioGroup>
</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="@string/breakTime"
android:gravity="center"/>
<EditText
android:id="@+id/breakTime"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="例30分➝30 1時間半➝90"
android:autofillHints=""
android:inputType=""
tools:ignore="LabelFor"/>
</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="@string/totalStudent"
android:gravity="center"/>
<EditText
android:id="@+id/totalStudent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="例30人➝30"
android:autofillHints=""
android:inputType=""
tools:ignore="LabelFor"/>
<EditText
android:id="@+id/totalStudent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="例30人➝30"
android:autofillHints=""
android:inputType=""
tools:ignore="LabelFor"/>
</LinearLayout>
@ -213,18 +274,20 @@
android:weightSum="2"
android:layout_marginTop="20sp">
<Button
android:id="@+id/resetButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reset"
android:layout_marginEnd="100dp"/>
<Button
android:id="@+id/resetButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reset"
android:layout_marginEnd="100dp"
style="?android:attr/buttonBarButtonStyle" />
<Button
android:id="@+id/setUpButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/setUp"/>
<Button
android:id="@+id/setUpButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/setUp"
style="?android:attr/buttonBarButtonStyle" />
</LinearLayout>

View File

@ -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=".SetupActivity">
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -10,4 +10,10 @@
<string name="intervalTime">訪問間隔</string>
<string name="breakTime">休憩時間</string>
<string name="totalStudent">生徒の人数</string>
<string name="timeSet">時刻設定</string>
<string name="Back">🔙</string>
<string name="startpoint">住所</string>
<string name="tenMinute">10分</string>
<string name="fifteenMinute">15分</string>
<string name="thirtyMinute">30分</string>
</resources>