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

squid:S1066 - Collapsible "if" statements should be merged #8

Merged
merged 1 commit into from
Mar 8, 2016
Merged
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
35 changes: 13 additions & 22 deletions app/src/main/java/com/jigdraw/draw/views/JigsawGridView.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,9 @@ public void onScroll(AbsListView view, int firstVisibleItem,
}

public void checkAndHandleFirstVisibleCellChange() {
if (mCurrentFirstVisibleItem != mPreviousFirstVisibleItem) {
if (mCellIsMobile && mMobileItemId != INVALID_ID) {
updateNeighborViewsForId(mMobileItemId);
handleCellSwitch();
}
if (mCurrentFirstVisibleItem != mPreviousFirstVisibleItem && (mCellIsMobile && mMobileItemId != INVALID_ID)) {
updateNeighborViewsForId(mMobileItemId);
handleCellSwitch();
}
}

Expand All @@ -160,11 +158,9 @@ public void checkAndHandleLastVisibleCellChange() {
+ mCurrentVisibleItemCount;
int previousLastVisibleItem = mPreviousFirstVisibleItem
+ mPreviousVisibleItemCount;
if (currentLastVisibleItem != previousLastVisibleItem) {
if (mCellIsMobile && mMobileItemId != INVALID_ID) {
updateNeighborViewsForId(mMobileItemId);
handleCellSwitch();
}
if (currentLastVisibleItem != previousLastVisibleItem && (mCellIsMobile && mMobileItemId != INVALID_ID)) {
updateNeighborViewsForId(mMobileItemId);
handleCellSwitch();
}
}

Expand Down Expand Up @@ -268,20 +264,16 @@ public boolean onTouchEvent(@NonNull MotionEvent event) {
case MotionEvent.ACTION_UP:
touchEventsEnded();

if (mHoverCell != null) {
if (mDropListener != null) {
mDropListener.onActionDrop();
}
if (mHoverCell != null && mDropListener != null) {
mDropListener.onActionDrop();
}
break;

case MotionEvent.ACTION_CANCEL:
touchEventsCancelled();

if (mHoverCell != null) {
if (mDropListener != null) {
mDropListener.onActionDrop();
}
if (mHoverCell != null && mDropListener != null) {
mDropListener.onActionDrop();
}
break;

Expand Down Expand Up @@ -312,10 +304,9 @@ public void setOnDragListener(OnDragListener dragListener) {

public void startEditMode(int position) {
requestDisallowInterceptTouchEvent(true);
if (isPostHoneycomb())
if (position != -1) {
startDragAtPosition(position);
}
if (isPostHoneycomb() && position != -1) {
startDragAtPosition(position);
}
mIsEditMode = true;
}

Expand Down