[Dialog/GenerateBlockTimetable] Add option for showing teacher names.

This commit is contained in:
Kacper Ziubryniewicz 2020-02-08 01:33:34 +01:00
parent b52e7a3078
commit 760338496c
3 changed files with 34 additions and 0 deletions

View File

@ -10,6 +10,7 @@ import android.net.Uri
import android.os.Build
import android.os.Environment
import android.util.Log
import android.view.View
import android.view.View.MeasureSpec
import android.widget.LinearLayout
import android.widget.TextView
@ -60,6 +61,7 @@ class GenerateBlockTimetableDialog(
private lateinit var b: DialogGenerateBlockTimetableBinding
private var showProfileName: Boolean = false
private var showTeachersNames: Boolean = true
private var noColors: Boolean = false
init { run {
@ -78,6 +80,9 @@ class GenerateBlockTimetableDialog(
b.showProfileNameItem.onClick { b.showProfileNameCheckbox.trigger() }
b.showProfileNameCheckbox.setOnCheckedChangeListener { _, isChecked -> showProfileName = isChecked }
b.showTeachersNamesItem.onClick { b.showTeachersNamesCheckbox.trigger() }
b.showTeachersNamesCheckbox.setOnCheckedChangeListener { _, isChecked -> showTeachersNames = isChecked }
b.noColorsItem.onClick { b.noColorsCheckbox.trigger() }
b.noColorsCheckbox.setOnCheckedChangeListener { _, isChecked -> noColors = isChecked }
@ -221,6 +226,8 @@ class GenerateBlockTimetableDialog(
teacherName.text = lesson.displayTeacherName ?: ""
teamName.text = lesson.displayTeamName ?: ""
if (!showTeachersNames) teacherName.visibility = View.GONE
when (lesson.type) {
Lesson.TYPE_NORMAL -> {}
Lesson.TYPE_CANCELLED, Lesson.TYPE_SHIFTED_SOURCE -> {

View File

@ -34,6 +34,32 @@
android:text="@string/timetable_generate_show_profile_name" />
</LinearLayout>
<LinearLayout
android:id="@+id/showTeachersNamesItem"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:orientation="horizontal">
<CheckBox
android:id="@+id/showTeachersNamesCheckbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:checked="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="@string/timetable_generate_show_teachers_names" />
</LinearLayout>
<LinearLayout
android:id="@+id/noColorsItem"
android:layout_width="match_parent"

View File

@ -1173,4 +1173,5 @@
<string name="dialog_grades_config_color_by_value">Wg wartości oceny</string>
<string name="other">Inne</string>
<string name="menu_grades_config">Ustawienia ocen</string>
<string name="timetable_generate_show_teachers_names">Pokaż imiona i nazwiska nauczycieli</string>
</resources>