From cb0bd42fe87a86f08024178b1d86a62a85570f66 Mon Sep 17 00:00:00 2001 From: Paul Rybitskyi Date: Mon, 5 Aug 2024 02:40:15 +0300 Subject: [PATCH] Update dependencies (#25) --- .editorconfig | 10 + .github/workflows/build.yml | 12 +- .github/workflows/release.yml | 4 +- build.gradle.kts | 15 +- buildSrc/build.gradle.kts | 6 +- buildSrc/src/main/java/Dependencies.kt | 37 +-- config/detekt/detekt.yml | 267 ++++++++++++------ gradle/wrapper/gradle-wrapper.properties | 2 +- sample/build.gradle.kts | 1 + sample/src/main/AndroidManifest.xml | 4 +- .../valuepicker/sample/BaseFragment.kt | 4 +- .../ClothingSizePickerFragment.kt | 6 +- .../clothingsizepicker/model/ClothingSize.kt | 2 +- .../sample/dashboard/DashboardDestination.kt | 18 +- .../sample/dashboard/DashboardFragment.kt | 4 +- .../dashboard/DashboardRecyclerViewAdapter.kt | 6 +- .../sample/datepicker/DatePickerFragment.kt | 12 +- .../sample/datepicker/model/Month.kt | 28 +- .../MovieFilteringPickerFragment.kt | 14 +- .../model/StreamingService.kt | 2 +- .../PersonInfoPickerFragment.kt | 20 +- .../ratingpicker/RatingPickerFragment.kt | 4 +- .../sample/ratingpicker/model/Rating.kt | 24 +- .../sample/teampicker/TeamPickerFragment.kt | 6 +- .../sample/teampicker/model/Team.kt | 2 +- .../sample/timepicker/TimePickerFragment.kt | 18 +- .../valueeffects/CompositeValueEffect.kt | 2 +- .../valueeffects/RotationValueEffect.kt | 6 +- value-picker-lint/build.gradle.kts | 10 +- .../lint/NumberPickerUsageDetector.kt | 12 +- .../lint/NumberPickerUsageDetectorTest.kt | 70 ++--- value-picker/build.gradle.kts | 2 +- value-picker/src/main/AndroidManifest.xml | 17 -- .../ValuePickerRecyclerViewAdapter.kt | 4 +- .../valuepicker/ValuePickerView.kt | 28 +- .../decorators/ValuePickerItemDecorator.kt | 2 +- .../ValuePickerItemDecoratorFactory.kt | 8 +- .../HorizontalValuePickerItemDecorator.kt | 6 +- .../VerticalValuePickerItemDecorator.kt | 6 +- .../layoutmanager/ValuePickerLayoutManager.kt | 14 +- .../valuepicker/model/DefaultValues.kt | 6 +- .../valuepicker/model/Orientation.kt | 5 +- .../valuepicker/model/PickerItem.kt | 2 +- .../paulrybitskyi/valuepicker/model/Size.kt | 8 +- .../valuepicker/model/ValueItemConfig.kt | 4 +- 45 files changed, 425 insertions(+), 315 deletions(-) delete mode 100644 value-picker/src/main/AndroidManifest.xml diff --git a/.editorconfig b/.editorconfig index 58af3ba..9e40bba 100644 --- a/.editorconfig +++ b/.editorconfig @@ -8,3 +8,13 @@ max_line_length = 120 [*.yml] indent_size = 2 + +[*.{kt,kts}] +ktlint_standard_annotation = disabled +ktlint_standard_no-empty-first-line-in-class-body = disabled +ktlint_standard_blank-line-before-declaration = disabled +ktlint_standard_multiline-expression-wrapping = disabled +ktlint_standard_string-template-indent = disabled +ktlint_standard_spacing-between-declarations-with-annotations = disabled +ktlint_standard_function-signature = disabled +ktlint_standard_class-signature = disabled diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ee3b4a2..2523a41 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,11 +16,11 @@ jobs: - name: Checkout Repo uses: actions/checkout@v2 - - name: Set up JDK 11 + - name: Set up JDK 17 uses: actions/setup-java@v2 with: distribution: 'temurin' - java-version: '11' + java-version: '17' - name: Generate a Cache Key run: ./checksum.sh checksum.txt @@ -51,11 +51,11 @@ jobs: - name: Checkout Repo uses: actions/checkout@v2 - - name: Set up JDK 11 + - name: Set up JDK 17 uses: actions/setup-java@v2 with: distribution: 'temurin' - java-version: '11' + java-version: '17' - name: Generate a Cache Key run: ./checksum.sh checksum.txt @@ -86,11 +86,11 @@ jobs: - name: Checkout Repo uses: actions/checkout@v2 - - name: Set up JDK 11 + - name: Set up JDK 17 uses: actions/setup-java@v2 with: distribution: 'temurin' - java-version: '11' + java-version: '17' - name: Generate a Cache Key run: ./checksum.sh checksum.txt diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cbd5c70..b96fb98 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,11 +14,11 @@ jobs: - name: Checkout Repo uses: actions/checkout@v2 - - name: Set up JDK 11 + - name: Set up JDK 17 uses: actions/setup-java@v2 with: distribution: 'temurin' - java-version: '11' + java-version: '17' - name: Generate a Cache Key run: ./checksum.sh checksum.txt diff --git a/build.gradle.kts b/build.gradle.kts index c3ef31e..0019323 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -14,6 +14,7 @@ * limitations under the License. */ +import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask import io.gitlab.arturbosch.detekt.Detekt plugins { @@ -40,13 +41,21 @@ buildscript { detekt { parallel = true buildUponDefaultConfig = true - config = files("config/detekt/detekt.yml") + config.setFrom("config/detekt/detekt.yml") } tasks.withType().configureEach { reports.html.required.set(true) } +tasks.withType { + rejectVersionIf { + listOf("alpha", "beta", "rc").any { keyword -> + candidate.version.lowercase().contains(keyword) + } + } +} + allprojects { apply(plugin = PLUGIN_DETEKT) apply(plugin = PLUGIN_KTLINT) @@ -57,8 +66,10 @@ allprojects { } configure { + version.set(versions.ktlint) android.set(true) outputToConsole.set(true) + verbose.set(true) reporters { reporter(org.jlleitschuh.gradle.ktlint.reporter.ReporterType.HTML) } @@ -66,5 +77,5 @@ allprojects { } val clean by tasks.registering(Delete::class) { - delete(buildDir) + delete(layout.buildDirectory) } diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index d22a7e1..219d034 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -15,7 +15,7 @@ */ plugins { - `kotlin-dsl` + `kotlin-dsl-base` } repositories { @@ -24,6 +24,6 @@ repositories { } dependencies { - implementation("com.android.tools.build:gradle:7.2.2") - implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0") + implementation("com.android.tools.build:gradle:8.3.1") + implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.0") } diff --git a/buildSrc/src/main/java/Dependencies.kt b/buildSrc/src/main/java/Dependencies.kt index bdfa8ac..410ca04 100644 --- a/buildSrc/src/main/java/Dependencies.kt +++ b/buildSrc/src/main/java/Dependencies.kt @@ -20,13 +20,13 @@ import org.gradle.api.JavaVersion object appConfig { - const val compileSdkVersion = 32 - const val targetSdkVersion = 32 + const val compileSdkVersion = 34 + const val targetSdkVersion = 34 const val minSdkVersion = 21 const val applicationId = "com.paulrybitskyi.valuepicker.sample" - val javaCompatibilityVersion = JavaVersion.VERSION_1_8 - val kotlinCompatibilityVersion = JavaVersion.VERSION_1_8 + val javaCompatibilityVersion = JavaVersion.VERSION_17 + val kotlinCompatibilityVersion = JavaVersion.VERSION_17 } object publishingConfig { @@ -54,31 +54,32 @@ object publishingConfig { object versions { - const val kotlin = "1.7.0" // also in buildSrc build.gradle.kts file - const val gradlePlugin = "7.2.2" // also in buildSrc build.gradle.kts file and lint version - const val detektPlugin = "1.20.0" - const val ktlintPlugin = "10.3.0" - const val gradleVersionsPlugin = "0.42.0" - const val dokkaPlugin = "1.7.0" - const val appCompat = "1.4.2" - const val recyclerView = "1.2.1" - const val navigation = "2.5.1" + const val kotlin = "2.0.0" // also in buildSrc build.gradle.kts file + const val androidPlugin = "8.3.1" // also in buildSrc build.gradle.kts file and lint version + const val detektPlugin = "1.23.6" + const val ktlintPlugin = "12.1.1" + const val gradleVersionsPlugin = "0.51.0" + const val dokkaPlugin = "1.9.20" + const val appCompat = "1.7.0" + const val recyclerView = "1.3.2" + const val navigation = "2.7.7" const val constraintLayout = "2.1.4" - const val coreKtx = "1.8.0" + const val coreKtx = "1.13.1" const val commonsCore = "1.0.3" const val commonsKtx = "1.0.3" const val commonsRecyclerView = "1.0.1" - const val autoService = "1.0" - const val lint = "30.2.2" // lintVersion = gradlePluginVersion + 23.0.0 + const val ktlint = "1.3.1" + const val autoService = "1.1.1" + const val lint = "31.3.1" // lintVersion = androidPlugin + 23.0.0 const val jUnit = "4.13.2" - const val jUnitExt = "1.1.3" + const val jUnitExt = "1.2.1" } object deps { object plugins { - const val androidGradle = "com.android.tools.build:gradle:${versions.gradlePlugin}" + const val androidGradle = "com.android.tools.build:gradle:${versions.androidPlugin}" const val kotlinGradle = "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}" const val gradleVersions = "com.github.ben-manes:gradle-versions-plugin:${versions.gradleVersionsPlugin}" const val dokka = "org.jetbrains.dokka:dokka-gradle-plugin:${versions.dokkaPlugin}" diff --git a/config/detekt/detekt.yml b/config/detekt/detekt.yml index 8ab5aa4..011d8ed 100644 --- a/config/detekt/detekt.yml +++ b/config/detekt/detekt.yml @@ -10,6 +10,7 @@ build: config: validation: true warningsAsErrors: false + checkExhaustiveness: false # when writing own rules with new properties, exclude the property path e.g.: 'my_rule_set,.*>.*>[my_property]' excludes: '' @@ -46,6 +47,8 @@ output-reports: # - 'TxtOutputReport' # - 'XmlOutputReport' # - 'HtmlOutputReport' + # - 'MdOutputReport' + # - 'SarifOutputReport' comments: active: true @@ -62,6 +65,9 @@ comments: EndOfSentenceFormat: active: false endOfSentenceFormat: '([.?!][ \t\n\r\f<])|([.?!:]$)' + KDocReferencesNonPublicProperty: + active: false + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] OutdatedDocumentation: active: false matchTypeParameters: true @@ -69,20 +75,26 @@ comments: allowParamOnConstructorProperties: false UndocumentedPublicClass: active: false - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] searchInNestedClass: true searchInInnerClass: true searchInInnerObject: true searchInInnerInterface: true + searchInProtectedClass: false UndocumentedPublicFunction: active: false - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] + searchProtectedFunction: false UndocumentedPublicProperty: active: false - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] + searchProtectedProperty: false complexity: active: true + CognitiveComplexMethod: + active: false + threshold: 15 ComplexCondition: active: true threshold: 4 @@ -91,7 +103,8 @@ complexity: threshold: 10 includeStaticDeclarations: false includePrivateDeclarations: false - ComplexMethod: + ignoreOverloaded: false + CyclomaticComplexMethod: active: true threshold: 15 ignoreSingleWhenExpression: false @@ -133,18 +146,27 @@ complexity: NestedBlockDepth: active: true threshold: 4 + NestedScopeFunctions: + active: false + threshold: 1 + functions: + - 'kotlin.apply' + - 'kotlin.run' + - 'kotlin.with' + - 'kotlin.let' + - 'kotlin.also' ReplaceSafeCallChainWithRun: active: false StringLiteralDuplication: active: false - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] threshold: 3 ignoreAnnotation: true excludeStringsWithLessThan5Characters: true ignoreStringsRegex: '$^' TooManyFunctions: active: true - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] thresholdInFiles: 11 thresholdInClasses: 11 thresholdInInterfaces: 11 @@ -153,25 +175,28 @@ complexity: ignoreDeprecated: false ignorePrivate: false ignoreOverridden: false + ignoreAnnotatedFunctions: [] coroutines: active: true GlobalCoroutineUsage: active: false InjectDispatcher: - active: false + active: true dispatcherNames: - 'IO' - 'Default' - 'Unconfined' RedundantSuspendModifier: - active: false + active: true SleepInsteadOfDelay: + active: true + SuspendFunSwallowedCancellation: active: false SuspendFunWithCoroutineScopeReceiver: active: false SuspendFunWithFlowReturnType: - active: false + active: true empty-blocks: active: true @@ -218,8 +243,8 @@ exceptions: - 'hashCode' - 'toString' InstanceOfCheckForException: - active: false - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] NotImplementedDeclaration: active: false ObjectExtendsThrowable: @@ -245,7 +270,7 @@ exceptions: active: false ThrowingExceptionsWithoutMessageOrCause: active: true - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] exceptions: - 'ArrayIndexOutOfBoundsException' - 'Exception' @@ -260,7 +285,7 @@ exceptions: active: true TooGenericExceptionCaught: active: true - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] exceptionNames: - 'ArrayIndexOutOfBoundsException' - 'Error' @@ -284,7 +309,6 @@ naming: BooleanPropertyNaming: active: false allowedPattern: '^(is|has|are)' - ignoreOverridden: true ClassNaming: active: true classPattern: '[A-Z][a-zA-Z0-9]*' @@ -293,7 +317,6 @@ naming: parameterPattern: '[a-z][A-Za-z0-9]*' privateParameterPattern: '[a-z][A-Za-z0-9]*' excludeClassPattern: '$^' - ignoreOverridden: true EnumNaming: active: true enumEntryPattern: '[A-Z][_a-zA-Z0-9]*' @@ -308,17 +331,15 @@ naming: minimumFunctionNameLength: 3 FunctionNaming: active: true - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] functionPattern: '[a-z][a-zA-Z0-9]*' excludeClassPattern: '$^' - ignoreOverridden: true FunctionParameterNaming: active: true parameterPattern: '[a-z][A-Za-z0-9]*' excludeClassPattern: '$^' - ignoreOverridden: true InvalidPackageDeclaration: - active: false + active: true rootPackage: '' requireRootInDeclaration: false LambdaParameterNaming: @@ -331,7 +352,7 @@ naming: active: true ignoreOverridden: true NoNameShadowing: - active: false + active: true NonBooleanPropertyPrefixedWithIs: active: false ObjectPropertyNaming: @@ -358,27 +379,33 @@ naming: variablePattern: '[a-z][A-Za-z0-9]*' privateVariablePattern: '(_)?[a-z][A-Za-z0-9]*' excludeClassPattern: '$^' - ignoreOverridden: true performance: active: true ArrayPrimitive: active: true + CouldBeSequence: + active: false + threshold: 3 ForEachOnRange: active: true - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] SpreadOperator: active: true - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] + UnnecessaryPartOfBinaryExpression: + active: false UnnecessaryTemporaryInstantiation: active: true potential-bugs: active: true AvoidReferentialEquality: - active: false + active: true forbiddenTypePatterns: - 'kotlin.String' + CastNullableToNonNullableType: + active: false CastToNullableType: active: false Deprecation: @@ -386,7 +413,7 @@ potential-bugs: DontDowncastCollectionTypes: active: false DoubleMutabilityForCollection: - active: false + active: true mutableTypes: - 'kotlin.collections.MutableList' - 'kotlin.collections.MutableMap' @@ -396,10 +423,9 @@ potential-bugs: - 'java.util.HashSet' - 'java.util.LinkedHashMap' - 'java.util.HashMap' - DuplicateCaseInWhenExpression: - active: true ElseCaseInsteadOfExhaustiveWhen: active: false + ignoredSubjectTypes: [] EqualsAlwaysReturnsTrueOrFalse: active: true EqualsWithHashCodeExist: @@ -409,15 +435,22 @@ potential-bugs: ExplicitGarbageCollectionCall: active: true HasPlatformType: - active: false + active: true IgnoredReturnValue: - active: false - restrictToAnnotatedMethods: true + active: true + restrictToConfig: true returnValueAnnotations: + - 'CheckResult' - '*.CheckResult' + - 'CheckReturnValue' - '*.CheckReturnValue' ignoreReturnValueAnnotations: + - 'CanIgnoreReturnValue' - '*.CanIgnoreReturnValue' + returnValueTypes: + - 'kotlin.sequences.Sequence' + - 'kotlinx.coroutines.flow.*Flow' + - 'java.util.stream.*Stream' ignoreFunctionCall: [] ImplicitDefaultLocale: active: true @@ -432,60 +465,84 @@ potential-bugs: active: true LateinitUsage: active: false - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] ignoreOnClassesPattern: '' MapGetWithNotNullAssertionOperator: - active: false + active: true MissingPackageDeclaration: active: false excludes: ['**/*.kts'] - MissingWhenCase: - active: true - allowElseExpression: true NullCheckOnMutableProperty: active: false NullableToStringCall: active: false - RedundantElseInWhen: - active: true + PropertyUsedBeforeDeclaration: + active: false UnconditionalJumpStatementInLoop: active: false + UnnecessaryNotNullCheck: + active: false UnnecessaryNotNullOperator: active: true UnnecessarySafeCall: active: true UnreachableCatchBlock: - active: false + active: true UnreachableCode: active: true UnsafeCallOnNullableType: active: true - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] UnsafeCast: active: true UnusedUnaryOperator: - active: false + active: true UselessPostfixExpression: - active: false + active: true WrongEqualsTypeParameter: active: true style: active: true + AlsoCouldBeApply: + active: false + BracesOnIfStatements: + active: false + singleLine: 'never' + multiLine: 'always' + BracesOnWhenStatements: + active: false + singleLine: 'necessary' + multiLine: 'consistent' CanBeNonNullable: active: false + CascadingCallWrapping: + active: false + includeElvis: true ClassOrdering: active: false CollapsibleIfStatements: active: false DataClassContainsFunctions: active: false - conversionFunctionPrefix: 'to' + conversionFunctionPrefix: + - 'to' + allowOperators: false DataClassShouldBeImmutable: active: false DestructuringDeclarationWithTooManyEntries: - active: false + active: true maxDestructuringEntries: 3 + DoubleNegativeLambda: + active: false + negativeFunctions: + - reason: 'Use `takeIf` instead.' + value: 'takeUnless' + - reason: 'Use `all` instead.' + value: 'none' + negativeFunctionNameParts: + - 'not' + - 'non' EqualsNullCall: active: true EqualsOnSignatureLine: @@ -493,18 +550,37 @@ style: ExplicitCollectionElementAccessMethod: active: false ExplicitItLambdaParameter: - active: false + active: true ExpressionBodySyntax: active: false includeLineWrapping: false + ForbiddenAnnotation: + active: false + annotations: + - reason: 'it is a java annotation. Use `Suppress` instead.' + value: 'java.lang.SuppressWarnings' + - reason: 'it is a java annotation. Use `kotlin.Deprecated` instead.' + value: 'java.lang.Deprecated' + - reason: 'it is a java annotation. Use `kotlin.annotation.MustBeDocumented` instead.' + value: 'java.lang.annotation.Documented' + - reason: 'it is a java annotation. Use `kotlin.annotation.Target` instead.' + value: 'java.lang.annotation.Target' + - reason: 'it is a java annotation. Use `kotlin.annotation.Retention` instead.' + value: 'java.lang.annotation.Retention' + - reason: 'it is a java annotation. Use `kotlin.annotation.Repeatable` instead.' + value: 'java.lang.annotation.Repeatable' + - reason: 'Kotlin does not support @Inherited annotation, see https://youtrack.jetbrains.com/issue/KT-22265' + value: 'java.lang.annotation.Inherited' ForbiddenComment: active: true - values: - - 'FIXME:' - - 'STOPSHIP:' - - 'TODO:' + comments: + - reason: 'Forbidden FIXME todo marker in comment, please fix the problem.' + value: 'FIXME:' + - reason: 'Forbidden STOPSHIP todo marker in comment, please address the problem before shipping the code.' + value: 'STOPSHIP:' + - reason: 'Forbidden TODO todo marker in comment, please do the changes.' + value: 'TODO:' allowedPatterns: '' - customMessage: '' ForbiddenImport: active: false imports: [] @@ -512,35 +588,28 @@ style: ForbiddenMethodCall: active: false methods: - - 'kotlin.io.print' - - 'kotlin.io.println' - ForbiddenPublicDataClass: - active: true - excludes: ['**'] - ignorePackages: - - '*.internal' - - '*.internal.*' - ForbiddenVoid: + - reason: 'print does not allow you to configure the output stream. Use a logger instead.' + value: 'kotlin.io.print' + - reason: 'println does not allow you to configure the output stream. Use a logger instead.' + value: 'kotlin.io.println' + ForbiddenSuppress: active: false + rules: [] + ForbiddenVoid: + active: true ignoreOverridden: false ignoreUsageInGenerics: false FunctionOnlyReturningConstant: active: true ignoreOverridableFunction: true ignoreActualFunction: true - excludedFunctions: '' - LibraryCodeMustSpecifyReturnType: - active: true - excludes: ['**'] - LibraryEntitiesShouldNotBePublic: - active: true - excludes: ['**'] + excludedFunctions: [] LoopWithTooManyJumpStatements: active: true maxJumpCount: 1 MagicNumber: active: true - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**', '**/*.kts'] ignoreNumbers: - '-1' - '0' @@ -556,36 +625,44 @@ style: ignoreEnums: false ignoreRanges: false ignoreExtensionFunctions: true - MandatoryBracesIfStatements: - active: false MandatoryBracesLoops: active: false + MaxChainedCallsOnSameLine: + active: false + maxChainedCalls: 5 MaxLineLength: active: true maxLineLength: 120 excludePackageStatements: true excludeImportStatements: true excludeCommentStatements: false + excludeRawStrings: true MayBeConst: active: true ModifierOrder: active: true MultilineLambdaItParameter: active: false + MultilineRawStringIndentation: + active: false + indentSize: 4 + trimmingMethods: + - 'trimIndent' + - 'trimMargin' NestedClassesVisibility: active: true NewLineAtEndOfFile: active: true NoTabs: active: false - ObjectLiteralToLambda: + NullableBooleanCheck: active: false + ObjectLiteralToLambda: + active: true OptionalAbstractKeyword: active: true OptionalUnit: active: false - OptionalWhenBraces: - active: false PreferToOverPairSyntax: active: false ProtectedMemberInFinalClass: @@ -593,13 +670,14 @@ style: RedundantExplicitType: active: false RedundantHigherOrderMapUsage: - active: false + active: true RedundantVisibilityModifierRule: active: false ReturnCount: active: true max: 2 - excludedFunctions: 'equals' + excludedFunctions: + - 'equals' excludeLabeled: false excludeReturnFromLambda: true excludeGuardClauses: true @@ -609,12 +687,21 @@ style: active: true SpacingBetweenPackageAndImports: active: false + StringShouldBeRawString: + active: false + maxEscapedCharacterCount: 2 + ignoredCharacters: [] ThrowsCount: active: true max: 2 excludeGuardClauses: false TrailingWhitespace: active: false + TrimMultilineRawString: + active: false + trimmingMethods: + - 'trimIndent' + - 'trimMargin' UnderscoresInNumericLiterals: active: false acceptableLength: 4 @@ -625,8 +712,12 @@ style: active: false UnnecessaryApply: active: true - UnnecessaryFilter: + UnnecessaryBackticks: active: false + UnnecessaryBracesAroundTrailingLambda: + active: false + UnnecessaryFilter: + active: true UnnecessaryInheritance: active: true UnnecessaryInnerClass: @@ -635,23 +726,30 @@ style: active: false UnnecessaryParentheses: active: false + allowForUnclearPrecedence: false UntilInsteadOfRangeTo: active: false UnusedImports: active: false + UnusedParameter: + active: true + allowedNames: 'ignored|expected' UnusedPrivateClass: active: true UnusedPrivateMember: active: true - allowedNames: '(_|ignored|expected|serialVersionUID)' + allowedNames: '' + UnusedPrivateProperty: + active: true + allowedNames: '_|ignored|expected|serialVersionUID' UseAnyOrNoneInsteadOfFind: - active: false + active: true UseArrayLiteralsInAnnotations: - active: false + active: true UseCheckNotNull: - active: false + active: true UseCheckOrError: - active: false + active: true UseDataClass: active: false allowVars: false @@ -661,13 +759,18 @@ style: active: false UseIfInsteadOfWhen: active: false + ignoreWhenContainingVariableDeclaration: false UseIsNullOrEmpty: + active: true + UseLet: active: false UseOrEmpty: - active: false + active: true UseRequire: - active: false + active: true UseRequireNotNull: + active: true + UseSumOfInsteadOfFlatMapSize: active: false UselessCallOnNotNull: active: true @@ -675,8 +778,8 @@ style: active: true VarCouldBeVal: active: true + ignoreLateinitVar: false WildcardImport: active: true - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] excludeImports: - 'java.util.*' diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index f562543..a69d049 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-all.zip diff --git a/sample/build.gradle.kts b/sample/build.gradle.kts index 6238020..6aa5a07 100644 --- a/sample/build.gradle.kts +++ b/sample/build.gradle.kts @@ -24,6 +24,7 @@ android { defaultConfig { applicationId = appConfig.applicationId + namespace = appConfig.applicationId minSdk = appConfig.minSdkVersion targetSdk = appConfig.targetSdkVersion diff --git a/sample/src/main/AndroidManifest.xml b/sample/src/main/AndroidManifest.xml index 06ede89..9c78aa6 100644 --- a/sample/src/main/AndroidManifest.xml +++ b/sample/src/main/AndroidManifest.xml @@ -14,9 +14,7 @@ ~ limitations under the License. --> - + (@LayoutRes contentLayoutId: Int) : Fragment(contentLayoutId) { private var isViewCreated = false @@ -36,7 +36,7 @@ internal abstract class BaseFragment< final override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? + savedInstanceState: Bundle?, ): View? { // Prevent the view from recreation until onDestroy is called return if (isViewCreated) { diff --git a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/clothingsizepicker/ClothingSizePickerFragment.kt b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/clothingsizepicker/ClothingSizePickerFragment.kt index b4fe0fe..7d900cd 100644 --- a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/clothingsizepicker/ClothingSizePickerFragment.kt +++ b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/clothingsizepicker/ClothingSizePickerFragment.kt @@ -34,7 +34,7 @@ import com.paulrybitskyi.valuepicker.sample.databinding.FragmentClothingSizePick @Suppress("MagicNumber") internal class ClothingSizePickerFragment : BaseFragment< - FragmentClothingSizePickerBinding + FragmentClothingSizePickerBinding, >(R.layout.fragment_clothing_size_picker) { override val viewBinding by viewBinding(FragmentClothingSizePickerBinding::bind) @@ -55,7 +55,7 @@ internal class ClothingSizePickerFragment : BaseFragment< dividerDrawable = getDrawable(R.drawable.clothing_size_picker_divider) fixedItemSize = Size.withFixedSize( width = getDimensionPixelSize(R.dimen.clothing_size_picker_item_width), - height = getDimensionPixelSize(R.dimen.clothing_size_picker_item_height) + height = getDimensionPixelSize(R.dimen.clothing_size_picker_item_height), ) orientation = Orientation.HORIZONTAL onItemSelectedListener = ValuePickerView.OnItemSelectedListener { @@ -71,7 +71,7 @@ internal class ClothingSizePickerFragment : BaseFragment< return ClothingSize.values().map { PickerItem( id = it.ordinal, - title = it.name + title = it.name, ) } } diff --git a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/clothingsizepicker/model/ClothingSize.kt b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/clothingsizepicker/model/ClothingSize.kt index 28dddf3..a3598ea 100644 --- a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/clothingsizepicker/model/ClothingSize.kt +++ b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/clothingsizepicker/model/ClothingSize.kt @@ -22,5 +22,5 @@ internal enum class ClothingSize { M, L, XL, - XXL + XXL, } diff --git a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/dashboard/DashboardDestination.kt b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/dashboard/DashboardDestination.kt index 9611356..20c7119 100644 --- a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/dashboard/DashboardDestination.kt +++ b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/dashboard/DashboardDestination.kt @@ -22,43 +22,43 @@ import com.paulrybitskyi.valuepicker.sample.R internal enum class DashboardDestination( val title: String, val description: String, - @IdRes val destinationId: Int + @IdRes val destinationId: Int, ) { TIME_PICKER( title = "Time Picker", description = "Three vertical pickers for picking time.", - destinationId = R.id.timePickerFragment + destinationId = R.id.timePickerFragment, ), DATE_PICKER( title = "Date Picker", description = "Three vertical pickers with infinite scroll enabled for picking date.", - destinationId = R.id.datePickerFragment + destinationId = R.id.datePickerFragment, ), TEAM_PICKER( title = "Team Picker", description = "A vertical picker with a fixed item size, custom divider, " + "and text font for picking the NBA team.", - destinationId = R.id.teamPickerFragment + destinationId = R.id.teamPickerFragment, ), MOVIE_FILTERING_PICKER( title = "Movie Filtering Picker", description = "Three vertical pickers each with a custom effect for picking a movie.", - destinationId = R.id.movieFilteringPicker + destinationId = R.id.movieFilteringPicker, ), RATING_PICKER( title = "Rating Picker", description = "A horizontal picker for picking a rating.", - destinationId = R.id.ratingPickerFragment + destinationId = R.id.ratingPickerFragment, ), CLOTHING_SIZE_PICKER( title = "Clothing Size Picker", description = "A horizontal picker with a fixed item size, custom divider, " + "and infinite scroll enabled for picking the clothing size.", - destinationId = R.id.clothingSizePickerFragment + destinationId = R.id.clothingSizePickerFragment, ), PERSON_INFO_PICKER( title = "Person Info Picker", description = "Three horizontal pickers each with a custom effect for picking person's information.", - destinationId = R.id.personInfoPickerFragment - ) + destinationId = R.id.personInfoPickerFragment, + ), } diff --git a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/dashboard/DashboardFragment.kt b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/dashboard/DashboardFragment.kt index 69808ea..03d637c 100644 --- a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/dashboard/DashboardFragment.kt +++ b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/dashboard/DashboardFragment.kt @@ -23,7 +23,7 @@ import com.paulrybitskyi.valuepicker.sample.R import com.paulrybitskyi.valuepicker.sample.databinding.FragmentDashboardBinding internal class DashboardFragment : BaseFragment< - FragmentDashboardBinding + FragmentDashboardBinding, >(R.layout.fragment_dashboard) { override val viewBinding by viewBinding(FragmentDashboardBinding::bind) @@ -42,7 +42,7 @@ internal class DashboardFragment : BaseFragment< return DashboardRecyclerViewAdapter( context = requireContext(), items = DashboardDestination.values().toList(), - onItemClickListener = ::navigateToDestination + onItemClickListener = ::navigateToDestination, ) } diff --git a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/dashboard/DashboardRecyclerViewAdapter.kt b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/dashboard/DashboardRecyclerViewAdapter.kt index 302644c..9aa40e1 100644 --- a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/dashboard/DashboardRecyclerViewAdapter.kt +++ b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/dashboard/DashboardRecyclerViewAdapter.kt @@ -28,7 +28,7 @@ import com.paulrybitskyi.valuepicker.sample.dashboard.DashboardRecyclerViewAdapt internal class DashboardRecyclerViewAdapter( context: Context, private val items: List, - private val onItemClickListener: (DashboardDestination) -> Unit + private val onItemClickListener: (DashboardDestination) -> Unit, ) : RecyclerView.Adapter() { private val layoutInflater = LayoutInflater.from(context) @@ -38,8 +38,8 @@ internal class DashboardRecyclerViewAdapter( layoutInflater.inflate( R.layout.item_view_dashboard, parent, - false - ) + false, + ), ) } diff --git a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/datepicker/DatePickerFragment.kt b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/datepicker/DatePickerFragment.kt index 964432d..1bb0a34 100644 --- a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/datepicker/DatePickerFragment.kt +++ b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/datepicker/DatePickerFragment.kt @@ -31,7 +31,7 @@ import com.paulrybitskyi.valuepicker.sample.datepicker.model.Month @Suppress("MagicNumber") internal class DatePickerFragment : BaseFragment< - FragmentDatePickerBinding + FragmentDatePickerBinding, >(R.layout.fragment_date_picker) { override val viewBinding by viewBinding(FragmentDatePickerBinding::bind) @@ -75,7 +75,7 @@ internal class DatePickerFragment : BaseFragment< PickerItem( id = it.ordinal, title = if (longMonthNames) it.longName else it.shortName, - payload = it + payload = it, ) } } @@ -97,8 +97,8 @@ internal class DatePickerFragment : BaseFragment< add( PickerItem( id = day, - title = if (day < 10) "0$day" else day.toString() - ) + title = if (day < 10) "0$day" else day.toString(), + ), ) } } @@ -121,8 +121,8 @@ internal class DatePickerFragment : BaseFragment< add( PickerItem( id = year, - title = year.toString() - ) + title = year.toString(), + ), ) } } diff --git a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/datepicker/model/Month.kt b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/datepicker/model/Month.kt index 88137ab..0b78747 100644 --- a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/datepicker/model/Month.kt +++ b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/datepicker/model/Month.kt @@ -18,54 +18,54 @@ package com.paulrybitskyi.valuepicker.sample.datepicker.model internal enum class Month( val longName: String, - val shortName: String + val shortName: String, ) { JANUARY( longName = "January", - shortName = "Jan" + shortName = "Jan", ), FEBRUARY( longName = "February", - shortName = "Feb" + shortName = "Feb", ), MARCH( longName = "March", - shortName = "Mar" + shortName = "Mar", ), APRIL( longName = "April", - shortName = "Apr" + shortName = "Apr", ), MAY( longName = "May", - shortName = "May" + shortName = "May", ), JUNE( longName = "June", - shortName = "Jun" + shortName = "Jun", ), JULY( longName = "July", - shortName = "Jul" + shortName = "Jul", ), AUGUST( longName = "August", - shortName = "Aug" + shortName = "Aug", ), SEPTEMBER( longName = "September", - shortName = "Sept" + shortName = "Sept", ), OCTOBER( longName = "October", - shortName = "Oct" + shortName = "Oct", ), NOVEMBER( longName = "November", - shortName = "Nov" + shortName = "Nov", ), DECEMBER( longName = "December", - shortName = "Dec" - ) + shortName = "Dec", + ), } diff --git a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/moviefilteringpicker/MovieFilteringPickerFragment.kt b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/moviefilteringpicker/MovieFilteringPickerFragment.kt index 09b7e2d..ed2449f 100644 --- a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/moviefilteringpicker/MovieFilteringPickerFragment.kt +++ b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/moviefilteringpicker/MovieFilteringPickerFragment.kt @@ -35,7 +35,7 @@ import com.paulrybitskyi.valuepicker.valueeffects.concrete.FadingValueEffect @Suppress("MagicNumber") internal class MovieFilteringPickerFragment : BaseFragment< - FragmentMovieFilteringPickerBinding + FragmentMovieFilteringPickerBinding, >(R.layout.fragment_movie_filtering_picker) { override val viewBinding by viewBinding(FragmentMovieFilteringPickerBinding::bind) @@ -80,7 +80,7 @@ internal class MovieFilteringPickerFragment : BaseFragment< PickerItem( id = it.ordinal, title = it.title, - payload = it + payload = it, ) } } @@ -103,8 +103,8 @@ internal class MovieFilteringPickerFragment : BaseFragment< add( PickerItem( id = year, - title = year.toString() - ) + title = year.toString(), + ), ) } } @@ -115,8 +115,8 @@ internal class MovieFilteringPickerFragment : BaseFragment< valueEffect = CompositeValueEffect( listOf( FadingValueEffect(), - RotationValueEffect(RotationValueEffect.Property.ROTATION_X) - ) + RotationValueEffect(RotationValueEffect.Property.ROTATION_X), + ), ) onItemSelectedListener = ValuePickerView.OnItemSelectedListener { viewBinding.serviceTv.text = "Service: ${it.title}" @@ -132,7 +132,7 @@ internal class MovieFilteringPickerFragment : BaseFragment< PickerItem( id = it.ordinal, title = it.title, - payload = it + payload = it, ) } } diff --git a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/moviefilteringpicker/model/StreamingService.kt b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/moviefilteringpicker/model/StreamingService.kt index de0b2b5..9c0d684 100644 --- a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/moviefilteringpicker/model/StreamingService.kt +++ b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/moviefilteringpicker/model/StreamingService.kt @@ -22,5 +22,5 @@ internal enum class StreamingService(val title: String) { HULU("Hulu"), HBO_MAX("HBO"), DISNEY("Disney"), - APPLE_TV("Apple") + APPLE_TV("Apple"), } diff --git a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/personinfopicker/PersonInfoPickerFragment.kt b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/personinfopicker/PersonInfoPickerFragment.kt index c9b3974..a4a1e01 100644 --- a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/personinfopicker/PersonInfoPickerFragment.kt +++ b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/personinfopicker/PersonInfoPickerFragment.kt @@ -36,7 +36,7 @@ import com.paulrybitskyi.valuepicker.valueeffects.concrete.NoValueEffect @Suppress("MagicNumber") internal class PersonInfoPickerFragment : BaseFragment< - FragmentPersonInfoPickerBinding + FragmentPersonInfoPickerBinding, >(R.layout.fragment_person_info_picker) { override val viewBinding by viewBinding(FragmentPersonInfoPickerBinding::bind) @@ -63,7 +63,7 @@ internal class PersonInfoPickerFragment : BaseFragment< textTypeface = Typeface.DEFAULT_BOLD fixedItemSize = Size.withFixedSize( width = getDimensionPixelSize(R.dimen.person_info_picker_item_width), - height = getDimensionPixelSize(R.dimen.person_info_picker_item_height) + height = getDimensionPixelSize(R.dimen.person_info_picker_item_height), ) orientation = Orientation.HORIZONTAL } @@ -86,8 +86,8 @@ internal class PersonInfoPickerFragment : BaseFragment< add( PickerItem( id = age, - title = age.toString() - ) + title = age.toString(), + ), ) } } @@ -111,8 +111,8 @@ internal class PersonInfoPickerFragment : BaseFragment< add( PickerItem( id = cm, - title = "$cm cm" - ) + title = "$cm cm", + ), ) } } @@ -123,8 +123,8 @@ internal class PersonInfoPickerFragment : BaseFragment< valueEffect = CompositeValueEffect( listOf( FadingValueEffect(), - RotationValueEffect(RotationValueEffect.Property.ROTATION_Y) - ) + RotationValueEffect(RotationValueEffect.Property.ROTATION_Y), + ), ) onItemSelectedListener = ValuePickerView.OnItemSelectedListener { viewBinding.weightTv.text = "Weight: ${it.title}" @@ -141,8 +141,8 @@ internal class PersonInfoPickerFragment : BaseFragment< add( PickerItem( id = kg, - title = "$kg kg" - ) + title = "$kg kg", + ), ) } } diff --git a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/ratingpicker/RatingPickerFragment.kt b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/ratingpicker/RatingPickerFragment.kt index 0f06648..c0eb0e6 100644 --- a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/ratingpicker/RatingPickerFragment.kt +++ b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/ratingpicker/RatingPickerFragment.kt @@ -31,7 +31,7 @@ import com.paulrybitskyi.valuepicker.sample.ratingpicker.model.Rating @Suppress("MagicNumber") internal class RatingPickerFragment : BaseFragment< - FragmentRatingPickerBinding + FragmentRatingPickerBinding, >(R.layout.fragment_rating_picker) { override val viewBinding by viewBinding(FragmentRatingPickerBinding::bind) @@ -65,7 +65,7 @@ internal class RatingPickerFragment : BaseFragment< PickerItem( id = it.ordinal, title = it.number.toString(), - payload = it + payload = it, ) } } diff --git a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/ratingpicker/model/Rating.kt b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/ratingpicker/model/Rating.kt index 097ca0b..724cf1e 100644 --- a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/ratingpicker/model/Rating.kt +++ b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/ratingpicker/model/Rating.kt @@ -18,46 +18,46 @@ package com.paulrybitskyi.valuepicker.sample.ratingpicker.model internal enum class Rating( val number: Int, - val title: String + val title: String, ) { ONE( number = 1, - title = "One" + title = "One", ), TWO( number = 2, - title = "Two" + title = "Two", ), THREE( number = 3, - title = "Three" + title = "Three", ), FOUR( number = 4, - title = "Four" + title = "Four", ), FIVE( number = 5, - title = "Five" + title = "Five", ), SIX( number = 6, - title = "Six" + title = "Six", ), SEVEN( number = 7, - title = "Seven" + title = "Seven", ), EIGHT( number = 8, - title = "Eight" + title = "Eight", ), NINE( number = 9, - title = "Nine" + title = "Nine", ), TEN( number = 10, - title = "Ten" - ) + title = "Ten", + ), } diff --git a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/teampicker/TeamPickerFragment.kt b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/teampicker/TeamPickerFragment.kt index d535085..789fac4 100644 --- a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/teampicker/TeamPickerFragment.kt +++ b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/teampicker/TeamPickerFragment.kt @@ -35,7 +35,7 @@ import com.paulrybitskyi.valuepicker.sample.teampicker.model.Team @Suppress("MagicNumber") internal class TeamPickerFragment : BaseFragment< - FragmentTeamPickerBinding + FragmentTeamPickerBinding, >(R.layout.fragment_team_picker) { override val viewBinding by viewBinding(FragmentTeamPickerBinding::bind) @@ -56,7 +56,7 @@ internal class TeamPickerFragment : BaseFragment< dividerDrawable = getDrawable(R.drawable.team_picker_divider) fixedItemSize = Size.withFixedSize( width = getDimensionPixelSize(R.dimen.team_picker_item_width), - height = getDimensionPixelSize(R.dimen.team_picker_item_height) + height = getDimensionPixelSize(R.dimen.team_picker_item_height), ) orientation = Orientation.VERTICAL onItemSelectedListener = ValuePickerView.OnItemSelectedListener { @@ -73,7 +73,7 @@ internal class TeamPickerFragment : BaseFragment< PickerItem( id = it.ordinal, title = it.longName, - payload = it + payload = it, ) } } diff --git a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/teampicker/model/Team.kt b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/teampicker/model/Team.kt index 1a15892..1851138 100644 --- a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/teampicker/model/Team.kt +++ b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/teampicker/model/Team.kt @@ -29,5 +29,5 @@ internal enum class Team(val longName: String) { MIAMI_HEAT(longName = "Miami Heat"), GOLDEN_STATE_WARRIOS(longName = "Golden State Warriors"), LOS_ANGELES_LAKERS(longName = "Los Angeles Lakers"), - SAN_ANTONIO_SPURS(longName = "San Antonio Spurs") + SAN_ANTONIO_SPURS(longName = "San Antonio Spurs"), } diff --git a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/timepicker/TimePickerFragment.kt b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/timepicker/TimePickerFragment.kt index db58299..784f685 100644 --- a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/timepicker/TimePickerFragment.kt +++ b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/timepicker/TimePickerFragment.kt @@ -30,7 +30,7 @@ import com.paulrybitskyi.valuepicker.sample.databinding.FragmentTimePickerBindin @Suppress("MagicNumber") internal class TimePickerFragment : BaseFragment< - FragmentTimePickerBinding + FragmentTimePickerBinding, >(R.layout.fragment_time_picker) { override val viewBinding by viewBinding(FragmentTimePickerBinding::bind) @@ -75,8 +75,8 @@ internal class TimePickerFragment : BaseFragment< add( PickerItem( id = hour, - title = hour.toString() - ) + title = hour.toString(), + ), ) } } @@ -99,8 +99,8 @@ internal class TimePickerFragment : BaseFragment< add( PickerItem( id = minute, - title = if (minute < 10) "0$minute" else minute.toString() - ) + title = if (minute < 10) "0$minute" else minute.toString(), + ), ) } } @@ -122,14 +122,14 @@ internal class TimePickerFragment : BaseFragment< add( PickerItem( id = 1, - title = "AM" - ) + title = "AM", + ), ) add( PickerItem( id = 2, - title = "PM" - ) + title = "PM", + ), ) } } diff --git a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/valueeffects/CompositeValueEffect.kt b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/valueeffects/CompositeValueEffect.kt index 064b9a5..fcaed4c 100644 --- a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/valueeffects/CompositeValueEffect.kt +++ b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/valueeffects/CompositeValueEffect.kt @@ -22,7 +22,7 @@ import com.paulrybitskyi.valuepicker.model.Orientation import com.paulrybitskyi.valuepicker.valueeffects.ValueEffect internal class CompositeValueEffect( - private val itemEffects: List + private val itemEffects: List, ) : ValueEffect { override fun applyEffect(child: View, recyclerView: RecyclerView, orientation: Orientation) { diff --git a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/valueeffects/RotationValueEffect.kt b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/valueeffects/RotationValueEffect.kt index 9fb85fd..f961886 100644 --- a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/valueeffects/RotationValueEffect.kt +++ b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/valueeffects/RotationValueEffect.kt @@ -25,7 +25,7 @@ private const val PROPERTY_ROTATION_X_START_ANGLE = 90f private const val PROPERTY_ROTATION_Y_START_ANGLE = -90f internal class RotationValueEffect( - private val property: Property + private val property: Property, ) : ValueEffect { override fun applyEffect(child: View, recyclerView: RecyclerView, orientation: Orientation) { @@ -34,7 +34,7 @@ internal class RotationValueEffect( val rvDistanceFrmChildCenter = (rvCenter - childCenter) val rotation = calculateChildRotation( rvDistanceFrmChildCenter, - recyclerView.getDimension(orientation) + recyclerView.getDimension(orientation), ) when (property) { @@ -55,6 +55,6 @@ internal class RotationValueEffect( internal enum class Property { ROTATION_X, - ROTATION_Y + ROTATION_Y, } } diff --git a/value-picker-lint/build.gradle.kts b/value-picker-lint/build.gradle.kts index 6120c3f..2b60fa6 100644 --- a/value-picker-lint/build.gradle.kts +++ b/value-picker-lint/build.gradle.kts @@ -1,3 +1,5 @@ +import org.jetbrains.kotlin.gradle.dsl.JvmTarget + /* * Copyright 2021 Paul Rybitskyi, paul.rybitskyi.work@gmail.com * @@ -24,11 +26,9 @@ plugins { java.sourceCompatibility = appConfig.javaCompatibilityVersion java.targetCompatibility = appConfig.javaCompatibilityVersion -kotlin.target { - compilations.all { - kotlinOptions { - jvmTarget = appConfig.kotlinCompatibilityVersion.toString() - } +kotlin { + compilerOptions { + jvmTarget = JvmTarget.fromTarget(appConfig.kotlinCompatibilityVersion.toString()) } } diff --git a/value-picker-lint/src/main/java/com/paulrybitskyi/valuepicker/lint/NumberPickerUsageDetector.kt b/value-picker-lint/src/main/java/com/paulrybitskyi/valuepicker/lint/NumberPickerUsageDetector.kt index 2acabb0..34d8172 100644 --- a/value-picker-lint/src/main/java/com/paulrybitskyi/valuepicker/lint/NumberPickerUsageDetector.kt +++ b/value-picker-lint/src/main/java/com/paulrybitskyi/valuepicker/lint/NumberPickerUsageDetector.kt @@ -30,10 +30,10 @@ import com.android.tools.lint.detector.api.SourceCodeScanner import com.android.tools.lint.detector.api.XmlContext import com.android.tools.lint.detector.api.XmlScanner import com.intellij.psi.PsiMethod -import java.util.EnumSet import org.jetbrains.uast.UCallExpression import org.jetbrains.uast.getQualifiedName import org.w3c.dom.Element +import java.util.EnumSet internal class NumberPickerUsageDetector : Detector(), XmlScanner, SourceCodeScanner { @@ -54,8 +54,8 @@ internal class NumberPickerUsageDetector : Detector(), XmlScanner, SourceCodeSca NumberPickerUsageDetector::class.java, EnumSet.of(Scope.RESOURCE_FILE, Scope.JAVA_FILE), Scope.RESOURCE_FILE_SCOPE, - Scope.JAVA_FILE_SCOPE - ) + Scope.JAVA_FILE_SCOPE, + ), ) } @@ -81,7 +81,7 @@ internal class NumberPickerUsageDetector : Detector(), XmlScanner, SourceCodeSca issue = ISSUE, location = context.getElementLocation(element), message = NUMBER_PICKER_USAGE_BRIEF_DESC, - quickfixData = computeQuickFixForXmlUsage(element) + quickfixData = computeQuickFixForXmlUsage(element), ) } @@ -101,13 +101,13 @@ internal class NumberPickerUsageDetector : Detector(), XmlScanner, SourceCodeSca override fun visitConstructor( context: JavaContext, node: UCallExpression, - constructor: PsiMethod + constructor: PsiMethod, ) { context.report( issue = ISSUE, location = context.getLocation(node), message = NUMBER_PICKER_USAGE_BRIEF_DESC, - quickfixData = computeQuickFixForSourceUsage(node) + quickfixData = computeQuickFixForSourceUsage(node), ) } diff --git a/value-picker-lint/src/test/java/com/paulrybitskyi/valuepicker/lint/NumberPickerUsageDetectorTest.kt b/value-picker-lint/src/test/java/com/paulrybitskyi/valuepicker/lint/NumberPickerUsageDetectorTest.kt index d2d36cb..47ac992 100644 --- a/value-picker-lint/src/test/java/com/paulrybitskyi/valuepicker/lint/NumberPickerUsageDetectorTest.kt +++ b/value-picker-lint/src/test/java/com/paulrybitskyi/valuepicker/lint/NumberPickerUsageDetectorTest.kt @@ -36,8 +36,8 @@ internal class NumberPickerUsageDetectorTest { xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content"/> - """ - ).indented() + """, + ).indented(), ) .issues(NumberPickerUsageDetector.ISSUE) .run() @@ -47,7 +47,7 @@ internal class NumberPickerUsageDetectorTest { - """ - ).indented() + """, + ).indented(), ) .issues(NumberPickerUsageDetector.ISSUE) .run() @@ -81,7 +81,7 @@ internal class NumberPickerUsageDetectorTest { - """ - ).indented() + """, + ).indented(), ) .issues(NumberPickerUsageDetector.ISSUE) .run() @@ -129,8 +129,8 @@ internal class NumberPickerUsageDetectorTest { return new NumberPicker(context); } } - """ - ).indented() + """, + ).indented(), ) .issues(NumberPickerUsageDetector.ISSUE) .run() @@ -140,7 +140,7 @@ internal class NumberPickerUsageDetectorTest { return new NumberPicker(context); ~~~~~~~~~~~~~~~~~~~~~~~~~ 0 errors, 1 warnings - """ + """, ) .expectFixDiffs( """ @@ -148,7 +148,7 @@ internal class NumberPickerUsageDetectorTest { @@ -9 +9 - return new NumberPicker(context); + return new com.paulrybitskyi.valuepicker.ValuePickerView(context); - """ + """, ) } @@ -170,8 +170,8 @@ internal class NumberPickerUsageDetectorTest { return new NumberPicker(context, attrs); } } - """ - ).indented() + """, + ).indented(), ) .issues(NumberPickerUsageDetector.ISSUE) .run() @@ -181,7 +181,7 @@ internal class NumberPickerUsageDetectorTest { return new NumberPicker(context, attrs); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 0 errors, 1 warnings - """ + """, ) .expectFixDiffs( """ @@ -189,7 +189,7 @@ internal class NumberPickerUsageDetectorTest { @@ -10 +10 - return new NumberPicker(context, attrs); + return new com.paulrybitskyi.valuepicker.ValuePickerView(context, attrs); - """ + """, ) } @@ -211,8 +211,8 @@ internal class NumberPickerUsageDetectorTest { return new NumberPicker(context, attrs, defStyleAttr); } } - """ - ).indented() + """, + ).indented(), ) .issues(NumberPickerUsageDetector.ISSUE) .run() @@ -222,7 +222,7 @@ internal class NumberPickerUsageDetectorTest { return new NumberPicker(context, attrs, defStyleAttr); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 0 errors, 1 warnings - """ + """, ) .expectFixDiffs( """ @@ -230,7 +230,7 @@ internal class NumberPickerUsageDetectorTest { @@ -10 +10 - return new NumberPicker(context, attrs, defStyleAttr); + return new com.paulrybitskyi.valuepicker.ValuePickerView(context, attrs, defStyleAttr); - """ + """, ) } @@ -252,8 +252,8 @@ internal class NumberPickerUsageDetectorTest { return new NumberPicker(context, attrs, defStyleAttr, defStyleRes); } } - """ - ).indented() + """, + ).indented(), ) .issues(NumberPickerUsageDetector.ISSUE) .run() @@ -263,7 +263,7 @@ internal class NumberPickerUsageDetectorTest { return new NumberPicker(context, attrs, defStyleAttr, defStyleRes); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 0 errors, 1 warnings - """ + """, ) } @@ -283,8 +283,8 @@ internal class NumberPickerUsageDetectorTest { return new android.widget.NumberPicker(context); } } - """ - ).indented() + """, + ).indented(), ) .issues(NumberPickerUsageDetector.ISSUE) .run() @@ -294,7 +294,7 @@ internal class NumberPickerUsageDetectorTest { return new android.widget.NumberPicker(context); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 0 errors, 1 warnings - """ + """, ) .expectFixDiffs( """ @@ -302,7 +302,7 @@ internal class NumberPickerUsageDetectorTest { @@ -8 +8 - return new android.widget.NumberPicker(context); + return new com.paulrybitskyi.valuepicker.ValuePickerView(context); - """ + """, ) } @@ -323,8 +323,8 @@ internal class NumberPickerUsageDetectorTest { return null; } } - """ - ).indented() + """, + ).indented(), ) .issues(NumberPickerUsageDetector.ISSUE) .run() @@ -349,8 +349,8 @@ internal class NumberPickerUsageDetectorTest { } } - """ - ).indented() + """, + ).indented(), ) .issues(NumberPickerUsageDetector.ISSUE) .run() @@ -360,7 +360,7 @@ internal class NumberPickerUsageDetectorTest { return NumberPicker(context) ~~~~~~~~~~~~~~~~~~~~~ 0 errors, 1 warnings - """ + """, ) .expectFixDiffs( """ @@ -368,7 +368,7 @@ internal class NumberPickerUsageDetectorTest { @@ -9 +9 - return NumberPicker(context) + return com.paulrybitskyi.valuepicker.ValuePickerView(context) - """ + """, ) } } diff --git a/value-picker/build.gradle.kts b/value-picker/build.gradle.kts index 91fc018..628fe2e 100644 --- a/value-picker/build.gradle.kts +++ b/value-picker/build.gradle.kts @@ -23,8 +23,8 @@ android { compileSdk = appConfig.compileSdkVersion defaultConfig { + namespace = "com.paulrybitskyi.valuepicker" minSdk = appConfig.minSdkVersion - targetSdk = appConfig.targetSdkVersion testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } diff --git a/value-picker/src/main/AndroidManifest.xml b/value-picker/src/main/AndroidManifest.xml deleted file mode 100644 index e995227..0000000 --- a/value-picker/src/main/AndroidManifest.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - \ No newline at end of file diff --git a/value-picker/src/main/java/com/paulrybitskyi/valuepicker/ValuePickerRecyclerViewAdapter.kt b/value-picker/src/main/java/com/paulrybitskyi/valuepicker/ValuePickerRecyclerViewAdapter.kt index 701f819..78a0c8f 100644 --- a/value-picker/src/main/java/com/paulrybitskyi/valuepicker/ValuePickerRecyclerViewAdapter.kt +++ b/value-picker/src/main/java/com/paulrybitskyi/valuepicker/ValuePickerRecyclerViewAdapter.kt @@ -33,7 +33,7 @@ import com.paulrybitskyi.valuepicker.scrollerhelpers.ScrollerHelper internal class ValuePickerRecyclerViewAdapter( items: List, var valueItemConfig: ValueItemConfig, - var scrollerHelper: ScrollerHelper + var scrollerHelper: ScrollerHelper, ) : RecyclerView.Adapter() { var items by observeChanges(items) { _, newItems -> @@ -51,7 +51,7 @@ internal class ValuePickerRecyclerViewAdapter( return AppCompatTextView(context).apply { layoutParams = RecyclerView.LayoutParams( valueItemConfig.size.width, - valueItemConfig.size.height + valueItemConfig.size.height, ) gravity = Gravity.CENTER setTextColor(valueItemConfig.textColor) diff --git a/value-picker/src/main/java/com/paulrybitskyi/valuepicker/ValuePickerView.kt b/value-picker/src/main/java/com/paulrybitskyi/valuepicker/ValuePickerView.kt index 8e8a72d..ed4cdbd 100644 --- a/value-picker/src/main/java/com/paulrybitskyi/valuepicker/ValuePickerView.kt +++ b/value-picker/src/main/java/com/paulrybitskyi/valuepicker/ValuePickerView.kt @@ -50,7 +50,6 @@ import com.paulrybitskyi.valuepicker.decorators.ValuePickerItemDecoratorFactory. import com.paulrybitskyi.valuepicker.decorators.ValuePickerItemDecoratorFactory.createVerticalDecorator import com.paulrybitskyi.valuepicker.layoutmanager.ValuePickerLayoutManager import com.paulrybitskyi.valuepicker.model.Item -import com.paulrybitskyi.valuepicker.model.Orientation as PickerOrientation import com.paulrybitskyi.valuepicker.model.Orientation.Companion.asOrientation import com.paulrybitskyi.valuepicker.model.Size import com.paulrybitskyi.valuepicker.model.VALUE_ITEM_CONFIG_STUB @@ -67,6 +66,7 @@ import com.paulrybitskyi.valuepicker.valueeffects.ValueEffect import com.paulrybitskyi.valuepicker.valueeffects.concrete.FadingValueEffect import com.paulrybitskyi.valuepicker.valueeffects.concrete.NoValueEffect import java.util.Collections +import com.paulrybitskyi.valuepicker.model.Orientation as PickerOrientation private const val DEFAULT_MAX_VISIBLE_ITEMS = 3 @@ -84,7 +84,7 @@ private val DEFAULT_VALUE_EFFECT = FadingValueEffect() class ValuePickerView @JvmOverloads constructor( context: Context, attrs: AttributeSet? = null, - defStyleAttr: Int = 0 + defStyleAttr: Int = 0, ) : RecyclerView(context, attrs, defStyleAttr) { /** @@ -179,7 +179,7 @@ class ValuePickerView @JvmOverloads constructor( set(value) { field = value.coerceIn( DEFAULT_FLING_SPEED_FACTOR_MIN, - DEFAULT_FLING_SPEED_FACTOR_MAX + DEFAULT_FLING_SPEED_FACTOR_MAX, ) } @@ -246,7 +246,9 @@ class ValuePickerView @JvmOverloads constructor( * A property representing a current list of items of the picker. */ var items: List - set(value) { _items = value.toList() } + set(value) { + _items = value.toList() + } get() = Collections.unmodifiableList(_items) private lateinit var valueItemViewPaint: Paint @@ -371,7 +373,7 @@ class ValuePickerView @JvmOverloads constructor( valuePickerAdapter.getItem(adapterPosition)?.let { setSelectedItem( item = it, - scrollToPosition = false + scrollToPosition = false, ) } } @@ -380,7 +382,7 @@ class ValuePickerView @JvmOverloads constructor( ValuePickerRecyclerViewAdapter( items = _items, valueItemConfig = valueItemConfig, - scrollerHelper = initScrollerHelper() + scrollerHelper = initScrollerHelper(), ) .apply { onItemClickListener = ::handleItemClick } .also { @@ -392,7 +394,7 @@ class ValuePickerView @JvmOverloads constructor( private fun initScrollerHelper(): ScrollerHelper { return ScrollerHelperFactory.create( isInfinite = isInfiniteScrollEnabled, - dataSetItemCount = itemCount + dataSetItemCount = itemCount, ) } @@ -409,7 +411,7 @@ class ValuePickerView @JvmOverloads constructor( size = defaultValues.valueItemSize, textColor = defaultValues.valueItemTextColor, textSize = defaultValues.valueItemTextSize, - textTypeface = defaultValues.valueItemTextTypeface + textTypeface = defaultValues.valueItemTextTypeface, ) } @@ -439,12 +441,12 @@ class ValuePickerView @JvmOverloads constructor( context.withStyledAttributes( set = attrs, attrs = R.styleable.ValuePickerView, - defStyleAttr = defStyle + defStyleAttr = defStyle, ) { areDividersEnabled = getBoolean(R.styleable.ValuePickerView_vpv_areDividersEnabled, areDividersEnabled) isInfiniteScrollEnabled = getBoolean( R.styleable.ValuePickerView_vpv_isInfiniteScrollEnabled, - isInfiniteScrollEnabled + isInfiniteScrollEnabled, ) maxVisibleItems = getInteger(R.styleable.ValuePickerView_vpv_maxVisibleItems, maxVisibleItems) textColor = getColor(R.styleable.ValuePickerView_vpv_textColor, textColor) @@ -499,7 +501,7 @@ class ValuePickerView @JvmOverloads constructor( return sizeOf( width = valueItemTextMaxWidth, - height = valueItemTextMaxHeight + height = valueItemTextMaxHeight, ) } @@ -522,7 +524,7 @@ class ValuePickerView @JvmOverloads constructor( return sizeOf( width = (width ?: 0), - height = (height ?: 0) + height = (height ?: 0), ) } @@ -645,7 +647,7 @@ class ValuePickerView @JvmOverloads constructor( override fun fling(velocityX: Int, velocityY: Int): Boolean { return super.fling( (velocityX * flingSpeedFactor).toInt(), - (velocityY * flingSpeedFactor).toInt() + (velocityY * flingSpeedFactor).toInt(), ) } } diff --git a/value-picker/src/main/java/com/paulrybitskyi/valuepicker/decorators/ValuePickerItemDecorator.kt b/value-picker/src/main/java/com/paulrybitskyi/valuepicker/decorators/ValuePickerItemDecorator.kt index 4674e5b..fb7e23d 100644 --- a/value-picker/src/main/java/com/paulrybitskyi/valuepicker/decorators/ValuePickerItemDecorator.kt +++ b/value-picker/src/main/java/com/paulrybitskyi/valuepicker/decorators/ValuePickerItemDecorator.kt @@ -24,7 +24,7 @@ import com.paulrybitskyi.valuepicker.model.ValueItemConfig internal abstract class ValuePickerItemDecorator( protected val maxVisibleItems: Int, protected val dividerDrawable: Drawable, - protected val valueItemConfigProvider: () -> ValueItemConfig + protected val valueItemConfigProvider: () -> ValueItemConfig, ) : RecyclerView.ItemDecoration() { override fun onDraw(canvas: Canvas, parent: RecyclerView, state: RecyclerView.State) { diff --git a/value-picker/src/main/java/com/paulrybitskyi/valuepicker/decorators/ValuePickerItemDecoratorFactory.kt b/value-picker/src/main/java/com/paulrybitskyi/valuepicker/decorators/ValuePickerItemDecoratorFactory.kt index 4534ad1..a1089bf 100644 --- a/value-picker/src/main/java/com/paulrybitskyi/valuepicker/decorators/ValuePickerItemDecoratorFactory.kt +++ b/value-picker/src/main/java/com/paulrybitskyi/valuepicker/decorators/ValuePickerItemDecoratorFactory.kt @@ -27,12 +27,12 @@ internal object ValuePickerItemDecoratorFactory { fun createVerticalDecorator( maxVisibleItems: Int, dividerDrawable: Drawable, - valueItemConfigProvider: () -> ValueItemConfig + valueItemConfigProvider: () -> ValueItemConfig, ): ValuePickerItemDecorator { return VerticalValuePickerItemDecorator( maxVisibleItems = maxVisibleItems, dividerDrawable = dividerDrawable, - valueItemConfigProvider = valueItemConfigProvider + valueItemConfigProvider = valueItemConfigProvider, ) } @@ -40,12 +40,12 @@ internal object ValuePickerItemDecoratorFactory { fun createHorizontalDecorator( maxVisibleItems: Int, dividerDrawable: Drawable, - valueItemConfigProvider: () -> ValueItemConfig + valueItemConfigProvider: () -> ValueItemConfig, ): ValuePickerItemDecorator { return HorizontalValuePickerItemDecorator( maxVisibleItems = maxVisibleItems, dividerDrawable = dividerDrawable, - valueItemConfigProvider = valueItemConfigProvider + valueItemConfigProvider = valueItemConfigProvider, ) } } diff --git a/value-picker/src/main/java/com/paulrybitskyi/valuepicker/decorators/concrete/HorizontalValuePickerItemDecorator.kt b/value-picker/src/main/java/com/paulrybitskyi/valuepicker/decorators/concrete/HorizontalValuePickerItemDecorator.kt index 01ab2f5..e8b2772 100644 --- a/value-picker/src/main/java/com/paulrybitskyi/valuepicker/decorators/concrete/HorizontalValuePickerItemDecorator.kt +++ b/value-picker/src/main/java/com/paulrybitskyi/valuepicker/decorators/concrete/HorizontalValuePickerItemDecorator.kt @@ -28,7 +28,7 @@ import kotlin.math.floor internal class HorizontalValuePickerItemDecorator( maxVisibleItems: Int, dividerDrawable: Drawable, - valueItemConfigProvider: () -> ValueItemConfig + valueItemConfigProvider: () -> ValueItemConfig, ) : ValuePickerItemDecorator(maxVisibleItems, dividerDrawable, valueItemConfigProvider) { override fun drawDividers(canvas: Canvas, parent: RecyclerView) = with(canvas) { @@ -46,7 +46,7 @@ internal class HorizontalValuePickerItemDecorator( left = drawableLeftBound, top = 0, right = drawableRightBound, - bottom = parent.height + bottom = parent.height, ) dividerDrawable.draw(this) } @@ -61,7 +61,7 @@ internal class HorizontalValuePickerItemDecorator( left = drawableLeftBound, top = 0, right = drawableRightBound, - bottom = parent.height + bottom = parent.height, ) dividerDrawable.draw(this) } diff --git a/value-picker/src/main/java/com/paulrybitskyi/valuepicker/decorators/concrete/VerticalValuePickerItemDecorator.kt b/value-picker/src/main/java/com/paulrybitskyi/valuepicker/decorators/concrete/VerticalValuePickerItemDecorator.kt index 05250ac..d868844 100644 --- a/value-picker/src/main/java/com/paulrybitskyi/valuepicker/decorators/concrete/VerticalValuePickerItemDecorator.kt +++ b/value-picker/src/main/java/com/paulrybitskyi/valuepicker/decorators/concrete/VerticalValuePickerItemDecorator.kt @@ -28,7 +28,7 @@ import kotlin.math.floor internal class VerticalValuePickerItemDecorator( maxVisibleItems: Int, dividerDrawable: Drawable, - valueItemConfigProvider: () -> ValueItemConfig + valueItemConfigProvider: () -> ValueItemConfig, ) : ValuePickerItemDecorator(maxVisibleItems, dividerDrawable, valueItemConfigProvider) { override fun drawDividers(canvas: Canvas, parent: RecyclerView) = with(canvas) { @@ -46,7 +46,7 @@ internal class VerticalValuePickerItemDecorator( left = 0, top = drawableTopBound, right = parent.width, - bottom = drawableBottomBound + bottom = drawableBottomBound, ) dividerDrawable.draw(this) } @@ -61,7 +61,7 @@ internal class VerticalValuePickerItemDecorator( left = 0, top = drawableTopBound, right = parent.width, - bottom = drawableBottomBound + bottom = drawableBottomBound, ) dividerDrawable.draw(this) } diff --git a/value-picker/src/main/java/com/paulrybitskyi/valuepicker/layoutmanager/ValuePickerLayoutManager.kt b/value-picker/src/main/java/com/paulrybitskyi/valuepicker/layoutmanager/ValuePickerLayoutManager.kt index 8c9212f..c131aad 100644 --- a/value-picker/src/main/java/com/paulrybitskyi/valuepicker/layoutmanager/ValuePickerLayoutManager.kt +++ b/value-picker/src/main/java/com/paulrybitskyi/valuepicker/layoutmanager/ValuePickerLayoutManager.kt @@ -27,11 +27,11 @@ import kotlin.math.abs internal class ValuePickerLayoutManager( private val recyclerView: RecyclerView, private val orientation: Orientation, - private val valueItemEffect: ValueEffect + private val valueItemEffect: ValueEffect, ) : LinearLayoutManager( recyclerView.context, orientation.rvOrientation, - false + false, ) { private val dimension: Int @@ -44,7 +44,7 @@ internal class ValuePickerLayoutManager( override fun onLayoutChildren( recycler: RecyclerView.Recycler, - state: RecyclerView.State + state: RecyclerView.State, ) { super.onLayoutChildren(recycler, state) @@ -62,7 +62,7 @@ internal class ValuePickerLayoutManager( override fun scrollVerticallyBy( dy: Int, recycler: RecyclerView.Recycler, - state: RecyclerView.State + state: RecyclerView.State, ): Int { return super.scrollVerticallyBy(dy, recycler, state) .also { applyEffectToChildren() } @@ -71,7 +71,7 @@ internal class ValuePickerLayoutManager( override fun scrollHorizontallyBy( dx: Int, recycler: RecyclerView.Recycler, - state: RecyclerView.State + state: RecyclerView.State, ): Int { return super.scrollHorizontallyBy(dx, recycler, state) .also { applyEffectToChildren() } @@ -116,14 +116,14 @@ internal class ValuePickerLayoutManager( override fun smoothScrollToPosition( recyclerView: RecyclerView, state: RecyclerView.State, - position: Int + position: Int, ) { attachCustomSmoothScroller(recyclerView, position) } private fun attachCustomSmoothScroller( recyclerView: RecyclerView, - position: Int + position: Int, ) { ValuePickerSmoothScroller(recyclerView.context) .apply { targetPosition = position } diff --git a/value-picker/src/main/java/com/paulrybitskyi/valuepicker/model/DefaultValues.kt b/value-picker/src/main/java/com/paulrybitskyi/valuepicker/model/DefaultValues.kt index bf6f141..0151204 100644 --- a/value-picker/src/main/java/com/paulrybitskyi/valuepicker/model/DefaultValues.kt +++ b/value-picker/src/main/java/com/paulrybitskyi/valuepicker/model/DefaultValues.kt @@ -31,13 +31,13 @@ internal class DefaultValues( val valueItemMinHeight: Int, val valueItemPadding: Int, val valueItemTextSize: Float, - val valueItemTextTypeface: Typeface + val valueItemTextTypeface: Typeface, ) internal val DefaultValues.valueItemSize: Size get() = sizeOf( width = valueItemMinWidth, - height = valueItemMinHeight + height = valueItemMinHeight, ) internal fun initDefaultValues(context: Context): DefaultValues { @@ -47,6 +47,6 @@ internal fun initDefaultValues(context: Context): DefaultValues { valueItemMinHeight = context.getDimensionPixelSize(R.dimen.default_value_item_min_height), valueItemPadding = context.getDimensionPixelSize(R.dimen.default_value_item_padding), valueItemTextSize = context.getDimension(R.dimen.default_value_item_text_size), - valueItemTextTypeface = Typeface.SANS_SERIF + valueItemTextTypeface = Typeface.SANS_SERIF, ) } diff --git a/value-picker/src/main/java/com/paulrybitskyi/valuepicker/model/Orientation.kt b/value-picker/src/main/java/com/paulrybitskyi/valuepicker/model/Orientation.kt index 8f080f5..9552cfc 100644 --- a/value-picker/src/main/java/com/paulrybitskyi/valuepicker/model/Orientation.kt +++ b/value-picker/src/main/java/com/paulrybitskyi/valuepicker/model/Orientation.kt @@ -30,9 +30,10 @@ import com.paulrybitskyi.valuepicker.ValuePickerView enum class Orientation(internal val id: Int) { VERTICAL(id = 1), - HORIZONTAL(id = 2); + HORIZONTAL(id = 2), + ; - companion object { +companion object { @JvmName("forId") @JvmStatic diff --git a/value-picker/src/main/java/com/paulrybitskyi/valuepicker/model/PickerItem.kt b/value-picker/src/main/java/com/paulrybitskyi/valuepicker/model/PickerItem.kt index 5ae1ee7..b36ac6d 100644 --- a/value-picker/src/main/java/com/paulrybitskyi/valuepicker/model/PickerItem.kt +++ b/value-picker/src/main/java/com/paulrybitskyi/valuepicker/model/PickerItem.kt @@ -24,5 +24,5 @@ package com.paulrybitskyi.valuepicker.model class PickerItem @JvmOverloads constructor( override val id: Int, override val title: String, - override val payload: Any? = null + override val payload: Any? = null, ) : Item diff --git a/value-picker/src/main/java/com/paulrybitskyi/valuepicker/model/Size.kt b/value-picker/src/main/java/com/paulrybitskyi/valuepicker/model/Size.kt index 8662d3d..8723faa 100644 --- a/value-picker/src/main/java/com/paulrybitskyi/valuepicker/model/Size.kt +++ b/value-picker/src/main/java/com/paulrybitskyi/valuepicker/model/Size.kt @@ -27,7 +27,7 @@ private const val DIMENSION_NOT_SET = -1 */ class Size internal constructor( val width: Int, - val height: Int + val height: Int, ) { companion object { @@ -44,7 +44,7 @@ class Size internal constructor( fun withFixedWidth(@Px width: Int): Size { return Size( width = width, - height = DIMENSION_NOT_SET + height = DIMENSION_NOT_SET, ) } @@ -60,7 +60,7 @@ class Size internal constructor( fun withFixedHeight(@Px height: Int): Size { return Size( width = DIMENSION_NOT_SET, - height = height + height = height, ) } @@ -76,7 +76,7 @@ class Size internal constructor( fun withFixedSize(@Px width: Int, @Px height: Int): Size { return Size( width = width, - height = height + height = height, ) } } diff --git a/value-picker/src/main/java/com/paulrybitskyi/valuepicker/model/ValueItemConfig.kt b/value-picker/src/main/java/com/paulrybitskyi/valuepicker/model/ValueItemConfig.kt index 77a11dd..e9ab1d1 100644 --- a/value-picker/src/main/java/com/paulrybitskyi/valuepicker/model/ValueItemConfig.kt +++ b/value-picker/src/main/java/com/paulrybitskyi/valuepicker/model/ValueItemConfig.kt @@ -24,7 +24,7 @@ internal data class ValueItemConfig( val size: Size, val textColor: Int, val textSize: Float, - val textTypeface: Typeface + val textTypeface: Typeface, ) @JvmField @@ -32,5 +32,5 @@ internal val VALUE_ITEM_CONFIG_STUB = ValueItemConfig( size = sizeOf(width = 0, height = 0), textColor = 0, textSize = 0f, - textTypeface = Typeface.SANS_SERIF + textTypeface = Typeface.SANS_SERIF, )