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

Added touchmove event for Titanium for Android. #1251

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,17 @@ public void fireScroll(int to)
fireEvent(TiC.EVENT_SCROLL, options);
}
}

public void fireTouchMove(float x, float y)
{
if (hasListeners(TiC.EVENT_TOUCH_MOVE)) {
KrollDict options = new KrollDict();
options.put("view", this);
options.put("x", x);
options.put("y", y);
fireEvent(TiC.EVENT_TOUCH_MOVE, options);
}
}

@Kroll.getProperty @Kroll.method
public int getCurrentPage()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,19 @@ private ViewPager buildViewPager(Context context, ViewPagerAdapter adapter)
{
ViewPager pager = new ViewPager(context);
pager.setAdapter(adapter);
pager.setOnTouchListener(new View.OnTouchListener()
{
@Override
public boolean onTouch(View v, MotionEvent e)
{
switch (e.getAction()) {
case MotionEvent.ACTION_MOVE:
((ScrollableViewProxy)proxy).fireTouchMove(e.getX(), e.getY());
break;
}
return true;
}
});
pager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener()
{
@Override
Expand Down