Search in sources :

Example 16 with GestureDetector

use of android.view.GestureDetector in project Shuttle by timusus.

the class LyricsFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_lyrics, container, false);
    rootView.setBackgroundColor(Color.parseColor("#C8000000"));
    mLyricsTextView = (TextView) rootView.findViewById(R.id.text1);
    mQuickLyricButton = (Button) rootView.findViewById(R.id.btn_quick_lyric);
    final GestureDetector gestureDetector = new GestureDetector(this.getActivity(), new GestureListener());
    mLyricsTextView.setOnTouchListener((view, motionEvent) -> gestureDetector.onTouchEvent(motionEvent));
    ScrollView scrollView = (ScrollView) rootView.findViewById(R.id.scrollView);
    ThemeUtils.themeScrollView(scrollView);
    return rootView;
}
Also used : ScrollView(android.widget.ScrollView) GestureDetector(android.view.GestureDetector) View(android.view.View) TextView(android.widget.TextView) ScrollView(android.widget.ScrollView)

Example 17 with GestureDetector

use of android.view.GestureDetector in project platform_frameworks_base by android.

the class SystemGesturesPointerEventListener method systemReady.

public void systemReady() {
    Handler h = new Handler(Looper.myLooper());
    mGestureDetector = new GestureDetector(mContext, new FlingGestureDetector(), h);
    mOverscroller = new OverScroller(mContext);
}
Also used : Handler(android.os.Handler) GestureDetector(android.view.GestureDetector) OverScroller(android.widget.OverScroller)

Example 18 with GestureDetector

use of android.view.GestureDetector in project platform_frameworks_base by android.

the class DecorCaptionView method init.

private void init(Context context) {
    mDragSlop = ViewConfiguration.get(context).getScaledTouchSlop();
    mGestureDetector = new GestureDetector(context, this);
}
Also used : GestureDetector(android.view.GestureDetector)

Example 19 with GestureDetector

use of android.view.GestureDetector in project MLib by DaoBillTang.

the class RollPagerView method initView.

/**
 * 读取提示形式  和   提示位置   和    播放延迟
 *
 * @param attrs
 */
private void initView(AttributeSet attrs) {
    if (mViewPager != null) {
        removeView(mViewPager);
    }
    TypedArray type = getContext().obtainStyledAttributes(attrs, R.styleable.RollPagerView);
    gravity = type.getInteger(R.styleable.RollPagerView_rollviewpager_hint_gravity, 1);
    delay = type.getInt(R.styleable.RollPagerView_rollviewpager_play_delay, 0);
    color = type.getColor(R.styleable.RollPagerView_rollviewpager_hint_color, Color.BLACK);
    alpha = type.getInt(R.styleable.RollPagerView_rollviewpager_hint_alpha, 0);
    isHint = type.getBoolean(R.styleable.RollPagerView_rollviewpager_ishint, true);
    paddingLeft = (int) type.getDimension(R.styleable.RollPagerView_rollviewpager_hint_paddingLeft, 0);
    paddingRight = (int) type.getDimension(R.styleable.RollPagerView_rollviewpager_hint_paddingRight, 0);
    paddingTop = (int) type.getDimension(R.styleable.RollPagerView_rollviewpager_hint_paddingTop, 0);
    paddingBottom = (int) type.getDimension(R.styleable.RollPagerView_rollviewpager_hint_paddingBottom, DensityUtilsKt.dip2px(4));
    mViewPager = new ViewPager(getContext());
    mViewPager.setId(R.id.viewpager_inner);
    mViewPager.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
    addView(mViewPager);
    type.recycle();
    // 颜色
    initHint(new ColorPointHintView(getContext(), Color.parseColor("#CFAF78"), Color.parseColor("#88ffffff")));
    // 手势处理
    mGestureDetector = new GestureDetector(getContext(), new GestureDetector.SimpleOnGestureListener() {

        @Override
        public boolean onSingleTapUp(MotionEvent e) {
            if (mOnItemClickListener != null) {
                // 原谅我写了这么丑的代码
                if (mAdapter instanceof LoopPagerAdapter) {
                    mOnItemClickListener.onItemClick(mViewPager.getCurrentItem() % ((LoopPagerAdapter) mAdapter).getRealCount());
                } else {
                    mOnItemClickListener.onItemClick(mViewPager.getCurrentItem());
                }
            }
            return super.onSingleTapUp(e);
        }
    });
}
Also used : LoopPagerAdapter(com.daotangbill.exlib.ui.rollviewpager.adapter.LoopPagerAdapter) TypedArray(android.content.res.TypedArray) ColorPointHintView(com.daotangbill.exlib.ui.rollviewpager.hintview.ColorPointHintView) GestureDetector(android.view.GestureDetector) ViewPager(android.support.v4.view.ViewPager) MotionEvent(android.view.MotionEvent)

Example 20 with GestureDetector

use of android.view.GestureDetector in project frostwire by frostwire.

the class AudioPlayerActivity method onCreate.

@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Control the media volume
    setVolumeControlStream(AudioManager.STREAM_MUSIC);
    // Bind Apollo's service
    mToken = MusicUtils.bindToService(this, this);
    // Initialize the image fetcher/cache
    mImageFetcher = ApolloUtils.getImageFetcher(this);
    // Initialize the handler used to update the current time
    mTimeHandler = new TimeHandler(this);
    // Initialize the broadcast receiver
    mPlaybackStatus = new PlaybackStatus(this);
    // Cache all the items
    initPlaybackControls();
    // Album Art Ad Controls
    mMopubAd = findView(R.id.audio_player_mopubview);
    mFallbackAd = findView(R.id.audio_player_fallback_imageview);
    mDismissAlbumArtAdButton = findView(R.id.audio_player_dismiss_mopubview_button);
    mAdvertisementText = findView(R.id.audio_player_advertisement_text);
    removeAdsTextView = findView(R.id.audio_player_remove_ads_text_link);
    initAlbumArtBanner();
    initRemoveAds();
    mPlayPauseButton.setOnLongClickListener(new StopListener(this, true));
    PlayerGestureListener gestureListener = new PlayerGestureListener();
    gestureDetector = new GestureDetector(this, gestureListener);
    gestureDetector.setOnDoubleTapListener(gestureListener);
    mAlbumArt.setOnTouchListener(gestureListener);
    writeSettingsHelper = new WriteSettingsPermissionActivityHelper(this);
}
Also used : WriteSettingsPermissionActivityHelper(com.frostwire.android.gui.util.WriteSettingsPermissionActivityHelper) GestureDetector(android.view.GestureDetector)

Aggregations

GestureDetector (android.view.GestureDetector)220 MotionEvent (android.view.MotionEvent)90 View (android.view.View)53 ScaleGestureDetector (android.view.ScaleGestureDetector)42 Paint (android.graphics.Paint)30 TextView (android.widget.TextView)29 Handler (android.os.Handler)20 ImageView (android.widget.ImageView)20 Matrix (android.graphics.Matrix)18 SuppressLint (android.annotation.SuppressLint)17 Scroller (android.widget.Scroller)16 WindowManager (android.view.WindowManager)15 TypedArray (android.content.res.TypedArray)12 SimpleOnGestureListener (android.view.GestureDetector.SimpleOnGestureListener)11 ViewGroup (android.view.ViewGroup)10 AdapterView (android.widget.AdapterView)10 Intent (android.content.Intent)9 SharedPreferences (android.content.SharedPreferences)9 PointF (android.graphics.PointF)9 OverScroller (android.widget.OverScroller)9