Java Code Examples for android.view.GestureDetector#setIsLongpressEnabled()

The following examples show how to use android.view.GestureDetector#setIsLongpressEnabled() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MNViderPlayer.java    From MNVideoPlayer with GNU General Public License v3.0 6 votes vote down vote up
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); // 获取当前值
}
 
Example 2
Source File: EmojiPageKeyboardView.java    From AOSP-Kayboard-7.1.2 with Apache License 2.0 5 votes vote down vote up
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();
}
 
Example 3
Source File: WheelScroller.java    From CoolClock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 4
Source File: WheelScroller.java    From Mupdf with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 5
Source File: LoopView.java    From CharacterPickerView with GNU General Public License v3.0 5 votes vote down vote up
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;
}
 
Example 6
Source File: WheelScroller.java    From RxTools-master with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 7
Source File: WheelView.java    From TimeSelector with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example 8
Source File: ChartScroller.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example 9
Source File: WheelView.java    From KUtils with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example 10
Source File: WheelView.java    From KUtils-master with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example 11
Source File: TouchpadGestureDetector.java    From wearmouse with Apache License 2.0 5 votes vote down vote up
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();
}
 
Example 12
Source File: WheelView.java    From AndroidFrame with Apache License 2.0 5 votes vote down vote up
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();
}
 
Example 13
Source File: DragSortController.java    From DongWeather with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example 14
Source File: RadarView.java    From RadarChart with Apache License 2.0 5 votes vote down vote up
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();
}
 
Example 15
Source File: LoopView.java    From androidWheelView with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 16
Source File: VDVideoControlPanelContainer.java    From NewsMe with Apache License 2.0 5 votes vote down vote up
private void init(Context context, int level) {
	mContext = context;
	mLevel = level;

	mVDVideoControlPanelGesture = new VDVideoControlPanelGesture(context,
			level);
	mGestureDetector = new GestureDetector(context,
			mVDVideoControlPanelGesture);
	mGestureDetector.setIsLongpressEnabled(false);
}
 
Example 17
Source File: ScrollGestureLayout.java    From Lassi-Android with MIT License 5 votes vote down vote up
@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.
}
 
Example 18
Source File: TouchNavigationMethod.java    From CodeEditor with Apache License 2.0 4 votes vote down vote up
public TouchNavigationMethod(FreeScrollingTextField textField) {
    _textField = textField;
    _gestureDetector = new GestureDetector(textField.getContext(), this);
    _gestureDetector.setIsLongpressEnabled(true);
}
 
Example 19
Source File: YCLrcCustomView.java    From YCAudioPlayer with Apache License 2.0 4 votes vote down vote up
private void initScrollAndListener() {
    //创建手势滑动监听器
    mGestureDetector = new GestureDetector(getContext(), mSimpleOnGestureListener);
    mGestureDetector.setIsLongpressEnabled(false);
    mScroller = new Scroller(getContext());
}
 
Example 20
Source File: LoopView.java    From phphub-android with Apache License 2.0 4 votes vote down vote up
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;
}