Skip to content

Commit 3baaa91

Browse files
committed
Merge branch 'StephaneBg-master'
2 parents fd66ce4 + 92ac1f3 commit 3baaa91

File tree

9 files changed

+62
-44
lines changed

9 files changed

+62
-44
lines changed

demo/build.gradle

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
apply plugin: 'com.android.application'
22

33
android {
4-
compileSdkVersion 20
5-
buildToolsVersion "20.0.0"
4+
compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
5+
buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
66

77
defaultConfig {
88
applicationId "com.daimajia.swipedemo"
9-
minSdkVersion 8
10-
targetSdkVersion 20
11-
versionCode 1
12-
versionName "1.0"
9+
minSdkVersion Integer.parseInt(project.ANDROID_BUILD_MIN_SDK_VERSION)
10+
targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION)
11+
versionName project.VERSION_NAME
12+
versionCode Integer.parseInt(project.VERSION_CODE)
1313
}
1414
buildTypes {
1515
release {
@@ -20,7 +20,6 @@ android {
2020
}
2121

2222
dependencies {
23-
compile fileTree(dir: 'libs', include: ['*.jar'])
2423
compile project(":library")
2524
compile 'com.nineoldandroids:library:2.4.0'
2625
compile 'com.daimajia.easing:library:1.0.0@aar'

demo/src/main/java/com/daimajia/swipedemo/MyActivity.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ protected void onCreate(Bundle savedInstanceState) {
2121
super.onCreate(savedInstanceState);
2222
setContentView(R.layout.main);
2323

24-
SwipeLayout swipeLayout = (SwipeLayout)findViewById(R.id.godfather);
25-
swipeLayout.setDragEdge(SwipeLayout.DragEdge.Bottom);
24+
// SwipeLayout swipeLayout = (SwipeLayout)findViewById(R.id.godfather);
25+
// swipeLayout.setDragEdge(SwipeLayout.DragEdge.Bottom); // Set in XML
2626

2727
//sample1
2828

demo/src/main/res/layout/main.xml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
<?xml version="1.0" encoding="utf-8"?>
22

3-
<com.daimajia.swipe.SwipeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
<com.daimajia.swipe.SwipeLayout
4+
xmlns:android="http://schemas.android.com/apk/res/android"
5+
xmlns:app="http://schemas.android.com/apk/res-auto"
46
android:id="@+id/godfather"
5-
android:layout_width="match_parent" android:layout_height="match_parent">
7+
android:layout_width="match_parent" android:layout_height="match_parent"
8+
app:drag_edge="bottom">
69
<LinearLayout
710
android:gravity="center"
811
android:layout_width="match_parent"

gradle.properties

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,11 @@
1818
# org.gradle.parallel=true
1919

2020

21-
VERSION_NAME=1.0.3
22-
VERSION_CODE=4
23-
GROUP=com.daimajia.swipelayout
21+
VERSION_NAME=1.0.2
22+
VERSION_CODE=3
23+
GROUP=com.daimajia.swipe
2424

25-
POM_DESCRIPTION=Android Swipe Layout
26-
POM_URL=https://github.com/daimajia/AndroidSwipeLayout
27-
POM_SCM_URL=https://github.com/daimajia/AndroidSwipeLayout
28-
POM_SCM_CONNECTION=scm:https://github.com/daimajia/AndroidSwipeLayout.git
29-
POM_SCM_DEV_CONNECTION=scm:https://github.com/daimajia/AndroidSwipeLayout.git
30-
POM_LICENCE_NAME=MIT
31-
POM_LICENCE_URL=http://opensource.org/licenses/MIT
32-
POM_LICENCE_DIST=repo
33-
POM_DEVELOPER_ID=daimajia
34-
POM_DEVELOPER_NAME=daimajia
25+
ANDROID_BUILD_MIN_SDK_VERSION=14
26+
ANDROID_BUILD_TARGET_SDK_VERSION=20
27+
ANDROID_BUILD_SDK_VERSION=20
28+
ANDROID_BUILD_TOOLS_VERSION=20.0.0

library/build.gradle

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,17 @@
11
apply plugin: 'com.android.library'
22

33
android {
4-
compileSdkVersion 20
5-
buildToolsVersion "20.0.0"
4+
compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
5+
buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
66

77
defaultConfig {
8-
applicationId "com.daimajia.swipelayout"
8+
applicationId "com.daimajia.swipe"
99
minSdkVersion 8
10-
targetSdkVersion 20
11-
versionCode 1
12-
versionName "1.0"
13-
}
14-
buildTypes {
15-
release {
16-
runProguard false
17-
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18-
}
10+
targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION)
1911
}
2012
}
2113

2214
dependencies {
23-
compile fileTree(dir: 'libs', include: ['*.jar'])
24-
compile 'com.android.support:appcompat-v7:20.+'
15+
compile 'com.android.support:support-v4:20.+'
2516
}
2617
apply from: './gradle-mvn-push.gradle'

library/gradle.properties

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,14 @@
2020
POM_NAME=Android SwipeLayout Library
2121
POM_ARTIFACT_ID=library
2222
POM_PACKAGING=aar
23+
24+
POM_DESCRIPTION=Android Swipe Layout
25+
POM_URL=https://github.com/daimajia/AndroidSwipeLayout
26+
POM_SCM_URL=https://github.com/daimajia/AndroidSwipeLayout
27+
POM_SCM_CONNECTION=scm:https://github.com/daimajia/AndroidSwipeLayout.git
28+
POM_SCM_DEV_CONNECTION=scm:https://github.com/daimajia/AndroidSwipeLayout.git
29+
POM_LICENCE_NAME=MIT
30+
POM_LICENCE_URL=http://opensource.org/licenses/MIT
31+
POM_LICENCE_DIST=repo
32+
POM_DEVELOPER_ID=daimajia
33+
POM_DEVELOPER_NAME=daimajia
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.daimajia.swipe">
31

4-
</manifest>
2+
<manifest package="com.daimajia.swipe"/>

library/src/main/java/com/daimajia/swipe/SwipeLayout.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.daimajia.swipe;
22

33
import android.content.Context;
4+
import android.content.res.TypedArray;
45
import android.graphics.Rect;
56
import android.support.v4.view.ViewCompat;
67
import android.support.v4.widget.ViewDragHelper;
@@ -23,8 +24,8 @@ public class SwipeLayout extends FrameLayout {
2324
private ViewDragHelper mDragHelper;
2425

2526
private int mDragDistance = 0;
26-
private DragEdge mDragEdge = DragEdge.Right;
27-
private ShowMode mShowMode = ShowMode.PullOut;
27+
private DragEdge mDragEdge;
28+
private ShowMode mShowMode;
2829

2930
private List<SwipeListener> mSwipeListeners = new ArrayList<SwipeListener>();
3031
private Map<View, ArrayList<OnRevealListener>> mRevealListeners = new HashMap<View, ArrayList<OnRevealListener>>();
@@ -53,6 +54,12 @@ public SwipeLayout(Context context, AttributeSet attrs) {
5354
public SwipeLayout(Context context, AttributeSet attrs, int defStyle) {
5455
super(context, attrs, defStyle);
5556
mDragHelper = ViewDragHelper.create(this, mDragHelperCallback);
57+
58+
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.SwipeLayout);
59+
int ordinal = a.getInt(R.styleable.SwipeLayout_drag_edge, DragEdge.Right.ordinal());
60+
mDragEdge = DragEdge.values()[ordinal];
61+
ordinal = a.getInt(R.styleable.SwipeLayout_show_mode, ShowMode.PullOut.ordinal());
62+
mShowMode = ShowMode.values()[ordinal];
5663
}
5764

5865

@@ -594,7 +601,7 @@ void layoutLayDown(){
594601
@Override
595602
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
596603
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
597-
604+
598605
if(mDragEdge == DragEdge.Left || mDragEdge == DragEdge.Right)
599606
mDragDistance = getBottomView().getMeasuredWidth();
600607
else
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<declare-styleable name="SwipeLayout">
4+
<attr name="drag_edge" format="enum">
5+
<enum name="left" value="0"/>
6+
<enum name="right" value="1"/>
7+
<enum name="top" value="2"/>
8+
<enum name="bottom" value="3"/>
9+
</attr>
10+
<attr name="show_mode" format="enum">
11+
<enum name="lay_down" value="0"/>
12+
<enum name="pull_out" value="1"/>
13+
</attr>
14+
</declare-styleable>
15+
</resources>

0 commit comments

Comments
 (0)