入力した情報を変数に入れる機能を作成しました、後はRoomに受け渡すだけです。

This commit is contained in:
Ekamo-11 2024-06-14 12:49:22 +09:00
parent 1e15a0626a
commit bc27676a7e
3 changed files with 58 additions and 69 deletions

View File

@ -10,13 +10,10 @@ import android.graphics.Paint;
import android.os.Bundle;
import android.app.TimePickerDialog;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.TimePicker;
import android.widget.Toast;
import java.util.Locale;
@ -80,66 +77,51 @@ public class SetUpActivity extends FragmentActivity
setUp.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View 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: できてるよ");
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(new View.OnClickListener() {
@Override
public void onClick(View v) {
isStartTimeSelected = 1; //ボタンの判別
showTimePickerDialog(); //TimePeckerの表示
}
startTimeSetButton.setOnClickListener(v -> {
isStartTimeSelected = 1; //ボタンの判別
showTimePickerDialog(); //TimePeckerの表示
});
endTimeSetButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
isStartTimeSelected = 2;
showTimePickerDialog();
}
endTimeSetButton.setOnClickListener(v -> {
isStartTimeSelected = 2;
showTimePickerDialog();
});
setStartBreakTime.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
isStartTimeSelected = 3;
showTimePickerDialog();
}
setStartBreakTime.setOnClickListener(v -> {
isStartTimeSelected = 3;
showTimePickerDialog();
});
setEndBreakTime.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
isStartTimeSelected = 4;
showTimePickerDialog();
}
setEndBreakTime.setOnClickListener(v -> {
isStartTimeSelected = 4;
showTimePickerDialog();
});
}

View File

@ -15,9 +15,9 @@
android:layout_height="wrap_content"
android:layout_gravity="left"
android:paddingStart="20dp"
android:text="🔙"
android:textSize="50dp"
tools:ignore="RtlCompat" />
android:text="@string/Back"
android:textSize="50sp"
tools:ignore="RtlCompat,RtlHardcoded,RtlSymmetry" />
<TextView
android:layout_width="wrap_content"
@ -66,7 +66,7 @@
android:id="@+id/startPoint"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="住所"
android:hint="@string/startpoint"
android:autofillHints=""
android:inputType=""
tools:ignore="LabelFor" />
@ -91,11 +91,11 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="   "
android:textSize="20dp"
android:textSize="20sp"
android:textAlignment="center"
android:autofillHints=""
android:inputType=""
tools:ignore="LabelFor"/>
tools:ignore="HardcodedText,LabelFor"/>
<Button
android:id="@+id/startTimeSetButton"
@ -126,7 +126,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="   "
android:textSize="20dp"
android:textSize="20sp"
android:textAlignment="center"
android:autofillHints=""
android:inputType=""
@ -167,7 +167,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="10分"
android:text="@string/tenMinute"
android:paddingEnd="20dp"
tools:ignore="RtlSymmetry" />
@ -176,7 +176,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="15分"
android:text="@string/fifteenMinute"
android:paddingEnd="20dp"
tools:ignore="RtlSymmetry" />
@ -185,7 +185,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="30分"
android:text="@string/thirtyMinute"
android:paddingEnd="20dp"
tools:ignore="RtlSymmetry" />
@ -213,7 +213,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint=" から "
android:textSize="20dp"
android:textSize="20sp"
android:textAlignment="center"
android:autofillHints=""
android:layout_weight="4"
@ -224,7 +224,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textSize="30dp"
android:textSize="30sp"
android:paddingStart="30dp"
android:paddingEnd="30dp" />
@ -232,7 +232,7 @@
android:id="@+id/endBreakTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20dp"
android:textSize="20sp"
android:hint=" まで "
android:textAlignment="center"
android:autofillHints=""
@ -279,13 +279,15 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reset"
android:layout_marginEnd="100dp"/>
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"/>
android:text="@string/setUp"
style="?android:attr/buttonBarButtonStyle" />
</LinearLayout>

View File

@ -11,4 +11,9 @@
<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>