Skip to content

Commit 3ebd37c

Browse files
committed
Refactored CardStackState
1 parent 1c3bedc commit 3ebd37c

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

cardstackview/src/main/java/com/yuyakaido/android/cardstackview/CardStackView.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,7 @@ private void initialize(boolean shouldReset) {
122122

123123
private void resetIfNeeded(boolean shouldReset) {
124124
if (shouldReset) {
125-
state.topIndex = 0;
126-
state.lastPoint = null;
127-
state.isInitialized = false;
125+
state.reset();
128126
}
129127
}
130128

cardstackview/src/main/java/com/yuyakaido/android/cardstackview/internal/CardStackState.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@
55
public class CardStackState {
66
public int topIndex = 0;
77
public Point lastPoint = null;
8-
public Integer lastCount = null;
8+
public int lastCount = 0;
99
public boolean isPaginationReserved = false;
1010
public boolean isInitialized = false;
11+
public void reset() {
12+
topIndex = 0;
13+
lastPoint = null;
14+
lastCount = 0;
15+
isPaginationReserved = false;
16+
isInitialized = false;
17+
}
1118
}

0 commit comments

Comments
 (0)