mirror of
https://github.com/Tencent/QMUI_Android.git
synced 2026-10-17 04:31:16 +08:00
feat:QMUIBottomSheet add OnBottomSheetStateListener
This commit is contained in:
@@ -13,7 +13,7 @@ object Dep {
|
||||
|
||||
object QMUI {
|
||||
const val group = "com.qmuiteam"
|
||||
const val qmuiVer = "2.1.0.8"
|
||||
const val qmuiVer = "2.1.0.9"
|
||||
const val archVer = "2.1.0.3"
|
||||
const val typeVer = "0.1.0.5"
|
||||
|
||||
|
||||
@@ -67,6 +67,7 @@ public class QMUIBottomSheet extends QMUIBaseDialog {
|
||||
private QMUIBottomSheetRootLayout mRootView;
|
||||
private OnBottomSheetShowListener mOnBottomSheetShowListener;
|
||||
private OnBottomSheetSlideListener mOnBottomSheetSlideListener;
|
||||
private OnBottomSheetStateListener mOnBottomSheetStateListener;
|
||||
private QMUIBottomSheetBehavior<QMUIBottomSheetRootLayout> mBehavior;
|
||||
private boolean mAnimateToCancel = false;
|
||||
private boolean mAnimateToDismiss = false;
|
||||
@@ -85,6 +86,9 @@ public class QMUIBottomSheet extends QMUIBaseDialog {
|
||||
mBehavior.addBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() {
|
||||
@Override
|
||||
public void onStateChanged(@NonNull View bottomSheet, int newState) {
|
||||
if (mOnBottomSheetStateListener != null) {
|
||||
mOnBottomSheetStateListener.onStateChanged(newState);
|
||||
}
|
||||
if (newState == BottomSheetBehavior.STATE_HIDDEN) {
|
||||
if (mAnimateToCancel) {
|
||||
// cancel() invoked
|
||||
@@ -213,6 +217,10 @@ public class QMUIBottomSheet extends QMUIBaseDialog {
|
||||
mOnBottomSheetSlideListener = onBottomSheetSlideListener;
|
||||
}
|
||||
|
||||
public void setOnBottomSheetStateListener(OnBottomSheetStateListener onBottomSheetStateListener) {
|
||||
mOnBottomSheetStateListener = onBottomSheetStateListener;
|
||||
}
|
||||
|
||||
public void setRadius(int radius) {
|
||||
mRootView.setRadius(radius, HIDE_RADIUS_SIDE_BOTTOM);
|
||||
}
|
||||
@@ -255,6 +263,10 @@ public class QMUIBottomSheet extends QMUIBaseDialog {
|
||||
void onSlide(float slideOffset);
|
||||
}
|
||||
|
||||
public interface OnBottomSheetStateListener {
|
||||
void onStateChanged(int newState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContentView(View view) {
|
||||
throw new IllegalStateException(
|
||||
|
||||
Reference in New Issue
Block a user