Fixed Lollipop issue were the edit list would not behave correctly
This commit is contained in:
parent
b2fc0d87a7
commit
103c8cbc4f
2 changed files with 12 additions and 6 deletions
|
|
@ -20,6 +20,7 @@ public class UeBehaviourStop extends UeBehaviour {
|
|||
if(!super.stopExecution()) {
|
||||
log.debug("Terminating executor");
|
||||
executor.terminateNonBlock();
|
||||
executor.setNextBehaviour(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@ import android.graphics.Color;
|
|||
import android.graphics.Paint;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.os.Build;
|
||||
import android.support.v4.BuildConfig;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.MotionEvent;
|
||||
|
|
@ -353,20 +355,24 @@ public class DynamicListView extends ListView {
|
|||
|
||||
final long switchItemID = isBelow ? mBelowItemId : mAboveItemId;
|
||||
View switchView = isBelow ? belowView : aboveView;
|
||||
final int originalItem = getPositionForView(mobileView);
|
||||
|
||||
if (switchView == null) {
|
||||
updateNeighborViewsForID(mMobileItemId);
|
||||
return;
|
||||
}
|
||||
|
||||
listener.swapItems(originalItem, getPositionForView(switchView));
|
||||
listener.swapItems(getPositionForView(mobileView), getPositionForView(switchView));
|
||||
((StableArrayAdapter) getAdapter()).notifyDataSetChanged();
|
||||
|
||||
mDownY = mLastEventY;
|
||||
|
||||
mobileView.setVisibility(View.VISIBLE);
|
||||
switchView.setVisibility(View.INVISIBLE);
|
||||
if(android.os.Build.VERSION.SDK_INT < 21) {
|
||||
// As we swap the items, the mobileView and switchView will contain the
|
||||
// switched items in older versions of android so we need to switch the
|
||||
// visibility of the two views.
|
||||
mobileView.setVisibility(View.VISIBLE);
|
||||
switchView.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
||||
updateNeighborViewsForID(mMobileItemId);
|
||||
|
||||
|
|
@ -375,11 +381,9 @@ public class DynamicListView extends ListView {
|
|||
observer.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
|
||||
public boolean onPreDraw() {
|
||||
observer.removeOnPreDrawListener(this);
|
||||
|
||||
View switchView = getViewForID(switchItemID);
|
||||
|
||||
mTotalOffset += deltaY;
|
||||
|
||||
int switchViewNewTop = switchView.getTop();
|
||||
int delta = switchViewStartTop - switchViewNewTop;
|
||||
|
||||
|
|
@ -428,6 +432,7 @@ public class DynamicListView extends ListView {
|
|||
}
|
||||
else if(mMode == TouchMode.SWAP) {
|
||||
mHoverCellCurrentBounds.offsetTo(mHoverCellOriginalBounds.left, mobileView.getTop());
|
||||
((StableArrayAdapter) getAdapter()).notifyDataSetChanged();
|
||||
}
|
||||
|
||||
// Animate
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue