From b1aa93ea8acde8509e99924e78bde40ff111abfb Mon Sep 17 00:00:00 2001 From: fangcan <403462630@qq.com> Date: Mon, 17 May 2021 13:53:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 15 ++--- bintray.gradle | 56 ------------------ build.gradle | 17 +++--- gradle/wrapper/gradle-wrapper.properties | 2 +- library/build.gradle | 57 +++++++++---------- .../FCSwipeRefreshLayout.java | 29 ++++++++-- 6 files changed, 68 insertions(+), 108 deletions(-) delete mode 100644 bintray.gradle diff --git a/app/build.gradle b/app/build.gradle index b24783b..65efeda 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -36,13 +36,14 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation 'androidx.appcompat:appcompat:1.0.2' - implementation 'androidx.recyclerview:recyclerview:1.0.0' - implementation 'com.google.android.material:material:1.1.0-alpha07' - implementation 'androidx.constraintlayout:constraintlayout:1.1.3' - testImplementation 'junit:junit:4.12' - androidTestImplementation 'androidx.test:runner:1.2.0' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' + implementation 'androidx.appcompat:appcompat:1.2.0' + implementation 'androidx.recyclerview:recyclerview:1.1.0' + implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0' + implementation 'com.google.android.material:material:1.3.0-alpha04' + implementation 'androidx.constraintlayout:constraintlayout:2.0.4' + testImplementation 'junit:junit:4.13.2' + androidTestImplementation 'androidx.test:runner:1.3.0' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' implementation project(":library") // implementation 'fc.nestedscrollview.androidx:library:1.0.0' implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.49-androidx' diff --git a/bintray.gradle b/bintray.gradle deleted file mode 100644 index b914c2c..0000000 --- a/bintray.gradle +++ /dev/null @@ -1,56 +0,0 @@ -apply plugin: 'com.github.dcendents.android-maven' -apply plugin: 'com.jfrog.bintray' - -def siteUrl = 'https://github.com/403462630/FCNestedScrollView1' // 项目的主页 -def gitUrl = 'git@github.com:403462630/FCNestedScrollView1.git' // Git仓库的url - -install { - repositories.mavenInstaller { - // This generates POM.xml with proper parameters - pom { - project { - // Add your description here - name project.name //项目的描述 你可以多写一点 - description project.name -// println("======${project.ext.artifactId}====") -// artifactId project.ext.artifactId - url siteUrl - // Set your license - licenses { - license { - name 'The Apache Software License, Version 2.0' - url 'http://www.apache.org/licenses/LICENSE-2.0.txt' - } - } - developers { - developer { - name 'w403462630' - } - } - scm { - connection gitUrl - developerConnection gitUrl - url siteUrl - } - } - } - } -} - -Properties properties = new Properties() -properties.load(project.rootProject.file('local.properties').newDataInputStream()) - -bintray { - user = properties.getProperty("bintray.user") - key = properties.getProperty("bintray.apikey") - configurations = ['archives'] - pkg { - repo = "maven" -// userOrg = "fc" - name = project.ext.projectName //发布到JCenter上的项目名字 - websiteUrl = siteUrl - vcsUrl = gitUrl - licenses = ["Apache-2.0"] - publish = true - } -} \ No newline at end of file diff --git a/build.gradle b/build.gradle index 05983ae..caf57e6 100644 --- a/build.gradle +++ b/build.gradle @@ -1,30 +1,29 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.3.50' + ext.kotlin_version = '1.4.30' repositories { google() - jcenter() + mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:4.0.0' + classpath 'com.android.tools.build:gradle:4.1.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files - classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3' - classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' + classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' } } allprojects { repositories { maven { url "https://jitpack.io" } - maven { - url "https://dl.bintray.com/403462630/maven" - } +// maven { +// url "https://dl.bintray.com/403462630/maven" +// } google() - jcenter() + mavenCentral() } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 3e91ebb..0765593 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-6.1.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip diff --git a/library/build.gradle b/library/build.gradle index bcb1918..21c7de4 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -1,13 +1,7 @@ apply plugin: 'com.android.library' +apply plugin: 'com.github.dcendents.android-maven' -ext { - projectName = "AndroidXFCNestedScrollView" -} - -apply from: "../bintray.gradle" - -group="fc.nestedscrollview.androidx" -version="1.0.7" +group="com.github.403462630" android { compileSdkVersion 28 @@ -33,31 +27,32 @@ android { } } -task sourcesJar(type: Jar) { - from android.sourceSets.main.java.srcDirs - classifier = 'sources' -} - -task javadoc(type: Javadoc) { - options.encoding = "utf-8" - source = android.sourceSets.main.java.srcDirs - classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) -} - -task javadocJar(type: Jar, dependsOn: javadoc) { - classifier = 'javadoc' - from javadoc.destinationDir -} - -artifacts { -// archives javadocJar - archives sourcesJar -} +//task sourcesJar(type: Jar) { +// from android.sourceSets.main.java.srcDirs +// classifier = 'sources' +//} +// +//task javadoc(type: Javadoc) { +// options.encoding = "utf-8" +// source = android.sourceSets.main.java.srcDirs +// classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) +//} +// +//task javadocJar(type: Jar, dependsOn: javadoc) { +// classifier = 'javadoc' +// from javadoc.destinationDir +//} +// +//artifacts { +//// archives javadocJar +// archives sourcesJar +//} dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - testImplementation 'junit:junit:4.12' + testImplementation 'junit:junit:4.13.2' - compileOnly 'androidx.appcompat:appcompat:1.0.2' - compileOnly 'androidx.recyclerview:recyclerview:1.0.0' + compileOnly 'androidx.appcompat:appcompat:1.2.0' + implementation 'androidx.recyclerview:recyclerview:1.1.0' + implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0' } diff --git a/library/src/main/java/com/fc/nestedscrollview/FCSwipeRefreshLayout.java b/library/src/main/java/com/fc/nestedscrollview/FCSwipeRefreshLayout.java index 7a19ea9..acf1dc4 100644 --- a/library/src/main/java/com/fc/nestedscrollview/FCSwipeRefreshLayout.java +++ b/library/src/main/java/com/fc/nestedscrollview/FCSwipeRefreshLayout.java @@ -5,6 +5,8 @@ import android.util.AttributeSet; import android.view.View; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import java.lang.reflect.Field; @@ -48,18 +50,37 @@ public void onNestedScrollAccepted(View child, View target, int axes) { this.targetView = target; } + @Override + public void onNestedPreScroll(View target, int dx, int dy, int[] consumed, int type) { + super.onNestedPreScroll(target, dx, dy, consumed, type); + } + + @Override + public void onNestedScroll(@NonNull View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int type, @NonNull int[] consumed) { + super.onNestedScroll(target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, type, consumed); + } + @Override public boolean dispatchNestedPreScroll(int dx, int dy, int[] consumed, int[] offsetInWindow) { - if (dy < 0 && isPullRefreshIntercept) { - return false; + return super.dispatchNestedPreScroll(dx, dy, consumed, offsetInWindow); + } + + @Override + public void dispatchNestedScroll(int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, @Nullable int[] offsetInWindow, int type, @NonNull int[] consumed) { + if (dyUnconsumed < 0 && !isRefreshing()) { +// return false; } else { - return super.dispatchNestedPreScroll(dx, dy, consumed, offsetInWindow); + super.dispatchNestedScroll(dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, offsetInWindow, type, consumed); } } @Override public boolean dispatchNestedScroll(int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int[] offsetInWindow) { - return false; + if (dyUnconsumed < 0 && !isRefreshing()) { + return false; + } else { + return super.dispatchNestedScroll(dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, offsetInWindow); + } } @Override