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:converter-gson: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 "pl.droidsonroids: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.** {*;}
# 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
-keepnames class kotlinx.coroutines.internal.MainDispatcherFactory {}
-keepnames class kotlinx.coroutines.CoroutineExceptionHandler {}

View File

@ -38,7 +38,7 @@ class VulcanHebeGrades(
val column = grade.getJsonObject("Column")
val category = column.getJsonObject("Category")
val categoryText = category.getString("Name")
val code = column.getString("Code").orNullIfEmpty()
val code = column.getString("Code").takeValue()
val teacherId = getTeacherId(grade, "Creator") ?: -1
val subjectId = getSubjectId(column, "Subject") ?: -1

View File

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

View File

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

View File

@ -398,14 +398,35 @@
tools:visibility="visible"
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
android:id="@+id/notesButton"
style="@style/Widget.Material3.Button.TextButton.Icon"
android:id="@+id/addEventButton"
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/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"
app:icon="@drawable/ic_note_legacy"
android:visibility="gone"/>
</LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</layout>