Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Commit 19b1afa

Browse files
committed
#294 fixed detekt errors in widgets module
1 parent 9dc0f42 commit 19b1afa

File tree

98 files changed

+204
-153
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+204
-153
lines changed

widgets/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
plugins {
66
id("multiplatform-library-convention")
7-
id("dev.icerock.mobile.multiplatform.android-manifest")
87
id("publication-convention")
98
id("kotlin-kapt")
109
id("kotlin-parcelize")

widgets/src/androidMain/kotlin/dev/icerock/moko/widgets/core/Image.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package dev.icerock.moko.widgets.core
77
import android.widget.ImageView
88
import dev.icerock.moko.resources.ImageResource
99

10+
@Suppress("UnnecessaryAbstractClass")
1011
actual abstract class Image {
1112
abstract fun loadIn(imageView: ImageView)
1213

widgets/src/androidMain/kotlin/dev/icerock/moko/widgets/core/PreviewView.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@file:Suppress("Filename", "MatchingDeclarationName")
12
/*
23
* Copyright 2019 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
34
*/
@@ -12,7 +13,9 @@ import android.widget.FrameLayout
1213
import dev.icerock.moko.widgets.core.screen.Screen
1314

1415
abstract class BasePreviewView @JvmOverloads constructor(
15-
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
16+
context: Context,
17+
attrs: AttributeSet? = null,
18+
defStyleAttr: Int = 0
1619
) : FrameLayout(context, attrs, defStyleAttr) {
1720
abstract fun createScreen(): Screen<*>
1821

widgets/src/androidMain/kotlin/dev/icerock/moko/widgets/core/factory/AutoScrollListViewFactory.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,4 @@ actual class AutoScrollListViewFactory actual constructor(
6565
else -> null
6666
}
6767
}
68-
}
68+
}

widgets/src/androidMain/kotlin/dev/icerock/moko/widgets/core/factory/ButtonWithIconViewFactory.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import dev.icerock.moko.widgets.core.style.view.WidgetSize
3030
import dev.icerock.moko.widgets.core.utils.bind
3131
import dev.icerock.moko.widgets.core.widget.ButtonWidget
3232

33+
@Suppress("LongParameterList")
3334
actual class ButtonWithIconViewFactory actual constructor(
3435
private val background: PressableState<Background<out Fill>>?,
3536
private val textStyle: TextStyle<PressableState<Color>>?,
@@ -42,6 +43,7 @@ actual class ButtonWithIconViewFactory actual constructor(
4243
private val icon: PressableState<ImageResource>
4344
) : ViewFactory<ButtonWidget<out WidgetSize>> {
4445

46+
@Suppress("ComplexMethod", "LongParameterList")
4547
@SuppressLint("RestrictedApi")
4648
override fun <WS : WidgetSize> build(
4749
widget: ButtonWidget<out WidgetSize>,
@@ -60,6 +62,7 @@ actual class ButtonWithIconViewFactory actual constructor(
6062
val icPadding = iconPadding ?: 0.0f
6163
val materialThemeWrapper = ContextThemeWrapper(ctx, R.style.Theme_MaterialComponents_NoActionBar)
6264

65+
@Suppress("TooGenericExceptionThrown")
6366
val button: MaterialButton = when (widget.content) {
6467
is ButtonWidget.Content.Text -> {
6568
MaterialButton(materialThemeWrapper).apply {

widgets/src/androidMain/kotlin/dev/icerock/moko/widgets/core/factory/CardViewFactory.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,4 @@ actual class CardViewFactory actual constructor(
6868
margins = margins
6969
)
7070
}
71-
7271
}

widgets/src/androidMain/kotlin/dev/icerock/moko/widgets/core/factory/CheckboxSwitchViewFactory.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
package dev.icerock.moko.widgets.core.factory
66

77
import android.graphics.drawable.StateListDrawable
8-
import android.widget.CheckBox
98
import androidx.appcompat.widget.AppCompatCheckBox
109
import androidx.core.content.ContextCompat
1110
import dev.icerock.moko.resources.ImageResource

widgets/src/androidMain/kotlin/dev/icerock/moko/widgets/core/factory/ClickableViewFactory.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ import dev.icerock.moko.widgets.core.ViewFactoryContext
1414
import dev.icerock.moko.widgets.core.style.view.WidgetSize
1515
import dev.icerock.moko.widgets.core.widget.ClickableWidget
1616

17-
actual class ClickableViewFactory actual constructor(
18-
) : ViewFactory<ClickableWidget<out WidgetSize>> {
17+
actual class ClickableViewFactory : ViewFactory<ClickableWidget<out WidgetSize>> {
1918

2019
override fun <WS : WidgetSize> build(
2120
widget: ClickableWidget<out WidgetSize>,

widgets/src/androidMain/kotlin/dev/icerock/moko/widgets/core/factory/ContainerViewFactory.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,4 +133,4 @@ actual class ContainerViewFactory actual constructor(
133133
}
134134
}
135135
}
136-
}
136+
}

widgets/src/androidMain/kotlin/dev/icerock/moko/widgets/core/factory/FloatingLabelInputViewFactory.kt

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import dev.icerock.moko.widgets.core.utils.bind
4040
import dev.icerock.moko.widgets.core.utils.dp
4141
import dev.icerock.moko.widgets.core.utils.sp
4242

43+
@Suppress("LongParameterList", "MagicNumber")
4344
actual class FloatingLabelInputViewFactory actual constructor(
4445
private val background: Background<Fill.Solid>?,
4546
private val margins: MarginValues?,
@@ -51,6 +52,7 @@ actual class FloatingLabelInputViewFactory actual constructor(
5152
private val textHorizontalAlignment: TextHorizontalAlignment?
5253
) : ViewFactory<InputWidget<out WidgetSize>> {
5354

55+
@Suppress("LongMethod", "ComplexMethod")
5456
@SuppressLint("RestrictedApi")
5557
override fun <WS : WidgetSize> build(
5658
widget: InputWidget<out WidgetSize>,
@@ -73,7 +75,8 @@ actual class FloatingLabelInputViewFactory actual constructor(
7375
ViewGroup.LayoutParams.MATCH_PARENT,
7476
ViewGroup.LayoutParams.WRAP_CONTENT
7577
).apply {
76-
// EditText's default background have paddings 4dp, while we not change background to own we just change margins
78+
// EditText's default background have paddings 4dp,
79+
// while we not change background to own we just change margins
7780
// https://stackoverflow.com/questions/31735291/removing-the-left-padding-on-an-android-edittext/44497551
7881
val dp4 = (-4).dp(context)
7982
MarginLayoutParamsCompat.setMarginStart(this, dp4)
@@ -104,18 +107,14 @@ actual class FloatingLabelInputViewFactory actual constructor(
104107
if (!hasFocus) widget.field.validate()
105108
}
106109
addTextChangedListener(object : TextWatcher {
107-
override fun afterTextChanged(s: Editable?) {
108-
109-
}
110+
override fun afterTextChanged(s: Editable?) = Unit
110111

111112
override fun beforeTextChanged(
112113
s: CharSequence?,
113114
start: Int,
114115
count: Int,
115116
after: Int
116-
) {
117-
118-
}
117+
) = Unit
119118

120119
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
121120
if (s == null) return
@@ -186,5 +185,4 @@ actual class FloatingLabelInputViewFactory actual constructor(
186185
field.isAccessible = true
187186
return field.get(this) as CollapsingTextHelper
188187
}
189-
190188
}

0 commit comments

Comments
 (0)