diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 00000000..c84fc407
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,20 @@
+language: android
+jdk: oraclejdk7
+
+android:
+ components:
+ - tools
+ - platform-tools
+ - extra-android-m2repository
+ - extra-google-m2repository
+ - build-tools-26.0.0
+ - android-26
+
+# Enable travis container based infrastructure
+sudo: false
+
+before_script:
+ - chmod +x gradlew
+
+script:
+ - ./gradlew clean assemble
diff --git a/LICENSE.txt b/LICENSE.txt
index 261eeb9e..6929566a 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.
- Copyright [yyyy] [name of copyright owner]
+ Copyright 2015 Anton Lopyrev
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/README.md b/README.md
index 6cc829ac..52da9c4d 100644
--- a/README.md
+++ b/README.md
@@ -1,22 +1,26 @@
[](https://maven-badges.herokuapp.com/maven-central/com.sothree.slidinguppanel/library)
+[](http://www.libtastic.com/technology/30/)
+**Note:** we are **not** actively responding to issues right now. If you find a bug, please submit a PR.
Android Sliding Up Panel
=========================
-This library provides a simple way to add a draggable sliding up panel (popularized by Google Music, Google Maps and Rdio) to your Android application. Umano Team <3 Open Source.
+This library provides a simple way to add a draggable sliding up panel (popularized by Google Music and Google Maps) to your Android application.
-As seen in [Umano](http://umanoapp.com) [Android app](https://play.google.com/store/apps/details?id=com.sothree.umano):
+As seen in Umano Android App (now acquired by Dropbox):

-### Importing the library
+### Known Uses in Popular Apps
-#### Eclipse
+* [Soundcloud] (https://play.google.com/store/apps/details?id=com.soundcloud.android)
+* [Dropbox Paper] (https://play.google.com/store/apps/details?id=com.dropbox.paper)
+* [Snaptee] (https://play.google.com/store/apps/details?id=co.snaptee.android)
-Download the [latest release](https://github.com/umano/AndroidSlidingUpPanel/releases) and include the `library` project as a dependency in Eclipse.
+If you are using the library and you would like to have your app listed, simply let us know.
-#### Android Studio
+### Importing the Library
Simply add the following dependency to your `build.gradle` file to use the latest version:
@@ -25,18 +29,18 @@ dependencies {
repositories {
mavenCentral()
}
- compile 'com.sothree.slidinguppanel:library:3.0.0'
+ compile 'com.sothree.slidinguppanel:library:3.4.0'
}
```
-### Usage
+### Usage
* Include `com.sothree.slidinguppanel.SlidingUpPanelLayout` as the root element in your activity layout.
* The layout must have `gravity` set to either `top` or `bottom`.
* Make sure that it has two children. The first child is your main layout. The second child is your layout for the sliding up panel.
* The main layout should have the width and the height set to `match_parent`.
-* The sliding layout should have the width set to `match_parent` and the height set to either `match_parent`, `wrap_content` or the max desireable height.
-* By default, the whole panel will act as a drag region and will intercept clicks and drag events. You can restrict the drag area to a specific view by using the `setDragView` method or `umanoDragView` attribute.
+* The sliding layout should have the width set to `match_parent` and the height set to either `match_parent`, `wrap_content` or the max desireable height. If you would like to define the height as the percetange of the screen, set it to `match_parent` and also define a `layout_weight` attribute for the sliding view.
+* By default, the whole panel will act as a drag region and will intercept clicks and drag events. You can restrict the drag area to a specific view by using the `setDragView` method or `umanoDragView` attribute.
For more information, please refer to the sample code.
@@ -83,13 +87,38 @@ or `?attr/actionBarSize` to support older API versions.
* Use `setTouchEnabled(false)` to disables panel's touch responsiveness (drag and click), you can still control the panel programatically
* Use `getPanelState` to get the current panel state
* Use `setPanelState` to set the current panel state
-* You can add paralax to the main view by setting `umanoParalaxOffset` attribute (see demo for the example).
+* You can add parallax to the main view by setting `umanoParallaxOffset` attribute (see demo for the example).
* You can set a anchor point in the middle of the screen using `setAnchorPoint` to allow an intermediate expanded state for the panel (similar to Google Maps).
* You can set a `PanelSlideListener` to monitor events about sliding panes.
* You can also make the panel slide from the top by changing the `layout_gravity` attribute of the layout to `top`.
+* You can provide a scroll interpolator for the panel movement by setting `umanoScrollInterpolator` attribute. For instance, if you want a bounce or overshoot effect for the panel.
* By default, the panel pushes up the main content. You can make it overlay the main content by using `setOverlayed` method or `umanoOverlay` attribute. This is useful if you would like to make the sliding layout semi-transparent. You can also set `umanoClipPanel` to false to make the panel transparent in non-overlay mode.
* By default, the main content is dimmed as the panel slides up. You can change the dim color by changing `umanoFadeColor`. Set it to `"@android:color/transparent"` to remove dimming completely.
+### Scrollable Sliding Views
+
+If you have a scrollable view inside of the sliding panel, make sure to set `umanoScrollableView` attribute on the panel to supported nested scrolling. The panel supports `ListView`, `ScrollView` and `RecyclerView` out of the box, but you can add support for any type of a scrollable view by setting a custom `ScrollableViewHelper`. Here is an example for `NestedScrollView`
+
+```
+public class NestedScrollableViewHelper extends ScrollableViewHelper {
+ public int getScrollableViewScrollPosition(View scrollableView, boolean isSlidingUp) {
+ if (mScrollableView instanceof NestedScrollView) {
+ if(isSlidingUp){
+ return mScrollableView.getScrollY();
+ } else {
+ NestedScrollView nsv = ((NestedScrollView) mScrollableView);
+ View child = nsv.getChildAt(0);
+ return (child.getBottom() - (nsv.getHeight() + nsv.getScrollY()));
+ }
+ } else {
+ return 0;
+ }
+ }
+}
+```
+
+Once you define your helper, you can set it using `setScrollableViewHelper` on the sliding panel.
+
### Implementation
This library was initially based on the opened-sourced [SlidingPaneLayout](http://developer.android.com/reference/android/support/v4/widget/SlidingPaneLayout.html) component from the r13 of the Android Support Library. Thanks Android team!
@@ -100,8 +129,9 @@ Tested on Android 2.2+
### Other Contributors
+* Nov 23, 15 - [@kiyeonk](https://github.com/kiyeonk) - umanoScrollInterpolator support
* Jan 21, 14 - ChaYoung You ([@yous](https://github.com/yous)) - Slide from the top support
-* Aug 20, 13 - ([@gipi](https://github.com/gipi)) - Android Studio Support
+* Aug 20, 13 - [@gipi](https://github.com/gipi) - Android Studio Support
* Jul 24, 13 - Philip Schiffer ([@hameno](https://github.com/hameno)) - Maven Support
* Oct 20, 13 - Irina Preșa ([@iriina](https://github.com/iriina)) - Anchor Support
* Dec 1, 13 - ([@youchy](https://github.com/youchy)) - XML Attributes Support
@@ -111,6 +141,25 @@ If you have an awesome pull request, send it over!
### Changelog
+* 3.4.0
+ * Use the latest support library 26 and update the min version to 14.
+ * Bug fixes
+* 3.3.1
+ * Lots of bug fixes from various pull requests.
+ * Removed the nineoldandroids dependency. Use ViewCompat instead.
+* 3.3.0
+ * You can now set a `FadeOnClickListener`, for when the faded area of the main content is clicked.
+ * `PanelSlideListener` has a new format (multiple of them can be set now
+ * Fixed the setTouchEnabled bug
+* 3.2.1
+ * Add support for `umanoScrollInterpolator`
+ * Add support for percentage-based sliding panel height using `layout_weight` attribute
+ * Add `ScrollableViewHelper` to allow users extend support for new types of scrollable views.
+* 3.2.0
+ * Rename `umanoParalaxOffset` to `umanoParallaxOffset`
+ * RecyclerView support.
+* 3.1.0
+ * Added `umanoScrollableView` to supported nested scrolling in children (only ScrollView and ListView are supported for now)
* 3.0.0
* Added `umano` prefix for all attributes
* Added `clipPanel` attribute for supporting transparent panels in non-overlay mode.
diff --git a/build.gradle b/build.gradle
index 676f50a4..53d5638f 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,11 +1,11 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
- mavenCentral()
+ jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:1.0.0'
+ classpath 'com.android.tools.build:gradle:2.3.2'
}
}
@@ -18,6 +18,14 @@ allprojects {
group = GROUP
repositories {
- mavenCentral()
+ jcenter()
+ maven {
+ url "https://maven.google.com"
+ }
}
}
+
+task wrapper(type: Wrapper) {
+ gradleVersion = '3.3'
+ distributionUrl = "https://services.gradle.org/distributions/gradle-${gradleVersion}-all.zip"
+}
diff --git a/demo/build.gradle b/demo/build.gradle
index 36e00617..02b6f063 100644
--- a/demo/build.gradle
+++ b/demo/build.gradle
@@ -1,30 +1,21 @@
apply plugin: 'com.android.application'
android {
- compileSdkVersion 21
- buildToolsVersion "21.0.1"
+ compileSdkVersion 26
+ buildToolsVersion "26.0.1"
lintOptions {
abortOnError false
}
defaultConfig {
- minSdkVersion 11
- targetSdkVersion 21
- }
- sourceSets {
- main {
- manifest.srcFile 'AndroidManifest.xml'
- java.srcDirs = ['src']
- resources.srcDirs = ['src']
- res.srcDirs = ['res']
- assets.srcDirs = ['assets']
- }
+ minSdkVersion 14
+ targetSdkVersion 26
}
}
dependencies {
- compile 'com.android.support:support-v4:21.0.0'
- compile 'com.android.support:appcompat-v7:21.0.0'
+ compile 'com.android.support:support-v4:26.0.2'
+ compile 'com.android.support:appcompat-v7:26.0.2'
compile project(':library')
}
diff --git a/demo/proguard-project.txt b/demo/proguard-project.txt
deleted file mode 100644
index f2fe1559..00000000
--- a/demo/proguard-project.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-# To enable ProGuard in your project, edit project.properties
-# to define the proguard.config property as described in that file.
-#
-# Add project specific ProGuard rules here.
-# By default, the flags in this file are appended to flags specified
-# in ${sdk.dir}/tools/proguard/proguard-android.txt
-# You can edit the include path and order by changing the ProGuard
-# include property in project.properties.
-#
-# For more details, see
-# http://developer.android.com/guide/developing/tools/proguard.html
-
-# Add any project specific keep options here:
-
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-# public *;
-#}
diff --git a/demo/project.properties b/demo/project.properties
deleted file mode 100644
index 0a62d816..00000000
--- a/demo/project.properties
+++ /dev/null
@@ -1,15 +0,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system edit
-# "ant.properties", and override values to adapt the script to your
-# project structure.
-#
-# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
-#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
-
-# Project target.
-target=android-16
-android.library.reference.1=../library
diff --git a/demo/res/layout/activity_demo.xml b/demo/res/layout/activity_demo.xml
deleted file mode 100644
index 852f1a6d..00000000
--- a/demo/res/layout/activity_demo.xml
+++ /dev/null
@@ -1,102 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -->
-
-
-
-
-
-
-
-
-
diff --git a/demo/AndroidManifest.xml b/demo/src/main/AndroidManifest.xml
similarity index 71%
rename from demo/AndroidManifest.xml
rename to demo/src/main/AndroidManifest.xml
index ee073f65..a37bd78c 100644
--- a/demo/AndroidManifest.xml
+++ b/demo/src/main/AndroidManifest.xml
@@ -1,12 +1,15 @@
+ xmlns:tools="http://schemas.android.com/tools"
+ android:versionCode="17"
+ android:versionName="3.4.0">
+ android:minSdkVersion="14"
+ android:targetSdkVersion="17"
+ tools:overrideLibrary="android.support.v7.appcompat,android.support.graphics.drawavle"
+ />
parent, View view, int position, long id)
lv.setAdapter(arrayAdapter);
mLayout = (SlidingUpPanelLayout) findViewById(R.id.sliding_layout);
- mLayout.setPanelSlideListener(new PanelSlideListener() {
+ mLayout.addPanelSlideListener(new PanelSlideListener() {
@Override
public void onPanelSlide(View panel, float slideOffset) {
Log.i(TAG, "onPanelSlide, offset " + slideOffset);
}
@Override
- public void onPanelExpanded(View panel) {
- Log.i(TAG, "onPanelExpanded");
-
- }
-
- @Override
- public void onPanelCollapsed(View panel) {
- Log.i(TAG, "onPanelCollapsed");
-
+ public void onPanelStateChanged(View panel, PanelState previousState, PanelState newState) {
+ Log.i(TAG, "onPanelStateChanged " + newState);
}
-
- @Override
- public void onPanelAnchored(View panel) {
- Log.i(TAG, "onPanelAnchored");
- }
-
+ });
+ mLayout.setFadeOnClickListener(new OnClickListener() {
@Override
- public void onPanelHidden(View panel) {
- Log.i(TAG, "onPanelHidden");
+ public void onClick(View view) {
+ mLayout.setPanelState(PanelState.COLLAPSED);
}
});
diff --git a/demo/res/drawable-hdpi/ic_launcher.png b/demo/src/main/res/drawable-hdpi/ic_launcher.png
similarity index 100%
rename from demo/res/drawable-hdpi/ic_launcher.png
rename to demo/src/main/res/drawable-hdpi/ic_launcher.png
diff --git a/demo/res/drawable-ldpi/ic_launcher.png b/demo/src/main/res/drawable-ldpi/ic_launcher.png
similarity index 100%
rename from demo/res/drawable-ldpi/ic_launcher.png
rename to demo/src/main/res/drawable-ldpi/ic_launcher.png
diff --git a/demo/res/drawable-mdpi/ic_launcher.png b/demo/src/main/res/drawable-mdpi/ic_launcher.png
similarity index 100%
rename from demo/res/drawable-mdpi/ic_launcher.png
rename to demo/src/main/res/drawable-mdpi/ic_launcher.png
diff --git a/demo/res/drawable-xhdpi/graphic.png b/demo/src/main/res/drawable-xhdpi/graphic.png
similarity index 100%
rename from demo/res/drawable-xhdpi/graphic.png
rename to demo/src/main/res/drawable-xhdpi/graphic.png
diff --git a/demo/res/drawable-xhdpi/ic_launcher.png b/demo/src/main/res/drawable-xhdpi/ic_launcher.png
similarity index 100%
rename from demo/res/drawable-xhdpi/ic_launcher.png
rename to demo/src/main/res/drawable-xhdpi/ic_launcher.png
diff --git a/demo/res/drawable-xxhdpi/ic_launcher.png b/demo/src/main/res/drawable-xxhdpi/ic_launcher.png
similarity index 100%
rename from demo/res/drawable-xxhdpi/ic_launcher.png
rename to demo/src/main/res/drawable-xxhdpi/ic_launcher.png
diff --git a/demo/src/main/res/layout/activity_demo.xml b/demo/src/main/res/layout/activity_demo.xml
new file mode 100644
index 00000000..b4d5a374
--- /dev/null
+++ b/demo/src/main/res/layout/activity_demo.xml
@@ -0,0 +1,96 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -->
+
+
+
+
+
+
+
diff --git a/demo/res/menu/demo.xml b/demo/src/main/res/menu/demo.xml
similarity index 100%
rename from demo/res/menu/demo.xml
rename to demo/src/main/res/menu/demo.xml
diff --git a/demo/res/values/strings.xml b/demo/src/main/res/values/strings.xml
similarity index 100%
rename from demo/res/values/strings.xml
rename to demo/src/main/res/values/strings.xml
diff --git a/demo/res/values/styles.xml b/demo/src/main/res/values/styles.xml
similarity index 88%
rename from demo/res/values/styles.xml
rename to demo/src/main/res/values/styles.xml
index 2554a4cb..70562b48 100644
--- a/demo/res/values/styles.xml
+++ b/demo/src/main/res/values/styles.xml
@@ -4,8 +4,7 @@
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
-