本文整理匯總了Java中android.view.MotionEvent.BUTTON_STYLUS_PRIMARY屬性的典型用法代碼示例。如果您正苦於以下問題:Java MotionEvent.BUTTON_STYLUS_PRIMARY屬性的具體用法?Java MotionEvent.BUTTON_STYLUS_PRIMARY怎麽用?Java MotionEvent.BUTTON_STYLUS_PRIMARY使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類android.view.MotionEvent
的用法示例。
在下文中一共展示了MotionEvent.BUTTON_STYLUS_PRIMARY屬性的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: process
public void process(final MotionEvent event)
{
//Log.i("SDL", "Got motion event, type " + (int)(event.getAction()) + " X " + (int)event.getX() + " Y " + (int)event.getY() + " buttons " + buttonState + " source " + event.getSource());
int buttonStateNew = event.getButtonState();
if( buttonStateNew != buttonState )
{
for( int i = 1; i <= MotionEvent.BUTTON_FORWARD; i *= 2 )
{
if( (buttonStateNew & i) != (buttonState & i) )
DemoGLSurfaceView.nativeMouseButtonsPressed(i, ((buttonStateNew & i) == 0) ? 0 : 1);
}
if( (buttonStateNew & MotionEvent.BUTTON_STYLUS_PRIMARY) != (buttonState & MotionEvent.BUTTON_STYLUS_PRIMARY) )
DemoGLSurfaceView.nativeMouseButtonsPressed(2, ((buttonStateNew & MotionEvent.BUTTON_STYLUS_PRIMARY) == 0) ? 0 : 1);
if( (buttonStateNew & MotionEvent.BUTTON_STYLUS_SECONDARY) != (buttonState & MotionEvent.BUTTON_STYLUS_SECONDARY) )
DemoGLSurfaceView.nativeMouseButtonsPressed(4, ((buttonStateNew & MotionEvent.BUTTON_STYLUS_SECONDARY) == 0) ? 0 : 1);
buttonState = buttonStateNew;
}
super.process(event);
}