From 1beca4bac5039d16a6d913cfed0f78fefae20435 Mon Sep 17 00:00:00 2001 From: Kongzue Date: Tue, 27 Feb 2024 22:18:55 +0800 Subject: [PATCH] =?UTF-8?q?0.0.50.beta9=20ready=20-=20=E9=92=88=E5=AF=B9?= =?UTF-8?q?=20PopMenu=E3=80=81GuideDialog=20=E9=92=88=E5=AF=B9=E7=BB=91?= =?UTF-8?q?=E5=AE=9A=E7=9A=84=20baseView=20=E4=BD=8D=E7=BD=AE=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E6=83=85=E5=86=B5=E7=9A=84=E5=A4=84=E7=90=86=EF=BC=9B?= =?UTF-8?q?=20-=20DialogXValueAnimator=20=E4=BF=AE=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=B1=8F=E5=B9=95=E6=9C=80=E9=AB=98=E5=88=B7?= =?UTF-8?q?=E6=96=B0=E7=8E=87=EF=BC=9B=20-=20=E4=BF=AE=E5=A4=8D=20BottomDi?= =?UTF-8?q?alog=E3=80=81FullScreenDialog=20=E6=BB=91=E5=8A=A8=E7=BB=A7?= =?UTF-8?q?=E6=89=BF=E7=9A=84=E4=B8=80=E4=BA=9B=E9=97=AE=E9=A2=98=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dialogx/util/BottomDialogTouchEventInterceptor.java | 1 + .../util/FullScreenDialogTouchEventInterceptor.java | 1 + .../com/kongzue/dialogx/util/views/FitSystemBarUtils.java | 7 +++++-- .../com/kongzue/dialogxdemo/activity/MainActivity.java | 1 + app/src/main/res/layout/layout_custom_recycleview.xml | 2 +- 5 files changed, 9 insertions(+), 3 deletions(-) diff --git a/DialogX/src/main/java/com/kongzue/dialogx/util/BottomDialogTouchEventInterceptor.java b/DialogX/src/main/java/com/kongzue/dialogx/util/BottomDialogTouchEventInterceptor.java index 633e5a2c..65e6a836 100644 --- a/DialogX/src/main/java/com/kongzue/dialogx/util/BottomDialogTouchEventInterceptor.java +++ b/DialogX/src/main/java/com/kongzue/dialogx/util/BottomDialogTouchEventInterceptor.java @@ -129,6 +129,7 @@ public boolean onTouch(View v, MotionEvent event) { enterAnim.start(); } } + impl.scrollView.lockScroll(false); break; } return false; diff --git a/DialogX/src/main/java/com/kongzue/dialogx/util/FullScreenDialogTouchEventInterceptor.java b/DialogX/src/main/java/com/kongzue/dialogx/util/FullScreenDialogTouchEventInterceptor.java index 1551375c..5bd55f4c 100644 --- a/DialogX/src/main/java/com/kongzue/dialogx/util/FullScreenDialogTouchEventInterceptor.java +++ b/DialogX/src/main/java/com/kongzue/dialogx/util/FullScreenDialogTouchEventInterceptor.java @@ -108,6 +108,7 @@ public boolean onTouch(View v, MotionEvent event) { enterAnim.start(); } } + ((ScrollController) impl.scrollView).lockScroll(false); break; } return false; diff --git a/DialogX/src/main/java/com/kongzue/dialogx/util/views/FitSystemBarUtils.java b/DialogX/src/main/java/com/kongzue/dialogx/util/views/FitSystemBarUtils.java index b0af8a81..6a773876 100644 --- a/DialogX/src/main/java/com/kongzue/dialogx/util/views/FitSystemBarUtils.java +++ b/DialogX/src/main/java/com/kongzue/dialogx/util/views/FitSystemBarUtils.java @@ -472,7 +472,7 @@ protected void log(String s) { } private int getStatusBarHeight() { - if (isFullScreen()) { + if (isFullScreen() || getDecorView() == null) { return 0; } WindowInsetsController insetsController = (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) ? getDecorView().getWindowInsetsController() : null; @@ -494,7 +494,7 @@ private int getStatusBarHeight() { } private int getNavigationBarHeight() { - if (isFullScreen()) { + if (isFullScreen() || getDecorView() == null) { return 0; } WindowInsetsController insetsController = (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) ? getDecorView().getWindowInsetsController() : null; @@ -600,6 +600,9 @@ public void onGlobalLayout() { private int getAppTargetSDKVersion() { try { Context context = BaseDialog.getApplicationContext(); + if (context == null) { + return -1; + } PackageManager pm = context.getPackageManager(); ApplicationInfo applicationInfo = pm.getApplicationInfo(context.getPackageName(), 0); int targetSdkVersion = applicationInfo.targetSdkVersion; diff --git a/app/src/main/java/com/kongzue/dialogxdemo/activity/MainActivity.java b/app/src/main/java/com/kongzue/dialogxdemo/activity/MainActivity.java index 81ed8df0..478811c0 100644 --- a/app/src/main/java/com/kongzue/dialogxdemo/activity/MainActivity.java +++ b/app/src/main/java/com/kongzue/dialogxdemo/activity/MainActivity.java @@ -1309,6 +1309,7 @@ public void onItemClick(AdapterView parent, View view, int position, long id) recyclerView.setAdapter(adapter); } }) + .setScrollableWhenContentLargeThanVisibleRange(false) .show(); } }); diff --git a/app/src/main/res/layout/layout_custom_recycleview.xml b/app/src/main/res/layout/layout_custom_recycleview.xml index 6ec44620..d0f4491d 100644 --- a/app/src/main/res/layout/layout_custom_recycleview.xml +++ b/app/src/main/res/layout/layout_custom_recycleview.xml @@ -4,4 +4,4 @@ android:tag="ScrollController" android:orientation="vertical" android:layout_width="match_parent" - android:layout_height="400dp"/> \ No newline at end of file + android:layout_height="wrap_content"/> \ No newline at end of file