Merge branch 'StephaneBg-master'

This commit is contained in:
daimajia 2014-08-28 09:01:43 +08:00
commit 3baaa91a5e
9 changed files with 62 additions and 44 deletions

View File

@ -1,15 +1,15 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion "20.0.0"
compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
defaultConfig {
applicationId "com.daimajia.swipedemo"
minSdkVersion 8
targetSdkVersion 20
versionCode 1
versionName "1.0"
minSdkVersion Integer.parseInt(project.ANDROID_BUILD_MIN_SDK_VERSION)
targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION)
versionName project.VERSION_NAME
versionCode Integer.parseInt(project.VERSION_CODE)
}
buildTypes {
release {
@ -20,7 +20,6 @@ android {
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(":library")
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.easing:library:1.0.0@aar'

View File

@ -21,8 +21,8 @@ public class MyActivity extends Activity {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
SwipeLayout swipeLayout = (SwipeLayout)findViewById(R.id.godfather);
swipeLayout.setDragEdge(SwipeLayout.DragEdge.Bottom);
// SwipeLayout swipeLayout = (SwipeLayout)findViewById(R.id.godfather);
// swipeLayout.setDragEdge(SwipeLayout.DragEdge.Bottom); // Set in XML
//sample1

View File

@ -1,8 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<com.daimajia.swipe.SwipeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<com.daimajia.swipe.SwipeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/godfather"
android:layout_width="match_parent" android:layout_height="match_parent">
android:layout_width="match_parent" android:layout_height="match_parent"
app:drag_edge="bottom">
<LinearLayout
android:gravity="center"
android:layout_width="match_parent"

View File

@ -18,17 +18,11 @@
# org.gradle.parallel=true
VERSION_NAME=1.0.3
VERSION_CODE=4
GROUP=com.daimajia.swipelayout
VERSION_NAME=1.0.2
VERSION_CODE=3
GROUP=com.daimajia.swipe
POM_DESCRIPTION=Android Swipe Layout
POM_URL=https://github.com/daimajia/AndroidSwipeLayout
POM_SCM_URL=https://github.com/daimajia/AndroidSwipeLayout
POM_SCM_CONNECTION=scm:https://github.com/daimajia/AndroidSwipeLayout.git
POM_SCM_DEV_CONNECTION=scm:https://github.com/daimajia/AndroidSwipeLayout.git
POM_LICENCE_NAME=MIT
POM_LICENCE_URL=http://opensource.org/licenses/MIT
POM_LICENCE_DIST=repo
POM_DEVELOPER_ID=daimajia
POM_DEVELOPER_NAME=daimajia
ANDROID_BUILD_MIN_SDK_VERSION=14
ANDROID_BUILD_TARGET_SDK_VERSION=20
ANDROID_BUILD_SDK_VERSION=20
ANDROID_BUILD_TOOLS_VERSION=20.0.0

View File

@ -1,26 +1,17 @@
apply plugin: 'com.android.library'
android {
compileSdkVersion 20
buildToolsVersion "20.0.0"
compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
defaultConfig {
applicationId "com.daimajia.swipelayout"
applicationId "com.daimajia.swipe"
minSdkVersion 8
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION)
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:20.+'
compile 'com.android.support:support-v4:20.+'
}
apply from: './gradle-mvn-push.gradle'

View File

@ -20,3 +20,14 @@
POM_NAME=Android SwipeLayout Library
POM_ARTIFACT_ID=library
POM_PACKAGING=aar
POM_DESCRIPTION=Android Swipe Layout
POM_URL=https://github.com/daimajia/AndroidSwipeLayout
POM_SCM_URL=https://github.com/daimajia/AndroidSwipeLayout
POM_SCM_CONNECTION=scm:https://github.com/daimajia/AndroidSwipeLayout.git
POM_SCM_DEV_CONNECTION=scm:https://github.com/daimajia/AndroidSwipeLayout.git
POM_LICENCE_NAME=MIT
POM_LICENCE_URL=http://opensource.org/licenses/MIT
POM_LICENCE_DIST=repo
POM_DEVELOPER_ID=daimajia
POM_DEVELOPER_NAME=daimajia

View File

@ -1,4 +1,2 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.daimajia.swipe">
</manifest>
<manifest package="com.daimajia.swipe"/>

View File

@ -1,6 +1,7 @@
package com.daimajia.swipe;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Rect;
import android.support.v4.view.ViewCompat;
import android.support.v4.widget.ViewDragHelper;
@ -23,8 +24,8 @@ public class SwipeLayout extends FrameLayout {
private ViewDragHelper mDragHelper;
private int mDragDistance = 0;
private DragEdge mDragEdge = DragEdge.Right;
private ShowMode mShowMode = ShowMode.PullOut;
private DragEdge mDragEdge;
private ShowMode mShowMode;
private List<SwipeListener> mSwipeListeners = new ArrayList<SwipeListener>();
private Map<View, ArrayList<OnRevealListener>> mRevealListeners = new HashMap<View, ArrayList<OnRevealListener>>();
@ -53,6 +54,12 @@ public class SwipeLayout extends FrameLayout {
public SwipeLayout(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
mDragHelper = ViewDragHelper.create(this, mDragHelperCallback);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.SwipeLayout);
int ordinal = a.getInt(R.styleable.SwipeLayout_drag_edge, DragEdge.Right.ordinal());
mDragEdge = DragEdge.values()[ordinal];
ordinal = a.getInt(R.styleable.SwipeLayout_show_mode, ShowMode.PullOut.ordinal());
mShowMode = ShowMode.values()[ordinal];
}
@ -594,7 +601,7 @@ public class SwipeLayout extends FrameLayout {
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
if(mDragEdge == DragEdge.Left || mDragEdge == DragEdge.Right)
mDragDistance = getBottomView().getMeasuredWidth();
else

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="SwipeLayout">
<attr name="drag_edge" format="enum">
<enum name="left" value="0"/>
<enum name="right" value="1"/>
<enum name="top" value="2"/>
<enum name="bottom" value="3"/>
</attr>
<attr name="show_mode" format="enum">
<enum name="lay_down" value="0"/>
<enum name="pull_out" value="1"/>
</attr>
</declare-styleable>
</resources>