Skip to content

Commit

Permalink
upgrade kotlinter - 4.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mvmike committed Jun 24, 2024
1 parent 9287da8 commit 3583933
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 33 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
id("com.android.application")
id("kotlin-android")
// https://github.com/jeremymailen/kotlinter-gradle/releases
id("org.jmailen.kotlinter") version "4.3.0"
id("org.jmailen.kotlinter") version "4.4.0"
// https://github.com/Kotlin/kotlinx-kover/releases
id("org.jetbrains.kotlinx.kover") version "0.8.1"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ data class Day(
fun getDayOfWeekDisplayValues(context: Context) =
DayOfWeek.entries.map { it.getDisplayValue(context) }

fun DayOfWeek.getDisplayValue(context: Context) =
context.getString(
fun DayOfWeek.getDisplayValue(context: Context) = context
.getString(
when (this) {
DayOfWeek.MONDAY -> R.string.monday
DayOfWeek.TUESDAY -> R.string.tuesday
Expand All @@ -44,8 +44,8 @@ fun DayOfWeek.getDisplayValue(context: Context) =
}
).replaceFirstChar { it.uppercase() }

fun DayOfWeek.getAbbreviatedDisplayValue(context: Context) =
context.getString(
fun DayOfWeek.getAbbreviatedDisplayValue(context: Context) = context
.getString(
when (this) {
DayOfWeek.MONDAY -> R.string.monday_abb
DayOfWeek.TUESDAY -> R.string.tuesday_abb
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@ sealed class Instance(
eventId = eventId,
isDeclined = isDeclined
) {
override fun isInDay(day: LocalDate, dayZoneId: ZoneId): Boolean {
return !start.isAfter(day) && !end.isBefore(day)
}
override fun isInDay(day: LocalDate, dayZoneId: ZoneId): Boolean =
!start.isAfter(day) && !end.isBefore(day)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ object LayoutService {
val backgroundColour = GraphicResolver.getColourAsString(context, widgetTheme.mainBackground)
val transparencyRange = TransparencyRange.COMPLETE

backgroundColour.withTransparency(
transparency = transparency,
transparencyRange = transparencyRange
).setAsBackground(
remoteViews = widgetRemoteView,
viewId = R.id.widget_layout
)
backgroundColour
.withTransparency(
transparency = transparency,
transparencyRange = transparencyRange
).setAsBackground(
remoteViews = widgetRemoteView,
viewId = R.id.widget_layout
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ object MonthAndYearHeaderService {
val displayMonth = systemLocalDate
.toMonthDisplayValue(context)
.take(textSize.monthHeaderLabelLength)
val displayYear = EnumConfigurationItem.WidgetCalendar.get(context)
val displayYear = EnumConfigurationItem.WidgetCalendar
.get(context)
.getYear(systemLocalDate)

GraphicResolver.createMonthAndYearHeader(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ data class Transparency(

internal fun getAlpha(
transparencyRange: TransparencyRange
) = (transparencyRange.maxAlpha - transparencyRange.minAlpha).toFloat()
) = (transparencyRange.maxAlpha - transparencyRange.minAlpha)
.toFloat()
.div(PERCENTAGE_RANGE.last)
.times(PERCENTAGE_RANGE.last - percentage)
.plus(transparencyRange.minAlpha)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ sealed class ActionableView(

// we return the instant of the clicked day with current zonedTime
val systemLocalDateTime = systemInstant.atZone(systemZoneId)
return extraInstant.atZone(systemZoneId)
return extraInstant
.atZone(systemZoneId)
.withHour(systemLocalDateTime.hour)
.withMinute(systemLocalDateTime.minute)
.withSecond(systemLocalDateTime.second)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,21 @@ class ConfigurationActivity : AppCompatActivity() {

@Suppress("UNUSED_PARAMETER")
fun onClickCloseSettingsButton(view: View) {
intent?.getIntExtra(
AppWidgetManager.EXTRA_APPWIDGET_ID,
AppWidgetManager.INVALID_APPWIDGET_ID
)?.takeIf {
it != AppWidgetManager.INVALID_APPWIDGET_ID
}?.let {
setResult(RESULT_OK, Intent().putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, it))
}
intent
?.getIntExtra(
AppWidgetManager.EXTRA_APPWIDGET_ID,
AppWidgetManager.INVALID_APPWIDGET_ID
)?.takeIf {
it != AppWidgetManager.INVALID_APPWIDGET_ID
}?.let {
setResult(RESULT_OK, Intent().putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, it))
}
finishAfterTransition()
}

class SettingsFragment : PreferenceFragmentCompat(), OnSharedPreferenceChangeListener {
class SettingsFragment :
PreferenceFragmentCompat(),
OnSharedPreferenceChangeListener {

override fun onCreatePreferences(
savedInstanceState: Bundle?,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,32 @@ internal class HexArchTest {
@ArchTest
val domainShouldNotDependOnApplication = ArchRuleDefinition
.noClasses()
.that().resideInAnyPackage("cat.mvmike.minimalcalendarwidget.domain..")
.should().dependOnClassesThat().resideInAPackage("cat.mvmike.minimalcalendarwidget.application..")!!
.that()
.resideInAnyPackage("cat.mvmike.minimalcalendarwidget.domain..")
.should()
.dependOnClassesThat()
.resideInAPackage("cat.mvmike.minimalcalendarwidget.application..")!!

@ArchTest
val domainShouldNotDependOnActivityOrReceiverInfrastructure = ArchRuleDefinition
.noClasses()
.that().resideInAnyPackage("cat.mvmike.minimalcalendarwidget.domain..")
.should().dependOnClassesThat().resideInAnyPackage(
.that()
.resideInAnyPackage("cat.mvmike.minimalcalendarwidget.domain..")
.should()
.dependOnClassesThat()
.resideInAnyPackage(
"cat.mvmike.minimalcalendarwidget.infrastructure.activity..",
"cat.mvmike.minimalcalendarwidget.infrastructure.receiver.."
)!!

@ArchTest
val applicationShouldNotDependOnReceiverInfrastructure = ArchRuleDefinition
.noClasses()
.that().resideInAnyPackage("cat.mvmike.minimalcalendarwidget.application..")
.should().dependOnClassesThat().resideInAnyPackage(
.that()
.resideInAnyPackage("cat.mvmike.minimalcalendarwidget.application..")
.should()
.dependOnClassesThat()
.resideInAnyPackage(
"cat.mvmike.minimalcalendarwidget.infrastructure.receiver.."
)!!
}

0 comments on commit 3583933

Please sign in to comment.