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

[TIMOB-20374] Android: Longpress event on ScrollView doesn't fire. #7912

Merged
merged 1 commit into from
Apr 5, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import android.content.Context;
import android.graphics.Canvas;
import android.os.Build;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
Expand All @@ -38,17 +39,32 @@ public class TiUIScrollView extends TiUIView
private int offsetX = 0, offsetY = 0;
private boolean setInitialOffset = false;
private boolean mScrollingEnabled = true;

public class TiScrollViewLayout extends TiCompositeLayout
{
private static final int AUTO = Integer.MAX_VALUE;
private int parentWidth = 0;
private int parentHeight = 0;
private boolean canCancelEvents = true;

private GestureDetector gestureDetector;

public TiScrollViewLayout(Context context, LayoutArrangement arrangement)
{
super(context, arrangement, proxy);
gestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() {
@Override
public void onLongPress(MotionEvent e) {
if (proxy.hierarchyHasListener(TiC.EVENT_LONGPRESS)) {
fireEvent(TiC.EVENT_LONGPRESS, dictFromEvent(e));
}
}
});
setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
return gestureDetector.onTouchEvent(event);
}
});
}

public void setParentWidth(int width)
Expand Down Expand Up @@ -155,7 +171,7 @@ protected int getMeasuredHeight(int maxHeight, int heightSpec)
}
}
}

// same code, different super-classes
private class TiVerticalScrollView extends ScrollView
{
Expand Down