Skip to content

Commit

Permalink
添加打包配置
Browse files Browse the repository at this point in the history
  • Loading branch information
teach committed Mar 23, 2020
1 parent 904238b commit a8411f8
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 10 deletions.
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
android:id="@+id/sample"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="基础案例" />
android:text="基础示例" />

<Button
android:id="@+id/sticky"
Expand Down
29 changes: 25 additions & 4 deletions consecutivescroller/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
apply plugin: 'com.android.library'

group='com.github.donkingliang' // 指定group,com.github.<用户名>

android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
Expand All @@ -26,9 +28,28 @@ android {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
}

//---------------------------------------------

// 指定编码
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}

// 打包源码
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}

// implementation 'androidx.appcompat:appcompat:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
task javadoc(type: Javadoc) {
failOnError false
source = android.sourceSets.main.java.sourceFiles
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
classpath += configurations.compile
}

artifacts {
archives sourcesJar
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@
import java.util.List;

/**
* @Author teach liang
* @Author donkingliang
* @Description
* @Date 2020/3/17
*/
public class ScrollUtils {

static int computeVerticalScrollOffset(View view) {

try {
Method method = View.class.getDeclaredMethod("computeVerticalScrollOffset");
method.setAccessible(true);
Expand All @@ -28,7 +27,6 @@ static int computeVerticalScrollOffset(View view) {
}

static int computeVerticalScrollRange(View view) {

try {
Method method = View.class.getDeclaredMethod("computeVerticalScrollRange");
method.setAccessible(true);
Expand All @@ -40,7 +38,6 @@ static int computeVerticalScrollRange(View view) {
}

static int computeVerticalScrollExtent(View view) {

try {
Method method = View.class.getDeclaredMethod("computeVerticalScrollExtent");
method.setAccessible(true);
Expand Down Expand Up @@ -105,6 +102,13 @@ static boolean canScrollVertically(View view, int direction) {
}
}

/**
* 获取当前触摸点下的View
* @param rootView
* @param touchX
* @param touchY
* @return
*/
static List<View> getTouchViews(View rootView, int touchX, int touchY) {
List views = new ArrayList();
addTouchViews(views, rootView, touchX, touchY);
Expand All @@ -125,7 +129,13 @@ private static void addTouchViews(List<View> views, View view, int touchX, int t
}
}

//(x,y)是否在view的区域内
/**
* 判断触摸点是否在View内
* @param view
* @param x
* @param y
* @return
*/
static boolean isTouchPointInView(View view, int x, int y) {
if (view == null) {
return false;
Expand Down

0 comments on commit a8411f8

Please sign in to comment.