mirror of
https://github.com/wulkanowy/wulkanowy.git
synced 2025-01-31 10:28:21 +01:00
Bump kotlin_version from 1.4.32 to 1.5.0 (#1310)
This commit is contained in:
parent
58d66b6e70
commit
1fff1c2b14
9
.idea/codeStyles/Project.xml
generated
9
.idea/codeStyles/Project.xml
generated
@ -7,15 +7,6 @@
|
|||||||
<package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" />
|
<package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" />
|
||||||
</value>
|
</value>
|
||||||
</option>
|
</option>
|
||||||
<option name="PACKAGES_IMPORT_LAYOUT">
|
|
||||||
<value>
|
|
||||||
<package name="" alias="false" withSubpackages="true" />
|
|
||||||
<package name="java" alias="false" withSubpackages="true" />
|
|
||||||
<package name="javax" alias="false" withSubpackages="true" />
|
|
||||||
<package name="kotlin" alias="false" withSubpackages="true" />
|
|
||||||
<package name="" alias="true" withSubpackages="true" />
|
|
||||||
</value>
|
|
||||||
</option>
|
|
||||||
<option name="NAME_COUNT_TO_USE_STAR_IMPORT" value="2147483647" />
|
<option name="NAME_COUNT_TO_USE_STAR_IMPORT" value="2147483647" />
|
||||||
<option name="NAME_COUNT_TO_USE_STAR_IMPORT_FOR_MEMBERS" value="2147483647" />
|
<option name="NAME_COUNT_TO_USE_STAR_IMPORT_FOR_MEMBERS" value="2147483647" />
|
||||||
<option name="WRAP_ELVIS_EXPRESSIONS" value="0" />
|
<option name="WRAP_ELVIS_EXPRESSIONS" value="0" />
|
||||||
|
@ -117,7 +117,6 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
useIR = true
|
|
||||||
jvmTarget = "1.8"
|
jvmTarget = "1.8"
|
||||||
freeCompilerArgs += ["-Xopt-in=kotlin.RequiresOptIn", "-Xjvm-default=all"]
|
freeCompilerArgs += ["-Xopt-in=kotlin.RequiresOptIn", "-Xjvm-default=all"]
|
||||||
}
|
}
|
||||||
@ -165,7 +164,7 @@ dependencies {
|
|||||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
|
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
|
||||||
|
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
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.core:core-ktx:1.3.2"
|
||||||
implementation "androidx.activity:activity-ktx:1.2.3"
|
implementation "androidx.activity:activity-ktx:1.2.3"
|
||||||
@ -197,7 +196,6 @@ dependencies {
|
|||||||
implementation "com.google.dagger:hilt-android:$hilt_version"
|
implementation "com.google.dagger:hilt-android:$hilt_version"
|
||||||
kapt "com.google.dagger:hilt-android-compiler:$hilt_version"
|
kapt "com.google.dagger:hilt-android-compiler:$hilt_version"
|
||||||
implementation "androidx.hilt:hilt-work:$work_hilt"
|
implementation "androidx.hilt:hilt-work:$work_hilt"
|
||||||
kapt "androidx.hilt:hilt-compiler:$work_hilt"
|
|
||||||
|
|
||||||
implementation "com.ncapdevi:frag-nav:3.3.0"
|
implementation "com.ncapdevi:frag-nav:3.3.0"
|
||||||
implementation "com.github.YarikSOffice:lingver:1.3.0"
|
implementation "com.github.YarikSOffice:lingver:1.3.0"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
apply plugin: "jacoco"
|
apply plugin: "jacoco"
|
||||||
|
|
||||||
jacoco {
|
jacoco {
|
||||||
toolVersion "0.8.6"
|
toolVersion "0.8.7"
|
||||||
reportsDirectory = file("$buildDir/reports")
|
reportsDirectory = file("$buildDir/reports")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ import io.github.wulkanowy.ui.base.BasePresenter
|
|||||||
import io.github.wulkanowy.ui.base.ErrorHandler
|
import io.github.wulkanowy.ui.base.ErrorHandler
|
||||||
import io.github.wulkanowy.utils.AnalyticsHelper
|
import io.github.wulkanowy.utils.AnalyticsHelper
|
||||||
import io.github.wulkanowy.utils.afterLoading
|
import io.github.wulkanowy.utils.afterLoading
|
||||||
|
import io.github.wulkanowy.utils.capitalise
|
||||||
import io.github.wulkanowy.utils.flowWithResource
|
import io.github.wulkanowy.utils.flowWithResource
|
||||||
import io.github.wulkanowy.utils.flowWithResourceIn
|
import io.github.wulkanowy.utils.flowWithResourceIn
|
||||||
import io.github.wulkanowy.utils.getLastSchoolDayIfHoliday
|
import io.github.wulkanowy.utils.getLastSchoolDayIfHoliday
|
||||||
@ -319,7 +320,7 @@ class AttendancePresenter @Inject constructor(
|
|||||||
view?.apply {
|
view?.apply {
|
||||||
showPreButton(!currentDate.minusDays(1).isHolidays)
|
showPreButton(!currentDate.minusDays(1).isHolidays)
|
||||||
showNextButton(!currentDate.plusDays(1).isHolidays)
|
showNextButton(!currentDate.plusDays(1).isHolidays)
|
||||||
updateNavigationDay(currentDate.toFormattedString("EEEE, dd.MM").capitalize())
|
updateNavigationDay(currentDate.toFormattedString("EEEE, dd.MM").capitalise())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,13 +76,13 @@ class AttendanceSummaryAdapter @Inject constructor() :
|
|||||||
|
|
||||||
private fun getTotalItem() = AttendanceSummary(
|
private fun getTotalItem() = AttendanceSummary(
|
||||||
month = Month.APRIL,
|
month = Month.APRIL,
|
||||||
presence = items.sumBy { it.presence },
|
presence = items.sumOf { it.presence },
|
||||||
absence = items.sumBy { it.absence },
|
absence = items.sumOf { it.absence },
|
||||||
absenceExcused = items.sumBy { it.absenceExcused },
|
absenceExcused = items.sumOf { it.absenceExcused },
|
||||||
absenceForSchoolReasons = items.sumBy { it.absenceForSchoolReasons },
|
absenceForSchoolReasons = items.sumOf { it.absenceForSchoolReasons },
|
||||||
exemption = items.sumBy { it.exemption },
|
exemption = items.sumOf { it.exemption },
|
||||||
lateness = items.sumBy { it.lateness },
|
lateness = items.sumOf { it.lateness },
|
||||||
latenessExcused = items.sumBy { it.latenessExcused },
|
latenessExcused = items.sumOf { it.latenessExcused },
|
||||||
diaryId = -1,
|
diaryId = -1,
|
||||||
studentId = -1,
|
studentId = -1,
|
||||||
subjectId = -1
|
subjectId = -1
|
||||||
|
@ -7,6 +7,7 @@ import androidx.recyclerview.widget.RecyclerView
|
|||||||
import io.github.wulkanowy.data.db.entities.Exam
|
import io.github.wulkanowy.data.db.entities.Exam
|
||||||
import io.github.wulkanowy.databinding.HeaderExamBinding
|
import io.github.wulkanowy.databinding.HeaderExamBinding
|
||||||
import io.github.wulkanowy.databinding.ItemExamBinding
|
import io.github.wulkanowy.databinding.ItemExamBinding
|
||||||
|
import io.github.wulkanowy.utils.capitalise
|
||||||
import io.github.wulkanowy.utils.toFormattedString
|
import io.github.wulkanowy.utils.toFormattedString
|
||||||
import io.github.wulkanowy.utils.weekDayName
|
import io.github.wulkanowy.utils.weekDayName
|
||||||
import java.time.LocalDate
|
import java.time.LocalDate
|
||||||
@ -42,7 +43,7 @@ class ExamAdapter @Inject constructor() : RecyclerView.Adapter<RecyclerView.View
|
|||||||
@SuppressLint("DefaultLocale")
|
@SuppressLint("DefaultLocale")
|
||||||
private fun bindHeaderViewHolder(binding: HeaderExamBinding, date: LocalDate) {
|
private fun bindHeaderViewHolder(binding: HeaderExamBinding, date: LocalDate) {
|
||||||
with(binding) {
|
with(binding) {
|
||||||
examHeaderDay.text = date.weekDayName.capitalize()
|
examHeaderDay.text = date.weekDayName.capitalise()
|
||||||
examHeaderDate.text = date.toFormattedString()
|
examHeaderDate.text = date.toFormattedString()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ class GradeDetailsAdapter @Inject constructor() : BaseExpandableAdapter<Recycler
|
|||||||
|
|
||||||
private fun bindHeaderViewHolder(holder: HeaderViewHolder, header: GradeDetailsHeader, position: Int) {
|
private fun bindHeaderViewHolder(holder: HeaderViewHolder, header: GradeDetailsHeader, position: Int) {
|
||||||
val headerPosition = headers.indexOf(items[position])
|
val headerPosition = headers.indexOf(items[position])
|
||||||
val adapterPosition = holder.adapterPosition
|
val adapterPosition = holder.bindingAdapterPosition
|
||||||
|
|
||||||
with(holder.binding) {
|
with(holder.binding) {
|
||||||
gradeHeaderDivider.visibility = if (adapterPosition == 0) View.GONE else View.VISIBLE
|
gradeHeaderDivider.visibility = if (adapterPosition == 0) View.GONE else View.VISIBLE
|
||||||
@ -161,7 +161,7 @@ class GradeDetailsAdapter @Inject constructor() : BaseExpandableAdapter<Recycler
|
|||||||
gradeItemNote.visibility = if (!grade.isRead) View.VISIBLE else View.GONE
|
gradeItemNote.visibility = if (!grade.isRead) View.VISIBLE else View.GONE
|
||||||
|
|
||||||
root.setOnClickListener {
|
root.setOnClickListener {
|
||||||
holder.adapterPosition.let { if (it != NO_POSITION) onClickListener(grade, it) }
|
holder.bindingAdapterPosition.let { if (it != NO_POSITION) onClickListener(grade, it) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package io.github.wulkanowy.ui.modules.grade.details
|
package io.github.wulkanowy.ui.modules.grade.details
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
|
||||||
import io.github.wulkanowy.data.Status
|
import io.github.wulkanowy.data.Status
|
||||||
import io.github.wulkanowy.data.db.entities.Grade
|
import io.github.wulkanowy.data.db.entities.Grade
|
||||||
import io.github.wulkanowy.data.repositories.GradeRepository
|
import io.github.wulkanowy.data.repositories.GradeRepository
|
||||||
@ -202,8 +201,9 @@ class GradeDetailsPresenter @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun updateNewGradesAmount(grades: List<GradeSubject>) {
|
private fun updateNewGradesAmount(grades: List<GradeSubject>) {
|
||||||
newGradesAmount =
|
newGradesAmount = grades.sumOf { item ->
|
||||||
grades.sumBy { item -> item.grades.sumBy { grade -> if (!grade.isRead) 1 else 0 } }
|
item.grades.sumOf { grade -> (if (!grade.isRead) 1 else 0).toInt() }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showErrorViewOnError(message: String, error: Throwable) {
|
private fun showErrorViewOnError(message: String, error: Throwable) {
|
||||||
@ -217,7 +217,6 @@ class GradeDetailsPresenter @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("DefaultLocale")
|
|
||||||
private fun createGradeItems(items: List<GradeSubject>): List<GradeDetailsItem> {
|
private fun createGradeItems(items: List<GradeSubject>): List<GradeDetailsItem> {
|
||||||
return items
|
return items
|
||||||
.let { gradesWithAverages ->
|
.let { gradesWithAverages ->
|
||||||
@ -228,7 +227,7 @@ class GradeDetailsPresenter @Inject constructor(
|
|||||||
.let {
|
.let {
|
||||||
when (preferencesRepository.gradeSortingMode) {
|
when (preferencesRepository.gradeSortingMode) {
|
||||||
DATE -> it.sortedByDescending { gradeDetailsWithAverage -> gradeDetailsWithAverage.grades.firstOrNull()?.date }
|
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) ->
|
.map { (subject, average, points, _, grades) ->
|
||||||
|
@ -8,6 +8,7 @@ import androidx.recyclerview.widget.RecyclerView
|
|||||||
import io.github.wulkanowy.data.db.entities.Homework
|
import io.github.wulkanowy.data.db.entities.Homework
|
||||||
import io.github.wulkanowy.databinding.HeaderHomeworkBinding
|
import io.github.wulkanowy.databinding.HeaderHomeworkBinding
|
||||||
import io.github.wulkanowy.databinding.ItemHomeworkBinding
|
import io.github.wulkanowy.databinding.ItemHomeworkBinding
|
||||||
|
import io.github.wulkanowy.utils.capitalise
|
||||||
import io.github.wulkanowy.utils.toFormattedString
|
import io.github.wulkanowy.utils.toFormattedString
|
||||||
import io.github.wulkanowy.utils.weekDayName
|
import io.github.wulkanowy.utils.weekDayName
|
||||||
import java.time.LocalDate
|
import java.time.LocalDate
|
||||||
@ -43,7 +44,7 @@ class HomeworkAdapter @Inject constructor() : RecyclerView.Adapter<RecyclerView.
|
|||||||
@SuppressLint("DefaultLocale")
|
@SuppressLint("DefaultLocale")
|
||||||
private fun bindHeaderViewHolder(binding: HeaderHomeworkBinding, date: LocalDate) {
|
private fun bindHeaderViewHolder(binding: HeaderHomeworkBinding, date: LocalDate) {
|
||||||
with(binding) {
|
with(binding) {
|
||||||
homeworkHeaderDay.text = date.weekDayName.capitalize()
|
homeworkHeaderDay.text = date.weekDayName.capitalise()
|
||||||
homeworkHeaderDate.text = date.toFormattedString()
|
homeworkHeaderDate.text = date.toFormattedString()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import android.view.ViewGroup
|
|||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import io.github.wulkanowy.data.db.entities.LuckyNumber
|
import io.github.wulkanowy.data.db.entities.LuckyNumber
|
||||||
import io.github.wulkanowy.databinding.ItemLuckyNumberHistoryBinding
|
import io.github.wulkanowy.databinding.ItemLuckyNumberHistoryBinding
|
||||||
|
import io.github.wulkanowy.utils.capitalise
|
||||||
import io.github.wulkanowy.utils.toFormattedString
|
import io.github.wulkanowy.utils.toFormattedString
|
||||||
import io.github.wulkanowy.utils.weekDayName
|
import io.github.wulkanowy.utils.weekDayName
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
@ -25,7 +26,7 @@ class LuckyNumberHistoryAdapter @Inject constructor() :
|
|||||||
override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
|
||||||
val item = items[position]
|
val item = items[position]
|
||||||
with(holder.binding) {
|
with(holder.binding) {
|
||||||
luckyNumberHistoryWeekName.text = item.date.weekDayName.capitalize()
|
luckyNumberHistoryWeekName.text = item.date.weekDayName.capitalise()
|
||||||
luckyNumberHistoryDate.text = item.date.toFormattedString()
|
luckyNumberHistoryDate.text = item.date.toFormattedString()
|
||||||
luckyNumberHistory.text = item.luckyNumber.toString()
|
luckyNumberHistory.text = item.luckyNumber.toString()
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ class MessageTabAdapter @Inject constructor() :
|
|||||||
messageItemAttachmentIcon.visibility = if (item.hasAttachments) View.VISIBLE else View.GONE
|
messageItemAttachmentIcon.visibility = if (item.hasAttachments) View.VISIBLE else View.GONE
|
||||||
|
|
||||||
root.setOnClickListener {
|
root.setOnClickListener {
|
||||||
holder.adapterPosition.let { if (it != NO_POSITION) onClickListener(item, it) }
|
holder.bindingAdapterPosition.let { if (it != NO_POSITION) onClickListener(item, it) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,6 @@ import kotlinx.coroutines.flow.onEach
|
|||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import me.xdrop.fuzzywuzzy.FuzzySearch
|
import me.xdrop.fuzzywuzzy.FuzzySearch
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import java.util.Locale
|
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import kotlin.math.pow
|
import kotlin.math.pow
|
||||||
|
|
||||||
@ -189,33 +188,30 @@ class MessageTabPresenter @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun calculateMatchRatio(message: Message, query: String): Int {
|
private fun calculateMatchRatio(message: Message, query: String): Int {
|
||||||
val subjectRatio = FuzzySearch.tokenSortPartialRatio(
|
val subjectRatio = FuzzySearch.tokenSortPartialRatio(query.lowercase(), message.subject)
|
||||||
query.toLowerCase(Locale.getDefault()),
|
|
||||||
message.subject
|
|
||||||
)
|
|
||||||
|
|
||||||
val senderOrRecipientRatio = FuzzySearch.tokenSortPartialRatio(
|
val senderOrRecipientRatio = FuzzySearch.tokenSortPartialRatio(
|
||||||
query.toLowerCase(Locale.getDefault()),
|
query.lowercase(),
|
||||||
if (message.sender.isNotEmpty()) message.sender.toLowerCase(Locale.getDefault())
|
if (message.sender.isNotEmpty()) message.sender.lowercase()
|
||||||
else message.recipient.toLowerCase(Locale.getDefault())
|
else message.recipient.lowercase()
|
||||||
)
|
)
|
||||||
|
|
||||||
val dateRatio = listOf(
|
val dateRatio = listOf(
|
||||||
FuzzySearch.ratio(
|
FuzzySearch.ratio(
|
||||||
query.toLowerCase(Locale.getDefault()),
|
query.lowercase(),
|
||||||
message.date.toFormattedString("dd.MM").toLowerCase(Locale.getDefault())
|
message.date.toFormattedString("dd.MM").lowercase()
|
||||||
),
|
),
|
||||||
FuzzySearch.ratio(
|
FuzzySearch.ratio(
|
||||||
query.toLowerCase(Locale.getDefault()),
|
query.lowercase(),
|
||||||
message.date.toFormattedString("dd.MM.yyyy").toLowerCase(Locale.getDefault())
|
message.date.toFormattedString("dd.MM.yyyy").lowercase()
|
||||||
),
|
),
|
||||||
FuzzySearch.ratio(
|
FuzzySearch.ratio(
|
||||||
query.toLowerCase(Locale.getDefault()),
|
query.lowercase(),
|
||||||
message.date.toFormattedString("d MMMM").toLowerCase(Locale.getDefault())
|
message.date.toFormattedString("d MMMM").lowercase()
|
||||||
),
|
),
|
||||||
FuzzySearch.ratio(
|
FuzzySearch.ratio(
|
||||||
query.toLowerCase(Locale.getDefault()),
|
query.lowercase(),
|
||||||
message.date.toFormattedString("d MMMM yyyy").toLowerCase(Locale.getDefault())
|
message.date.toFormattedString("d MMMM yyyy").lowercase()
|
||||||
)
|
)
|
||||||
).maxOrNull() ?: 0
|
).maxOrNull() ?: 0
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ import io.github.wulkanowy.databinding.FragmentStudentInfoBinding
|
|||||||
import io.github.wulkanowy.ui.base.BaseFragment
|
import io.github.wulkanowy.ui.base.BaseFragment
|
||||||
import io.github.wulkanowy.ui.modules.main.MainActivity
|
import io.github.wulkanowy.ui.modules.main.MainActivity
|
||||||
import io.github.wulkanowy.ui.modules.main.MainView
|
import io.github.wulkanowy.ui.modules.main.MainView
|
||||||
|
import io.github.wulkanowy.utils.capitalise
|
||||||
import io.github.wulkanowy.utils.getThemeAttrColor
|
import io.github.wulkanowy.utils.getThemeAttrColor
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
@ -149,8 +150,8 @@ class StudentInfoFragment :
|
|||||||
override fun showFamilyTypeData(studentInfo: StudentInfo) {
|
override fun showFamilyTypeData(studentInfo: StudentInfo) {
|
||||||
updateData(
|
updateData(
|
||||||
listOfNotNull(
|
listOfNotNull(
|
||||||
studentInfo.firstGuardian?.let { it.kinship.capitalize() to it.fullName },
|
studentInfo.firstGuardian?.let { it.kinship.capitalise() to it.fullName },
|
||||||
studentInfo.secondGuardian?.let { it.kinship.capitalize() to it.fullName },
|
studentInfo.secondGuardian?.let { it.kinship.capitalise() to it.fullName },
|
||||||
).map { (title, value) ->
|
).map { (title, value) ->
|
||||||
val updatedValue = value.ifBlank { getString(R.string.all_no_data) }
|
val updatedValue = value.ifBlank { getString(R.string.all_no_data) }
|
||||||
val updatedTitle = title.ifBlank { getString(R.string.all_no_data) }
|
val updatedTitle = title.ifBlank { getString(R.string.all_no_data) }
|
||||||
|
@ -12,10 +12,13 @@ import androidx.fragment.app.DialogFragment
|
|||||||
import io.github.wulkanowy.R
|
import io.github.wulkanowy.R
|
||||||
import io.github.wulkanowy.data.db.entities.Timetable
|
import io.github.wulkanowy.data.db.entities.Timetable
|
||||||
import io.github.wulkanowy.databinding.DialogTimetableBinding
|
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.getThemeAttrColor
|
||||||
import io.github.wulkanowy.utils.lifecycleAwareVariable
|
import io.github.wulkanowy.utils.lifecycleAwareVariable
|
||||||
import io.github.wulkanowy.utils.toFormattedString
|
import io.github.wulkanowy.utils.toFormattedString
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
|
import java.util.Locale
|
||||||
|
|
||||||
class TimetableDialog : DialogFragment() {
|
class TimetableDialog : DialogFragment() {
|
||||||
|
|
||||||
@ -101,8 +104,8 @@ class TimetableDialog : DialogFragment() {
|
|||||||
timetableDialogChangesValue.text = when {
|
timetableDialogChangesValue.text = when {
|
||||||
canceled && !changes -> "Lekcja odwołana: $info"
|
canceled && !changes -> "Lekcja odwołana: $info"
|
||||||
changes && teacher.isNotBlank() -> "Zastępstwo: $teacher"
|
changes && teacher.isNotBlank() -> "Zastępstwo: $teacher"
|
||||||
changes && teacher.isBlank() -> "Zastępstwo, ${info.decapitalize()}"
|
changes && teacher.isBlank() -> "Zastępstwo, ${info.decapitalise()}"
|
||||||
else -> info.capitalize()
|
else -> info.capitalise()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
|
@ -11,6 +11,7 @@ import io.github.wulkanowy.ui.base.BasePresenter
|
|||||||
import io.github.wulkanowy.ui.base.ErrorHandler
|
import io.github.wulkanowy.ui.base.ErrorHandler
|
||||||
import io.github.wulkanowy.utils.AnalyticsHelper
|
import io.github.wulkanowy.utils.AnalyticsHelper
|
||||||
import io.github.wulkanowy.utils.afterLoading
|
import io.github.wulkanowy.utils.afterLoading
|
||||||
|
import io.github.wulkanowy.utils.capitalise
|
||||||
import io.github.wulkanowy.utils.flowWithResourceIn
|
import io.github.wulkanowy.utils.flowWithResourceIn
|
||||||
import io.github.wulkanowy.utils.getLastSchoolDayIfHoliday
|
import io.github.wulkanowy.utils.getLastSchoolDayIfHoliday
|
||||||
import io.github.wulkanowy.utils.isHolidays
|
import io.github.wulkanowy.utils.isHolidays
|
||||||
@ -229,7 +230,7 @@ class TimetablePresenter @Inject constructor(
|
|||||||
view?.apply {
|
view?.apply {
|
||||||
showPreButton(!currentDate.minusDays(1).isHolidays)
|
showPreButton(!currentDate.minusDays(1).isHolidays)
|
||||||
showNextButton(!currentDate.plusDays(1).isHolidays)
|
showNextButton(!currentDate.plusDays(1).isHolidays)
|
||||||
updateNavigationDay(currentDate.toFormattedString("EEEE, dd.MM").capitalize())
|
updateNavigationDay(currentDate.toFormattedString("EEEE, dd.MM").capitalise())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import io.github.wulkanowy.ui.base.BasePresenter
|
|||||||
import io.github.wulkanowy.ui.base.ErrorHandler
|
import io.github.wulkanowy.ui.base.ErrorHandler
|
||||||
import io.github.wulkanowy.utils.AnalyticsHelper
|
import io.github.wulkanowy.utils.AnalyticsHelper
|
||||||
import io.github.wulkanowy.utils.afterLoading
|
import io.github.wulkanowy.utils.afterLoading
|
||||||
|
import io.github.wulkanowy.utils.capitalise
|
||||||
import io.github.wulkanowy.utils.flowWithResourceIn
|
import io.github.wulkanowy.utils.flowWithResourceIn
|
||||||
import io.github.wulkanowy.utils.getLastSchoolDayIfHoliday
|
import io.github.wulkanowy.utils.getLastSchoolDayIfHoliday
|
||||||
import io.github.wulkanowy.utils.isHolidays
|
import io.github.wulkanowy.utils.isHolidays
|
||||||
@ -164,7 +165,7 @@ class AdditionalLessonsPresenter @Inject constructor(
|
|||||||
view?.apply {
|
view?.apply {
|
||||||
showPreButton(!currentDate.minusDays(1).isHolidays)
|
showPreButton(!currentDate.minusDays(1).isHolidays)
|
||||||
showNextButton(!currentDate.plusDays(1).isHolidays)
|
showNextButton(!currentDate.plusDays(1).isHolidays)
|
||||||
updateNavigationDay(currentDate.toFormattedString("EEEE, dd.MM").capitalize())
|
updateNavigationDay(currentDate.toFormattedString("EEEE, dd.MM").capitalise())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import io.github.wulkanowy.data.repositories.StudentRepository
|
|||||||
import io.github.wulkanowy.ui.base.BasePresenter
|
import io.github.wulkanowy.ui.base.BasePresenter
|
||||||
import io.github.wulkanowy.utils.AnalyticsHelper
|
import io.github.wulkanowy.utils.AnalyticsHelper
|
||||||
import io.github.wulkanowy.utils.afterLoading
|
import io.github.wulkanowy.utils.afterLoading
|
||||||
|
import io.github.wulkanowy.utils.capitalise
|
||||||
import io.github.wulkanowy.utils.flowWithResourceIn
|
import io.github.wulkanowy.utils.flowWithResourceIn
|
||||||
import io.github.wulkanowy.utils.getLastSchoolDayIfHoliday
|
import io.github.wulkanowy.utils.getLastSchoolDayIfHoliday
|
||||||
import io.github.wulkanowy.utils.isHolidays
|
import io.github.wulkanowy.utils.isHolidays
|
||||||
@ -188,7 +189,7 @@ class CompletedLessonsPresenter @Inject constructor(
|
|||||||
view?.apply {
|
view?.apply {
|
||||||
showPreButton(!currentDate.minusDays(1).isHolidays)
|
showPreButton(!currentDate.minusDays(1).isHolidays)
|
||||||
showNextButton(!currentDate.plusDays(1).isHolidays)
|
showNextButton(!currentDate.plusDays(1).isHolidays)
|
||||||
updateNavigationDay(currentDate.toFormattedString("EEEE, dd.MM").capitalize())
|
updateNavigationDay(currentDate.toFormattedString("EEEE, dd.MM").capitalise())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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.MainActivity
|
||||||
import io.github.wulkanowy.ui.modules.main.MainView
|
import io.github.wulkanowy.ui.modules.main.MainView
|
||||||
import io.github.wulkanowy.utils.AnalyticsHelper
|
import io.github.wulkanowy.utils.AnalyticsHelper
|
||||||
|
import io.github.wulkanowy.utils.capitalise
|
||||||
import io.github.wulkanowy.utils.createNameInitialsDrawable
|
import io.github.wulkanowy.utils.createNameInitialsDrawable
|
||||||
import io.github.wulkanowy.utils.getCompatColor
|
import io.github.wulkanowy.utils.getCompatColor
|
||||||
import io.github.wulkanowy.utils.nextOrSameSchoolDay
|
import io.github.wulkanowy.utils.nextOrSameSchoolDay
|
||||||
@ -180,7 +181,7 @@ class TimetableWidgetProvider : HiltBroadcastReceiver() {
|
|||||||
setEmptyView(R.id.timetableWidgetList, R.id.timetableWidgetEmpty)
|
setEmptyView(R.id.timetableWidgetList, R.id.timetableWidgetEmpty)
|
||||||
setTextViewText(
|
setTextViewText(
|
||||||
R.id.timetableWidgetDate,
|
R.id.timetableWidgetDate,
|
||||||
date.toFormattedString("EEEE, dd.MM").capitalize()
|
date.toFormattedString("EEEE, dd.MM").capitalise()
|
||||||
)
|
)
|
||||||
setTextViewText(
|
setTextViewText(
|
||||||
R.id.timetableWidgetName,
|
R.id.timetableWidgetName,
|
||||||
|
@ -19,7 +19,7 @@ private inline val AttendanceSummary.allAbsences: Double
|
|||||||
fun AttendanceSummary.calculatePercentage() = calculatePercentage(allPresences, allAbsences)
|
fun AttendanceSummary.calculatePercentage() = calculatePercentage(allPresences, allAbsences)
|
||||||
|
|
||||||
fun List<AttendanceSummary>.calculatePercentage(): Double {
|
fun List<AttendanceSummary>.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 {
|
private fun calculatePercentage(presence: Double, absence: Double): Double {
|
||||||
|
@ -126,7 +126,7 @@ fun Context.createNameInitialsDrawable(
|
|||||||
val firstCharFirstWord = words.getOrNull(0)?.firstOrNull() ?: ""
|
val firstCharFirstWord = words.getOrNull(0)?.firstOrNull() ?: ""
|
||||||
val firstCharSecondWord = words.getOrNull(1)?.firstOrNull() ?: ""
|
val firstCharSecondWord = words.getOrNull(1)?.firstOrNull() ?: ""
|
||||||
|
|
||||||
val initials = "$firstCharFirstWord$firstCharSecondWord".toUpperCase()
|
val initials = "$firstCharFirstWord$firstCharSecondWord".uppercase()
|
||||||
|
|
||||||
val bounds = Rect()
|
val bounds = Rect()
|
||||||
val dimension = this.dpToPx(64f * scaleFactory).toInt()
|
val dimension = this.dpToPx(64f * scaleFactory).toInt()
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
package io.github.wulkanowy.utils
|
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() }
|
||||||
|
@ -43,7 +43,7 @@ fun Month.getFormattedName(): String {
|
|||||||
val formatter = SimpleDateFormat("LLLL", Locale.getDefault())
|
val formatter = SimpleDateFormat("LLLL", Locale.getDefault())
|
||||||
|
|
||||||
val date = now().withMonth(value)
|
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
|
inline val LocalDate.nextSchoolDay: LocalDate
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
buildscript {
|
buildscript {
|
||||||
ext {
|
ext {
|
||||||
kotlin_version = '1.4.32'
|
kotlin_version = '1.5.0'
|
||||||
about_libraries = '8.8.5'
|
about_libraries = '8.8.5'
|
||||||
hilt_version = "2.35.1"
|
hilt_version = "2.35.1"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user