diff --git a/app/src/main/java/nerd/tuxmobil/fahrplan/congress/dataconverters/ShiftExtensions.kt b/app/src/main/java/nerd/tuxmobil/fahrplan/congress/dataconverters/ShiftExtensions.kt index 478585786e..b387bb7798 100644 --- a/app/src/main/java/nerd/tuxmobil/fahrplan/congress/dataconverters/ShiftExtensions.kt +++ b/app/src/main/java/nerd/tuxmobil/fahrplan/congress/dataconverters/ShiftExtensions.kt @@ -31,10 +31,10 @@ fun Shift.toSessionAppModel( room = virtualRoomName speakers = emptyList() startTime = minuteOfDay // minutes since day start - title = name - subtitle = talkTitle + title = talkTitle + subtitle = locationName // Shift.timeZoneName is not mapped here. Using Meta.timeZoneName instead. - track = virtualRoomName + track = typeName url = talkUrl } @@ -60,15 +60,18 @@ private val Shift.dateUtcMs val Shift.descriptionText: String get() { var text = "" - if (locationName.isNotEmpty()) { - text += locationName - } if (locationUrl.isNotEmpty()) { if (text.isNotEmpty()) { text += "\n" } text += "$locationUrl" } + if (typeDescription.isNotEmpty()) { + if (text.isNotEmpty()) { + text += "\n\n" + } + text += typeDescription + } if (locationDescription.isNotEmpty()) { if (text.isNotEmpty()) { text += "\n\n" diff --git a/app/src/main/java/nerd/tuxmobil/fahrplan/congress/details/SessionDetailsFragment.kt b/app/src/main/java/nerd/tuxmobil/fahrplan/congress/details/SessionDetailsFragment.kt index b7b9213501..d59a895864 100644 --- a/app/src/main/java/nerd/tuxmobil/fahrplan/congress/details/SessionDetailsFragment.kt +++ b/app/src/main/java/nerd/tuxmobil/fahrplan/congress/details/SessionDetailsFragment.kt @@ -28,7 +28,9 @@ import androidx.fragment.app.Fragment import androidx.fragment.app.FragmentManager import androidx.fragment.app.viewModels import info.metadude.android.eventfahrplan.commons.flow.observe +import io.noties.markwon.AbstractMarkwonPlugin import io.noties.markwon.Markwon +import io.noties.markwon.core.MarkwonTheme import io.noties.markwon.linkify.LinkifyPlugin import nerd.tuxmobil.fahrplan.congress.BuildConfig import nerd.tuxmobil.fahrplan.congress.R @@ -59,6 +61,15 @@ class SessionDetailsFragment : Fragment() { private const val SCHEDULE_FEEDBACK_URL = BuildConfig.SCHEDULE_FEEDBACK_URL private val SHOW_FEEDBACK_MENU_ITEM = !TextUtils.isEmpty(SCHEDULE_FEEDBACK_URL) + // Custom heading text size multipliers for each heading level. + // Docs: https://noties.io/Markwon/docs/v4/core/theme.html#typeface + private val HEADING_TEXT_SIZE_MULTIPLIERS = floatArrayOf(1.25f, 1.18f, 1.07F, 1.0f, .83F, .67F) + private val HEADINGS_PLUGIN = object : AbstractMarkwonPlugin() { + override fun configureTheme(builder: MarkwonTheme.Builder) { + builder.headingTextSizeMultipliers(HEADING_TEXT_SIZE_MULTIPLIERS) + } + } + @JvmStatic fun replaceAtBackStack(fragmentManager: FragmentManager, @IdRes containerViewId: Int, sidePane: Boolean) { val fragment = SessionDetailsFragment().withArguments( @@ -114,6 +125,7 @@ class SessionDetailsFragment : Fragment() { alarmServices = AlarmServices.newInstance(context, appRepository) notificationHelper = NotificationHelper(context) markwon = Markwon.builder(requireContext()) + .usePlugin(HEADINGS_PLUGIN) .usePlugin(LinkifyPlugin.create()) .build() } diff --git a/app/src/test/java/nerd/tuxmobil/fahrplan/congress/dataconverters/ShiftExtensionsTest.kt b/app/src/test/java/nerd/tuxmobil/fahrplan/congress/dataconverters/ShiftExtensionsTest.kt index c4e8a0472b..744392b91c 100644 --- a/app/src/test/java/nerd/tuxmobil/fahrplan/congress/dataconverters/ShiftExtensionsTest.kt +++ b/app/src/test/java/nerd/tuxmobil/fahrplan/congress/dataconverters/ShiftExtensionsTest.kt @@ -45,7 +45,7 @@ class ShiftExtensionsTest { @Test fun descriptionTextWithShiftWithLocationName() { - assertThat(Shift(locationName = "Room 23").descriptionText).isEqualTo("Room 23") + assertThat(Shift(locationName = "Room 23").descriptionText).isEqualTo("") } @Test @@ -71,7 +71,7 @@ class ShiftExtensionsTest { locationDescription = "The small orange room.", userComment = "Take a bottle of water with you" ) - val text = "Room 42\nhttps://conference.org\n\nThe small orange room.\n\n_Take a bottle of water with you_" + val text = "https://conference.org\n\nThe small orange room.\n\n_Take a bottle of water with you_" assertThat(shift.descriptionText).isEqualTo(text) } diff --git a/buildSrc/src/main/kotlin/nerd/tuxmobil/fahrplan/congress/Dependencies.kt b/buildSrc/src/main/kotlin/nerd/tuxmobil/fahrplan/congress/Dependencies.kt index 0e82456c23..7eb8a56a35 100644 --- a/buildSrc/src/main/kotlin/nerd/tuxmobil/fahrplan/congress/Dependencies.kt +++ b/buildSrc/src/main/kotlin/nerd/tuxmobil/fahrplan/congress/Dependencies.kt @@ -63,7 +63,7 @@ object Libs { const val coreKtx = "1.9.0" const val coreTesting = "2.2.0" const val emailIntentBuilder = "2.0.0" - const val engelsystem = "7.3.0" + const val engelsystem = "8.0.0" const val espresso = "3.5.1" const val junit = "4.13.2" const val kotlinCoroutines = "1.7.3" diff --git a/engelsystem/src/test/kotlin/info/metadude/android/eventfahrplan/engelsystem/EngelsystemNetworkRepositoryTest.kt b/engelsystem/src/test/kotlin/info/metadude/android/eventfahrplan/engelsystem/EngelsystemNetworkRepositoryTest.kt index e7f9ebbb56..09eb34620a 100644 --- a/engelsystem/src/test/kotlin/info/metadude/android/eventfahrplan/engelsystem/EngelsystemNetworkRepositoryTest.kt +++ b/engelsystem/src/test/kotlin/info/metadude/android/eventfahrplan/engelsystem/EngelsystemNetworkRepositoryTest.kt @@ -31,7 +31,7 @@ class EngelsystemNetworkRepositoryTest { const val VALID_ONE_ITEM_SHIFTS_JSON = """ [ { - "Comment": "This is a very secret comment.", + "user_comment": "This is a very secret comment.", "Name": "Kirmes", "RID": 12, "SID": 579, @@ -46,8 +46,9 @@ class EngelsystemNetworkRepositoryTest { "event_timezone": "Europe/Berlin", "freeloaded": 0, "id": 37, - "name": "Collect stickers", "shifttype_id": 6, + "shifttype_name": "Name of the shift type", + "shifttype_description": "# Description of the shift type as markdown\n", "start_date": "2019-08-21T13:00:00+02:00", "title": "Tag 1: Decorate fridge" } @@ -65,12 +66,13 @@ class EngelsystemNetworkRepositoryTest { endsAtDate = ENDS_AT, locationDescription = "Kirmes are fun.", locationName = "Kirmes", - name = "Collect stickers", sID = 579, startsAtDate = STARTS_AT, talkTitle = "Tag 1: Decorate fridge", timeZoneName = "Europe/Berlin", - typeId = 6 + typeId = 6, + typeName = "Name of the shift type", + typeDescription = "# Description of the shift type as markdown\n", )) const val URL = "https://example.com/test/shifts-json-export/file.json?key=111111"