This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GestureListener implements GestureDetector.OnGestureListener, GestureDetector.OnDoubleTapListener | |
{ | |
@Override | |
public boolean onSingleTapConfirmed(MotionEvent e) | |
{ | |
// Do smth with single tap | |
} | |
@Override | |
public boolean onDoubleTapEvent(MotionEvent e) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.navigine.navigine; | |
import android.content.Context; | |
import android.content.res.TypedArray; | |
import android.os.Parcel; | |
import android.os.Parcelable; | |
import android.util.AttributeSet; | |
import android.view.MotionEvent; | |
import android.view.VelocityTracker; | |
import android.view.View; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int top; | |
if (state == STATE_COLLAPSED) | |
top = mMinOffset; | |
else if (state == STATE_EXPANDED | |
top = mMaxOffset; | |
else if (mHideable && state == STATE_HIDDEN) | |
top = -child.getHeight(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int currentTop = child.getTop(); | |
int newTop = currentTop - dy; | |
if (dy > 0) { | |
if (!ViewCompat.canScrollVertically(target, 1)) { | |
if (newTop >= mMinOffset || mHideable) { | |
consumed[1] = dy; | |
ViewCompat.offsetTopAndBottom(child, -dy); | |
setStateInternal(STATE_DRAGGING); | |
} else { | |
consumed[1] = currentTop - mMinOffset; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public boolean onLayoutChild(CoordinatorLayout parent, V child, int layoutDirection) { | |
if (ViewCompat.getFitsSystemWindows(parent) && !ViewCompat.getFitsSystemWindows(child)) | |
ViewCompat.setFitsSystemWindows(child, true); | |
int savedTop = child.getTop(); | |
// First let the parent lay it out | |
parent.onLayoutChild(child, layoutDirection); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ConstraintLayout logsTopSheet = findViewById(R.id.navigine__logcat_sheet); | |
TopSheetBehavior topSheetBehavior = TopSheetBehavior.from(logsTopSheet); | |
topSheetBehavior.setState(TopSheetBehavior.STATE_HIDDEN); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JNIEXPORT void JNICALL | |
Java_com_navigine_view_internal_GLRenderer_onEventHandled(JNIEnv * env, jobject self, jobject motionEvent) | |
{ | |
// getting motion event class | |
jclass motionEventClass=env->GetObjectClass(motionEvent); | |
// getting functions id | |
jmethodID pointersCountMethodId = env->GetMethodID(motionEventClass, "getPointerCount", "()I"); | |
jmethodID pointerIndexMethodId = env->GetMethodID(motionEventClass, "findPointerIndex", "(I)I"); | |
jmethodID getActionMethodId = env->GetMethodID(motionEventClass, "getActionMasked", "()I"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case MotionEvent.ACTION_POINTER_UP: | |
int index = (event.getAction() & MotionEvent.ACTION_POINTER_INDEX_MASK) >> MotionEvent.ACTION_POINTER_INDEX_SHIFT; | |
// .. | |
// Do something here .. | |
// .. | |
break; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A pressed gesture has started, the | |
* motion contains the initial starting location. | |
*/ | |
public static final int ACTION_DOWN = 0; | |
/** | |
* A pressed gesture has finished, the | |
* motion contains the final release location as well as any intermediate | |
* points since the last down or move event. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
bottomSheetBehavior.setBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() { | |
@Override | |
public void onStateChanged(View view, int i) { | |
// .. | |
// your code is here | |
} | |
@Override |