android.support.v4.view.GestureDetectorCompat Java Examples
The following examples show how to use
android.support.v4.view.GestureDetectorCompat.
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: Attacher.java From PicKing with Apache License 2.0 | 6 votes |
public Attacher(DraweeView<GenericDraweeHierarchy> draweeView) { mDraweeView = new WeakReference<>(draweeView); draweeView.getHierarchy().setActualImageScaleType(ScalingUtils.ScaleType.FIT_CENTER); draweeView.setOnTouchListener(this); mScaleDragDetector = new ScaleDragDetector(draweeView.getContext(), this); mGestureDetector = new GestureDetectorCompat(draweeView.getContext(), new GestureDetector.SimpleOnGestureListener() { @Override public void onLongPress(MotionEvent e) { super.onLongPress(e); if (null != mLongClickListener) { mLongClickListener.onLongClick(getDraweeView()); } } }); mGestureDetector.setOnDoubleTapListener(new DefaultOnDoubleTapListener(this)); }
Example #2
Source File: SimpleClickListener.java From NIM_Android_UIKit with MIT License | 6 votes |
@Override public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) { if (!shouldDetectGesture()) { return false; // 拦截手势检测 } // 手势检测 if (recyclerView == null) { this.recyclerView = rv; this.baseAdapter = (T) recyclerView.getAdapter(); mGestureDetector = new GestureDetectorCompat(recyclerView.getContext(), new ItemTouchHelperGestureListener(recyclerView)); } if (!mGestureDetector.onTouchEvent(e) && e.getActionMasked() == MotionEvent.ACTION_UP && mIsShowPress) { if (mPressedView != null) { BaseViewHolder vh = (BaseViewHolder) recyclerView.getChildViewHolder(mPressedView); if (vh == null || vh.getItemViewType() != IRecyclerView.LOADING_VIEW || vh.getItemViewType() != IRecyclerView.FETCHING_VIEW) { mPressedView.setPressed(false); } mPressedView = null; } mIsShowPress = false; mIsPrepressed = false; } return false; }
Example #3
Source File: Attacher.java From TLint with Apache License 2.0 | 6 votes |
public Attacher(DraweeView<GenericDraweeHierarchy> draweeView) { mDraweeView = new WeakReference<>(draweeView); draweeView.getHierarchy().setActualImageScaleType(ScalingUtils.ScaleType.FIT_CENTER); draweeView.setOnTouchListener(this); mScaleDragDetector = new ScaleDragDetector(draweeView.getContext(), this); mGestureDetector = new GestureDetectorCompat(draweeView.getContext(), new GestureDetector.SimpleOnGestureListener() { @Override public void onLongPress(MotionEvent e) { super.onLongPress(e); if (null != mLongClickListener) { mLongClickListener.onLongClick(getDraweeView()); } } }); mGestureDetector.setOnDoubleTapListener(new DefaultOnDoubleTapListener(this)); }
Example #4
Source File: CalendarFragment.java From narrate-android with Apache License 2.0 | 6 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mLandscape = getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE; mGestureDetector = new GestureDetectorCompat(getActivity(), new GestureListener()); if ( mLandscape ) { mainActivity.mViewPagerListeners.add(this); } if ( savedInstanceState != null ) { long date = savedInstanceState.getLong(SAVE_DATE, -1); if ( date > 0 ) mCalendar.setTimeInMillis(date); } }
Example #5
Source File: DraggableSquareView.java From Flora with MIT License | 6 votes |
public DraggableSquareView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); mDragHelper = ViewDragHelper .create(this, 10f, new DragHelperCallback()); moveDetector = new GestureDetectorCompat(context, new MoveDetector()); moveDetector.setIsLongpressEnabled(false); // 不能处理长按事件,否则违背最初设计的初衷 spaceInterval = (int) getResources().getDimension(R.dimen.drag_square_interval); // 小方块之间的间隔 // 滑动的距离阈值由系统提供 ViewConfiguration configuration = ViewConfiguration.get(getContext()); mTouchSlop = configuration.getScaledTouchSlop(); anchorHandler = new Handler() { @Override public void handleMessage(Message msg) { if (draggingView != null) { // 开始移动重心的动画 draggingView.startAnchorAnimation(); } } }; }
Example #6
Source File: DragLayout.java From timecat with Apache License 2.0 | 6 votes |
public DragLayout(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); TypedArray typedArray = context.obtainStyledAttributes(attrs, dragLayout, 0, 0); bottomDragVisibleHeight = (int) typedArray.getDimension(R.styleable.dragLayout_bottomDragVisibleHeight, 0); bottomExtraIndicatorHeight = (int) typedArray.getDimension(R.styleable.dragLayout_bottomExtraIndicatorHeight, 0); typedArray.recycle(); mDragHelper = ViewDragHelper .create(this, 10f, new DragHelperCallback()); mDragHelper.setEdgeTrackingEnabled(ViewDragHelper.EDGE_TOP); moveDetector = new GestureDetectorCompat(context, new MoveDetector()); moveDetector.setIsLongpressEnabled(false); // 不处理长按事件 // 滑动的距离阈值由系统提供 ViewConfiguration configuration = ViewConfiguration.get(getContext()); mTouchSlop = configuration.getScaledTouchSlop(); }
Example #7
Source File: SwipeRevealLayout.java From SwipeRevealLayoutExample with MIT License | 6 votes |
private void init(Context context, AttributeSet attrs) { if (attrs != null && context != null) { TypedArray a = context.getTheme().obtainStyledAttributes( attrs, R.styleable.SwipeRevealLayout, 0, 0 ); mDragEdge = a.getInteger(R.styleable.SwipeRevealLayout_dragFromEdge, DRAG_EDGE_LEFT); mMode = MODE_NORMAL; mMinFlingVelocity = DEFAULT_MIN_FLING_VELOCITY; mMinDistRequestDisallowParent = DEFAULT_MIN_DIST_REQUEST_DISALLOW_PARENT; } mDragHelper = ViewDragHelper.create(this, 1.0f, mDragHelperCallback); mDragHelper.setEdgeTrackingEnabled(ViewDragHelper.EDGE_ALL); mGestureDetector = new GestureDetectorCompat(context, mGestureListener); }
Example #8
Source File: MainActivity.java From DGameDetail with Apache License 2.0 | 6 votes |
/** * 初始化参数 */ private void initParams() { mDetector = new GestureDetectorCompat(this, new SimpleGestureAction()); mStateBarH = AndroidUtils.getStatusBarHeight(this); mHeadH = (int) getResources().getDimension(R.dimen.game_detail_head_height); mBarH = (int) getResources().getDimension(R.dimen.tool_bar_height); mScreenH = AndroidUtils.getScreenParams(this)[1]; mNBarH = AndroidUtils.getNavigationBarHeight(this); mTopL = -mHeadH + mBarH; mCenterL = DensityUtils.dp2px(150); mBottomL = mScreenH - mStateBarH - mNBarH - mHeadH + mBarH; mRootView = findViewById(android.R.id.content); //处理4.4之后状态栏 if (AndroidVersionUtil.hasKitKat()) { mTemp.setVisibility(View.VISIBLE); mToolBar.setTranslationY(mStateBarH); mTemp.getLayoutParams().height = mStateBarH; } else { mTemp.setVisibility(View.GONE); } }
Example #9
Source File: Attacher.java From SprintNBA with Apache License 2.0 | 6 votes |
public Attacher(DraweeView<GenericDraweeHierarchy> draweeView) { mDraweeView = new WeakReference<>(draweeView); draweeView.getHierarchy().setActualImageScaleType(ScalingUtils.ScaleType.FIT_CENTER); draweeView.setOnTouchListener(this); mScaleDragDetector = new ScaleDragDetector(draweeView.getContext(), this); mGestureDetector = new GestureDetectorCompat(draweeView.getContext(), new GestureDetector.SimpleOnGestureListener() { @Override public void onLongPress(MotionEvent e) { super.onLongPress(e); if (null != mLongClickListener) { mLongClickListener.onLongClick(getDraweeView()); } } }); mGestureDetector.setOnDoubleTapListener(new DefaultOnDoubleTapListener(this)); }
Example #10
Source File: MinuteChartView.java From KChartView with Apache License 2.0 | 6 votes |
private void init() { mDetector = new GestureDetectorCompat(getContext(), this); mTopPadding = dp2px(mTopPadding); mBottomPadding = dp2px(mBottomPadding); mTextSize = sp2px(mTextSize); mVolumeHeight=dp2px(mVolumeHeight); mGridPaint.setColor(Color.parseColor("#353941")); mGridPaint.setStrokeWidth(dp2px(1)); mTextPaint.setColor(Color.parseColor("#B1B2B6")); mTextPaint.setTextSize(mTextSize); mTextPaint.setStrokeWidth(dp2px(0.5f)); mAvgPaint.setColor(Color.parseColor("#90A901")); mAvgPaint.setStrokeWidth(dp2px(0.5f)); mAvgPaint.setTextSize(mTextSize); mPricePaint.setColor(Color.parseColor("#FF6600")); mPricePaint.setStrokeWidth(dp2px(0.5f)); mPricePaint.setTextSize(mTextSize); mVolumePaintGreen.setColor(ContextCompat.getColor(getContext(), R.color.chart_green)); mVolumePaintRed.setColor(ContextCompat.getColor(getContext(),R.color.chart_red)); mBackgroundColor =Color.parseColor("#202326"); mBackgroundPaint.setColor(mBackgroundColor); mVolumeFormatter=new BigValueFormatter(); }
Example #11
Source File: BaseKChartView.java From KChartView with Apache License 2.0 | 6 votes |
private void init() { setWillNotDraw(false); mDetector = new GestureDetectorCompat(getContext(), this); mScaleDetector = new ScaleGestureDetector(getContext(), this); mTopPadding = (int) getResources().getDimension(R.dimen.chart_top_padding); mBottomPadding = (int)getResources().getDimension(R.dimen.chart_bottom_padding); mKChartTabView = new KChartTabView(getContext()); addView(mKChartTabView, new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); mKChartTabView.setOnTabSelectListener(new KChartTabView.TabSelectListener() { @Override public void onTabSelected(int type) { setChildDraw(type); } }); mAnimator = ValueAnimator.ofFloat(0f, 1f); mAnimator.setDuration(mAnimationDuration); mAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { invalidate(); } }); }
Example #12
Source File: SwipeRevealLayout.java From SwipeRevealLayout with MIT License | 6 votes |
private void init(Context context, AttributeSet attrs) { if (attrs != null && context != null) { TypedArray a = context.getTheme().obtainStyledAttributes( attrs, R.styleable.SwipeRevealLayout, 0, 0 ); mDragEdge = a.getInteger(R.styleable.SwipeRevealLayout_dragEdge, DRAG_EDGE_LEFT); mMinFlingVelocity = a.getInteger(R.styleable.SwipeRevealLayout_flingVelocity, DEFAULT_MIN_FLING_VELOCITY); mMode = a.getInteger(R.styleable.SwipeRevealLayout_mode, MODE_NORMAL); mMinDistRequestDisallowParent = a.getDimensionPixelSize( R.styleable.SwipeRevealLayout_minDistRequestDisallowParent, dpToPx(DEFAULT_MIN_DIST_REQUEST_DISALLOW_PARENT) ); } mDragHelper = ViewDragHelper.create(this, 1.0f, mDragHelperCallback); mDragHelper.setEdgeTrackingEnabled(ViewDragHelper.EDGE_ALL); mGestureDetector = new GestureDetectorCompat(context, mGestureListener); }
Example #13
Source File: WebsiteDetailFragment.java From Gazetti_Newspaper_Reader with MIT License | 5 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); dataSource = new BookmarkDataSource(getActivity()); dataSource.open(); setRetainInstance(true); try { if(getArguments()!=null){ npNameString = getArguments().getString("npName"); catNameString = getArguments().getString("catName"); actionBarColor = getArguments().getInt("actionBarColor"); if (getArguments().containsKey(HEADLINE_CLICKED)) { mArticleHeadline = getArguments().getString(HEADLINE_CLICKED); mArticleURL = NewsAdapter.linkMap.get(mArticleHeadline); mArticlePubDate = NewsAdapter.pubDateMap.get(mArticleHeadline); } else { Crashlytics.log("Argument contains key -- "+HEADLINE_CLICKED+"--"+(getArguments().containsKey(HEADLINE_CLICKED))); } } else { Crashlytics.log("Get Arguments is null -- "+(null==getArguments())); } } catch (Exception e) { Crashlytics.log("Get Arguments is null -- "+(null==getArguments())); Crashlytics.log("Argument contains key -- "+HEADLINE_CLICKED+"--"+(getArguments().containsKey(HEADLINE_CLICKED))); Crashlytics.log("Null -- " +(npNameString==null) +(catNameString==null) +(actionBarColor==0) +(mArticleHeadline==null) +(mArticleURL==null) +(mArticlePubDate==null) ); } mDetector = new GestureDetectorCompat(getActivity(), new MyGestureListener()); slide_down = AnimationUtils.loadAnimation(getActivity(), R.anim.slide_down); }
Example #14
Source File: NotificationView.java From Android-Notification with Apache License 2.0 | 5 votes |
void initialize(NotificationHandler handler) { TAG += "@" + handler.toSimpleString(); mContext = getContext(); mNotificationHandler = handler; mContentViewSwitcher = new ContentViewSwitcher(); mChildViewManager = new ChildViewManager(); mGestureDetector = new GestureDetectorCompat(mContext, this); mContentBackground = new GradientDrawable(); mDimension[0] = LayoutParams.MATCH_PARENT; mDimension[1] = LayoutParams.WRAP_CONTENT; mHideAnimationListener = mDismissAnimationListener; mDefaultShowAnimation = AnimationFactory.pushDownIn(); mDefaultHideAnimation = AnimationFactory.pushUpOut(); }
Example #15
Source File: ScrollableImageView.java From imageres_resolution with MIT License | 5 votes |
public ScrollableImageView(Context context, @Nullable AttributeSet attrs) { super(context, attrs); DisplayMetrics dm = getResources().getDisplayMetrics(); screenW = dm.widthPixels; screenH = dm.heightPixels; gestureDetector = new GestureDetectorCompat(context, gestureListener); overScroller = new OverScroller(context); }
Example #16
Source File: PhotoView.java From v2ex-daily-android with Apache License 2.0 | 5 votes |
/** * Initializes the header and any static values */ private void initialize() { Context context = getContext(); if (!sInitialized) { sInitialized = true; Resources resources = context.getApplicationContext().getResources(); sCropSize = resources.getDimensionPixelSize(R.dimen.photo_crop_width); sCropDimPaint = new Paint(); sCropDimPaint.setAntiAlias(true); sCropDimPaint.setColor(resources.getColor(R.color.photo_crop_dim_color)); sCropDimPaint.setStyle(Style.FILL); sCropPaint = new Paint(); sCropPaint.setAntiAlias(true); sCropPaint.setColor(resources.getColor(R.color.photo_crop_highlight_color)); sCropPaint.setStyle(Style.STROKE); sCropPaint.setStrokeWidth(resources.getDimension(R.dimen.photo_crop_stroke_width)); final ViewConfiguration configuration = ViewConfiguration.get(context); final int touchSlop = configuration.getScaledTouchSlop(); sTouchSlopSquare = touchSlop * touchSlop; } mGestureDetector = new GestureDetectorCompat(context, this, null); mScaleGetureDetector = new ScaleGestureDetector(context, this); mQuickScaleEnabled = ScaleGestureDetectorCompat.isQuickScaleEnabled(mScaleGetureDetector); mScaleRunnable = new ScaleRunnable(this); mTranslateRunnable = new TranslateRunnable(this); mSnapRunnable = new SnapRunnable(this); mRotateRunnable = new RotateRunnable(this); }
Example #17
Source File: SwipeItemTouchListener.java From Tangram-Android with MIT License | 5 votes |
public SwipeItemTouchListener(Context context, GroupBasicAdapter groupBasicAdapter, RecyclerView recyclerView) { this.mGroupBasicAdapter = groupBasicAdapter; this.recyclerView = recyclerView; this.recyclerView.addOnScrollListener(scrollListener); this.layoutManager = (VirtualLayoutManager) recyclerView.getLayoutManager(); mSwipeGestureDector = new GestureDetectorCompat(context, new SwipeGestureListener()); mChildList = new ArrayList<>(); }
Example #18
Source File: MainActivity.java From Android-9-Development-Cookbook with MIT License | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mGestureDetector = new GestureDetectorCompat(this, new GestureListener()); hideSystemUi(); }
Example #19
Source File: MinuteChartView.java From kAndroid with Apache License 2.0 | 5 votes |
private void init() { mDetector = new GestureDetectorCompat(getContext(), this); mTopPadding = dp2px(mTopPadding); mBottomPadding = dp2px(mBottomPadding); mTextSize = sp2px(mTextSize); mVolumeHeight = dp2px(mVolumeHeight); mGridPaint.setColor(ContextCompat.getColor(getContext(), R.color.chart_grid_line));//网络线颜色 mGridPaint.setStrokeWidth(dp2px(1)); mTextPaint.setColor(ContextCompat.getColor(getContext(), R.color.chart_text)); mTextPaint.setTextSize(mTextSize); mTextPaint.setStrokeWidth(dp2px(0.5f)); // mAvgPaint.setColor(ContextCompat.getColor(getContext(), R.color.chart_FFFFFF)); // mAvgPaint.setStrokeWidth(dp2px(0.5f)); // mAvgPaint.setTextSize(mTextSize); mPricePaint.setColor(ContextCompat.getColor(getContext(), R.color.chart_FFFFFF)); mPricePaint.setStrokeWidth(dp2px(0.5f)); mPricePaint.setTextSize(mTextSize); mTimePaint.setColor(ContextCompat.getColor(getContext(), R.color.chart_FFFFFF)); mTimePaint.setStrokeWidth(dp2px(0.5f)); mTimePaint.setTextSize(mTextSize); mVolumePaintGreen.setColor(ContextCompat.getColor(getContext(), R.color.chart_green));//阴线柱状颜色 mVolumePaintRed.setColor(ContextCompat.getColor(getContext(), R.color.chart_red));//阳线柱状颜色 mBackgroundColor = ContextCompat.getColor(getContext(), R.color.chart_background); mBackgroundPaint.setColor(mBackgroundColor); mVolumeFormatter = new BigValueFormatter(); setSelectorBackgroundColor(ContextCompat.getColor(getContext(), R.color.chart_dialog_bg)); setSelectorTextSize(sp2px(12)); setSelectorTextColor(ContextCompat.getColor(getContext(), R.color.chart_white)); }
Example #20
Source File: NotificationBoard.java From Android-Notification with Apache License 2.0 | 5 votes |
private void initialize() { mContext = getContext(); mInflater = LayoutInflater.from(mContext); mCenter = NotificationDelegater.getInstance().center(); mCenter.addListener(this); mGestureDetector = new GestureDetectorCompat(mContext, this); mH = new H(this); mContentView = new ContentView(mContext); addView(mContentView, new FrameLayout.LayoutParams( mContentView.mWidth, mContentView.mHeight, Gravity.CENTER | Gravity.TOP)); }
Example #21
Source File: EntryListDialogFragment.java From narrate-android with Apache License 2.0 | 5 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mGestureDetector = new GestureDetectorCompat(getActivity(), new GestureListener()); setRetainInstance(true); if ( savedInstanceState != null ) mItems = savedInstanceState.getParcelableArrayList(STATE_ENTRIES); }
Example #22
Source File: SwipeLayout.java From NewsMe with Apache License 2.0 | 5 votes |
public SwipeLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); density = context.getResources().getDisplayMetrics().density; setWillNotDraw(false); // 初始化底部 View mButtomView = new ButtomView(getContext()); mButtomView.setDirection(mDirection); mGestureDetectorCompat = new GestureDetectorCompat(context, onScrollDetector()); mDragHelper = ViewDragHelper.create(this, onDragHelperCallback()); mDragHelper.setMinVelocity(MIN_FLING_VELOCITY * density); }
Example #23
Source File: ClickItemTouchListener.java From MultiView with Apache License 2.0 | 5 votes |
ClickItemTouchListener(RecyclerView hostView) { mGestureDetector = //new ItemClickGestureDetector( new GestureDetectorCompat( hostView.getContext(), new ItemClickGestureListener(hostView)); }
Example #24
Source File: ScalableRecyclerGridView.java From MultiView with Apache License 2.0 | 5 votes |
private void init() { gestureDetector = new GestureDetectorCompat(context, this); gestureDetector.setOnDoubleTapListener(this); scaleGestureDetector = new ScaleGestureDetector(context, this); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { scaleGestureDetector.setQuickScaleEnabled(false); } }
Example #25
Source File: MainActivity.java From AndroidWearable-Samples with Apache License 2.0 | 5 votes |
@Override public void onCreate(Bundle b) { super.onCreate(b); setContentView(R.layout.main_activity); mDismissOverlayView = (DismissOverlayView) findViewById(R.id.dismiss_overlay); mDismissOverlayView.setIntroText(R.string.intro_text); mDismissOverlayView.showIntroIfNecessary(); mGestureDetector = new GestureDetectorCompat(this, new LongPressListener()); }
Example #26
Source File: AnalyzerActivity.java From audio-analyzer-for-android with Apache License 2.0 | 5 votes |
@Override public void onCreate(Bundle savedInstanceState) { // Debug.startMethodTracing("calc"); final int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024); Log.i(TAG, " max runtime mem = " + maxMemory + "k"); super.onCreate(savedInstanceState); setContentView(R.layout.main); Resources res = getResources(); analyzerParam = new AnalyzerParameters(res); // Initialized preferences by default values PreferenceManager.setDefaultValues(this, R.xml.preferences, false); // Read preferences and set corresponding variables loadPreferenceForView(); analyzerViews = new AnalyzerViews(this); // travel Views, and attach ClickListener to the views that contain android:tag="select" visit((ViewGroup) analyzerViews.graphView.getRootView(), new Visit() { @Override public void exec(View view) { view.setOnLongClickListener(AnalyzerActivity.this); view.setOnClickListener(AnalyzerActivity.this); ((TextView) view).setFreezesText(true); } }, "select"); rangeViewDialogC = new RangeViewDialogC(this, analyzerViews.graphView); mDetector = new GestureDetectorCompat(this, new AnalyzerGestureListener()); }
Example #27
Source File: BaseGridScaler.java From MultiView with Apache License 2.0 | 5 votes |
private void init() { gestureDetector = new GestureDetectorCompat(context, this); gestureDetector.setOnDoubleTapListener(this); scaleGestureDetector = new ScaleGestureDetector(context, this); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { scaleGestureDetector.setQuickScaleEnabled(false); } }
Example #28
Source File: LatestDebatesFragment.java From kaif-android with Apache License 2.0 | 5 votes |
private void setupView() { final LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity()); debateListView.setLayoutManager(linearLayoutManager); adapter = new LatestDebateListAdapter(); debateListView.setAdapter(adapter); debateListView.getItemAnimator().setChangeDuration(120); debateListView.addOnScrollListener(new OnScrollToLastListener() { private boolean loadingNextPage = false; @Override public void onScrollToLast() { if (loadingNextPage) { return; } loadingNextPage = true; bind(listDebates(adapter.getLastDebateId())).subscribe(adapter::addAll, throwable -> { }, () -> loadingNextPage = false); } }); GestureDetectorCompat gestureDetector = new GestureDetectorCompat(getActivity(), new OnItemClickListener()); debateListView.addOnItemTouchListener(new RecyclerView.SimpleOnItemTouchListener() { @Override public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) { return gestureDetector.onTouchEvent(e); } }); pullToRefreshLayout.setOnRefreshListener(LatestDebatesFragment.this::reload); }
Example #29
Source File: DragLayout.java From AndroidBase with Apache License 2.0 | 5 votes |
public DragLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); mDragHelper = ViewDragHelper .create(this, 10f, new DragHelperCallback()); mDragHelper.setEdgeTrackingEnabled(ViewDragHelper.EDGE_BOTTOM); gestureDetector = new GestureDetectorCompat(context, new YScrollDetector()); }
Example #30
Source File: FloatingWindow.java From UCDLive_Android with MIT License | 5 votes |
public FloatingWindow(Context context, AVOption avOption) { super(context); this.avOption = avOption; avOption.videoResolution = UVideoProfile.Resolution.RATIO_4x3.ordinal(); //默认Camera预览大小写死成了4:3 windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); initWindow(); gestureDetector = new GestureDetectorCompat(context, new GestureListener()); scaleDetector = new ScaleGestureDetector(context, new ScaleListener()); addCameraSessionListener(cameraSessionListener); setOnTouchListener(this); init(avOption); }