Compare commits

...

3 Commits

6 changed files with 48 additions and 18 deletions

View File

@ -184,7 +184,7 @@ dependencies {
implementation "com.squareup.retrofit2:retrofit:2.9.0" implementation "com.squareup.retrofit2:retrofit:2.9.0"
implementation "com.squareup.retrofit2:converter-gson:2.9.0" implementation "com.squareup.retrofit2:converter-gson:2.9.0"
implementation "com.squareup.retrofit2:converter-scalars:2.9.0" implementation "com.squareup.retrofit2:converter-scalars:2.9.0"
implementation 'com.google.code.gson:gson:2.10.1' implementation 'com.google.code.gson:gson:2.11.0'
implementation 'org.jsoup:jsoup:1.14.3' implementation 'org.jsoup:jsoup:1.14.3'
implementation "pl.droidsonroids:jspoon:1.3.2" implementation "pl.droidsonroids:jspoon:1.3.2"
implementation "pl.droidsonroids.retrofit2:converter-jspoon:1.3.2" implementation "pl.droidsonroids.retrofit2:converter-jspoon:1.3.2"

View File

@ -58,6 +58,17 @@
-keep class com.google.android.material.tabs.** {*;} -keep class com.google.android.material.tabs.** {*;}
# Exclude AgendaCalendarView
# Preserve generic type information for EventRenderer and its subclasses
-keepclassmembers class * extends com.github.tibolte.agendacalendarview.render.EventRenderer {
<fields>;
<methods>;
}
# Keep the EventRenderer class itself and all its subclasses
-keep class com.github.tibolte.agendacalendarview.render.EventRenderer
-keep class * extends com.github.tibolte.agendacalendarview.render.EventRenderer
# ServiceLoader support # ServiceLoader support
-keepnames class kotlinx.coroutines.internal.MainDispatcherFactory {} -keepnames class kotlinx.coroutines.internal.MainDispatcherFactory {}
-keepnames class kotlinx.coroutines.CoroutineExceptionHandler {} -keepnames class kotlinx.coroutines.CoroutineExceptionHandler {}

View File

@ -38,7 +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 code = column.getString("Code").takeValue()
val teacherId = getTeacherId(grade, "Creator") ?: -1 val teacherId = getTeacherId(grade, "Creator") ?: -1
val subjectId = getSubjectId(column, "Subject") ?: -1 val subjectId = getSubjectId(column, "Subject") ?: -1

View File

@ -141,8 +141,6 @@ 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

@ -49,8 +49,6 @@ class LessonDetailsDialog(
DialogLessonDetailsBinding.inflate(layoutInflater) DialogLessonDetailsBinding.inflate(layoutInflater)
override fun getPositiveButtonText() = R.string.close override fun getPositiveButtonText() = R.string.close
override fun getNegativeButtonText() = R.string.notes_button
override fun getNeutralButtonText() = R.string.add
private lateinit var adapter: EventListAdapter private lateinit var adapter: EventListAdapter
private val manager private val manager
@ -58,7 +56,7 @@ class LessonDetailsDialog(
private val attendanceManager private val attendanceManager
get() = app.attendanceManager get() = app.attendanceManager
override suspend fun onNeutralClick(): Boolean { fun openAddEventDialog(): Boolean {
EventManualDialog( EventManualDialog(
activity, activity,
lesson.profileId, lesson.profileId,
@ -68,6 +66,7 @@ class LessonDetailsDialog(
).show() ).show()
return NO_DISMISS return NO_DISMISS
} }
override suspend fun onShow() { override suspend fun onShow() {
if (App.devMode) if (App.devMode)
b.lessonId.visibility = View.VISIBLE b.lessonId.visibility = View.VISIBLE
@ -227,6 +226,8 @@ class LessonDetailsDialog(
addItemDecoration(SimpleDividerItemDecoration(context)) addItemDecoration(SimpleDividerItemDecoration(context))
} }
} }
@Suppress("NotifyDataSetChanged")
adapter.notifyDataSetChanged() adapter.notifyDataSetChanged()
if (events != null && events.isNotEmpty()) { if (events != null && events.isNotEmpty()) {
@ -240,7 +241,6 @@ class LessonDetailsDialog(
lesson.displayTeacherName?.let { name -> lesson.displayTeacherName?.let { name ->
lesson.displayTeacherId ?: return@let lesson.displayTeacherId ?: return@let
/*
BetterLink.attach( BetterLink.attach(
b.teacherNameView, b.teacherNameView,
teachers = mapOf(lesson.displayTeacherId!! to name), teachers = mapOf(lesson.displayTeacherId!! to name),
@ -251,9 +251,9 @@ class LessonDetailsDialog(
teachers = mapOf(lesson.displayTeacherId!! to name), teachers = mapOf(lesson.displayTeacherId!! to name),
onActionSelected = dialog::dismiss onActionSelected = dialog::dismiss
) )
*/
} }
/*
b.addEventButton.onClick { openAddEventDialog() }
b.notesButton.isVisible = showNotes b.notesButton.isVisible = showNotes
b.notesButton.setupNotesButton( b.notesButton.setupNotesButton(
activity = activity, activity = activity,
@ -261,9 +261,9 @@ class LessonDetailsDialog(
onShowListener = onShowListener, onShowListener = onShowListener,
onDismissListener = onDismissListener, onDismissListener = onDismissListener,
) )
b.legend.isVisible = showNotes b.legend.isVisible = showNotes
if (showNotes) if (showNotes)
NoteManager.setLegendText(lesson, b.legend) NoteManager.setLegendText(lesson, b.legend)
*/
} }
} }

View File

@ -398,14 +398,35 @@
tools:visibility="visible" tools:visibility="visible"
tools:listitem="@layout/event_list_item" /> tools:listitem="@layout/event_list_item" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="8dp"
android:layout_marginTop="8dp"
android:gravity="center_horizontal"
android:orientation="horizontal">
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:id="@+id/notesButton" android:id="@+id/addEventButton"
style="@style/Widget.Material3.Button.TextButton.Icon" style="@style/Widget.Material3.Button.OutlinedButton.Icon"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:layout_margin="8dp"
android:text="@string/add"
app:icon="@drawable/ic_action_add"/>
<com.google.android.material.button.MaterialButton
android:id="@+id/notesButton"
style="@style/Widget.Material3.Button.OutlinedButton.Icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="8dp"
android:text="@string/notes_button" android:text="@string/notes_button"
app:icon="@drawable/ic_note_legacy"
android:visibility="gone"/> android:visibility="gone"/>
</LinearLayout> </LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>
</layout> </layout>