Compare commits
No commits in common. "master" and "fix_relayout" have entirely different histories.
master
...
fix_relayo
12
.travis.yml
12
.travis.yml
|
|
@ -1,12 +0,0 @@
|
||||||
language: android
|
|
||||||
android:
|
|
||||||
components:
|
|
||||||
- tools
|
|
||||||
- platform-tools
|
|
||||||
- build-tools-25.0.2
|
|
||||||
- android-25
|
|
||||||
- extra-android-support
|
|
||||||
- extra
|
|
||||||
- extra-android-m2repository
|
|
||||||
script:
|
|
||||||
- ./gradlew assembleDebug
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
# Android Swipe Layout [](https://travis-ci.org/daimajia/AndroidSwipeLayout)
|
# Android Swipe Layout
|
||||||
|
|
||||||
[](https://gitter.im/daimajia/AndroidSwipeLayout?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
[](https://gitter.im/daimajia/AndroidSwipeLayout?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||||
|
|
||||||
[](https://insight.io/github.com/daimajia/AndroidSwipeLayout)
|
|
||||||
|
|
||||||
This is the brother of [AndroidViewHover](https://github.com/daimajia/AndroidViewHover).
|
This is the brother of [AndroidViewHover](https://github.com/daimajia/AndroidViewHover).
|
||||||
|
|
||||||
One year ago, I started to make an app named [EverMemo](https://play.google.com/store/apps/details?id=com.zhan_dui.evermemo) with my good friends. The designer gave me a design picture, the design like this:
|
One year ago, I started to make an app named [EverMemo](https://play.google.com/store/apps/details?id=com.zhan_dui.evermemo) with my good friends. The designer gave me a design picture, the design like this:
|
||||||
|
|
@ -73,8 +71,6 @@ dependencies {
|
||||||
|
|
||||||
### Step 2
|
### Step 2
|
||||||
|
|
||||||
**Make sure to use the internal adapter instead of your own!**
|
|
||||||
|
|
||||||
[Wiki Usage](https://github.com/daimajia/AndroidSwipeLayout/wiki/usage)
|
[Wiki Usage](https://github.com/daimajia/AndroidSwipeLayout/wiki/usage)
|
||||||
|
|
||||||
## Wiki
|
## Wiki
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ buildscript {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:2.3.0'
|
classpath 'com.android.tools.build:gradle:1.0.0'
|
||||||
classpath 'com.github.dcendents:android-maven-plugin:1.2'
|
classpath 'com.github.dcendents:android-maven-plugin:1.2'
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ android {
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(":library")
|
compile project(":library")
|
||||||
compile 'com.android.support:recyclerview-v7:25.1.1'
|
compile 'com.android.support:recyclerview-v7:21.0.0'
|
||||||
compile 'com.daimajia.easing:library:1.0.0@aar'
|
compile 'com.daimajia.easing:library:1.0.0@aar'
|
||||||
compile 'com.daimajia.androidanimations:library:1.1.2@aar'
|
compile 'com.daimajia.androidanimations:library:1.1.2@aar'
|
||||||
compile 'com.nineoldandroids:library:2.4.0'
|
compile 'com.nineoldandroids:library:2.4.0'
|
||||||
|
|
|
||||||
|
|
@ -37,9 +37,4 @@ public class RecyclerItemClickListener implements RecyclerView.OnItemTouchListen
|
||||||
@Override
|
@Override
|
||||||
public void onTouchEvent(RecyclerView view, MotionEvent motionEvent) {
|
public void onTouchEvent(RecyclerView view, MotionEvent motionEvent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ VERSION_NAME=1.2.0
|
||||||
VERSION_CODE=22
|
VERSION_CODE=22
|
||||||
GROUP=com.daimajia.swipelayout
|
GROUP=com.daimajia.swipelayout
|
||||||
|
|
||||||
ANDROID_BUILD_MIN_SDK_VERSION=9
|
ANDROID_BUILD_MIN_SDK_VERSION=8
|
||||||
ANDROID_BUILD_TARGET_SDK_VERSION=25
|
ANDROID_BUILD_TARGET_SDK_VERSION=21
|
||||||
ANDROID_BUILD_SDK_VERSION=25
|
ANDROID_BUILD_SDK_VERSION=21
|
||||||
ANDROID_BUILD_TOOLS_VERSION=25.0.2
|
ANDROID_BUILD_TOOLS_VERSION=21.0.0
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#Thu Mar 09 16:07:03 CST 2017
|
#Wed Apr 10 15:27:10 PDT 2013
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
|
distributionUrl=http\://services.gradle.org/distributions/gradle-2.2.1-all.zip
|
||||||
|
|
@ -5,17 +5,18 @@ android {
|
||||||
buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
|
buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 9
|
minSdkVersion 8
|
||||||
targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION)
|
targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'com.android.support:recyclerview-v7:25.2.0'
|
compile 'com.android.support:recyclerview-v7:21.0.0'
|
||||||
compile 'com.android.support:support-v4:25.2.0'
|
compile 'com.android.support:support-v4:22.1.1'
|
||||||
}
|
}
|
||||||
apply from: './gradle-mvn-push.gradle'
|
apply from: './gradle-mvn-push.gradle'
|
||||||
|
|
||||||
|
apply plugin: 'android-maven'
|
||||||
// build a jar with source files
|
// build a jar with source files
|
||||||
task sourcesJar(type: Jar) {
|
task sourcesJar(type: Jar) {
|
||||||
from android.sourceSets.main.java.srcDirs
|
from android.sourceSets.main.java.srcDirs
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package com.daimajia.swipe;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
import android.support.v4.view.GravityCompat;
|
import android.support.v4.view.GravityCompat;
|
||||||
import android.support.v4.view.ViewCompat;
|
import android.support.v4.view.ViewCompat;
|
||||||
import android.support.v4.widget.ViewDragHelper;
|
import android.support.v4.widget.ViewDragHelper;
|
||||||
|
|
@ -58,8 +59,6 @@ public class SwipeLayout extends FrameLayout {
|
||||||
private boolean mSwipeEnabled = true;
|
private boolean mSwipeEnabled = true;
|
||||||
private boolean[] mSwipesEnabled = new boolean[]{true, true, true, true};
|
private boolean[] mSwipesEnabled = new boolean[]{true, true, true, true};
|
||||||
private boolean mClickToClose = false;
|
private boolean mClickToClose = false;
|
||||||
private float mWillOpenPercentAfterOpen = 0.75f;
|
|
||||||
private float mWillOpenPercentAfterClose = 0.25f;
|
|
||||||
|
|
||||||
public enum DragEdge {
|
public enum DragEdge {
|
||||||
Left,
|
Left,
|
||||||
|
|
@ -800,8 +799,7 @@ public class SwipeLayout extends FrameLayout {
|
||||||
}
|
}
|
||||||
View currentBottomView = getCurrentBottomView();
|
View currentBottomView = getCurrentBottomView();
|
||||||
Rect bottomViewRect = mViewBoundCache.get(currentBottomView);
|
Rect bottomViewRect = mViewBoundCache.get(currentBottomView);
|
||||||
if (bottomViewRect == null)
|
if(bottomViewRect == null) bottomViewRect = computeBottomLayoutAreaViaSurface(ShowMode.PullOut, surfaceRect);
|
||||||
bottomViewRect = computeBottomLayoutAreaViaSurface(ShowMode.PullOut, surfaceRect);
|
|
||||||
if (currentBottomView != null) {
|
if (currentBottomView != null) {
|
||||||
currentBottomView.layout(bottomViewRect.left, bottomViewRect.top, bottomViewRect.right, bottomViewRect.bottom);
|
currentBottomView.layout(bottomViewRect.left, bottomViewRect.top, bottomViewRect.right, bottomViewRect.bottom);
|
||||||
}
|
}
|
||||||
|
|
@ -817,8 +815,7 @@ public class SwipeLayout extends FrameLayout {
|
||||||
}
|
}
|
||||||
View currentBottomView = getCurrentBottomView();
|
View currentBottomView = getCurrentBottomView();
|
||||||
Rect bottomViewRect = mViewBoundCache.get(currentBottomView);
|
Rect bottomViewRect = mViewBoundCache.get(currentBottomView);
|
||||||
if (bottomViewRect == null)
|
if(bottomViewRect == null) bottomViewRect = computeBottomLayoutAreaViaSurface(ShowMode.LayDown, surfaceRect);
|
||||||
bottomViewRect = computeBottomLayoutAreaViaSurface(ShowMode.LayDown, surfaceRect);
|
|
||||||
if (currentBottomView != null) {
|
if (currentBottomView != null) {
|
||||||
currentBottomView.layout(bottomViewRect.left, bottomViewRect.top, bottomViewRect.right, bottomViewRect.bottom);
|
currentBottomView.layout(bottomViewRect.left, bottomViewRect.top, bottomViewRect.right, bottomViewRect.bottom);
|
||||||
}
|
}
|
||||||
|
|
@ -1045,46 +1042,6 @@ public class SwipeLayout extends FrameLayout {
|
||||||
this.mSwipesEnabled[DragEdge.Bottom.ordinal()] = bottomSwipeEnabled;
|
this.mSwipesEnabled[DragEdge.Bottom.ordinal()] = bottomSwipeEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***
|
|
||||||
* Returns the percentage of revealing at which the view below should the view finish opening
|
|
||||||
* if it was already open before dragging
|
|
||||||
*
|
|
||||||
* @returns The percentage of view revealed to trigger, default value is 0.25
|
|
||||||
*/
|
|
||||||
public float getWillOpenPercentAfterOpen() {
|
|
||||||
return mWillOpenPercentAfterOpen;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***
|
|
||||||
* Allows to stablish at what percentage of revealing the view below should the view finish opening
|
|
||||||
* if it was already open before dragging
|
|
||||||
*
|
|
||||||
* @param willOpenPercentAfterOpen The percentage of view revealed to trigger, default value is 0.25
|
|
||||||
*/
|
|
||||||
public void setWillOpenPercentAfterOpen(float willOpenPercentAfterOpen) {
|
|
||||||
this.mWillOpenPercentAfterOpen = willOpenPercentAfterOpen;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***
|
|
||||||
* Returns the percentage of revealing at which the view below should the view finish opening
|
|
||||||
* if it was already closed before dragging
|
|
||||||
*
|
|
||||||
* @returns The percentage of view revealed to trigger, default value is 0.25
|
|
||||||
*/
|
|
||||||
public float getWillOpenPercentAfterClose() {
|
|
||||||
return mWillOpenPercentAfterClose;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***
|
|
||||||
* Allows to stablish at what percentage of revealing the view below should the view finish opening
|
|
||||||
* if it was already closed before dragging
|
|
||||||
*
|
|
||||||
* @param willOpenPercentAfterClose The percentage of view revealed to trigger, default value is 0.75
|
|
||||||
*/
|
|
||||||
public void setWillOpenPercentAfterClose(float willOpenPercentAfterClose) {
|
|
||||||
this.mWillOpenPercentAfterClose = willOpenPercentAfterClose;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean insideAdapterView() {
|
private boolean insideAdapterView() {
|
||||||
return getAdapterView() != null;
|
return getAdapterView() != null;
|
||||||
}
|
}
|
||||||
|
|
@ -1269,6 +1226,7 @@ public class SwipeLayout extends FrameLayout {
|
||||||
/**
|
/**
|
||||||
* return null if there is no bottom view
|
* return null if there is no bottom view
|
||||||
*/
|
*/
|
||||||
|
@Nullable
|
||||||
public View getCurrentBottomView() {
|
public View getCurrentBottomView() {
|
||||||
List<View> bottoms = getBottomViews();
|
List<View> bottoms = getBottomViews();
|
||||||
if (mCurrentDragEdge.ordinal() < bottoms.size()) {
|
if (mCurrentDragEdge.ordinal() < bottoms.size()) {
|
||||||
|
|
@ -1331,7 +1289,7 @@ public class SwipeLayout extends FrameLayout {
|
||||||
if (currentDragEdge == null || surfaceView == null) {
|
if (currentDragEdge == null || surfaceView == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
float willOpenPercent = (isCloseBeforeDragged ? mWillOpenPercentAfterClose : mWillOpenPercentAfterOpen);
|
float willOpenPercent = (isCloseBeforeDragged ? .25f : .75f);
|
||||||
if (currentDragEdge == DragEdge.Left) {
|
if (currentDragEdge == DragEdge.Left) {
|
||||||
if (xvel > minVelocity) open();
|
if (xvel > minVelocity) open();
|
||||||
else if (xvel < -minVelocity) close();
|
else if (xvel < -minVelocity) close();
|
||||||
|
|
@ -1570,7 +1528,7 @@ public class SwipeLayout extends FrameLayout {
|
||||||
setCurrentDragEdge(dragEdge);
|
setCurrentDragEdge(dragEdge);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onViewRemoved(View child) {
|
protected void onViewRemoved(View child) {
|
||||||
for (Map.Entry<DragEdge, View> entry : new HashMap<DragEdge, View>(mDragEdges).entrySet()) {
|
for (Map.Entry<DragEdge, View> entry : new HashMap<DragEdge, View>(mDragEdges).entrySet()) {
|
||||||
if (entry.getValue() == child) {
|
if (entry.getValue() == child) {
|
||||||
mDragEdges.remove(entry.getKey());
|
mDragEdges.remove(entry.getKey());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue