Skip to content

Commit

Permalink
优化点击事件
Browse files Browse the repository at this point in the history
  • Loading branch information
wenchaosong committed Mar 28, 2019
1 parent 694c704 commit 7b948b6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,14 @@

#### Step 1.依赖banner
```
repositories {
jcenter()
maven { url 'https://jitpack.io' }
}
dependencies{
implementation 'com.github.wenchaosong:Banner:2.3.8'
// 或者
implementation 'com.ms:banner:latest'
}
```
Expand Down
3 changes: 2 additions & 1 deletion banner/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ dependencies {
}

apply plugin: 'com.github.dcendents.android-maven'
/*
apply plugin: 'com.jfrog.bintray'
def siteUrl = 'https://github.com/wenchaosong/Banner'
Expand Down Expand Up @@ -98,4 +99,4 @@ bintray {
licenses = ["Apache-2.0"]
publish = true
}
}
}*/
4 changes: 3 additions & 1 deletion banner/src/main/java/com/ms/banner/Banner.java
Original file line number Diff line number Diff line change
Expand Up @@ -511,9 +511,11 @@ public boolean dispatchTouchEvent(MotionEvent ev) {
case MotionEvent.ACTION_DOWN:
float downX = ev.getX();
if (mPageLeftMargin != 0 || mPageRightMargin != 0) {
if (downX > mPageLeftMargin && downX < mPageRightMargin) {
if (downX > mPageLeftMargin && downX < getWidth() - mPageRightMargin) {
stopAutoPlay();
}
} else {
stopAutoPlay();
}
break;
}
Expand Down
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
}
}

Expand Down

0 comments on commit 7b948b6

Please sign in to comment.