From 4cc7c21624926ae8524b4cc6f8f5e7b707b90fd8 Mon Sep 17 00:00:00 2001 From: li-xiaojun <16167479@qq.com> Date: Tue, 16 Aug 2022 21:35:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=BC=B9=E7=AA=97=E5=A4=9A?= =?UTF-8?q?=E4=B8=AA=E5=BC=80=E5=90=AF=E6=97=B6=E5=85=B3=E4=BA=8EStatusBar?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E6=97=A0=E6=95=88=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/lxj/xpopupdemo/fragment/QuickStartDemo.java | 3 +-- .../java/com/lxj/xpopup/core/FullScreenDialog.java | 11 ++++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/lxj/xpopupdemo/fragment/QuickStartDemo.java b/app/src/main/java/com/lxj/xpopupdemo/fragment/QuickStartDemo.java index e85800e8..f4e0ff33 100644 --- a/app/src/main/java/com/lxj/xpopupdemo/fragment/QuickStartDemo.java +++ b/app/src/main/java/com/lxj/xpopupdemo/fragment/QuickStartDemo.java @@ -142,7 +142,6 @@ public void onClick(View v) { case R.id.btnShowConfirm: //带确认和取消按钮的弹窗 /*if(popupView==null)*/ popupView = new XPopup.Builder(getContext()) -// .hasStatusBar(false) .isDestroyOnDismiss(true) // .isTouchThrough(true) // .dismissOnBackPressed(false) @@ -306,7 +305,7 @@ public void onSelect(int position, String text) { popupView = new ZhihuCommentPopup(getContext()); new XPopup.Builder(getContext()) .moveUpToKeyboard(false) //如果不加这个,评论弹窗会移动到软键盘上面 - .isViewMode(true) +// .isViewMode(true) // .enableDrag(false) .isDestroyOnDismiss(true) //对于只使用一次的弹窗,推荐设置这个 // .isThreeDrag(true) //是否开启三阶拖拽,如果设置enableDrag(false)则无效 diff --git a/library/src/main/java/com/lxj/xpopup/core/FullScreenDialog.java b/library/src/main/java/com/lxj/xpopup/core/FullScreenDialog.java index 9edc05a8..67c1a1da 100644 --- a/library/src/main/java/com/lxj/xpopup/core/FullScreenDialog.java +++ b/library/src/main/java/com/lxj/xpopup/core/FullScreenDialog.java @@ -67,11 +67,6 @@ protected void onCreate(Bundle savedInstanceState) { getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); //尝试兼容部分手机上的状态栏空白问题 } - //隐藏导航栏 - if (!contentView.popupInfo.hasNavigationBar) { - hideNavigationBar(); - } - if(!contentView.popupInfo.isRequestFocus){//不获取焦点 int flag = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; if(contentView.popupInfo.isCoverSoftInput){ @@ -178,6 +173,10 @@ private String getResNameById(int id) { } public void setNavBarLightMode() { + //隐藏导航栏 + if (!contentView.popupInfo.hasNavigationBar) { + hideNavigationBar(); + } int light = contentView.popupInfo.isLightNavigationBar == 0 ? XPopup.isLightNavigationBar : contentView.popupInfo.isLightNavigationBar; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && light!=0) { View decorView = getWindow().getDecorView(); @@ -203,6 +202,8 @@ public FullScreenDialog setContent(BasePopupView view) { @Override public void onWindowFocusChanged(boolean hasFocus) { super.onWindowFocusChanged(hasFocus); + setStatusBarLightMode(); + setNavBarLightMode(); if(hasFocus && contentView!=null && contentView.hasMoveUp && contentView.popupStatus== PopupStatus.Show){ contentView.focusAndProcessBackPress(); KeyboardUtils.showSoftInput(contentView);