本文整理汇总了Java中android.view.GestureDetector.setIsLongpressEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java GestureDetector.setIsLongpressEnabled方法的具体用法?Java GestureDetector.setIsLongpressEnabled怎么用?Java GestureDetector.setIsLongpressEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.GestureDetector
的用法示例。
在下文中一共展示了GestureDetector.setIsLongpressEnabled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initData
import android.view.GestureDetector; //导入方法依赖的package包/类
/**
* Initializes class data
*
* @param context
* the context
*/
private void initData(Context context) {
gestureDetector = new GestureDetector(context, gestureListener);
gestureDetector.setIsLongpressEnabled(false);
scroller = new Scroller(context);
mScale = getContext().getResources().getDisplayMetrics().density;
TEXT_SIZE *= mScale;
}
示例2: initData
import android.view.GestureDetector; //导入方法依赖的package包/类
/**
* Initializes class data
*
* @param context
* the context
*/
private void initData(Context context) {
gestureDetector = new GestureDetector(context, gestureListener);
gestureDetector.setIsLongpressEnabled(false);
LABEL_OFFSET = DensityUtil.dip2px(context, LABEL_OFFSET_DIP);
scroller = new Scroller(context);
}
示例3: WheelScroller
import android.view.GestureDetector; //导入方法依赖的package包/类
/**
* Constructor
* @param context the current context
* @param listener the scrolling listener
*/
public WheelScroller(Context context, ScrollingListener listener) {
gestureDetector = new GestureDetector(context, gestureListener);
gestureDetector.setIsLongpressEnabled(false);
scroller = new Scroller(context, new LinearInterpolator());
this.listener = listener;
this.context = context;
}
示例4: initLoopView
import android.view.GestureDetector; //导入方法依赖的package包/类
private void initLoopView(Context context) {
this.context = context;
handler = new MessageHandler(this);
gestureDetector = new GestureDetector(context, new LoopViewGestureListener(this));
gestureDetector.setIsLongpressEnabled(false);
isLoop = true;
totalScrollY = 0;
initPosition = -1;
initPaints();
}
示例5: initData
import android.view.GestureDetector; //导入方法依赖的package包/类
/**
* Initializes class data
*
* @param context
* the context
*/
private void initData(Context context) {
gestureDetector = new GestureDetector(context, gestureListener);
gestureDetector.setIsLongpressEnabled(false);
scroller = new Scroller(context);
}
示例6: DragSortController
import android.view.GestureDetector; //导入方法依赖的package包/类
/**
* By default, sorting is enabled, and removal is disabled.
*
* @param dslv The DSLV instance
* @param dragHandleId The resource id of the View that represents
* the drag handle in a list item.
*/
public DragSortController(DragSortListView dslv, int dragHandleId, int dragInitMode,
int removeMode, int clickRemoveId, int flingHandleId) {
super(dslv);
mDslv = dslv;
mDetector = new GestureDetector(dslv.getContext(), this);
mFlingRemoveDetector = new GestureDetector(dslv.getContext(), mFlingRemoveListener);
mFlingRemoveDetector.setIsLongpressEnabled(false);
mTouchSlop = ViewConfiguration.get(dslv.getContext()).getScaledTouchSlop();
mDragHandleId = dragHandleId;
mClickRemoveId = clickRemoveId;
mFlingHandleId = flingHandleId;
setRemoveMode(removeMode);
setDragInitMode(dragInitMode);
}
示例7: initAssistantField
import android.view.GestureDetector; //导入方法依赖的package包/类
/**
* 初始化 辅助字段
*/
private void initAssistantField() {
mAppContext = getContext().getApplicationContext();
// 获取屏幕宽高
DisplayMetrics dm = getResources().getDisplayMetrics();
screenWidth = dm.widthPixels;
screenHeight = dm.heightPixels;
Log.i(TAG, "initAssistantField: " + "screenWidth = " + screenWidth + ", screenHeight = " + screenHeight);
// 创建手势识别器
mGestureDetector = new GestureDetector(getContext(), this);
mGestureDetector.setIsLongpressEnabled(true);
mGestureDetector.setOnDoubleTapListener(this);
}
示例8: init
import android.view.GestureDetector; //导入方法依赖的package包/类
protected void init(Context context) {
setLayoutParams(new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
setLayerType(View.LAYER_TYPE_SOFTWARE, null);
setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_IME_MULTI_LINE
| InputType.TYPE_TEXT_FLAG_MULTI_LINE);
mGestureDetector = new GestureDetector(getContext(), this);
mGestureDetector.setIsLongpressEnabled(true);
mScroller = new Scroller(getContext(), null, false);
mWindowManager = (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE);
mRotation = mWindowManager.getDefaultDisplay().getRotation();
mDrawingRect = new Rect();
mLineBounds = new Rect();
mScrollMax = new Point();
mPaintNumbers = new Paint();
mPaintNumbers.setAntiAlias(true);
mPaintNumbers.setDither(false);
mPaintHighlight = new Paint();
mPaintHighlight.setStyle(Style.FILL);
mPadding = (int) (6.0f * context.getResources().getDisplayMetrics().density);
mScrollDirection = 0;
setHorizontallyScrolling(true);
addTextChangedListener(new EditTextChangeListener());
mUndoRedoHelper = new UndoRedoHelper(this);
mUndoRedoHelper.setMaxHistorySize(MAX_HISTORY_SIZE);
setOnKeyListener(this);
postInvalidate();
refreshDrawableState();
invalidateCharHeight();
}
示例9: initData
import android.view.GestureDetector; //导入方法依赖的package包/类
/**
* Initializes class data
*
* @param context the mContext
*/
private void initData(Context context) {
mContext = context;
gestureDetector = new GestureDetector(context, gestureListener);
gestureDetector.setIsLongpressEnabled(false);
scroller = new Scroller(context);
TEXT_SIZE = ToolUtils.dip2px(context, TEXT_SIZE);
ITEM_OFFSET = ToolUtils.dip2px(context, ITEM_OFFSET);
}
示例10: WheelScroller
import android.view.GestureDetector; //导入方法依赖的package包/类
/**
* Constructor
* @param context the current context
* @param listener the scrolling listener
*/
public WheelScroller(Context context, ScrollingListener listener) {
gestureDetector = new GestureDetector(context, gestureListener);
gestureDetector.setIsLongpressEnabled(false);
scroller = new Scroller(context);
this.listener = listener;
this.context = context;
}
示例11: WheelScroller
import android.view.GestureDetector; //导入方法依赖的package包/类
/**
* Constructor
*
* @param context
* the current context
* @param listener
* the scrolling listener
*/
public WheelScroller(Context context, ScrollingListener listener) {
gestureDetector = new GestureDetector(context, gestureListener);
gestureDetector.setIsLongpressEnabled(false);
scroller = new Scroller(context);
this.listener = listener;
this.context = context;
}
示例12: DragSortController
import android.view.GestureDetector; //导入方法依赖的package包/类
/**
* By default, sorting is enabled, and removal is disabled.
*
* @param dslv The DSLV instance
* @param dragHandleId The resource id of the View that represents
* the drag handle in a list item.
*/
public DragSortController(DragSortListView dslv, int dragHandleId, int dragInitMode,
int removeMode, int clickRemoveId, int flingHandleId) {
super(dslv);
mDslv = dslv;
mDetector = new GestureDetector(dslv.getContext(), this);
mFlingRemoveDetector = new GestureDetector(dslv.getContext(), mFlingRemoveListener);
mFlingRemoveDetector.setIsLongpressEnabled(false);
mTouchSlop = ViewConfiguration.get(dslv.getContext()).getScaledTouchSlop();
mDragHandleId = dragHandleId;
mClickRemoveId = clickRemoveId;
mFlingHandleId = flingHandleId;
setRemoveMode(removeMode);
setDragInitMode(dragInitMode);
}
示例13: generateGestureDetector
import android.view.GestureDetector; //导入方法依赖的package包/类
@Override
public GestureDetector generateGestureDetector(Context context, IPlayer player, IPlayerControlView controlView) {
GestureDetector gestureDetector = new GestureDetector(context.getApplicationContext(),
new TestOnDefaultGestureListener(player, controlView));
//解决长按屏幕后无法拖动的现象
gestureDetector.setIsLongpressEnabled(false);
return gestureDetector;
}
示例14: EdgeSwipeEventFilter
import android.view.GestureDetector; //导入方法依赖的package包/类
/**
* Creates a {@link EdgeSwipeEventFilter} captures event either in edge swipe gestures or
* propagate them.
* @param context A {@link Context} instance.
* @param host The {@link EventFilterHost} where the event is coming from.
* @param edgeSwipeHandler The {@link EdgeSwipeHandler} that is going to get notified.
*/
public EdgeSwipeEventFilter(
Context context, EventFilterHost host, EdgeSwipeHandler edgeSwipeHandler) {
super(context, host, false);
mEnableTabSwiping = TAB_SWIPING_ENABLED;
mScrollDirection = ScrollDirection.UNKNOWN;
mSwipeTimeConstantPx = SWIPE_TIME_CONSTANT_DP / mPxToDp;
mGestureDetector = new GestureDetector(context, new ViewScrollerGestureDetector());
mGestureDetector.setIsLongpressEnabled(true);
mEdgeSwipeHandler = edgeSwipeHandler;
}
示例15: initView
import android.view.GestureDetector; //导入方法依赖的package包/类
private void initView(Context context,AttributeSet attrs) {
TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.LoopView);
if (array != null) {
mTopBottomTextColor = array.getColor(R.styleable.LoopView_topBottomTextColor, 0xffafafaf);
mCenterTextColor = array.getColor(R.styleable.LoopView_centerTextColor, 0xff313131);
mCenterLineColor = array.getColor(R.styleable.LoopView_lineColor, 0xffc5c5c5);
mCanLoop = array.getBoolean(R.styleable.LoopView_canLoop, true);
mInitPosition = array.getInt(R.styleable.LoopView_initPosition, -1);
mTextSize = array.getDimensionPixelSize(R.styleable.LoopView_textSize, sp2px(context, 16));
//mDrawItemsCount只能为奇数 才能正确显示
mDrawItemsCount = array.getInt(R.styleable.LoopView_drawItemCount, 7);
if(mDrawItemsCount % 2 == 0){
if(mDrawItemsCount>=10){
mDrawItemsCount -= 1;
}else{
mDrawItemsCount += 1;
}
}
//确保绘制显示的item >= 1
if(mDrawItemsCount<3){
mDrawItemsCount = 3;
}
array.recycle();
}
lineSpacingMultiplier = 2.0F;//控制item高度
this.mContext = context;
mTextPaddingLeftRight = ConvertUtils.toDp(context,mTextPaddingLeftRight);
mOnGestureListener = new LoopViewGestureListener();
mCenterTopBottomTextPaint = new Paint();
mTopBottomTextPaint = new Paint();
mCenterTextPaint = new Paint();
mCenterLinePaint = new Paint();
if (Build.VERSION.SDK_INT >= 11) {
setLayerType(LAYER_TYPE_SOFTWARE, null);
}
mGestureDetector = new GestureDetector(context, mOnGestureListener);
mGestureDetector.setIsLongpressEnabled(false);
}