Skip to content

Commit 5106665

Browse files
committed
fix error status in GridView
1 parent 5686835 commit 5106665

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

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

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public void onReveal(View child, SwipeLayout.DragEdge edge, float fraction, int
4040

4141
sample2 = (SwipeLayout)findViewById(R.id.sample2);
4242
sample2.setShowMode(SwipeLayout.ShowMode.LayDown);
43-
sample2.setShowMode(SwipeLayout.ShowMode.PullOut);
43+
// sample2.setShowMode(SwipeLayout.ShowMode.PullOut);
4444
sample2.findViewById(R.id.star).setOnClickListener(new View.OnClickListener() {
4545
@Override
4646
public void onClick(View v) {
@@ -68,6 +68,27 @@ public void onClick(View v) {
6868
Toast.makeText(MyActivity.this, "Yo",Toast.LENGTH_SHORT).show();
6969
}
7070
});
71+
sample1.addSwipeListener(new SwipeLayout.SwipeListener() {
72+
@Override
73+
public void onClose(SwipeLayout layout) {
74+
75+
}
76+
77+
@Override
78+
public void onUpdate(SwipeLayout layout, int leftOffset, int topOffset) {
79+
80+
}
81+
82+
@Override
83+
public void onOpen(SwipeLayout layout) {
84+
85+
}
86+
87+
@Override
88+
public void onHandRelease(SwipeLayout layout, float xvel, float yvel) {
89+
90+
}
91+
});
7192

7293
//sample3
7394

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public final View getView(int position, View convertView, ViewGroup parent) {
4747
OnLayoutListener onLayoutListener = new OnLayoutListener(position);
4848
SwipeMemory swipeMemory = new SwipeMemory(position);
4949
swipeLayout.addSwipeListener(swipeMemory);
50+
swipeLayout.addOnLayoutListener(onLayoutListener);
5051
swipeLayout.setTag(swipeResourceId, new ValueBox(position, swipeMemory, onLayoutListener));
5152
}
5253
}else{
@@ -58,7 +59,6 @@ public final View getView(int position, View convertView, ViewGroup parent) {
5859
valueBox.position = position;
5960
}
6061
}
61-
swipeLayout.addOnLayoutListener(new OnLayoutListener(position));
6262
fillValues(position, v);
6363
return v;
6464
}
@@ -89,7 +89,6 @@ public void setPosition(int position){
8989

9090
@Override
9191
public void onLayout(SwipeLayout v) {
92-
v.removeOnLayoutListener(this);
9392
if(mOpenPositions.contains(position))
9493
v.open(false);
9594
else{

0 commit comments

Comments
 (0)