android.view.GestureDetector#setIsLongpressEnabled ( )源码实例Demo

下面列出了android.view.GestureDetector#setIsLongpressEnabled ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: MNVideoPlayer   文件: MNViderPlayer.java
private void initGesture() {
    gesture_volume_layout = (RelativeLayout) findViewById(R.id.mn_gesture_volume_layout);
    geture_tv_volume_percentage = (TextView) findViewById(R.id.mn_gesture_tv_volume_percentage);
    geture_tv_volume_percentage_progress = (ProgressBar) findViewById(R.id.mn_gesture_tv_volume_percentage_progress);
    gesture_iv_player_volume = (ImageView) findViewById(R.id.mn_gesture_iv_player_volume);

    gesture_progress_layout = (RelativeLayout) findViewById(R.id.mn_gesture_progress_layout);
    geture_tv_progress_time = (TextView) findViewById(R.id.mn_gesture_tv_progress_time);
    gesture_iv_progress = (ImageView) findViewById(R.id.mn_gesture_iv_progress);

    //亮度的布局
    gesture_light_layout = (RelativeLayout) findViewById(R.id.mn_gesture_light_layout);
    geture_tv_light_percentage = (TextView) findViewById(R.id.mn_geture_tv_light_percentage);
    geture_tv_light_percentageProgress = (ProgressBar) findViewById(R.id.mn_geture_tv_light_percentage_progress);

    gesture_volume_layout.setVisibility(View.GONE);
    gesture_progress_layout.setVisibility(View.GONE);
    gesture_light_layout.setVisibility(View.GONE);

    gestureDetector = new GestureDetector(getContext(), this);
    setLongClickable(true);
    gestureDetector.setIsLongpressEnabled(true);
    audiomanager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
    maxVolume = audiomanager.getStreamMaxVolume(AudioManager.STREAM_MUSIC); // 获取系统最大音量
    currentVolume = audiomanager.getStreamVolume(AudioManager.STREAM_MUSIC); // 获取当前值
}
 
源代码2 项目: wearmouse   文件: TouchpadGestureDetector.java
TouchpadGestureListener(Context context) {
    gestureDetector = new GestureDetector(context, this);
    gestureDetector.setIsLongpressEnabled(false);

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    final int touchSlop = configuration.getScaledTouchSlop();
    slopSquare = touchSlop * touchSlop;
    tapTimeout = ViewConfiguration.getTapTimeout();
}
 
源代码3 项目: Lassi-Android   文件: ScrollGestureLayout.java
@Override
protected void onInitialize(@NonNull Context context) {
    super.onInitialize(context);
    mPoints = new PointF[]{new PointF(0, 0), new PointF(0, 0)};
    mDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() {

        @Override
        public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
            boolean horizontal;
            LOG.i("onScroll:", "distanceX=" + distanceX, "distanceY=" + distanceY);
            if (e1 == null || e2 == null) return false; // Got some crashes about this.
            if (e1.getX() != getPoints()[0].x || e1.getY() != getPoints()[0].y) {
                // First step. We choose now if it's a vertical or horizontal scroll, and
                // stick to it for the whole gesture.
                horizontal = Math.abs(distanceX) >= Math.abs(distanceY);
                setGestureType(horizontal ? Gesture.SCROLL_HORIZONTAL : Gesture.SCROLL_VERTICAL);
                getPoints()[0].set(e1.getX(), e1.getY());
            } else {
                // Not the first step. We already defined the type.
                horizontal = getGestureType() == Gesture.SCROLL_HORIZONTAL;
            }
            getPoints()[1].set(e2.getX(), e2.getY());
            mFactor = horizontal ? (distanceX / getWidth()) : (distanceY / getHeight());
            mFactor = horizontal ? -mFactor : mFactor; // When vertical, up = positive
            mNotify = true;
            return true;
        }
    });

    mDetector.setIsLongpressEnabled(false); // Looks important.
}
 
源代码4 项目: NewsMe   文件: VDVideoControlPanelContainer.java
private void init(Context context, int level) {
	mContext = context;
	mLevel = level;

	mVDVideoControlPanelGesture = new VDVideoControlPanelGesture(context,
			level);
	mGestureDetector = new GestureDetector(context,
			mVDVideoControlPanelGesture);
	mGestureDetector.setIsLongpressEnabled(false);
}
 
源代码5 项目: androidWheelView   文件: LoopView.java
private void initLoopView(Context context, AttributeSet attributeset) {
    this.context = context;
    handler = new MessageHandler(this);
    flingGestureDetector = new GestureDetector(context, new LoopViewGestureListener(this));
    flingGestureDetector.setIsLongpressEnabled(false);

    TypedArray typedArray = context.obtainStyledAttributes(attributeset, R.styleable.LoopView);
    if (typedArray != null) {
        textSize = typedArray.getInteger(R.styleable.LoopView_awv_textsize, DEFAULT_TEXT_SIZE);
        textSize = (int) (Resources.getSystem().getDisplayMetrics().density * textSize);
        lineSpacingMultiplier = typedArray.getFloat(R.styleable.LoopView_awv_lineSpace, DEFAULT_LINE_SPACE);
        centerTextColor = typedArray.getInteger(R.styleable.LoopView_awv_centerTextColor, 0xff313131);
        outerTextColor = typedArray.getInteger(R.styleable.LoopView_awv_outerTextColor, 0xffafafaf);
        dividerColor = typedArray.getInteger(R.styleable.LoopView_awv_dividerTextColor, 0xffc5c5c5);
        itemsVisibleCount =
                typedArray.getInteger(R.styleable.LoopView_awv_itemsVisibleCount, DEFAULT_VISIBIE_ITEMS);
        if (itemsVisibleCount % 2 == 0) {
            itemsVisibleCount = DEFAULT_VISIBIE_ITEMS;
        }
        isLoop = typedArray.getBoolean(R.styleable.LoopView_awv_isLoop, true);
        typedArray.recycle();
    }

    drawingStrings=new HashMap<>();
    totalScrollY = 0;
    initPosition = -1;
}
 
源代码6 项目: RadarChart   文件: RadarView.java
private void init() {
    mRadarPath = new Path();
    mAnimeUtil = new AnimeUtil(this);
    mScroller = new Scroller(mContext);
    mDetector = new GestureDetector(mContext, new GestureListener());
    mDetector.setIsLongpressEnabled(false);

    mRadarData = new ArrayList<>();
    mLayerColor = new ArrayList<>();
    initLayerColor();

    mRadarLinePaint = new Paint();
    mLayerPaint = new Paint();
    mValuePaint = new Paint();
    mVertexTextPaint = new TextPaint();
    mValueTextPaint = new TextPaint();
    mCenterTextPaint = new TextPaint();

    mRadarLinePaint.setAntiAlias(true);
    mLayerPaint.setAntiAlias(true);
    mVertexTextPaint.setAntiAlias(true);
    mCenterTextPaint.setAntiAlias(true);
    mValueTextPaint.setAntiAlias(true);
    mValuePaint.setAntiAlias(true);
    mValueTextPaint.setFakeBoldText(true);

    mVertexIconRect = new RectF();
}
 
源代码7 项目: DongWeather   文件: DragSortController.java
/**
 * 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);
}
 
源代码8 项目: AndroidFrame   文件: WheelView.java
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();
}
 
public EmojiPageKeyboardView(final Context context, final AttributeSet attrs,
        final int defStyle) {
    super(context, attrs, defStyle);
    mGestureDetector = new GestureDetector(context, this);
    mGestureDetector.setIsLongpressEnabled(false /* isLongpressEnabled */);
    mHandler = new Handler();
}
 
源代码10 项目: KUtils-master   文件: WheelView.java
/**
 * 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);
}
 
源代码11 项目: KUtils   文件: WheelView.java
/**
 * 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);
}
 
源代码12 项目: MiBandDecompiled   文件: ChartScroller.java
public ChartScroller(Context context, ScrollingListener scrollinglistener)
{
    n = new c(this);
    d = context;
    c = scrollinglistener;
    e = new GestureDetector(context, n);
    e.setIsLongpressEnabled(false);
    f = new Scroller(context);
    m = new b(this);
}
 
源代码13 项目: TimeSelector   文件: WheelView.java
/**
 * Initializes class data
 * 
 * @param context
 *            the context
 */
private void initData(Context context) {
	gestureDetector = new GestureDetector(context, gestureListener);
	gestureDetector.setIsLongpressEnabled(false);
	mContext = context;
	scroller = new Scroller(context);
}
 
源代码14 项目: RxTools-master   文件: WheelScroller.java
/**
 * 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;
}
 
源代码15 项目: CharacterPickerView   文件: LoopView.java
private void initLoopView(Context context, AttributeSet attributeset) {
    this.context = context;
    handler = new MessageHandler(this);
    flingGestureDetector = new GestureDetector(context, new LoopViewGestureListener(this));
    flingGestureDetector.setIsLongpressEnabled(false);

    TypedArray typedArray = context.obtainStyledAttributes(attributeset, R.styleable.LoopView);
    if (typedArray != null) {
        textSize = typedArray.getInteger(R.styleable.LoopView_awv_textsize, DEFAULT_TEXT_SIZE);
        textSize = (int) (Resources.getSystem().getDisplayMetrics().density * textSize);
        lineSpacingMultiplier = typedArray.getFloat(R.styleable.LoopView_awv_lineSpace, DEFAULT_LINE_SPACE);
        centerTextColor = typedArray.getInteger(R.styleable.LoopView_awv_centerTextColor, 0xff313131);
        outerTextColor = typedArray.getInteger(R.styleable.LoopView_awv_outerTextColor, 0xffafafaf);
        dividerColor = typedArray.getInteger(R.styleable.LoopView_awv_dividerTextColor, 0xffc5c5c5);
        itemsVisibleCount =
                typedArray.getInteger(R.styleable.LoopView_awv_itemsVisibleCount, DEFAULT_VISIBIE_ITEMS);
        if (itemsVisibleCount % 2 == 0) {
            itemsVisibleCount = DEFAULT_VISIBIE_ITEMS;
        }
        isLoop = typedArray.getBoolean(R.styleable.LoopView_awv_isLoop, true);
        typedArray.recycle();
    }

    drawingStrings = new String[itemsVisibleCount];

    totalScrollY = 0;
    initPosition = -1;
}
 
源代码16 项目: Mupdf   文件: WheelScroller.java
/**
 * 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;
}
 
源代码17 项目: CoolClock   文件: WheelScroller.java
/**
 * 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;
}
 
源代码18 项目: phphub-android   文件: LoopView.java
private void d() {
    if (arrayList == null) {
        return;
    }
    paintA = new Paint();
    paintA.setColor(colorGray);
    paintA.setAntiAlias(true);
    paintA.setTypeface(Typeface.MONOSPACE);
    paintA.setTextSize(textSize);
    paintB = new Paint();
    paintB.setColor(colorBlack);
    paintB.setAntiAlias(true);
    paintB.setTextScaleX(1.05F);
    paintB.setTypeface(Typeface.MONOSPACE);
    paintB.setTextSize(textSize);
    paintC = new Paint();
    paintC.setColor(colorGrayLight);
    paintC.setAntiAlias(true);
    paintC.setTypeface(Typeface.MONOSPACE);
    paintC.setTextSize(textSize);
    if (android.os.Build.VERSION.SDK_INT >= 11) {
        setLayerType(1, null);
    }
    gestureDetector = new GestureDetector(context, simpleOnGestureListener);
    gestureDetector.setIsLongpressEnabled(false);
    e();
    t = (int) ((float) h * l * (float) (r - 1));
    s = (int) ((double) (t * 2) / Math.PI);
    u = (int) ((double) t / Math.PI);
    v = g + textSize;
    n = (int) (((float) s - l * (float) h) / 2.0F);
    o = (int) (((float) s + l * (float) h) / 2.0F);
    if (positon == -1) {
        if (isLoop) {
            positon = (arrayList.size() + 1) / 2;
        } else {
            positon = 0;
        }
    }
    p = positon;
}
 
源代码19 项目: YCAudioPlayer   文件: YCLrcCustomView.java
private void initScrollAndListener() {
    //创建手势滑动监听器
    mGestureDetector = new GestureDetector(getContext(), mSimpleOnGestureListener);
    mGestureDetector.setIsLongpressEnabled(false);
    mScroller = new Scroller(getContext());
}
 
源代码20 项目: CodeEditor   文件: TouchNavigationMethod.java
public TouchNavigationMethod(FreeScrollingTextField textField) {
    _textField = textField;
    _gestureDetector = new GestureDetector(textField.getContext(), this);
    _gestureDetector.setIsLongpressEnabled(true);
}