add support for grade column codes

This commit is contained in:
Franek 2024-06-14 17:59:54 +02:00
parent 29fd96acb4
commit 567dd8e6a2
No known key found for this signature in database
GPG Key ID: 0329F871B2079351
23 changed files with 2485 additions and 87 deletions

View File

@ -2,11 +2,11 @@
"formatVersion": 1, "formatVersion": 1,
"database": { "database": {
"version": 100, "version": 100,
"identityHash": "4c141460d807d32d00faad4fb3c12522", "identityHash": "26b54e8e64642eb693587f983aaf3adc",
"entities": [ "entities": [
{ {
"tableName": "grades", "tableName": "grades",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`profileId` INTEGER NOT NULL, `gradeId` INTEGER NOT NULL, `gradeName` TEXT NOT NULL, `gradeType` INTEGER NOT NULL, `gradeValue` REAL NOT NULL, `gradeWeight` REAL NOT NULL, `gradeColor` INTEGER NOT NULL, `gradeCategory` TEXT, `gradeDescription` TEXT, `gradeComment` TEXT, `gradeSemester` INTEGER NOT NULL, `teacherId` INTEGER NOT NULL, `subjectId` INTEGER NOT NULL, `addedDate` INTEGER NOT NULL, `gradeValueMax` REAL, `gradeClassAverage` REAL, `gradeParentId` INTEGER, `gradeIsImprovement` INTEGER NOT NULL, `keep` INTEGER NOT NULL, PRIMARY KEY(`profileId`, `gradeId`))", "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`profileId` INTEGER NOT NULL, `gradeId` INTEGER NOT NULL, `gradeName` TEXT NOT NULL, `gradeType` INTEGER NOT NULL, `gradeValue` REAL NOT NULL, `gradeWeight` REAL NOT NULL, `gradeColor` INTEGER NOT NULL, `code` TEXT, `gradeCategory` TEXT, `gradeDescription` TEXT, `gradeComment` TEXT, `gradeSemester` INTEGER NOT NULL, `teacherId` INTEGER NOT NULL, `subjectId` INTEGER NOT NULL, `addedDate` INTEGER NOT NULL, `gradeValueMax` REAL, `gradeClassAverage` REAL, `gradeParentId` INTEGER, `gradeIsImprovement` INTEGER NOT NULL, `keep` INTEGER NOT NULL, PRIMARY KEY(`profileId`, `gradeId`))",
"fields": [ "fields": [
{ {
"fieldPath": "profileId", "fieldPath": "profileId",
@ -50,6 +50,12 @@
"affinity": "INTEGER", "affinity": "INTEGER",
"notNull": true "notNull": true
}, },
{
"fieldPath": "code",
"columnName": "code",
"affinity": "TEXT",
"notNull": false
},
{ {
"fieldPath": "category", "fieldPath": "category",
"columnName": "gradeCategory", "columnName": "gradeCategory",
@ -124,11 +130,11 @@
} }
], ],
"primaryKey": { "primaryKey": {
"autoGenerate": false,
"columnNames": [ "columnNames": [
"profileId", "profileId",
"gradeId" "gradeId"
], ]
"autoGenerate": false
}, },
"indices": [ "indices": [
{ {
@ -197,11 +203,11 @@
} }
], ],
"primaryKey": { "primaryKey": {
"autoGenerate": false,
"columnNames": [ "columnNames": [
"profileId", "profileId",
"teacherId" "teacherId"
], ]
"autoGenerate": false
}, },
"indices": [], "indices": [],
"foreignKeys": [] "foreignKeys": []
@ -278,11 +284,11 @@
} }
], ],
"primaryKey": { "primaryKey": {
"autoGenerate": false,
"columnNames": [ "columnNames": [
"profileId", "profileId",
"teacherAbsenceId" "teacherAbsenceId"
], ]
"autoGenerate": false
}, },
"indices": [ "indices": [
{ {
@ -321,11 +327,11 @@
} }
], ],
"primaryKey": { "primaryKey": {
"autoGenerate": false,
"columnNames": [ "columnNames": [
"profileId", "profileId",
"teacherAbsenceTypeId" "teacherAbsenceTypeId"
], ]
"autoGenerate": false
}, },
"indices": [], "indices": [],
"foreignKeys": [] "foreignKeys": []
@ -366,11 +372,11 @@
} }
], ],
"primaryKey": { "primaryKey": {
"autoGenerate": false,
"columnNames": [ "columnNames": [
"profileId", "profileId",
"subjectId" "subjectId"
], ]
"autoGenerate": false
}, },
"indices": [], "indices": [],
"foreignKeys": [] "foreignKeys": []
@ -441,11 +447,11 @@
} }
], ],
"primaryKey": { "primaryKey": {
"autoGenerate": false,
"columnNames": [ "columnNames": [
"profileId", "profileId",
"noticeId" "noticeId"
], ]
"autoGenerate": false
}, },
"indices": [ "indices": [
{ {
@ -502,11 +508,11 @@
} }
], ],
"primaryKey": { "primaryKey": {
"autoGenerate": false,
"columnNames": [ "columnNames": [
"profileId", "profileId",
"teamId" "teamId"
], ]
"autoGenerate": false
}, },
"indices": [], "indices": [],
"foreignKeys": [] "foreignKeys": []
@ -619,11 +625,11 @@
} }
], ],
"primaryKey": { "primaryKey": {
"autoGenerate": false,
"columnNames": [ "columnNames": [
"profileId", "profileId",
"attendanceId" "attendanceId"
], ]
"autoGenerate": false
}, },
"indices": [ "indices": [
{ {
@ -770,11 +776,11 @@
} }
], ],
"primaryKey": { "primaryKey": {
"autoGenerate": false,
"columnNames": [ "columnNames": [
"profileId", "profileId",
"eventId" "eventId"
], ]
"autoGenerate": false
}, },
"indices": [ "indices": [
{ {
@ -843,11 +849,11 @@
} }
], ],
"primaryKey": { "primaryKey": {
"autoGenerate": false,
"columnNames": [ "columnNames": [
"profileId", "profileId",
"eventType" "eventType"
], ]
"autoGenerate": false
}, },
"indices": [], "indices": [],
"foreignKeys": [] "foreignKeys": []
@ -882,10 +888,10 @@
} }
], ],
"primaryKey": { "primaryKey": {
"autoGenerate": false,
"columnNames": [ "columnNames": [
"loginStoreId" "loginStoreId"
], ]
"autoGenerate": false
}, },
"indices": [], "indices": [],
"foreignKeys": [] "foreignKeys": []
@ -1046,10 +1052,10 @@
} }
], ],
"primaryKey": { "primaryKey": {
"autoGenerate": false,
"columnNames": [ "columnNames": [
"profileId" "profileId"
], ]
"autoGenerate": false
}, },
"indices": [], "indices": [],
"foreignKeys": [] "foreignKeys": []
@ -1084,11 +1090,11 @@
} }
], ],
"primaryKey": { "primaryKey": {
"autoGenerate": false,
"columnNames": [ "columnNames": [
"profileId", "profileId",
"luckyNumberDate" "luckyNumberDate"
], ]
"autoGenerate": false
}, },
"indices": [], "indices": [],
"foreignKeys": [] "foreignKeys": []
@ -1159,11 +1165,11 @@
} }
], ],
"primaryKey": { "primaryKey": {
"autoGenerate": false,
"columnNames": [ "columnNames": [
"profileId", "profileId",
"announcementId" "announcementId"
], ]
"autoGenerate": false
}, },
"indices": [ "indices": [
{ {
@ -1238,12 +1244,12 @@
} }
], ],
"primaryKey": { "primaryKey": {
"autoGenerate": false,
"columnNames": [ "columnNames": [
"profileId", "profileId",
"categoryId", "categoryId",
"type" "type"
], ]
"autoGenerate": false
}, },
"indices": [], "indices": [],
"foreignKeys": [] "foreignKeys": []
@ -1308,10 +1314,10 @@
} }
], ],
"primaryKey": { "primaryKey": {
"autoGenerate": true,
"columnNames": [ "columnNames": [
"messageId" "messageId"
], ]
"autoGenerate": true
}, },
"indices": [], "indices": [],
"foreignKeys": [] "foreignKeys": []
@ -1400,11 +1406,11 @@
} }
], ],
"primaryKey": { "primaryKey": {
"autoGenerate": false,
"columnNames": [ "columnNames": [
"profileId", "profileId",
"messageId" "messageId"
], ]
"autoGenerate": false
}, },
"indices": [ "indices": [
{ {
@ -1456,12 +1462,12 @@
} }
], ],
"primaryKey": { "primaryKey": {
"autoGenerate": false,
"columnNames": [ "columnNames": [
"profileId", "profileId",
"messageRecipientId", "messageRecipientId",
"messageId" "messageId"
], ]
"autoGenerate": false
}, },
"indices": [], "indices": [],
"foreignKeys": [] "foreignKeys": []
@ -1484,10 +1490,10 @@
} }
], ],
"primaryKey": { "primaryKey": {
"autoGenerate": true,
"columnNames": [ "columnNames": [
"id" "id"
], ]
"autoGenerate": true
}, },
"indices": [], "indices": [],
"foreignKeys": [] "foreignKeys": []
@ -1528,11 +1534,11 @@
} }
], ],
"primaryKey": { "primaryKey": {
"autoGenerate": false,
"columnNames": [ "columnNames": [
"profileId", "profileId",
"endpointId" "endpointId"
], ]
"autoGenerate": false
}, },
"indices": [], "indices": [],
"foreignKeys": [] "foreignKeys": []
@ -1567,11 +1573,11 @@
} }
], ],
"primaryKey": { "primaryKey": {
"autoGenerate": false,
"columnNames": [ "columnNames": [
"profileId", "profileId",
"lessonRangeNumber" "lessonRangeNumber"
], ]
"autoGenerate": false
}, },
"indices": [], "indices": [],
"foreignKeys": [] "foreignKeys": []
@ -1648,10 +1654,10 @@
} }
], ],
"primaryKey": { "primaryKey": {
"autoGenerate": true,
"columnNames": [ "columnNames": [
"id" "id"
], ]
"autoGenerate": true
}, },
"indices": [], "indices": [],
"foreignKeys": [] "foreignKeys": []
@ -1680,11 +1686,11 @@
} }
], ],
"primaryKey": { "primaryKey": {
"autoGenerate": false,
"columnNames": [ "columnNames": [
"profileId", "profileId",
"id" "id"
], ]
"autoGenerate": false
}, },
"indices": [], "indices": [],
"foreignKeys": [] "foreignKeys": []
@ -1713,11 +1719,11 @@
} }
], ],
"primaryKey": { "primaryKey": {
"autoGenerate": false,
"columnNames": [ "columnNames": [
"profileId", "profileId",
"id" "id"
], ]
"autoGenerate": false
}, },
"indices": [], "indices": [],
"foreignKeys": [] "foreignKeys": []
@ -1770,11 +1776,11 @@
} }
], ],
"primaryKey": { "primaryKey": {
"autoGenerate": false,
"columnNames": [ "columnNames": [
"profileId", "profileId",
"id" "id"
], ]
"autoGenerate": false
}, },
"indices": [], "indices": [],
"foreignKeys": [] "foreignKeys": []
@ -1923,11 +1929,11 @@
} }
], ],
"primaryKey": { "primaryKey": {
"autoGenerate": false,
"columnNames": [ "columnNames": [
"profileId", "profileId",
"id" "id"
], ]
"autoGenerate": false
}, },
"indices": [ "indices": [
{ {
@ -1979,11 +1985,11 @@
} }
], ],
"primaryKey": { "primaryKey": {
"autoGenerate": false,
"columnNames": [ "columnNames": [
"profileId", "profileId",
"key" "key"
], ]
"autoGenerate": false
}, },
"indices": [], "indices": [],
"foreignKeys": [] "foreignKeys": []
@ -2024,11 +2030,11 @@
} }
], ],
"primaryKey": { "primaryKey": {
"autoGenerate": false,
"columnNames": [ "columnNames": [
"profileId", "profileId",
"lessonId" "lessonId"
], ]
"autoGenerate": false
}, },
"indices": [ "indices": [
{ {
@ -2127,10 +2133,10 @@
} }
], ],
"primaryKey": { "primaryKey": {
"autoGenerate": true,
"columnNames": [ "columnNames": [
"id" "id"
], ]
"autoGenerate": true
}, },
"indices": [ "indices": [
{ {
@ -2228,10 +2234,10 @@
} }
], ],
"primaryKey": { "primaryKey": {
"autoGenerate": false,
"columnNames": [ "columnNames": [
"noteId" "noteId"
], ]
"autoGenerate": false
}, },
"indices": [ "indices": [
{ {
@ -2290,10 +2296,10 @@
} }
], ],
"primaryKey": { "primaryKey": {
"autoGenerate": true,
"columnNames": [ "columnNames": [
"metadataId" "metadataId"
], ]
"autoGenerate": true
}, },
"indices": [ "indices": [
{ {
@ -2314,7 +2320,7 @@
"views": [], "views": [],
"setupQueries": [ "setupQueries": [
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)", "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '4c141460d807d32d00faad4fb3c12522')" "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '26b54e8e64642eb693587f983aaf3adc')"
] ]
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -58,7 +58,8 @@ class LibrusApiBehaviourGrades(override val data: DataLibrus,
semester = 1, semester = 1,
teacherId = -1, teacherId = -1,
subjectId = 1, subjectId = 1,
addedDate = profile.getSemesterStart(1).inMillis addedDate = profile.getSemesterStart(1).inMillis,
code = null
) )
data.gradeList.add(semester1StartGradeObject) data.gradeList.add(semester1StartGradeObject)
@ -86,7 +87,8 @@ class LibrusApiBehaviourGrades(override val data: DataLibrus,
semester = 2, semester = 2,
teacherId = -1, teacherId = -1,
subjectId = 1, subjectId = 1,
addedDate = profile.getSemesterStart(2).inMillis addedDate = profile.getSemesterStart(2).inMillis,
code = null
) )
data.gradeList.add(semester2StartGradeObject) data.gradeList.add(semester2StartGradeObject)
@ -158,7 +160,8 @@ class LibrusApiBehaviourGrades(override val data: DataLibrus,
semester = semester, semester = semester,
teacherId = teacherId, teacherId = teacherId,
subjectId = 1, subjectId = 1,
addedDate = addedDate addedDate = addedDate,
code = null
).apply { ).apply {
valueMax = valueTo valueMax = valueTo
} }

View File

@ -68,7 +68,8 @@ class LibrusApiDescriptiveGrades(override val data: DataLibrus,
semester = semester, semester = semester,
teacherId = teacherId, teacherId = teacherId,
subjectId = subjectId, subjectId = subjectId,
addedDate = addedDate addedDate = addedDate,
code = null
) )
data.gradeList.add(gradeObject) data.gradeList.add(gradeObject)

View File

@ -82,7 +82,8 @@ class LibrusApiGrades(override val data: DataLibrus,
semester = semester, semester = semester,
teacherId = teacherId, teacherId = teacherId,
subjectId = subjectId, subjectId = subjectId,
addedDate = addedDate addedDate = addedDate,
code = null
) )
grade.getJsonObject("Improvement")?.also { grade.getJsonObject("Improvement")?.also {

View File

@ -59,7 +59,8 @@ class LibrusApiPointGrades(override val data: DataLibrus,
semester = semester, semester = semester,
teacherId = teacherId, teacherId = teacherId,
subjectId = subjectId, subjectId = subjectId,
addedDate = addedDate addedDate = addedDate,
code = null
).apply { ).apply {
valueMax = category?.valueTo ?: 0f valueMax = category?.valueTo ?: 0f
} }

View File

@ -63,7 +63,8 @@ class LibrusApiTextGrades(override val data: DataLibrus,
semester = semester, semester = semester,
teacherId = teacherId, teacherId = teacherId,
subjectId = subjectId, subjectId = subjectId,
addedDate = addedDate addedDate = addedDate,
code = null
) )
data.gradeList.add(gradeObject) data.gradeList.add(gradeObject)

View File

@ -81,7 +81,8 @@ class MobidziennikApiGrades(val data: DataMobidziennik, rows: List<String>) {
semester = semester, semester = semester,
teacherId = teacherId, teacherId = teacherId,
subjectId = subjectId, subjectId = subjectId,
addedDate = addedDate addedDate = addedDate,
code = null
) )
if (data.profile?.empty == true) { if (data.profile?.empty == true) {

View File

@ -128,7 +128,8 @@ class MobidziennikWebGrades(override val data: DataMobidziennik,
semester = gradeSemester, semester = gradeSemester,
teacherId = teacherId, teacherId = teacherId,
subjectId = subjectId, subjectId = subjectId,
addedDate = gradeAddedDateMillis addedDate = gradeAddedDateMillis,
code = null
) )
gradeObject.classAverage = gradeClassAverage gradeObject.classAverage = gradeClassAverage

View File

@ -57,7 +57,8 @@ class PodlasieApiFinalGrades(val data: DataPodlasie, val rows: List<JsonObject>)
semester = semester, semester = semester,
teacherId = -1, teacherId = -1,
subjectId = subject.id, subjectId = subject.id,
addedDate = addedDate addedDate = addedDate,
code = null
) )
data.gradeList.add(gradeObject) data.gradeList.add(gradeObject)
@ -94,7 +95,8 @@ class PodlasieApiFinalGrades(val data: DataPodlasie, val rows: List<JsonObject>)
semester = semester, semester = semester,
teacherId = -1, teacherId = -1,
subjectId = subject.id, subjectId = subject.id,
addedDate = addedDate addedDate = addedDate,
code = null
) )
data.gradeList.add(proposedGradeObject) data.gradeList.add(proposedGradeObject)

View File

@ -27,6 +27,7 @@ class PodlasieApiGrades(val data: DataPodlasie, val rows: List<JsonObject>) {
val includeToAverage = grade.getInt("IncludeToAverage") != 0 val includeToAverage = grade.getInt("IncludeToAverage") != 0
val color = grade.getString("Color")?.let { Color.parseColor(it) } ?: -1 val color = grade.getString("Color")?.let { Color.parseColor(it) } ?: -1
val category = grade.getString("Category") ?: "" val category = grade.getString("Category") ?: ""
val code = grade.getString("Code") ?: ""
val comment = grade.getString("Comment") ?: "" val comment = grade.getString("Comment") ?: ""
val semester = grade.getString("TermShortcut")?.length ?: data.currentSemester val semester = grade.getString("TermShortcut")?.length ?: data.currentSemester
@ -54,7 +55,8 @@ class PodlasieApiGrades(val data: DataPodlasie, val rows: List<JsonObject>) {
semester = semester, semester = semester,
teacherId = teacher.id, teacherId = teacher.id,
subjectId = subject.id, subjectId = subject.id,
addedDate = addedDate addedDate = addedDate,
code = code
) )
data.gradeList.add(gradeObject) data.gradeList.add(gradeObject)

View File

@ -66,7 +66,8 @@ class VulcanHebeGradeSummary(
semester = data.studentSemesterNumber, semester = data.studentSemesterNumber,
teacherId = -1, teacherId = -1,
subjectId = subjectId, subjectId = subjectId,
addedDate = addedDate addedDate = addedDate,
code = null
) )
data.gradeList.add(gradeObject) data.gradeList.add(gradeObject)

View File

@ -4,7 +4,6 @@
package pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.data.hebe package pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.data.hebe
import pl.szczodrzynski.edziennik.*
import pl.szczodrzynski.edziennik.data.api.VULCAN_HEBE_ENDPOINT_GRADES import pl.szczodrzynski.edziennik.data.api.VULCAN_HEBE_ENDPOINT_GRADES
import pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.DataVulcan import pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.DataVulcan
import pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.ENDPOINT_VULCAN_HEBE_GRADES import pl.szczodrzynski.edziennik.data.api.edziennik.vulcan.ENDPOINT_VULCAN_HEBE_GRADES
@ -39,6 +38,7 @@ class VulcanHebeGrades(
val column = grade.getJsonObject("Column") val column = grade.getJsonObject("Column")
val category = column.getJsonObject("Category") val category = column.getJsonObject("Category")
val categoryText = category.getString("Name") val categoryText = category.getString("Name")
val code = column.getString("Code").orNullIfEmpty()
val teacherId = getTeacherId(grade, "Creator") ?: -1 val teacherId = getTeacherId(grade, "Creator") ?: -1
val subjectId = getSubjectId(column, "Subject") ?: -1 val subjectId = getSubjectId(column, "Subject") ?: -1
@ -100,6 +100,7 @@ class VulcanHebeGrades(
weight = weight, weight = weight,
color = color, color = color,
category = categoryText, category = categoryText,
code = code,
description = finalDescription, description = finalDescription,
comment = null, comment = null,
semester = getSemester(column), semester = getSemester(column),

View File

@ -44,7 +44,7 @@ import pl.szczodrzynski.edziennik.data.db.migration.*
TimetableManual::class, TimetableManual::class,
Note::class, Note::class,
Metadata::class Metadata::class
], version = 100) ], version = 101)
@TypeConverters( @TypeConverters(
ConverterTime::class, ConverterTime::class,
ConverterDate::class, ConverterDate::class,
@ -189,6 +189,7 @@ abstract class AppDb : RoomDatabase() {
Migration98(), Migration98(),
Migration99(), Migration99(),
Migration100(), Migration100(),
Migration101()
).allowMainThreadQueries().build() ).allowMainThreadQueries().build()
} }
} }

View File

@ -29,6 +29,12 @@ open class Grade(
@ColumnInfo(name = "gradeColor") @ColumnInfo(name = "gradeColor")
var color: Int, var color: Int,
/**
* Applies only for Vulcan (i think)
*/
@ColumnInfo(name = "code")
var code: String?,
@ColumnInfo(name = "gradeCategory") @ColumnInfo(name = "gradeCategory")
var category: String?, var category: String?,
@ColumnInfo(name = "gradeDescription") @ColumnInfo(name = "gradeDescription")

View File

@ -10,12 +10,12 @@ import pl.szczodrzynski.edziennik.data.db.entity.Noteable
class GradeFull( class GradeFull(
profileId: Int, id: Long, name: String, type: Int, profileId: Int, id: Long, name: String, type: Int,
value: Float, weight: Float, color: Int, value: Float, weight: Float, color: Int, code: String?,
category: String?, description: String?, comment: String?, category: String?, description: String?, comment: String?,
semester: Int, teacherId: Long, subjectId: Long, addedDate: Long = System.currentTimeMillis() semester: Int, teacherId: Long, subjectId: Long, addedDate: Long = System.currentTimeMillis()
) : Grade( ) : Grade(
profileId, id, name, type, profileId, id, name, type,
value, weight, color, value, weight, color, code,
category, description, comment, category, description, comment,
semester, teacherId, subjectId, addedDate semester, teacherId, subjectId, addedDate
), Noteable { ), Noteable {

View File

@ -0,0 +1,15 @@
/*
* Copyright (c) Kuba Szczodrzyński 2022-10-25.
* Copyright (c) Franciszek Pilch 2024-06-14.
*/
package pl.szczodrzynski.edziennik.data.db.migration
import androidx.room.migration.Migration
import androidx.sqlite.db.SupportSQLiteDatabase
class Migration101 : Migration(100, 101) {
override fun migrate(database: SupportSQLiteDatabase) {
database.execSQL("ALTER TABLE grades ADD COLUMN code TEXT DEFAULT NULL;")
}
}

View File

@ -141,6 +141,8 @@ fun String.fixWhiteSpaces() = buildString(length) {
} }
}.trimEnd() }.trimEnd()
fun String?.orNullIfEmpty(): String? = if (this.isNullOrEmpty()) null else this
fun CharSequence?.asColoredSpannable(colorInt: Int): Spannable { fun CharSequence?.asColoredSpannable(colorInt: Int): Spannable {
val spannable = SpannableString(this) val spannable = SpannableString(this)
spannable.setSpan(ForegroundColorSpan(colorInt), 0, spannable.length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE) spannable.setSpan(ForegroundColorSpan(colorInt), 0, spannable.length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)

View File

@ -30,6 +30,11 @@ class GradeViewHolder(
@Suppress("PARAMETER_NAME_CHANGED_ON_OVERRIDE") @Suppress("PARAMETER_NAME_CHANGED_ON_OVERRIDE")
override fun onBind(activity: AppCompatActivity, app: App, grade: GradeFull, position: Int, adapter: GradesAdapter) { override fun onBind(activity: AppCompatActivity, app: App, grade: GradeFull, position: Int, adapter: GradesAdapter) {
val manager = app.gradesManager val manager = app.gradesManager
val gradeCategoryText: String = when {
grade.category != null && grade.code != null -> "${grade.code} - ${grade.category}"
grade.code != null -> grade.code!!
else -> grade.category!!
}
b.gradeName.setGrade(grade, manager, bigView = true) b.gradeName.setGrade(grade, manager, bigView = true)
@ -40,15 +45,15 @@ class GradeViewHolder(
if (grade.isImprovement) if (grade.isImprovement)
app.getString(R.string.grades_improvement_category_format, "") app.getString(R.string.grades_improvement_category_format, "")
else else
"" if (grade.code != null) gradeCategoryText else null
} else { } else {
b.gradeDescription.text = b.gradeDescription.text =
grade.getNoteSubstituteText(adapter.showNotes) ?: grade.description grade.getNoteSubstituteText(adapter.showNotes) ?: grade.description
b.gradeCategory.text = b.gradeCategory.text =
if (grade.isImprovement) if (grade.isImprovement)
app.getString(R.string.grades_improvement_category_format, grade.category) app.getString(R.string.grades_improvement_category_format, gradeCategoryText)
else else
grade.category gradeCategoryText
} }
if (adapter.showNotes) if (adapter.showNotes)

View File

@ -157,6 +157,23 @@
android:textIsSelectable="true" android:textIsSelectable="true"
tools:text="@string/dialog_grade_details_no_category" /> tools:text="@string/dialog_grade_details_no_category" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="@string/dialog_grade_details_code"
android:textAppearance="@style/NavView.TextView.BodyMedium"
android:textStyle="bold"
android:textColor="?colorPrimary" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="0dp"
android:text="@{Utils.ns(@string/dialog_grade_details_no_code, grade.code)}"
android:textIsSelectable="true"
tools:text="@string/dialog_grade_details_no_code" />
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -164,8 +181,7 @@
android:text="@string/dialog_grade_details_description" android:text="@string/dialog_grade_details_description"
android:textAppearance="@style/NavView.TextView.BodyMedium" android:textAppearance="@style/NavView.TextView.BodyMedium"
android:textStyle="bold" android:textStyle="bold"
android:textColor="?colorPrimary" android:textColor="?colorPrimary" />
/>
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -1229,4 +1229,6 @@
<string name="edziennik_progress_endpoint_addressbook">Addressbuch herunterladen…</string> <string name="edziennik_progress_endpoint_addressbook">Addressbuch herunterladen…</string>
<string name="settings_ui_lock_layout_text">Sperren des Startbildschirm-Layouts</string> <string name="settings_ui_lock_layout_text">Sperren des Startbildschirm-Layouts</string>
<string name="settings_ui_lock_layout_subtext">Sie können keine Elemente auf dem Startbildschirm bearbeiten</string> <string name="settings_ui_lock_layout_subtext">Sie können keine Elemente auf dem Startbildschirm bearbeiten</string>
<string name="dialog_grade_details_code">Notenspaltencode</string>
<string name="dialog_grade_details_no_code">(kein Notenspaltencode)</string>
</resources> </resources>

View File

@ -1436,4 +1436,6 @@
<string name="home_timetable_all_lessons">All lessons:</string> <string name="home_timetable_all_lessons">All lessons:</string>
<string name="settings_ui_lock_layout_text">Lock home screen layout</string> <string name="settings_ui_lock_layout_text">Lock home screen layout</string>
<string name="settings_ui_lock_layout_subtext">You will not be able to edit items on the home screen</string> <string name="settings_ui_lock_layout_subtext">You will not be able to edit items on the home screen</string>
<string name="dialog_grade_details_code">Grade column code</string>
<string name="dialog_grade_details_no_code">(no column code)</string>
</resources> </resources>

View File

@ -1556,4 +1556,6 @@
<string name="menu_timetable_sync">Odśwież wybrany tydzień</string> <string name="menu_timetable_sync">Odśwież wybrany tydzień</string>
<string name="settings_ui_lock_layout_text">Zablokuj układ ekranu głównego</string> <string name="settings_ui_lock_layout_text">Zablokuj układ ekranu głównego</string>
<string name="settings_ui_lock_layout_subtext">Nie będzie można edytować przedmiotów na ekranie głównym</string> <string name="settings_ui_lock_layout_subtext">Nie będzie można edytować przedmiotów na ekranie głównym</string>
<string name="dialog_grade_details_code">Kod oceny</string>
<string name="dialog_grade_details_no_code">(brak kodu)</string>
</resources> </resources>