This commit is contained in:
nuclearfog 2023-04-12 01:30:37 +02:00
parent dd54a3079f
commit 6398b829c1
No known key found for this signature in database
GPG Key ID: 03488A185C476379
2 changed files with 20 additions and 4 deletions

View File

@ -16,7 +16,7 @@ public class LockableConstraintLayout extends ConstraintLayout {
@Nullable
private LockCallback callback;
private boolean lock = true;
private boolean lock = false;
private float yPos = 0.0f;
/**
@ -42,7 +42,7 @@ public class LockableConstraintLayout extends ConstraintLayout {
break;
case MotionEvent.ACTION_MOVE:
if (ev.getY() < yPos && callback != null) {
if (ev.getY() < yPos && callback != null) {// scroll down
lock = callback.aquireLock();
}
yPos = ev.getY();

View File

@ -8,7 +8,7 @@ import android.widget.LinearLayout;
import androidx.annotation.Nullable;
/**
* {@link LinearLayout} implementation with child scroll lock
* Vertical {@link LinearLayout} implementation with child scroll lock
*
* @author nuclearfog
*/
@ -16,7 +16,7 @@ public class LockableLinearLayout extends LinearLayout {
@Nullable
private LockCallback callback;
private boolean lock = true;
private boolean lock = false;
private float yPos = 0.0f;
/**
@ -35,6 +35,22 @@ public class LockableLinearLayout extends LinearLayout {
setOrientation(VERTICAL);
}
/**
* @inheritDoc
*/
public LockableLinearLayout(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
setOrientation(VERTICAL);
}
/**
* @inheritDoc
*/
public LockableLinearLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
setOrientation(VERTICAL);
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {