Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Added touchmove event for Titanium for Android. #1251

Closed
wants to merge 1 commit into from

3 participants

@peterwilli

Hi,

This commit has added the touchmove event for the ScrollableView for Android. More events to come.

@negupta

Russ - Did you sign a CLA? If yes, please provide me the sign date and email address that you signed it with.

@marshall

@peterwilli Just to echo @negupta, we will need you to sign our Contributor's License Agreement, file a JIRA issue to track the feature (or point to an existing one), and provide a simple test case so we can verify this works :)

@negupta negupta closed this
@negupta

Closing this PR in the absence of a signed CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 25, 2012
  1. @peterwilli
This page is out of date. Refresh to see the latest.
View
11 android/modules/ui/src/java/ti/modules/titanium/ui/ScrollableViewProxy.java
@@ -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()
View
13 android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiUIScrollableView.java
@@ -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
Something went wrong with that request. Please try again.