Skip to content
This repository has been archived by the owner on Nov 4, 2022. It is now read-only.

Commit

Permalink
Merge branch 'devel'
Browse files Browse the repository at this point in the history
  • Loading branch information
Malinskiy committed Jul 28, 2015
2 parents f6269ec + 01cfec8 commit 764dd07
Show file tree
Hide file tree
Showing 14 changed files with 225 additions and 147 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,12 @@ Custom attributes supported:
####[Sample java][sample java]
## Proguard
```
-dontwarn com.malinskiy.superrecyclerview.SwipeDismissRecyclerViewTouchListener*
```
##Thanks
[Jake Warthon][jake-swipe-to-dismiss] for implementation of SwipeToDismiss via NineOldAndroids
Expand Down
13 changes: 8 additions & 5 deletions SuperRecyclerView-sample/build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
apply plugin: 'com.android.application'

def SupportVersion = '22.2.1'

android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
compileSdkVersion 22
buildToolsVersion "22.0.1"

defaultConfig {
applicationId "com.malinskiy.superrecyclerview.sample"
minSdkVersion 7
targetSdkVersion 21
targetSdkVersion 22
versionCode 1
versionName "1.0.0"
}

buildTypes {
release {
minifyEnabled false
Expand All @@ -21,8 +24,8 @@ android {
dependencies {
compile project(':SuperRecyclerView')

compile 'com.android.support:appcompat-v7:21.0.2'
compile 'com.android.support:cardview-v7:21.0.2'
compile "com.android.support:appcompat-v7:$SupportVersion"
compile "com.android.support:cardview-v7:$SupportVersion"

compile 'com.malinskiy:materialicons:1.0.1'
compile 'com.eowise:recyclerview-stickyheaders:0.5.0@aar'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.RecyclerView;
import android.widget.Toast;
Expand All @@ -16,9 +17,11 @@

public abstract class BaseActivity extends Activity implements SwipeRefreshLayout.OnRefreshListener, OnMoreListener, SwipeDismissRecyclerViewTouchListener.DismissCallbacks {

private SuperRecyclerView mRecycler;
private StringListAdapter mAdapter;
private SparseItemRemoveAnimator mSparseAnimator;
private SuperRecyclerView mRecycler;
private StringListAdapter mAdapter;
private SparseItemRemoveAnimator mSparseAnimator;
private RecyclerView.LayoutManager mLayoutManager;
private Handler mHandler;

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand All @@ -29,7 +32,8 @@ protected void onCreate(Bundle savedInstanceState) {
mAdapter = new StringListAdapter(list);

mRecycler = (SuperRecyclerView) findViewById(R.id.list);
mRecycler.setLayoutManager(getLayoutManager());
mLayoutManager = getLayoutManager();
mRecycler.setLayoutManager(mLayoutManager);

boolean dismissEnabled = isSwipeToDismissEnabled();
if (dismissEnabled) {
Expand All @@ -38,6 +42,8 @@ protected void onCreate(Bundle savedInstanceState) {
mRecycler.getRecyclerView().setItemAnimator(mSparseAnimator);
}

mHandler = new Handler(Looper.getMainLooper());

Thread thread = new Thread(new Runnable() {
@Override
public void run() {
Expand All @@ -63,9 +69,7 @@ public void run() {
runOnUiThread(new Runnable() {
@Override
public void run() {
mAdapter.add("More stuff");
mAdapter.add("More stuff");
mAdapter.add("More stuff");
mAdapter.addAll(new String[]{"More stuff", "More stuff", "More stuff"});
}
});
}
Expand All @@ -87,10 +91,9 @@ public void run() {
public void onRefresh() {
Toast.makeText(this, "Refresh", Toast.LENGTH_LONG).show();

Handler handler = new Handler();
handler.postDelayed(new Runnable() {
mHandler.postDelayed(new Runnable() {
public void run() {
mAdapter.insert("New stuff", 0);
mAdapter.add("New stuff");
}
}, 2000);
}
Expand All @@ -99,7 +102,11 @@ public void run() {
public void onMoreAsked(int numberOfItems, int numberBeforeMore, int currentItemPos) {
Toast.makeText(this, "More", Toast.LENGTH_LONG).show();

mAdapter.add("More asked, more served");
mHandler.postDelayed(new Runnable() {
public void run() {
mAdapter.add("More asked, more served");
}
}, 300);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public static class RecyclerItemClickListener implements RecyclerView.OnItemTouc
private OnItemClickListener mListener;

public interface OnItemClickListener {
public void onItemClick(View view, int position);
void onItemClick(View view, int position);
}

GestureDetector mGestureDetector;
Expand All @@ -39,5 +39,9 @@ public boolean onInterceptTouchEvent(RecyclerView view, MotionEvent e) {
@Override
public void onTouchEvent(RecyclerView view, MotionEvent motionEvent) {
}

@Override
public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) {
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.LinearLayoutManager;
import android.view.View;
Expand All @@ -18,6 +19,7 @@ public class SwipeActivity extends Activity implements SwipeRefreshLayout.OnRefr

private SuperRecyclerView mRecycler;
private SwipeAdapter mAdapter;
private Handler mHandler;

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand All @@ -37,6 +39,8 @@ public void onItemClick(View view, int position) {
}
}));

mHandler = new Handler(Looper.getMainLooper());

Thread thread = new Thread(new Runnable() {
@Override
public void run() {
Expand Down Expand Up @@ -82,18 +86,21 @@ public void onRefresh() {

mAdapter.closeAllExcept(null);

Handler handler = new Handler();
handler.postDelayed(new Runnable() {
mHandler.postDelayed(new Runnable() {
public void run() {
mAdapter.insert("New stuff", 0);
}
}, 2000);
}, 1000);
}

@Override
public void onMoreAsked(int numberOfItems, int numberBeforeMore, int currentItemPos) {
Toast.makeText(this, "More", Toast.LENGTH_LONG).show();

mAdapter.add("More asked, more served");
mHandler.postDelayed(new Runnable() {
public void run() {
mAdapter.add("More asked, more served");
}
}, 300);
}
}
22 changes: 15 additions & 7 deletions SuperRecyclerView/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
compileSdkVersion 22
buildToolsVersion "22.0.1"

defaultConfig {
minSdkVersion 7
targetSdkVersion 21
versionCode 3
versionName "1.1.0"
targetSdkVersion 22
versionCode 4
versionName "1.1.1"
}
buildTypes {
release {
Expand All @@ -18,8 +18,16 @@ android {
}

dependencies {
compile 'com.android.support:recyclerview-v7:21.0.3'
compile 'com.android.support:recyclerview-v7:22.2.1'
compile 'com.nineoldandroids:library:2.4.0'
}

apply from: 'https://raw.github.com/chrisbanes/gradle-mvn-push/master/gradle-mvn-push.gradle'
if (JavaVersion.current().isJava8Compatible()) {
tasks.withType(Javadoc) {
// disable the crazy super-strict doclint tool in Java 8
//noinspection SpellCheckingInspection
options.addStringOption('Xdoclint:none', '-quiet')
}
}

apply from: 'https://raw.github.com/chrisbanes/gradle-mvn-push/master/gradle-mvn-push.gradle'
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ public interface OnMoreListener {
* @param itemsBeforeMore
* @param maxLastVisiblePosition for staggered grid this is max of all spans
*/
public void onMoreAsked(int overallItemsCount, int itemsBeforeMore, int maxLastVisiblePosition);
void onMoreAsked(int overallItemsCount, int itemsBeforeMore, int maxLastVisiblePosition);
}
Loading

0 comments on commit 764dd07

Please sign in to comment.