I am trying to write a Adobe air native extension to catch mouse wheel on android.
Android is getting the mouse wheel event when I am testing it as a native application.
But when I try to package that code as a native extension, I am not getting the event.
I follow this tutorial.
Could I add a listener to the current view?
Am I missing something else?
Is there a mouse wheel extension for mouse wheel in android?
public class OpenAppANE extends Activity implements FREExtension, OnTouchListener {
public void startMouseEvent()
{
LinearLayout touchLayout = new LinearLayout(this);
// set layout width 30 px and height is equal to full screen
LayoutParams lp = new LayoutParams(30, LayoutParams.MATCH_PARENT);
touchLayout.setLayoutParams(lp);
// set color if you want layout visible on screen
// touchLayout.setBackgroundColor(Color.CYAN);
// set on touch listener
touchLayout.setOnTouchListener(this);
// fetch window manager object
WindowManager mWindowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
// set layout parameter of window manager
WindowManager.LayoutParams mParams = new WindowManager.LayoutParams(30,
// width of layout 30 px
WindowManager.LayoutParams.MATCH_PARENT, // height is equal to full screen
WindowManager.LayoutParams.TYPE_PHONE, // Type Phone, These are non-application windows providing user interaction with the phone (in particular incoming calls).
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, // this window won't ever get key input focus
PixelFormat.TRANSLUCENT);
mParams.gravity = Gravity.LEFT | Gravity.TOP;
Log.i("TAG", "add View");
mWindowManager.addView(touchLayout, mParams);
}
@Override
public boolean onGenericMotionEvent(MotionEvent event) {
Toast.makeText(appContext, "inside onGenericMotionEvent" , Toast.LENGTH_SHORT ).show();
}
}