Skip to content

Commit 269351d

Browse files
authored
Merge pull request #1 from umano/master
merge1
2 parents 23f58d2 + 45a4604 commit 269351d

File tree

11 files changed

+62
-32
lines changed

11 files changed

+62
-32
lines changed

.travis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ android:
77
- platform-tools
88
- extra-android-m2repository
99
- extra-google-m2repository
10-
- build-tools-23.0.3
11-
- android-23
10+
- build-tools-26.0.0
11+
- android-26
1212

1313
# Enable travis container based infrastructure
1414
sudo: false

README.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.sothree.slidinguppanel/library/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.sothree.slidinguppanel/library)
22
[![Badge](http://www.libtastic.com/static/osbadges/30.png)](http://www.libtastic.com/technology/30/)
33

4+
**Note:** we are **not** actively responding to issues right now. If you find a bug, please submit a PR.
5+
46
Android Sliding Up Panel
57
=========================
68

@@ -27,7 +29,7 @@ dependencies {
2729
repositories {
2830
mavenCentral()
2931
}
30-
compile 'com.sothree.slidinguppanel:library:3.3.1'
32+
compile 'com.sothree.slidinguppanel:library:3.4.0'
3133
}
3234
```
3335

@@ -139,6 +141,9 @@ If you have an awesome pull request, send it over!
139141

140142
### Changelog
141143

144+
* 3.4.0
145+
* Use the latest support library 26 and update the min version to 14.
146+
* Bug fixes
142147
* 3.3.1
143148
* Lots of bug fixes from various pull requests.
144149
* Removed the nineoldandroids dependency. Use ViewCompat instead.

build.gradle

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22
buildscript {
33
repositories {
4-
mavenCentral()
4+
jcenter()
55
}
66

77
dependencies {
8-
classpath 'com.android.tools.build:gradle:2.1.2'
8+
classpath 'com.android.tools.build:gradle:2.3.2'
99
}
1010
}
1111

@@ -18,11 +18,14 @@ allprojects {
1818
group = GROUP
1919

2020
repositories {
21-
mavenCentral()
21+
jcenter()
22+
maven {
23+
url "https://maven.google.com"
24+
}
2225
}
2326
}
2427

2528
task wrapper(type: Wrapper) {
26-
gradleVersion = '2.13'
29+
gradleVersion = '3.3'
2730
distributionUrl = "https://services.gradle.org/distributions/gradle-${gradleVersion}-all.zip"
2831
}

demo/build.gradle

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
apply plugin: 'com.android.application'
22

33
android {
4-
compileSdkVersion 23
5-
buildToolsVersion "23.0.3"
4+
compileSdkVersion 26
5+
buildToolsVersion "26.0.1"
66

77
lintOptions {
88
abortOnError false
99
}
1010

1111
defaultConfig {
12-
minSdkVersion 11
13-
targetSdkVersion 23
12+
minSdkVersion 14
13+
targetSdkVersion 26
1414
}
1515
}
1616

1717
dependencies {
18-
compile 'com.android.support:support-v4:23.4.0'
19-
compile 'com.android.support:appcompat-v7:23.4.0'
18+
compile 'com.android.support:support-v4:26.0.2'
19+
compile 'com.android.support:appcompat-v7:26.0.2'
2020
compile project(':library')
2121
}

demo/src/main/AndroidManifest.xml

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
package="com.sothree.slidinguppanel.demo"
4-
android:versionCode="16"
5-
android:versionName="3.3.1">
4+
xmlns:tools="http://schemas.android.com/tools"
5+
android:versionCode="17"
6+
android:versionName="3.4.0">
67

78
<uses-sdk
8-
android:minSdkVersion="11"
9-
android:targetSdkVersion="17" />
9+
android:minSdkVersion="14"
10+
android:targetSdkVersion="17"
11+
tools:overrideLibrary="android.support.v7.appcompat,android.support.graphics.drawavle"
12+
/>
1013

1114
<application
1215
android:allowBackup="true"

demo/src/main/java/com/sothree/slidinguppanel/demo/DemoActivity.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import android.content.Intent;
44
import android.net.Uri;
55
import android.os.Bundle;
6-
import android.support.v7.app.ActionBarActivity;
6+
import android.support.v7.app.AppCompatActivity;
77
import android.support.v7.widget.Toolbar;
88
import android.text.Html;
99
import android.text.method.LinkMovementMethod;
@@ -26,7 +26,7 @@
2626
import java.util.Arrays;
2727
import java.util.List;
2828

29-
public class DemoActivity extends ActionBarActivity {
29+
public class DemoActivity extends AppCompatActivity {
3030
private static final String TAG = "DemoActivity";
3131

3232
private SlidingUpPanelLayout mLayout;

gradle.properties

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
VERSION_NAME=3.3.1
2-
VERSION_CODE=16
1+
VERSION_NAME=3.4.0
2+
VERSION_CODE=17
33
GROUP=com.sothree.slidinguppanel
44

55
POM_DESCRIPTION=Android Sliding Up Panel Library

gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-2.13-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip

library/build.gradle

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
apply plugin: 'com.android.library'
22

33
repositories {
4-
mavenCentral()
4+
jcenter()
55
}
66

77
dependencies {
8-
compile 'com.android.support:support-v4:23.4.0'
9-
compile 'com.android.support:support-annotations:23.4.0'
10-
compile 'com.android.support:recyclerview-v7:23.4.0'
8+
compile 'com.android.support:support-v4:26.0.2'
9+
compile 'com.android.support:support-annotations:26.0.2'
10+
compile 'com.android.support:recyclerview-v7:26.0.2'
1111
}
1212

1313
android {
14-
compileSdkVersion 23
15-
buildToolsVersion "23.0.3"
14+
compileSdkVersion 26
15+
buildToolsVersion "26.0.1"
1616
lintOptions {
1717
abortOnError false
1818
}
1919
}
2020

21-
apply from: '../maven_push.gradle'
21+
apply from: '../maven_push.gradle'

library/src/main/AndroidManifest.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
package="com.sothree.slidinguppanel.library"
4-
android:versionCode="16"
5-
android:versionName="3.3.1">
4+
android:versionCode="17"
5+
android:versionName="3.4.0">
66

77
<uses-sdk
8-
android:minSdkVersion="8" />
8+
android:minSdkVersion="14" />
99

1010
<application />
1111

library/src/main/java/com/sothree/slidinguppanel/SlidingUpPanelLayout.java

+19
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import android.support.v4.view.MotionEventCompat;
1414
import android.support.v4.view.ViewCompat;
1515
import android.util.AttributeSet;
16+
import android.util.Log;
1617
import android.view.Gravity;
1718
import android.view.MotionEvent;
1819
import android.view.View;
@@ -207,6 +208,7 @@ public enum PanelState {
207208
*/
208209
private boolean mIsTouchEnabled;
209210

211+
private float mPrevMotionX;
210212
private float mPrevMotionY;
211213
private float mInitialMotionX;
212214
private float mInitialMotionY;
@@ -961,15 +963,24 @@ public boolean dispatchTouchEvent(MotionEvent ev) {
961963
return super.dispatchTouchEvent(ev);
962964
}
963965

966+
final float x = ev.getX();
964967
final float y = ev.getY();
965968

966969
if (action == MotionEvent.ACTION_DOWN) {
967970
mIsScrollableViewHandlingTouch = false;
971+
mPrevMotionX = x;
968972
mPrevMotionY = y;
969973
} else if (action == MotionEvent.ACTION_MOVE) {
974+
float dx = x - mPrevMotionX;
970975
float dy = y - mPrevMotionY;
976+
mPrevMotionX = x;
971977
mPrevMotionY = y;
972978

979+
if (Math.abs(dx) > Math.abs(dy)) {
980+
// Scrolling horizontally, so ignore
981+
return super.dispatchTouchEvent(ev);
982+
}
983+
973984
// If the scroll view isn't under the touch, pass the
974985
// event along to the dragView.
975986
if (!isViewUnder(mScrollableView, (int) mInitialMotionX, (int) mInitialMotionY)) {
@@ -1086,6 +1097,13 @@ public PanelState getPanelState() {
10861097
* @param state - new panel state
10871098
*/
10881099
public void setPanelState(PanelState state) {
1100+
1101+
// Abort any running animation, to allow state change
1102+
if(mDragHelper.getViewDragState() == ViewDragHelper.STATE_SETTLING){
1103+
Log.d(TAG, "View is settling. Aborting animation.");
1104+
mDragHelper.abort();
1105+
}
1106+
10891107
if (state == null || state == PanelState.DRAGGING) {
10901108
throw new IllegalArgumentException("Panel state cannot be null or DRAGGING.");
10911109
}
@@ -1216,6 +1234,7 @@ boolean smoothSlideTo(float slideOffset, int velocity) {
12161234
}
12171235

12181236
int panelTop = computePanelTopPosition(slideOffset);
1237+
12191238
if (mDragHelper.smoothSlideViewTo(mSlideableView, mSlideableView.getLeft(), panelTop)) {
12201239
setAllChildrenVisible();
12211240
ViewCompat.postInvalidateOnAnimation(this);

0 commit comments

Comments
 (0)