2020-05-05 07:42:09 +00:00
|
|
|
package code.name.monkey.retromusic;
|
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
import android.util.AttributeSet;
|
|
|
|
import android.view.MotionEvent;
|
|
|
|
import android.view.View;
|
|
|
|
|
|
|
|
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
|
|
|
|
|
|
|
import com.google.android.material.bottomsheet.BottomSheetBehavior;
|
|
|
|
|
2020-06-06 18:57:28 +00:00
|
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
|
|
2020-05-05 07:42:09 +00:00
|
|
|
|
2020-05-07 06:57:24 +00:00
|
|
|
public class RetroBottomSheetBehavior<V extends View> extends BottomSheetBehavior<V> {
|
2020-05-05 07:42:09 +00:00
|
|
|
|
2020-06-06 18:57:28 +00:00
|
|
|
private static final String TAG = "RetroBottomSheetBehavior";
|
2020-05-05 07:42:09 +00:00
|
|
|
|
|
|
|
private boolean allowDragging = true;
|
|
|
|
|
2020-05-07 06:57:24 +00:00
|
|
|
public RetroBottomSheetBehavior() {
|
2020-05-05 07:42:09 +00:00
|
|
|
}
|
|
|
|
|
2020-05-07 06:57:24 +00:00
|
|
|
public RetroBottomSheetBehavior(Context context, AttributeSet attrs) {
|
2020-05-05 07:42:09 +00:00
|
|
|
super(context, attrs);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setAllowDragging(boolean allowDragging) {
|
|
|
|
this.allowDragging = allowDragging;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2020-06-06 18:57:28 +00:00
|
|
|
public boolean onInterceptTouchEvent(@NotNull CoordinatorLayout parent, @NotNull V child, @NotNull MotionEvent event) {
|
2020-05-05 07:42:09 +00:00
|
|
|
if (!allowDragging) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return super.onInterceptTouchEvent(parent, child, event);
|
|
|
|
}
|
|
|
|
}
|