當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。