本文整理汇总了Java中android.view.InputDevice.SOURCE_CLASS_POINTER属性的典型用法代码示例。如果您正苦于以下问题:Java InputDevice.SOURCE_CLASS_POINTER属性的具体用法?Java InputDevice.SOURCE_CLASS_POINTER怎么用?Java InputDevice.SOURCE_CLASS_POINTER使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.view.InputDevice
的用法示例。
在下文中一共展示了InputDevice.SOURCE_CLASS_POINTER属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onGenericMotionEvent
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1)
@Override
public boolean onGenericMotionEvent(MotionEvent event) {
if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) {
switch (event.getAction()) {
case MotionEvent.ACTION_SCROLL: {
if (mTouchMode == TOUCH_MODE_REST) {
final float hscroll = event
.getAxisValue(MotionEvent.AXIS_HSCROLL);
if (hscroll != 0) {
final int delta = (int) (hscroll * getHorizontalScrollFactor());
if (!trackMotionScroll(delta, delta)) {
return true;
}
}
}
}
}
}
return super.onGenericMotionEvent(event);
}
示例2: onGenericMotionEvent
@Override
public boolean onGenericMotionEvent(MotionEvent event) {
if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) {
switch (event.getAction()) {
case MotionEvent.ACTION_SCROLL: {
final float vscroll = event.getAxisValue(MotionEvent.AXIS_VSCROLL);
if(DBG) Log.d(TAG,"onGenericMotionEvent ACTION_SCROLL vscroll="+vscroll);
if (vscroll != 0) {
final int index = mLayout.getFrontCoverIndex();
int targetIndex;
if (index+vscroll<0) {
targetIndex=0;
} else if (index+vscroll >= mCovers.size()-1) {
targetIndex = mCovers.size()-1;
} else {
targetIndex = (int)(index+vscroll+0.5);
}
float targetScroll = mLayout.getScrollingPositionToCenterThisCover(targetIndex);
mAnimHandler.startScrollingAnimPosition(targetScroll, AnimHandler.SPEED_FAST);
}
}
}
}
return super.onGenericMotionEvent(event);
}
示例3: onGenericMotionEvent
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1)
@Override
public boolean onGenericMotionEvent(MotionEvent event) {
if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) {
switch (event.getAction()) {
case MotionEvent.ACTION_SCROLL: {
if (mTouchMode == TOUCH_MODE_REST) {
final float vscroll = event.getAxisValue(MotionEvent.AXIS_VSCROLL);
if (vscroll != 0 && !trackMotionScroll((int) vscroll)) {
return true;
}
}
}
}
}
return super.onGenericMotionEvent(event);
}
示例4: onGenericMotionEvent
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1)
@Override
public boolean onGenericMotionEvent(MotionEvent event) {
if (Build.VERSION.SDK_INT >= 12) {
if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) {
switch (event.getAction()) {
case MotionEvent.ACTION_SCROLL: {
if (mTouchMode == TOUCH_MODE_REST) {
final float vscroll = event.getAxisValue(MotionEvent.AXIS_VSCROLL);
if (vscroll != 0) {
final int delta = (int) (vscroll * getVerticalScrollFactor());
if (!trackMotionScroll(delta, delta)) {
return true;
}
}
}
}
}
}
}
return super.onGenericMotionEvent(event);
}
示例5: onGenericMotionEvent
@Override
public boolean onGenericMotionEvent(MotionEvent event) {
if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) {
switch (event.getAction()) {
case MotionEvent.ACTION_SCROLL:
if (mTouchMode == TOUCH_MODE_REST) {
final float vscroll
= MotionEventCompat.getAxisValue(event, MotionEventCompat.AXIS_VSCROLL);
if (vscroll != 0) {
final int delta = (int) (vscroll * ViewUtils.getVerticalScrollFactor(this));
if (!trackMotionScroll(delta, delta)) {
return true;
}
}
}
break;
}
}
return super.onGenericMotionEvent(event);
}
示例6: onMotionEvent
/** This function MUST be called on the UI thread */
@Override
public boolean onMotionEvent(MotionEvent event) {
if (Versions.preHCMR1) {
return false;
}
switch (event.getSource() & InputDevice.SOURCE_CLASS_MASK) {
case InputDevice.SOURCE_CLASS_POINTER:
switch (event.getAction() & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_SCROLL: return handlePointerScroll(event);
}
break;
case InputDevice.SOURCE_CLASS_JOYSTICK:
switch (event.getAction() & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_MOVE: return handleJoystickNav(event);
}
break;
}
return false;
}
示例7: onGenericMotionEvent
/**
* Handles generic motion events
*/
public boolean onGenericMotionEvent(MotionEvent ev) {
if ((ev.getSource() & InputDevice.SOURCE_CLASS_POINTER) ==
InputDevice.SOURCE_CLASS_POINTER) {
int action = ev.getAction();
switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_SCROLL:
// Find the front most task and scroll the next task to the front
float vScroll = ev.getAxisValue(MotionEvent.AXIS_VSCROLL);
if (vScroll > 0) {
if (mDeckView.ensureFocusedTask()) {
mDeckView.focusNextTask(true, false);
}
} else {
if (mDeckView.ensureFocusedTask()) {
mDeckView.focusNextTask(false, false);
}
}
return true;
}
}
return false;
}
示例8: onGenericMotionEvent
@Override
public boolean onGenericMotionEvent(MotionEvent event) {
if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0 &&
event.getAction() == MotionEvent.ACTION_SCROLL &&
event.getAxisValue(MotionEvent.AXIS_VSCROLL) != 0) {
float factor = event.getAxisValue(MotionEvent.AXIS_VSCROLL) < 0 ? 0.90f : 1.10f;
// Calculate pan offsetting.
float focusX = (event.getX() - getWidth() / 2) / zoomScale;
float focusY = (event.getY() - getHeight() / 2) / zoomScale;
float dx = focusX * (1 - factor);
float dy = focusY * (1 - factor);
float new_x = Float.isNaN(panCenterX) ? -dx : panCenterX - dx;
float new_y = Float.isNaN(panCenterY) ? -dy : panCenterY - dy;
setPanZoom(new_x, new_y, zoomScale * factor);
return true;
}
return super.onGenericMotionEvent(event);
}
示例9: onGenericMotionEvent
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1)
@Override
public boolean onGenericMotionEvent(MotionEvent event) {
if (APIUtil.isSupport(12)) {
if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) {
switch (event.getAction()) {
case MotionEvent.ACTION_SCROLL: {
if (mTouchMode == TOUCH_MODE_REST) {
final float vscroll = event.getAxisValue(MotionEvent.AXIS_VSCROLL);
if (vscroll != 0) {
final int delta = (int) (vscroll * getVerticalScrollFactor());
if (!trackMotionScroll(delta, delta)) {
return true;
}
}
}
}
}
}
}
return super.onGenericMotionEvent(event);
}
示例10: onGenericMotionEvent
@TargetApi(12)
@Override
public boolean onGenericMotionEvent( MotionEvent event ) {
if ( ( event.getSource() & InputDevice.SOURCE_CLASS_POINTER ) != 0 ) {
switch ( event.getAction() ) {
case MotionEvent.ACTION_SCROLL: {
if ( mTouchMode == TOUCH_MODE_REST ) {
final float hscroll = event.getAxisValue( MotionEvent.AXIS_HSCROLL );
if ( hscroll != 0 ) {
final int delta = (int) ( hscroll * getHorizontalScrollFactor() );
if ( !trackMotionScroll( delta, delta ) ) {
return true;
}
}
}
}
}
}
return super.onGenericMotionEvent( event );
}
示例11: onGenericMotionEvent
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1)
@Override
public boolean onGenericMotionEvent(MotionEvent event) {
if (APIUtil.isSupport(12)) {
if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) {
switch (event.getAction()) {
case MotionEvent.ACTION_SCROLL: {
if (mTouchMode == TOUCH_MODE_REST) {
final float vscroll = event
.getAxisValue(MotionEvent.AXIS_VSCROLL);
if (vscroll != 0) {
final int delta = (int) (vscroll * getVerticalScrollFactor());
if (!trackMotionScroll(delta, delta)) {
return true;
}
}
}
}
}
}
}
return super.onGenericMotionEvent(event);
}
示例12: onGenericMotionEvent
/**
* @see View#onGenericMotionEvent(MotionEvent)
*/
public boolean onGenericMotionEvent(MotionEvent event) {
if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) {
switch (event.getAction()) {
case MotionEvent.ACTION_SCROLL:
nativeSendMouseWheelEvent(mNativeContentViewCore, event.getEventTime(),
event.getX(), event.getY(),
event.getAxisValue(MotionEvent.AXIS_VSCROLL));
mContainerView.removeCallbacks(mFakeMouseMoveRunnable);
// Send a delayed onMouseMove event so that we end
// up hovering over the right position after the scroll.
final MotionEvent eventFakeMouseMove = MotionEvent.obtain(event);
mFakeMouseMoveRunnable = new Runnable() {
@Override
public void run() {
onHoverEvent(eventFakeMouseMove);
}
};
mContainerView.postDelayed(mFakeMouseMoveRunnable, 250);
return true;
}
}
return mContainerViewInternals.super_onGenericMotionEvent(event);
}
示例13: onGenericMotionEvent
/**
* @see View#onGenericMotionEvent(MotionEvent)
*/
public boolean onGenericMotionEvent(MotionEvent event) {
if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) {
switch (event.getAction()) {
case MotionEvent.ACTION_SCROLL:
nativeSendMouseWheelEvent(mNativeContentViewCore, event.getEventTime(),
event.getX(), event.getY(),
event.getAxisValue(MotionEvent.AXIS_VSCROLL));
mContainerView.removeCallbacks(mFakeMouseMoveRunnable);
// Send a delayed onMouseMove event so that we end
// up hovering over the right position after the scroll.
final MotionEvent eventFakeMouseMove = MotionEvent.obtain(event);
mFakeMouseMoveRunnable = new Runnable() {
@Override
public void run() {
onHoverEvent(eventFakeMouseMove);
}
};
mContainerView.postDelayed(mFakeMouseMoveRunnable, 250);
return true;
}
}
return mContainerViewInternals.super_onGenericMotionEvent(event);
}
示例14: onGenericMotionEvent
@Override
@TargetApi(12)
public boolean onGenericMotionEvent(MotionEvent event) {
if ((MotionEventCompat.getSource(event) & InputDevice.SOURCE_CLASS_POINTER) != 0) {
switch (event.getAction()) {
case MotionEvent.ACTION_SCROLL:
// Process scroll wheel movement:
float yDistance = MotionEventCompat.getAxisValue(event, MotionEvent.AXIS_VSCROLL);
vt320 vtBuffer = (vt320) terminalView.bridge.buffer;
boolean mouseReport = vtBuffer.isMouseReportEnabled();
if (mouseReport) {
int row = (int) Math.floor(event.getY() / terminalView.bridge.charHeight);
int col = (int) Math.floor(event.getX() / terminalView.bridge.charWidth);
vtBuffer.mouseWheel(
yDistance > 0,
col,
row,
(event.getMetaState() & KeyEvent.META_CTRL_ON) != 0,
(event.getMetaState() & KeyEvent.META_SHIFT_ON) != 0,
(event.getMetaState() & KeyEvent.META_META_ON) != 0);
return true;
}
}
}
return super.onGenericMotionEvent(event);
}
示例15: onGenericMotionEvent
@Override
public boolean onGenericMotionEvent(MotionEvent event) {
if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) {
switch (event.getAction()) {
case MotionEvent.ACTION_SCROLL: {
// Handle mouse (or ext. device) by shifting the page depending on the scroll
final float vscroll;
final float hscroll;
if ((event.getMetaState() & KeyEvent.META_SHIFT_ON) != 0) {
vscroll = 0;
hscroll = event.getAxisValue(MotionEvent.AXIS_VSCROLL);
} else {
vscroll = -event.getAxisValue(MotionEvent.AXIS_VSCROLL);
hscroll = event.getAxisValue(MotionEvent.AXIS_HSCROLL);
}
if (hscroll != 0 || vscroll != 0) {
boolean isForwardScroll = mIsRtl ? (hscroll < 0 || vscroll < 0)
: (hscroll > 0 || vscroll > 0);
if (isForwardScroll) {
scrollRight();
} else {
scrollLeft();
}
return true;
}
}
}
}
return super.onGenericMotionEvent(event);
}