From 1bc59cfa7f800ecadbe78cc305c9ab21cad09634 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Borcz?= Date: Sun, 10 Apr 2022 20:23:46 +0200 Subject: [PATCH 1/2] Another attempt to fix destination crash (#1826) --- .../wulkanowy/ui/modules/Destination.kt | 58 +++++++++---------- .../wulkanowy/ui/modules/main/MainActivity.kt | 4 +- .../ui/modules/main/MainPresenter.kt | 6 +- .../NotificationsCenterFragment.kt | 2 +- 4 files changed, 35 insertions(+), 35 deletions(-) diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/Destination.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/Destination.kt index f8c456fe..73a680cf 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/Destination.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/Destination.kt @@ -21,15 +21,15 @@ import kotlinx.serialization.Serializable import java.time.LocalDate @Serializable -sealed class Destination private constructor() : Parcelable { +sealed class Destination : Parcelable { /* Type in children classes have to be as getter to avoid null in enums https://stackoverflow.com/questions/68866453/kotlin-enum-val-is-returning-null-despite-being-set-at-compile-time */ - abstract val type: Type + abstract val destinationType: Type - abstract val fragment: Fragment + abstract val destinationFragment: Fragment enum class Type(val defaultDestination: Destination) { DASHBOARD(Dashboard), @@ -50,29 +50,29 @@ sealed class Destination private constructor() : Parcelable { @Parcelize @Serializable object Dashboard : Destination() { - override val type get() = Type.DASHBOARD - override val fragment get() = DashboardFragment.newInstance() + override val destinationType get() = Type.DASHBOARD + override val destinationFragment get() = DashboardFragment.newInstance() } @Parcelize @Serializable object Grade : Destination() { - override val type get() = Type.GRADE - override val fragment get() = GradeFragment.newInstance() + override val destinationType get() = Type.GRADE + override val destinationFragment get() = GradeFragment.newInstance() } @Parcelize @Serializable object Attendance : Destination() { - override val type get() = Type.ATTENDANCE - override val fragment get() = AttendanceFragment.newInstance() + override val destinationType get() = Type.ATTENDANCE + override val destinationFragment get() = AttendanceFragment.newInstance() } @Parcelize @Serializable object Exam : Destination() { - override val type get() = Type.EXAM - override val fragment get() = ExamFragment.newInstance() + override val destinationType get() = Type.EXAM + override val destinationFragment get() = ExamFragment.newInstance() } @Parcelize @@ -81,63 +81,63 @@ sealed class Destination private constructor() : Parcelable { @Serializable(with = LocalDateSerializer::class) private val date: LocalDate? = null ) : Destination() { - override val type get() = Type.TIMETABLE - override val fragment get() = TimetableFragment.newInstance(date) + override val destinationType get() = Type.TIMETABLE + override val destinationFragment get() = TimetableFragment.newInstance(date) } @Parcelize @Serializable object Homework : Destination() { - override val type get() = Type.HOMEWORK - override val fragment get() = HomeworkFragment.newInstance() + override val destinationType get() = Type.HOMEWORK + override val destinationFragment get() = HomeworkFragment.newInstance() } @Parcelize @Serializable object Note : Destination() { - override val type get() = Type.NOTE - override val fragment get() = NoteFragment.newInstance() + override val destinationType get() = Type.NOTE + override val destinationFragment get() = NoteFragment.newInstance() } @Parcelize @Serializable object Conference : Destination() { - override val type get() = Type.CONFERENCE - override val fragment get() = ConferenceFragment.newInstance() + override val destinationType get() = Type.CONFERENCE + override val destinationFragment get() = ConferenceFragment.newInstance() } @Parcelize @Serializable object SchoolAnnouncement : Destination() { - override val type get() = Type.SCHOOL_ANNOUNCEMENT - override val fragment get() = SchoolAnnouncementFragment.newInstance() + override val destinationType get() = Type.SCHOOL_ANNOUNCEMENT + override val destinationFragment get() = SchoolAnnouncementFragment.newInstance() } @Parcelize @Serializable object School : Destination() { - override val type get() = Type.SCHOOL - override val fragment get() = SchoolFragment.newInstance() + override val destinationType get() = Type.SCHOOL + override val destinationFragment get() = SchoolFragment.newInstance() } @Parcelize @Serializable object LuckyNumber : Destination() { - override val type get() = Type.LUCKY_NUMBER - override val fragment get() = LuckyNumberFragment.newInstance() + override val destinationType get() = Type.LUCKY_NUMBER + override val destinationFragment get() = LuckyNumberFragment.newInstance() } @Parcelize @Serializable object More : Destination() { - override val type get() = Type.MORE - override val fragment get() = MoreFragment.newInstance() + override val destinationType get() = Type.MORE + override val destinationFragment get() = MoreFragment.newInstance() } @Parcelize @Serializable object Message : Destination() { - override val type get() = Type.MESSAGE - override val fragment get() = MessageFragment.newInstance() + override val destinationType get() = Type.MESSAGE + override val destinationFragment get() = MessageFragment.newInstance() } } diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainActivity.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainActivity.kt index d1f32447..b6d41e2c 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainActivity.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainActivity.kt @@ -129,7 +129,7 @@ class MainActivity : BaseActivity(), MainVie ) } fragmentHideStrategy = HIDE - rootFragments = rootDestinations.map { it.fragment } + rootFragments = rootDestinations.map { it.destinationFragment } initialize(startMenuIndex, savedInstanceState) } @@ -230,7 +230,7 @@ class MainActivity : BaseActivity(), MainVie } override fun openMoreDestination(destination: Destination) { - pushView(destination.fragment) + pushView(destination.destinationFragment) } override fun notifyMenuViewReselected() { diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainPresenter.kt index e01497b9..cb414fcb 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainPresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/main/MainPresenter.kt @@ -45,8 +45,8 @@ class MainPresenter @Inject constructor( private val Destination?.startMenuIndex get() = when { this == null -> prefRepository.startMenuIndex - type in rootDestinationTypeList -> { - rootDestinationTypeList.indexOf(type) + destinationType in rootDestinationTypeList -> { + rootDestinationTypeList.indexOf(destinationType) } else -> 4 } @@ -56,7 +56,7 @@ class MainPresenter @Inject constructor( val startMenuIndex = initDestination.startMenuIndex val destinations = rootDestinationTypeList.map { - if (it == initDestination?.type) initDestination else it.defaultDestination + if (it == initDestination?.destinationType) initDestination else it.defaultDestination } view.initView(startMenuIndex, destinations) diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/notificationscenter/NotificationsCenterFragment.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/notificationscenter/NotificationsCenterFragment.kt index 4f1943f4..ca71910a 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/notificationscenter/NotificationsCenterFragment.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/notificationscenter/NotificationsCenterFragment.kt @@ -43,7 +43,7 @@ class NotificationsCenterFragment : override fun initView() { notificationsCenterAdapter.onItemClickListener = { notification -> - (requireActivity() as MainActivity).pushView(notification.destination.fragment) + (requireActivity() as MainActivity).pushView(notification.destination.destinationFragment) } with(binding.notificationsCenterRecycler) { From e6f56a74a4360163aa5bba98bea7bc9b5b621b4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Pich?= Date: Sun, 10 Apr 2022 20:37:10 +0200 Subject: [PATCH 2/2] Version 1.6.2 --- app/build.gradle | 6 +++--- app/src/main/play/release-notes/pl-PL/default.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 56137fff..2f77712f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -22,8 +22,8 @@ android { testApplicationId "io.github.tests.wulkanowy" minSdkVersion 21 targetSdkVersion 31 - versionCode 105 - versionName "1.6.1" + versionCode 106 + versionName "1.6.2" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" resValue "string", "app_name", "Wulkanowy" @@ -153,7 +153,7 @@ play { defaultToAppBundles = false track = 'production' releaseStatus = com.github.triplet.gradle.androidpublisher.ReleaseStatus.IN_PROGRESS - userFraction = 0.25d + userFraction = 0.50d updatePriority = 1 enabled.set(false) } diff --git a/app/src/main/play/release-notes/pl-PL/default.txt b/app/src/main/play/release-notes/pl-PL/default.txt index f66c2549..4a3b1e2f 100644 --- a/app/src/main/play/release-notes/pl-PL/default.txt +++ b/app/src/main/play/release-notes/pl-PL/default.txt @@ -1,4 +1,4 @@ -Wersja 1.6.0 +Wersja 1.6.2 - dodaliśmy możliwość usuwania wielu wiadomości jednocześnie - dodaliśmy opcję szybkiego dodawania sprawdzianów do kalendarza