当前位置: 首页>>代码示例>>Java>>正文


Java InputDevice.SOURCE_CLASS_POINTER属性代码示例

本文整理汇总了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);
}
 
开发者ID:junchenChow,项目名称:exciting-app,代码行数:21,代码来源:AbsHListView.java

示例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);
}
 
开发者ID:archos-sa,项目名称:aos-MediaLib,代码行数:26,代码来源:CoverRoll3D.java

示例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);
}
 
开发者ID:Leone90,项目名称:RefreshRecyclerView,代码行数:17,代码来源:RefreshRecyclerView.java

示例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);
}
 
开发者ID:DIY-green,项目名称:AndroidStudyDemo,代码行数:22,代码来源:ZrcAbsListView.java

示例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);
}
 
开发者ID:kyze8439690,项目名称:StockAdapterView,代码行数:21,代码来源:AbsListView.java

示例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;
}
 
开发者ID:jrconlin,项目名称:mc_backup,代码行数:21,代码来源:JavaPanZoomController.java

示例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;
}
 
开发者ID:jzhu1224,项目名称:DeckView,代码行数:25,代码来源:DeckViewTouchHandler.java

示例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);
}
 
开发者ID:diedricm,项目名称:MapEver,代码行数:21,代码来源:LargeImageView.java

示例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);
}
 
开发者ID:sampoop23,项目名称:7788_ZrcListView,代码行数:22,代码来源:ZrcAbsListView.java

示例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 );
}
 
开发者ID:jonathangerbaud,项目名称:Klyph,代码行数:20,代码来源:AbsHListView.java

示例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);
}
 
开发者ID:Namir233,项目名称:ZrcListView,代码行数:23,代码来源:ZrcAbsListView.java

示例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);
}
 
开发者ID:openresearch,项目名称:android-chromium-view,代码行数:27,代码来源:ContentViewCore.java

示例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);
}
 
开发者ID:mogoweb,项目名称:chromium_webview,代码行数:27,代码来源:ContentViewCore.java

示例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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:29,代码来源:TerminalTextViewOverlay.java

示例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);
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:30,代码来源:PagedView.java


注:本文中的android.view.InputDevice.SOURCE_CLASS_POINTER属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。