use of android.view.GestureDetector in project muzei by romannurik.
the class FullScreenActivity method onCreate.
public void onCreate(Bundle savedState) {
super.onCreate(savedState);
setContentView(R.layout.full_screen_activity);
FirebaseAnalytics.getInstance(this).setUserProperty("device_type", BuildConfig.DEVICE_TYPE);
mPanView = (PanView) findViewById(R.id.pan_view);
getLoaderManager().initLoader(0, null, this);
mScrimView = findViewById(R.id.scrim);
mLoadingIndicatorView = findViewById(R.id.loading_indicator);
mHandler.postDelayed(mShowLoadingIndicatorRunnable, 500);
mMetadataContainerView = findViewById(R.id.metadata_container);
mTitleView = (TextView) findViewById(R.id.title);
mBylineView = (TextView) findViewById(R.id.byline);
Typeface tf = TypefaceUtil.getAndCache(this, "Alegreya-BlackItalic.ttf");
mTitleView = (TextView) findViewById(R.id.title);
mTitleView.setTypeface(tf);
tf = TypefaceUtil.getAndCache(this, "Alegreya-Italic.ttf");
mBylineView = (TextView) findViewById(R.id.byline);
mBylineView.setTypeface(tf);
mDismissOverlay = (DismissOverlayView) findViewById(R.id.dismiss_overlay);
// Only show the dismiss overlay on Wear 1.0 devices
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
mDismissOverlay.setIntroText(R.string.dismiss_overlay_intro);
mDismissOverlay.showIntroIfNecessary();
}
mDetector = new GestureDetector(this, new GestureDetector.SimpleOnGestureListener() {
@Override
public boolean onSingleTapConfirmed(MotionEvent e) {
if (mDismissOverlay.getVisibility() == View.VISIBLE) {
return false;
}
if (mMetadataVisible) {
setMetadataVisible(false);
} else {
setMetadataVisible(true);
}
return true;
}
@Override
public void onLongPress(MotionEvent ev) {
if (mDismissOverlay.getVisibility() == View.VISIBLE) {
return;
}
// Only show the dismiss overlay on Wear 1.0 devices
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
mDismissOverlay.show();
}
}
});
}
use of android.view.GestureDetector in project FoldableLayout by alexvasilkov.
the class FoldableListLayout method init.
private void init(Context context) {
gestureDetector = new GestureDetector(context, new SimpleOnGestureListener() {
@Override
public boolean onDown(MotionEvent event) {
return FoldableListLayout.this.onDown();
}
@Override
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distX, float distY) {
return FoldableListLayout.this.onScroll(e1, e2);
}
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velX, float velY) {
return FoldableListLayout.this.onFling(velY);
}
});
gestureDetector.setIsLongpressEnabled(false);
animator = ObjectAnimator.ofFloat(this, "foldRotation", 0f);
minDistanceBeforeScroll = ViewConfiguration.get(context).getScaledTouchSlop();
flingAnimation = new FlingAnimation();
foldShading = new SimpleFoldShading();
setChildrenDrawingOrderEnabled(true);
}
use of android.view.GestureDetector in project platform_frameworks_base by android.
the class Gallery method onAttachedToWindow.
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
if (mGestureDetector == null) {
mGestureDetector = new GestureDetector(getContext(), this);
mGestureDetector.setIsLongpressEnabled(true);
}
}
use of android.view.GestureDetector in project CircularReveal by ozodrukh.
the class RadialTransformationActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sample_2);
ButterKnife.bind(this);
Picasso.with(this).load("http://camp-campbell.com/wp-content/uploads/2014/09/847187872-san-francisco.jpg").resizeDimen(R.dimen.radial_card_width, R.dimen.radial_card_height).centerCrop().into(sanFranciscoView);
videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
mp.setLooping(true);
}
});
videoView.setVideoURI(Uri.parse(VIDEO_URL));
videoView.start();
final GestureDetector detector = new GestureDetector(this, tapDetector);
for (int i = 0; i < stack.getChildCount(); i++) {
View view = stack.getChildAt(i);
view.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
return detector.onTouchEvent(event);
}
});
}
final ViewRevealManager revealManager = new ViewRevealManager();
final SpringViewAnimatorManager springManager = new SpringViewAnimatorManager();
springManager.setDampingRatio(SpringForce.DAMPING_RATIO_NO_BOUNCY);
springManager.setStiffness(SpringForce.STIFFNESS_LOW);
stack.setViewRevealManager(revealManager);
settingsView.addSwitch("Enable Spring", false, new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
stack.setViewRevealManager(isChecked ? springManager : revealManager);
}
});
settingsView.setAnimatorManager(springManager);
final BottomSheetBehavior behavior = BottomSheetBehavior.from(settingsView);
behavior.setPeekHeight(getResources().getDimensionPixelSize(R.dimen.bottom_peek_height));
behavior.setSkipCollapsed(false);
behavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
}
use of android.view.GestureDetector in project android-common by Trinea.
the class HorizontalListView method initView.
private synchronized void initView() {
mLeftViewIndex = -1;
mRightViewIndex = 0;
mDisplayOffset = 0;
mCurrentX = 0;
mNextX = 0;
mMaxX = Integer.MAX_VALUE;
mScroller = new Scroller(getContext());
mGesture = new GestureDetector(getContext(), mOnGesture);
}
Aggregations