Skip to content

Commit ee02941

Browse files
committed
merging
2 parents f8350fc + b97faca commit ee02941

33 files changed

+2689
-184
lines changed

README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Time passed, finally...as you see right now.
1616

1717
![](http://ww2.sinaimg.cn/mw690/610dc034jw1ejoplapwtqg208n0e74dx.gif)
1818

19-
[Download Demo](https://github.com/daimajia/AndroidSwipeLayout/releases/download/v1.1.6/AndroidSwipeLayout-v1.1.6.apk)
19+
[Download Demo](https://github.com/daimajia/AndroidSwipeLayout/releases/download/v1.1.8/AndroidSwipeLayout-v1.1.8.apk)
2020

2121
Before I made this, I actually found some libraries (eg.[SwipeListView](https://github.com/47deg/android-swipelistview)) that helps developers to integrate swiping with your UI component.
2222

@@ -38,8 +38,9 @@ When I start to make this library, I set some goals:
3838

3939
```groovy
4040
dependencies {
41+
compile 'com.android.support:recyclerview-v7:21.0.0'
4142
compile 'com.android.support:support-v4:20.+'
42-
compile "com.daimajia.swipelayout:library:1.1.7@aar"
43+
compile "com.daimajia.swipelayout:library:1.1.8@aar"
4344
}
4445
```
4546

@@ -51,17 +52,22 @@ dependencies {
5152
<artifactId>support-v4</artifactId>
5253
<version>r6</version>
5354
</dependency>
55+
<dependency>
56+
<groupId>com.google.android</groupId>
57+
<artifactId>recyclerview-v7</artifactId>
58+
<version>21.0.0</version>
59+
</dependency>
5460
<dependency>
5561
<groupId>com.daimajia.swipelayout</groupId>
5662
<artifactId>library</artifactId>
57-
<version>1.1.7</version>
63+
<version>1.1.8</version>
5864
<type>apklib</type>
5965
</dependency>
6066
```
6167

6268
#### Eclipse
6369

64-
[AndroidSwipeLayout-v1.1.6.jar](https://github.com/daimajia/AndroidSwipeLayout/releases/download/v1.1.6/AndroidSwipeLayout-v1.1.6.jar)
70+
[AndroidSwipeLayout-v1.1.8.jar](https://github.com/daimajia/AndroidSwipeLayout/releases/download/v1.1.8/AndroidSwipeLayout-v1.1.8.jar)
6571

6672
### Step 2
6773

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ buildscript {
55
jcenter()
66
}
77
dependencies {
8-
classpath 'com.android.tools.build:gradle:0.12.+'
8+
classpath 'com.android.tools.build:gradle:1.0.0'
99

1010
// NOTE: Do not place your application dependencies here; they belong
1111
// in the individual module build.gradle files

demo/build.gradle

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

3+
repositories {
4+
jcenter()
5+
}
6+
37
android {
48
compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
59
buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
610

711
defaultConfig {
8-
applicationId "com.daimajia.swipedemo"
912
minSdkVersion Integer.parseInt(project.ANDROID_BUILD_MIN_SDK_VERSION)
1013
targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION)
1114
versionName project.VERSION_NAME
1215
versionCode Integer.parseInt(project.VERSION_CODE)
1316
}
1417
buildTypes {
1518
release {
16-
runProguard false
19+
minifyEnabled false
1720
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
1821
}
1922
}
23+
lintOptions {
24+
abortOnError false
25+
}
2026
}
2127

2228
dependencies {
2329
compile project(":library")
24-
compile 'com.nineoldandroids:library:2.4.0'
30+
compile 'com.android.support:recyclerview-v7:21.0.0'
2531
compile 'com.daimajia.easing:library:1.0.0@aar'
2632
compile 'com.daimajia.androidanimations:library:1.1.2@aar'
2733
compile 'com.nineoldandroids:library:2.4.0'
34+
// This dude gave a shoutout to you (daimajia) on his github page:
35+
compile 'jp.wasabeef:recyclerview-animators:1.0.3@aar'
2836
}

demo/src/main/AndroidManifest.xml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,28 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
package="com.daimajia.swipedemo" >
3+
xmlns:tools="http://schemas.android.com/tools"
4+
package="com.daimajia.swipedemo">
5+
6+
<uses-sdk tools:overrideLibrary="org.lucasr.twowayview, org.lucasr.twowayview.widget, jp.wasabeef.recyclerview" />
47

58
<application
69
android:allowBackup="true"
710
android:icon="@drawable/ic_launcher"
811
android:label="@string/app_name"
9-
android:theme="@style/AppTheme" >
12+
android:theme="@style/AppTheme">
1013
<activity
1114
android:name="com.daimajia.swipedemo.MyActivity"
12-
android:label="@string/app_name" >
15+
android:label="@string/app_name">
1316
<intent-filter>
1417
<action android:name="android.intent.action.MAIN" />
1518

1619
<category android:name="android.intent.category.LAUNCHER" />
1720
</intent-filter>
1821
</activity>
19-
<activity android:name="com.daimajia.swipedemo.ListViewExample"/>
20-
<activity android:name="com.daimajia.swipedemo.GridViewExample"/>
21-
<activity android:name=".NestedExample"/>
22+
<activity android:name="com.daimajia.swipedemo.ListViewExample" />
23+
<activity android:name="com.daimajia.swipedemo.GridViewExample" />
24+
<activity android:name="com.daimajia.swipedemo.RecyclerViewExample" />
25+
<activity android:name=".NestedExample" />
2226
</application>
2327

2428
</manifest>

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import android.widget.GridView;
99

1010
import com.daimajia.swipe.implments.SwipeItemMangerImpl;
11+
import com.daimajia.swipe.util.Attributes;
1112
import com.daimajia.swipedemo.adapter.GridViewAdapter;
1213

1314
public class GridViewExample extends Activity{
@@ -18,7 +19,7 @@ protected void onCreate(Bundle savedInstanceState) {
1819
setContentView(R.layout.gridview);
1920
final GridView gridView = (GridView)findViewById(R.id.gridview);
2021
final GridViewAdapter adapter = new GridViewAdapter(this);
21-
adapter.setMode(SwipeItemMangerImpl.Mode.Multiple);
22+
adapter.setMode(Attributes.Mode.Multiple);
2223
gridView.setAdapter(adapter);
2324
gridView.setSelected(false);
2425
gridView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {

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

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

3+
import android.app.ActionBar;
34
import android.app.Activity;
45
import android.content.Context;
56
import android.content.Intent;
7+
import android.os.Build;
68
import android.os.Bundle;
79
import android.util.Log;
810
import android.view.Menu;
@@ -14,19 +16,28 @@
1416
import android.widget.ListView;
1517
import android.widget.Toast;
1618

19+
import com.daimajia.swipe.SwipeLayout;
1720
import com.daimajia.swipe.implments.SwipeItemMangerImpl;
21+
import com.daimajia.swipe.util.Attributes;
1822
import com.daimajia.swipedemo.adapter.ListViewAdapter;
1923

2024
public class ListViewExample extends Activity {
2125

2226
private ListView mListView;
2327
private ListViewAdapter mAdapter;
2428
private Context mContext = this;
29+
2530
@Override
2631
protected void onCreate(Bundle savedInstanceState) {
2732
super.onCreate(savedInstanceState);
2833
setContentView(R.layout.listview);
29-
mListView = (ListView)findViewById(R.id.listview);
34+
mListView = (ListView) findViewById(R.id.listview);
35+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
36+
ActionBar actionBar = getActionBar();
37+
if (actionBar != null) {
38+
actionBar.setTitle("ListView");
39+
}
40+
}
3041

3142
/**
3243
* The following comment is the sample usage of ArraySwipeAdapter.
@@ -39,17 +50,17 @@ protected void onCreate(Bundle savedInstanceState) {
3950

4051
mAdapter = new ListViewAdapter(this);
4152
mListView.setAdapter(mAdapter);
42-
mAdapter.setMode(SwipeItemMangerImpl.Mode.Single);
53+
mAdapter.setMode(Attributes.Mode.Single);
4354
mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
4455
@Override
4556
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
46-
Toast.makeText(mContext, "Click", Toast.LENGTH_SHORT).show();
57+
((SwipeLayout)(mListView.getChildAt(position - mListView.getFirstVisiblePosition()))).open(true);
4758
}
4859
});
4960
mListView.setOnTouchListener(new View.OnTouchListener() {
5061
@Override
5162
public boolean onTouch(View v, MotionEvent event) {
52-
Log.e("ListView","OnTouch");
63+
Log.e("ListView", "OnTouch");
5364
return false;
5465
}
5566
});
@@ -63,7 +74,7 @@ public boolean onItemLongClick(AdapterView<?> parent, View view, int position, l
6374
mListView.setOnScrollListener(new AbsListView.OnScrollListener() {
6475
@Override
6576
public void onScrollStateChanged(AbsListView view, int scrollState) {
66-
Log.e("ListView","onScrollStateChanged");
77+
Log.e("ListView", "onScrollStateChanged");
6778
}
6879

6980
@Override
@@ -104,10 +115,14 @@ public boolean onOptionsItemSelected(MenuItem item) {
104115
startActivity(new Intent(this, ListViewExample.class));
105116
finish();
106117
return true;
107-
}else if(id == R.id.action_gridview){
118+
} else if (id == R.id.action_gridview) {
108119
startActivity(new Intent(this, GridViewExample.class));
109120
finish();
110121
return true;
122+
} else if (id == R.id.action_recycler) {
123+
startActivity(new Intent(this, RecyclerViewExample.class));
124+
finish();
125+
return true;
111126
}
112127
return super.onOptionsItemSelected(item);
113128
}

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,11 @@ public boolean onOptionsItemSelected(MenuItem item) {
137137
} else if (id == R.id.action_gridview) {
138138
startActivity(new Intent(this, GridViewExample.class));
139139
return true;
140-
} else if (id == R.id.action_nexted) {
140+
} else if (id == R.id.action_nested) {
141141
startActivity(new Intent(this, NestedExample.class));
142142
return true;
143+
} else if (id == R.id.action_recycler) {
144+
startActivity(new Intent(this, RecyclerViewExample.class));
143145
}
144146
return super.onOptionsItemSelected(item);
145147
}

0 commit comments

Comments
 (0)