diff --git a/build.gradle b/build.gradle index a75fc818..6356aabd 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:0.12.+' + classpath 'com.android.tools.build:gradle:1.0.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/demo/build.gradle b/demo/build.gradle index ae2fca12..bf084103 100644 --- a/demo/build.gradle +++ b/demo/build.gradle @@ -13,7 +13,7 @@ android { } buildTypes { release { - runProguard false + minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } diff --git a/demo/src/main/java/com/daimajia/swipedemo/GridViewExample.java b/demo/src/main/java/com/daimajia/swipedemo/GridViewExample.java index 8e79c45b..f95b9c5c 100644 --- a/demo/src/main/java/com/daimajia/swipedemo/GridViewExample.java +++ b/demo/src/main/java/com/daimajia/swipedemo/GridViewExample.java @@ -18,7 +18,7 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.gridview); final GridView gridView = (GridView)findViewById(R.id.gridview); final GridViewAdapter adapter = new GridViewAdapter(this); - adapter.setMode(SwipeItemMangerImpl.Mode.Multiple); + adapter.setMode(SwipeItemMangerImpl.Mode.Single); gridView.setAdapter(adapter); gridView.setSelected(false); gridView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { @@ -32,6 +32,7 @@ public boolean onItemLongClick(AdapterView parent, View view, int position, l @Override public void onItemClick(AdapterView parent, View view, int position, long id) { Log.e("onItemClick","onItemClick:" + position); + Log.e("onItemClick","onItemClick: isOpen = " + adapter.isOpen(position)); } }); diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 1e61d1fd..09bd7355 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Wed Apr 10 15:27:10 PDT 2013 +#Fri Jan 23 13:20:27 CST 2015 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip diff --git a/library/build.gradle b/library/build.gradle index 7a178216..baa6a496 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -5,7 +5,7 @@ android { buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION defaultConfig { - applicationId "com.daimajia.swipe" +// applicationId "com.daimajia.swipe" minSdkVersion 8 targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION) } diff --git a/library/src/main/java/com/daimajia/swipe/implments/SwipeItemMangerImpl.java b/library/src/main/java/com/daimajia/swipe/implments/SwipeItemMangerImpl.java index fdb20f8e..12838abc 100644 --- a/library/src/main/java/com/daimajia/swipe/implments/SwipeItemMangerImpl.java +++ b/library/src/main/java/com/daimajia/swipe/implments/SwipeItemMangerImpl.java @@ -180,6 +180,7 @@ public void onLayout(SwipeLayout v) { } + protected int mOpenTimes = 0; class SwipeMemory extends SimpleSwipeListener { private int position; @@ -193,7 +194,10 @@ public void onClose(SwipeLayout layout) { if(mode == Mode.Multiple){ mOpenPositions.remove(position); }else{ - mOpenPosition = INVALID_POSITION; + mOpenTimes--; + if(mOpenTimes == 0) { + mOpenPosition = INVALID_POSITION; + } } } @@ -209,6 +213,8 @@ public void onOpen(SwipeLayout layout) { if (mode == Mode.Multiple) mOpenPositions.add(position); else { + closeAllExcept(layout); + mOpenTimes++; closeAllExcept(layout); mOpenPosition = position; }