仕様に修正があったので、レイアウトを修正し、変数も変更しました。

This commit is contained in:
Ekamo-11 2024-06-28 16:20:56 +09:00
parent 444d1a0469
commit a08b9c33ae
2 changed files with 71 additions and 66 deletions

View File

@ -38,6 +38,8 @@ public class SetUpActivity extends FragmentActivity
int totalStudent; int totalStudent;
private TextView setTeacherName; private TextView setTeacherName;
private TextView setStartPoint; private TextView setStartPoint;
private TextView setStartTime;
private TextView setEndTime;
private TextView setStartBreakTime; private TextView setStartBreakTime;
private TextView setEndBreakTime; private TextView setEndBreakTime;
private TextView setTotalStudent; private TextView setTotalStudent;
@ -46,19 +48,11 @@ public class SetUpActivity extends FragmentActivity
String stringHourOfDay; String stringHourOfDay;
String stringMinute; String stringMinute;
Button startFirstDay; Button firstDay;
Button startSecondDay; Button secondDay;
Button startThirdDay; Button thirdDay;
Button endFirstDay; Button setStartTimeButton;
Button endSecondDay; Button setEndTimeButton;
Button endThirdDay;
Button startTimeSetButton;
Button endTimeSetButton;
@ -73,13 +67,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); //開始地点
startFirstDay = findViewById(R.id.startFirstDay); //1日目の開始時刻を設定するボタン firstDay = findViewById(R.id.setFirstDayButton); //1日目の日付
startSecondDay = findViewById(R.id.startSecondDay); //2日目の開始時刻 secondDay = findViewById(R.id.setSecondDayButton); //2日目の日付
startThirdDay = findViewById(R.id.startThirdDay); //3日目の開始時刻 thirdDay = findViewById(R.id.setThirdDayButton); //3日目の日付
endFirstDay = findViewById(R.id.endFirstDay); //1日目の終了時刻を設定するボタン setStartTimeButton = findViewById(R.id.startTimeSetButton); //開始時刻を設定するボタン
endSecondDay = findViewById(R.id.endSecondDay); //2日目の終了時刻 setStartTime = findViewById(R.id.startTime); //開始時刻を出力するTextView
endThirdDay = findViewById(R.id.endThirdDay); //3日目の終了時刻 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分
@ -170,12 +165,12 @@ public class SetUpActivity extends FragmentActivity
}); });
startTimeSetButton.setOnClickListener(v -> { setStartTimeButton.setOnClickListener(v -> {
isStartTimeSelected = 1; //ボタンの判別 isStartTimeSelected = 1; //ボタンの判別
showTimePickerDialog(); //TimePeckerの表示 showTimePickerDialog(); //TimePeckerの表示
}); });
endTimeSetButton.setOnClickListener(v -> { setEndTimeButton.setOnClickListener(v -> {
isStartTimeSelected = 2; isStartTimeSelected = 2;
showTimePickerDialog(); showTimePickerDialog();
}); });
@ -221,6 +216,7 @@ public class SetUpActivity extends FragmentActivity
stringMinute = String.format("%02d", minute); //分を取得 stringMinute = String.format("%02d", minute); //分を取得
startTime = stringHourOfDay + stringMinute; //時と分を結合し四桁の文字列に startTime = stringHourOfDay + stringMinute; //時と分を結合し四桁の文字列に
} 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);

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"/>
@ -92,7 +91,7 @@
<TextView <TextView
android:layout_width="90sp" android:layout_width="90sp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/startTime" android:text="日付設定"
android:gravity="center"/> android:gravity="center"/>
<!-- <TextView--> <!-- <TextView-->
@ -107,7 +106,7 @@
<!-- tools:ignore="HardcodedText,LabelFor"/>--> <!-- tools:ignore="HardcodedText,LabelFor"/>-->
<Button <Button
android:id="@+id/startFirstDay" android:id="@+id/setFirstDayButton"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="1日目" android:text="1日目"
@ -116,7 +115,7 @@
tools:ignore="DuplicateIds" /> tools:ignore="DuplicateIds" />
<Button <Button
android:id="@+id/startSecondDay" android:id="@+id/setSecondDayButton"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="2日目" android:text="2日目"
@ -125,7 +124,7 @@
tools:ignore="DuplicateIds" /> tools:ignore="DuplicateIds" />
<Button <Button
android:id="@+id/startThirdDay" android:id="@+id/setThirdDayButton"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="3日目" android:text="3日目"
@ -135,6 +134,41 @@
</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="@string/startTime"
android:gravity="center"/>
<TextView
android:id="@+id/startTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="未設定"
android:textSize="20sp"
android:textAlignment="center"
android:autofillHints=""
android:inputType=""
tools:ignore="LabelFor"/>
<Button
android:id="@+id/startTimeSetButton"
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 <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -148,51 +182,26 @@
android:text="@string/endTime" android:text="@string/endTime"
android:gravity="center"/> android:gravity="center"/>
<!-- <TextView--> <TextView
<!-- android:id="@+id/endTime"--> 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" />-->
<Button
android:id="@+id/endFirstDay"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="1日目" android:hint="未設定"
android:layout_marginStart="7sp" android:textSize="20sp"
android:layout_marginEnd="7sp" android:textAlignment="center"
tools:ignore="DuplicateIds" /> android:autofillHints=""
android:inputType=""
tools:ignore="LabelFor"/>
<Button <Button
android:id="@+id/endSecondDay" android:id="@+id/endTimeSetButton"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="2日目" android:text="@string/timeSet"
android:layout_marginStart="7sp" android:layout_marginStart="65dp"
android:layout_marginEnd="7sp" android:layout_marginEnd="65dp"
tools:ignore="DuplicateIds" /> tools:ignore="DuplicateIds" />
<Button
android:id="@+id/endThirdDay"
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 <LinearLayout