diff --git a/StackLayoutManager/build.gradle b/StackLayoutManager/build.gradle index 598d599..cda35ed 100644 --- a/StackLayoutManager/build.gradle +++ b/StackLayoutManager/build.gradle @@ -3,13 +3,13 @@ apply plugin: 'kotlin-android' apply plugin: 'com.novoda.bintray-release' android { - compileSdkVersion 27 + compileSdkVersion 28 defaultConfig { minSdkVersion 14 - targetSdkVersion 27 - versionCode 6 - versionName "1.0.5" + targetSdkVersion 28 + versionCode 7 + versionName "1.0.6" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" @@ -30,7 +30,7 @@ android { dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation 'com.android.support:recyclerview-v7:27.1.1' + implementation 'com.android.support:recyclerview-v7:28.0.0' } repositories { mavenCentral() @@ -46,7 +46,7 @@ publish{ userOrg = 'jinliancheng120' groupId = 'com.littlemango' artifactId = 'stacklayoutmanager' - publishVersion = '1.0.5' + publishVersion = '1.0.6' desc = 'A RecyclerView.LayoutManager implementation which provides functionality to show a group of stack view.' website = 'https://github.com/LittleMango/StackLayoutManager' licences = ['MIT'] diff --git a/StackLayoutManager/src/main/java/com/littlemango/stacklayoutmanager/DefaultAnimation.kt b/StackLayoutManager/src/main/java/com/littlemango/stacklayoutmanager/DefaultAnimation.kt index 9742e9e..d8b0b81 100644 --- a/StackLayoutManager/src/main/java/com/littlemango/stacklayoutmanager/DefaultAnimation.kt +++ b/StackLayoutManager/src/main/java/com/littlemango/stacklayoutmanager/DefaultAnimation.kt @@ -2,6 +2,7 @@ package com.littlemango.stacklayoutmanager import android.view.View import com.littlemango.stacklayoutmanager.StackLayoutManager.ScrollOrientation +import kotlin.math.pow class DefaultAnimation(scrollOrientation: ScrollOrientation, visibleCount: Int) : StackAnimation(scrollOrientation, visibleCount) { @@ -72,8 +73,8 @@ class DefaultAnimation(scrollOrientation: ScrollOrientation, visibleCount: Int) scale = 1 - ((1 - mOutScale) * firstMovePercent) rotation = mOutRotation * firstMovePercent } else { - val minScale = (Math.pow(mScale.toDouble(), position.toDouble())).toFloat() - val maxScale = (Math.pow(mScale.toDouble(), (position - 1).toDouble())).toFloat() + val minScale = (mScale.toDouble().pow(position.toDouble())).toFloat() + val maxScale = (mScale.toDouble().pow((position - 1).toDouble())).toFloat() scale = minScale + (maxScale - minScale) * firstMovePercent //只对最后一个 item 做透明度变化 if (position == mVisibleCount) { diff --git a/StackLayoutManager/src/main/java/com/littlemango/stacklayoutmanager/StackLayoutManager.kt b/StackLayoutManager/src/main/java/com/littlemango/stacklayoutmanager/StackLayoutManager.kt index 5eef721..5c5ae25 100644 --- a/StackLayoutManager/src/main/java/com/littlemango/stacklayoutmanager/StackLayoutManager.kt +++ b/StackLayoutManager/src/main/java/com/littlemango/stacklayoutmanager/StackLayoutManager.kt @@ -6,6 +6,8 @@ import android.support.v7.widget.RecyclerView.SCROLL_STATE_DRAGGING import android.support.v7.widget.RecyclerView.SCROLL_STATE_IDLE import android.view.View import android.view.ViewGroup +import kotlin.math.max +import kotlin.math.min class StackLayoutManager(scrollOrientation: ScrollOrientation, visibleCount: Int, @@ -427,8 +429,8 @@ class StackLayoutManager(scrollOrientation: ScrollOrientation, private fun getValidOffset(expectOffset: Int): Int { return when(mScrollOrientation) { - ScrollOrientation.RIGHT_TO_LEFT, ScrollOrientation.LEFT_TO_RIGHT -> Math.max(Math.min(width * (itemCount - 1), expectOffset), 0) - else -> Math.max(Math.min(height * (itemCount - 1), expectOffset), 0) + ScrollOrientation.RIGHT_TO_LEFT, ScrollOrientation.LEFT_TO_RIGHT -> max(min(width * (itemCount - 1), expectOffset), 0) + else -> max(min(height * (itemCount - 1), expectOffset), 0) } } diff --git a/sample/build.gradle b/sample/build.gradle index eff7b48..6989aaf 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -5,13 +5,13 @@ apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' android { - compileSdkVersion 27 + compileSdkVersion 28 defaultConfig { applicationId "com.littlemango.stacklayoutmanagermaster" minSdkVersion 19 - targetSdkVersion 27 - versionCode 6 - versionName "1.0.5" + targetSdkVersion 28 + versionCode 7 + versionName "1.0.6" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { @@ -22,19 +22,19 @@ android { } } -ext.kotlin_version = '1.2.60' +ext.kotlin_version = '1.3.50' dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation 'com.android.support:appcompat-v7:27.1.1' + implementation 'com.android.support:appcompat-v7:28.0.0' implementation 'com.android.support.constraint:constraint-layout:1.1.3' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' - implementation 'com.android.support:recyclerview-v7:27.1.1' - implementation 'com.android.support:cardview-v7:27.1.1' + implementation 'com.android.support:recyclerview-v7:28.0.0' + implementation 'com.android.support:cardview-v7:28.0.0' implementation project(':StackLayoutManager') implementation 'com.afollestad.material-dialogs:core:0.9.6.0' - implementation 'com.android.support:design:27.1.1' + implementation 'com.android.support:design:28.0.0' }