Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix Mode Single , check view is Open always return false but the view is open. #72

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion demo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ android {
}
buildTypes {
release {
runProguard false
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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));
}
});

Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ public void onLayout(SwipeLayout v) {

}

protected int mOpenTimes = 0;
class SwipeMemory extends SimpleSwipeListener {

private int position;
Expand All @@ -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;
}
}
}

Expand All @@ -209,6 +213,8 @@ public void onOpen(SwipeLayout layout) {
if (mode == Mode.Multiple)
mOpenPositions.add(position);
else {
closeAllExcept(layout);
mOpenTimes++;
closeAllExcept(layout);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

redundant line, calling closeAllExcept should result same as in line 216 ?

mOpenPosition = position;
}
Expand Down