From 1fff1c2b144f1139b166c7f7589038472c4fb09b Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Thu, 6 May 2021 11:02:08 +0000
Subject: [PATCH] Bump kotlin_version from 1.4.32 to 1.5.0 (#1310)
---
.idea/codeStyles/Project.xml | 9 ------
app/build.gradle | 4 +--
app/jacoco.gradle | 2 +-
.../modules/attendance/AttendancePresenter.kt | 3 +-
.../summary/AttendanceSummaryAdapter.kt | 14 +++++-----
.../wulkanowy/ui/modules/exam/ExamAdapter.kt | 3 +-
.../grade/details/GradeDetailsAdapter.kt | 4 +--
.../grade/details/GradeDetailsPresenter.kt | 9 +++---
.../ui/modules/homework/HomeworkAdapter.kt | 3 +-
.../history/LuckyNumberHistoryAdapter.kt | 3 +-
.../modules/message/tab/MessageTabAdapter.kt | 2 +-
.../message/tab/MessageTabPresenter.kt | 28 ++++++++-----------
.../studentinfo/StudentInfoFragment.kt | 5 ++--
.../ui/modules/timetable/TimetableDialog.kt | 7 +++--
.../modules/timetable/TimetablePresenter.kt | 3 +-
.../additional/AdditionalLessonsPresenter.kt | 3 +-
.../completed/CompletedLessonsPresenter.kt | 3 +-
.../TimetableWidgetProvider.kt | 3 +-
.../wulkanowy/utils/AttendanceExtension.kt | 2 +-
.../wulkanowy/utils/ContextExtension.kt | 2 +-
.../github/wulkanowy/utils/StringExtension.kt | 8 +++++-
.../github/wulkanowy/utils/TimeExtension.kt | 2 +-
build.gradle | 2 +-
23 files changed, 63 insertions(+), 61 deletions(-)
diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
index 0ac66f649..ab7844747 100644
--- a/.idea/codeStyles/Project.xml
+++ b/.idea/codeStyles/Project.xml
@@ -7,15 +7,6 @@
-
diff --git a/app/build.gradle b/app/build.gradle
index 74d3e37d8..81b6bd735 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -117,7 +117,6 @@ android {
}
kotlinOptions {
- useIR = true
jvmTarget = "1.8"
freeCompilerArgs += ["-Xopt-in=kotlin.RequiresOptIn", "-Xjvm-default=all"]
}
@@ -165,7 +164,7 @@ dependencies {
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
- implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.3'
+ implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.0-RC"
implementation "androidx.core:core-ktx:1.3.2"
implementation "androidx.activity:activity-ktx:1.2.3"
@@ -197,7 +196,6 @@ dependencies {
implementation "com.google.dagger:hilt-android:$hilt_version"
kapt "com.google.dagger:hilt-android-compiler:$hilt_version"
implementation "androidx.hilt:hilt-work:$work_hilt"
- kapt "androidx.hilt:hilt-compiler:$work_hilt"
implementation "com.ncapdevi:frag-nav:3.3.0"
implementation "com.github.YarikSOffice:lingver:1.3.0"
diff --git a/app/jacoco.gradle b/app/jacoco.gradle
index 1fb1ebd76..9c1f5b1c2 100644
--- a/app/jacoco.gradle
+++ b/app/jacoco.gradle
@@ -1,7 +1,7 @@
apply plugin: "jacoco"
jacoco {
- toolVersion "0.8.6"
+ toolVersion "0.8.7"
reportsDirectory = file("$buildDir/reports")
}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendancePresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendancePresenter.kt
index b03db91af..333e7103a 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendancePresenter.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/AttendancePresenter.kt
@@ -11,6 +11,7 @@ import io.github.wulkanowy.ui.base.BasePresenter
import io.github.wulkanowy.ui.base.ErrorHandler
import io.github.wulkanowy.utils.AnalyticsHelper
import io.github.wulkanowy.utils.afterLoading
+import io.github.wulkanowy.utils.capitalise
import io.github.wulkanowy.utils.flowWithResource
import io.github.wulkanowy.utils.flowWithResourceIn
import io.github.wulkanowy.utils.getLastSchoolDayIfHoliday
@@ -319,7 +320,7 @@ class AttendancePresenter @Inject constructor(
view?.apply {
showPreButton(!currentDate.minusDays(1).isHolidays)
showNextButton(!currentDate.plusDays(1).isHolidays)
- updateNavigationDay(currentDate.toFormattedString("EEEE, dd.MM").capitalize())
+ updateNavigationDay(currentDate.toFormattedString("EEEE, dd.MM").capitalise())
}
}
}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryAdapter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryAdapter.kt
index 4250a9109..a2b6abfb8 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryAdapter.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/attendance/summary/AttendanceSummaryAdapter.kt
@@ -76,13 +76,13 @@ class AttendanceSummaryAdapter @Inject constructor() :
private fun getTotalItem() = AttendanceSummary(
month = Month.APRIL,
- presence = items.sumBy { it.presence },
- absence = items.sumBy { it.absence },
- absenceExcused = items.sumBy { it.absenceExcused },
- absenceForSchoolReasons = items.sumBy { it.absenceForSchoolReasons },
- exemption = items.sumBy { it.exemption },
- lateness = items.sumBy { it.lateness },
- latenessExcused = items.sumBy { it.latenessExcused },
+ presence = items.sumOf { it.presence },
+ absence = items.sumOf { it.absence },
+ absenceExcused = items.sumOf { it.absenceExcused },
+ absenceForSchoolReasons = items.sumOf { it.absenceForSchoolReasons },
+ exemption = items.sumOf { it.exemption },
+ lateness = items.sumOf { it.lateness },
+ latenessExcused = items.sumOf { it.latenessExcused },
diaryId = -1,
studentId = -1,
subjectId = -1
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/exam/ExamAdapter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/exam/ExamAdapter.kt
index 535587399..4dc8afd30 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/exam/ExamAdapter.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/exam/ExamAdapter.kt
@@ -7,6 +7,7 @@ import androidx.recyclerview.widget.RecyclerView
import io.github.wulkanowy.data.db.entities.Exam
import io.github.wulkanowy.databinding.HeaderExamBinding
import io.github.wulkanowy.databinding.ItemExamBinding
+import io.github.wulkanowy.utils.capitalise
import io.github.wulkanowy.utils.toFormattedString
import io.github.wulkanowy.utils.weekDayName
import java.time.LocalDate
@@ -42,7 +43,7 @@ class ExamAdapter @Inject constructor() : RecyclerView.Adapter) {
- newGradesAmount =
- grades.sumBy { item -> item.grades.sumBy { grade -> if (!grade.isRead) 1 else 0 } }
+ newGradesAmount = grades.sumOf { item ->
+ item.grades.sumOf { grade -> (if (!grade.isRead) 1 else 0).toInt() }
+ }
}
private fun showErrorViewOnError(message: String, error: Throwable) {
@@ -217,7 +217,6 @@ class GradeDetailsPresenter @Inject constructor(
}
}
- @SuppressLint("DefaultLocale")
private fun createGradeItems(items: List): List {
return items
.let { gradesWithAverages ->
@@ -228,7 +227,7 @@ class GradeDetailsPresenter @Inject constructor(
.let {
when (preferencesRepository.gradeSortingMode) {
DATE -> it.sortedByDescending { gradeDetailsWithAverage -> gradeDetailsWithAverage.grades.firstOrNull()?.date }
- ALPHABETIC -> it.sortedBy { gradeDetailsWithAverage -> gradeDetailsWithAverage.subject.toLowerCase() }
+ ALPHABETIC -> it.sortedBy { gradeDetailsWithAverage -> gradeDetailsWithAverage.subject.lowercase() }
}
}
.map { (subject, average, points, _, grades) ->
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/homework/HomeworkAdapter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/homework/HomeworkAdapter.kt
index 8ae06aeb5..9dcd3d4a2 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/homework/HomeworkAdapter.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/homework/HomeworkAdapter.kt
@@ -8,6 +8,7 @@ import androidx.recyclerview.widget.RecyclerView
import io.github.wulkanowy.data.db.entities.Homework
import io.github.wulkanowy.databinding.HeaderHomeworkBinding
import io.github.wulkanowy.databinding.ItemHomeworkBinding
+import io.github.wulkanowy.utils.capitalise
import io.github.wulkanowy.utils.toFormattedString
import io.github.wulkanowy.utils.weekDayName
import java.time.LocalDate
@@ -43,7 +44,7 @@ class HomeworkAdapter @Inject constructor() : RecyclerView.Adapter
val updatedValue = value.ifBlank { getString(R.string.all_no_data) }
val updatedTitle = title.ifBlank { getString(R.string.all_no_data) }
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableDialog.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableDialog.kt
index f8be9a35b..648d9a58c 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableDialog.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetableDialog.kt
@@ -12,10 +12,13 @@ import androidx.fragment.app.DialogFragment
import io.github.wulkanowy.R
import io.github.wulkanowy.data.db.entities.Timetable
import io.github.wulkanowy.databinding.DialogTimetableBinding
+import io.github.wulkanowy.utils.capitalise
+import io.github.wulkanowy.utils.decapitalise
import io.github.wulkanowy.utils.getThemeAttrColor
import io.github.wulkanowy.utils.lifecycleAwareVariable
import io.github.wulkanowy.utils.toFormattedString
import java.time.LocalDateTime
+import java.util.Locale
class TimetableDialog : DialogFragment() {
@@ -101,8 +104,8 @@ class TimetableDialog : DialogFragment() {
timetableDialogChangesValue.text = when {
canceled && !changes -> "Lekcja odwołana: $info"
changes && teacher.isNotBlank() -> "Zastępstwo: $teacher"
- changes && teacher.isBlank() -> "Zastępstwo, ${info.decapitalize()}"
- else -> info.capitalize()
+ changes && teacher.isBlank() -> "Zastępstwo, ${info.decapitalise()}"
+ else -> info.capitalise()
}
}
else -> {
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetablePresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetablePresenter.kt
index 1f777f1b2..fa1bbfb28 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetablePresenter.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/TimetablePresenter.kt
@@ -11,6 +11,7 @@ import io.github.wulkanowy.ui.base.BasePresenter
import io.github.wulkanowy.ui.base.ErrorHandler
import io.github.wulkanowy.utils.AnalyticsHelper
import io.github.wulkanowy.utils.afterLoading
+import io.github.wulkanowy.utils.capitalise
import io.github.wulkanowy.utils.flowWithResourceIn
import io.github.wulkanowy.utils.getLastSchoolDayIfHoliday
import io.github.wulkanowy.utils.isHolidays
@@ -229,7 +230,7 @@ class TimetablePresenter @Inject constructor(
view?.apply {
showPreButton(!currentDate.minusDays(1).isHolidays)
showNextButton(!currentDate.plusDays(1).isHolidays)
- updateNavigationDay(currentDate.toFormattedString("EEEE, dd.MM").capitalize())
+ updateNavigationDay(currentDate.toFormattedString("EEEE, dd.MM").capitalise())
}
}
}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/additional/AdditionalLessonsPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/additional/AdditionalLessonsPresenter.kt
index 4edf7b05f..3496e141a 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/additional/AdditionalLessonsPresenter.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/additional/AdditionalLessonsPresenter.kt
@@ -9,6 +9,7 @@ import io.github.wulkanowy.ui.base.BasePresenter
import io.github.wulkanowy.ui.base.ErrorHandler
import io.github.wulkanowy.utils.AnalyticsHelper
import io.github.wulkanowy.utils.afterLoading
+import io.github.wulkanowy.utils.capitalise
import io.github.wulkanowy.utils.flowWithResourceIn
import io.github.wulkanowy.utils.getLastSchoolDayIfHoliday
import io.github.wulkanowy.utils.isHolidays
@@ -164,7 +165,7 @@ class AdditionalLessonsPresenter @Inject constructor(
view?.apply {
showPreButton(!currentDate.minusDays(1).isHolidays)
showNextButton(!currentDate.plusDays(1).isHolidays)
- updateNavigationDay(currentDate.toFormattedString("EEEE, dd.MM").capitalize())
+ updateNavigationDay(currentDate.toFormattedString("EEEE, dd.MM").capitalise())
}
}
}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/completed/CompletedLessonsPresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/completed/CompletedLessonsPresenter.kt
index 04e2a5cd7..b75b42f8b 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/completed/CompletedLessonsPresenter.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/timetable/completed/CompletedLessonsPresenter.kt
@@ -9,6 +9,7 @@ import io.github.wulkanowy.data.repositories.StudentRepository
import io.github.wulkanowy.ui.base.BasePresenter
import io.github.wulkanowy.utils.AnalyticsHelper
import io.github.wulkanowy.utils.afterLoading
+import io.github.wulkanowy.utils.capitalise
import io.github.wulkanowy.utils.flowWithResourceIn
import io.github.wulkanowy.utils.getLastSchoolDayIfHoliday
import io.github.wulkanowy.utils.isHolidays
@@ -188,7 +189,7 @@ class CompletedLessonsPresenter @Inject constructor(
view?.apply {
showPreButton(!currentDate.minusDays(1).isHolidays)
showNextButton(!currentDate.plusDays(1).isHolidays)
- updateNavigationDay(currentDate.toFormattedString("EEEE, dd.MM").capitalize())
+ updateNavigationDay(currentDate.toFormattedString("EEEE, dd.MM").capitalise())
}
}
}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/timetablewidget/TimetableWidgetProvider.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/timetablewidget/TimetableWidgetProvider.kt
index fd79f738a..733eb17fc 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/modules/timetablewidget/TimetableWidgetProvider.kt
+++ b/app/src/main/java/io/github/wulkanowy/ui/modules/timetablewidget/TimetableWidgetProvider.kt
@@ -27,6 +27,7 @@ import io.github.wulkanowy.services.widgets.TimetableWidgetService
import io.github.wulkanowy.ui.modules.main.MainActivity
import io.github.wulkanowy.ui.modules.main.MainView
import io.github.wulkanowy.utils.AnalyticsHelper
+import io.github.wulkanowy.utils.capitalise
import io.github.wulkanowy.utils.createNameInitialsDrawable
import io.github.wulkanowy.utils.getCompatColor
import io.github.wulkanowy.utils.nextOrSameSchoolDay
@@ -180,7 +181,7 @@ class TimetableWidgetProvider : HiltBroadcastReceiver() {
setEmptyView(R.id.timetableWidgetList, R.id.timetableWidgetEmpty)
setTextViewText(
R.id.timetableWidgetDate,
- date.toFormattedString("EEEE, dd.MM").capitalize()
+ date.toFormattedString("EEEE, dd.MM").capitalise()
)
setTextViewText(
R.id.timetableWidgetName,
diff --git a/app/src/main/java/io/github/wulkanowy/utils/AttendanceExtension.kt b/app/src/main/java/io/github/wulkanowy/utils/AttendanceExtension.kt
index f10b00a07..8bccec620 100644
--- a/app/src/main/java/io/github/wulkanowy/utils/AttendanceExtension.kt
+++ b/app/src/main/java/io/github/wulkanowy/utils/AttendanceExtension.kt
@@ -19,7 +19,7 @@ private inline val AttendanceSummary.allAbsences: Double
fun AttendanceSummary.calculatePercentage() = calculatePercentage(allPresences, allAbsences)
fun List.calculatePercentage(): Double {
- return calculatePercentage(sumByDouble { it.allPresences }, sumByDouble { it.allAbsences })
+ return calculatePercentage(sumOf { it.allPresences }, sumOf { it.allAbsences })
}
private fun calculatePercentage(presence: Double, absence: Double): Double {
diff --git a/app/src/main/java/io/github/wulkanowy/utils/ContextExtension.kt b/app/src/main/java/io/github/wulkanowy/utils/ContextExtension.kt
index f7f560346..be664a470 100644
--- a/app/src/main/java/io/github/wulkanowy/utils/ContextExtension.kt
+++ b/app/src/main/java/io/github/wulkanowy/utils/ContextExtension.kt
@@ -126,7 +126,7 @@ fun Context.createNameInitialsDrawable(
val firstCharFirstWord = words.getOrNull(0)?.firstOrNull() ?: ""
val firstCharSecondWord = words.getOrNull(1)?.firstOrNull() ?: ""
- val initials = "$firstCharFirstWord$firstCharSecondWord".toUpperCase()
+ val initials = "$firstCharFirstWord$firstCharSecondWord".uppercase()
val bounds = Rect()
val dimension = this.dpToPx(64f * scaleFactory).toInt()
diff --git a/app/src/main/java/io/github/wulkanowy/utils/StringExtension.kt b/app/src/main/java/io/github/wulkanowy/utils/StringExtension.kt
index 65167fd78..5c888f30a 100644
--- a/app/src/main/java/io/github/wulkanowy/utils/StringExtension.kt
+++ b/app/src/main/java/io/github/wulkanowy/utils/StringExtension.kt
@@ -1,3 +1,9 @@
package io.github.wulkanowy.utils
-inline fun String?.ifNullOrBlank(defaultValue: () -> String) = if (this.isNullOrBlank()) defaultValue() else this
+inline fun String?.ifNullOrBlank(defaultValue: () -> String) =
+ if (isNullOrBlank()) defaultValue() else this
+
+fun String.capitalise() =
+ replaceFirstChar { if (it.isLowerCase()) it.titlecase() else it.toString() }
+
+fun String.decapitalise() = replaceFirstChar { it.lowercase() }
diff --git a/app/src/main/java/io/github/wulkanowy/utils/TimeExtension.kt b/app/src/main/java/io/github/wulkanowy/utils/TimeExtension.kt
index a734b6616..b0ec3a712 100644
--- a/app/src/main/java/io/github/wulkanowy/utils/TimeExtension.kt
+++ b/app/src/main/java/io/github/wulkanowy/utils/TimeExtension.kt
@@ -43,7 +43,7 @@ fun Month.getFormattedName(): String {
val formatter = SimpleDateFormat("LLLL", Locale.getDefault())
val date = now().withMonth(value)
- return formatter.format(date.toInstant(ZoneOffset.UTC).toEpochMilli()).capitalize()
+ return formatter.format(date.toInstant(ZoneOffset.UTC).toEpochMilli()).capitalise()
}
inline val LocalDate.nextSchoolDay: LocalDate
diff --git a/build.gradle b/build.gradle
index b91b4b8b3..986f626a3 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,6 +1,6 @@
buildscript {
ext {
- kotlin_version = '1.4.32'
+ kotlin_version = '1.5.0'
about_libraries = '8.8.5'
hilt_version = "2.35.1"
}