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;
}
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);
}
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);
}
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);
}
});
}
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);
}
Aggregations