入力した情報を変数に入れる機能を作成しました、後は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.os.Bundle;
import android.app.TimePickerDialog; import android.app.TimePickerDialog;
import android.util.Log; import android.util.Log;
import android.view.View;
import android.widget.Button; import android.widget.Button;
import android.widget.RadioButton; import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView; import android.widget.TextView;
import android.widget.TimePicker; import android.widget.TimePicker;
import android.widget.Toast;
import java.util.Locale; import java.util.Locale;
@ -80,66 +77,51 @@ public class SetUpActivity extends FragmentActivity
setUp.setOnClickListener(new View.OnClickListener() { setUp.setOnClickListener(view -> {
@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: できてるよ");
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() { startTimeSetButton.setOnClickListener(v -> {
@Override isStartTimeSelected = 1; //ボタンの判別
public void onClick(View v) { showTimePickerDialog(); //TimePeckerの表示
isStartTimeSelected = 1; //ボタンの判別
showTimePickerDialog(); //TimePeckerの表示
}
}); });
endTimeSetButton.setOnClickListener(new View.OnClickListener() { endTimeSetButton.setOnClickListener(v -> {
@Override isStartTimeSelected = 2;
public void onClick(View v) { showTimePickerDialog();
isStartTimeSelected = 2;
showTimePickerDialog();
}
}); });
setStartBreakTime.setOnClickListener(new View.OnClickListener() { setStartBreakTime.setOnClickListener(v -> {
@Override isStartTimeSelected = 3;
public void onClick(View v) { showTimePickerDialog();
isStartTimeSelected = 3;
showTimePickerDialog();
}
}); });
setEndBreakTime.setOnClickListener(new View.OnClickListener() { setEndBreakTime.setOnClickListener(v -> {
@Override isStartTimeSelected = 4;
public void onClick(View v) { showTimePickerDialog();
isStartTimeSelected = 4;
showTimePickerDialog();
}
}); });
} }

View File

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

View File

@ -11,4 +11,9 @@
<string name="breakTime">休憩時間</string> <string name="breakTime">休憩時間</string>
<string name="totalStudent">生徒の人数</string> <string name="totalStudent">生徒の人数</string>
<string name="timeSet">時刻設定</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> </resources>