From 7cc2bd665be9ba8d06f562665d8d2b1d5e11f91c Mon Sep 17 00:00:00 2001 From: goweii Date: Sun, 13 Dec 2020 15:45:13 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9READMEM,=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0gitee=E4=BB=93=E5=BA=93=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index e6c0557..dfc1aa5 100644 --- a/README.md +++ b/README.md @@ -106,6 +106,8 @@ Android稳定高效的浮层创建管理框架。 allprojects { repositories { maven { url 'https://www.jitpack.io' } + // 支持4.1.0及以后版本 + // maven { url "https://gitee.com/goweii/maven-repository/raw/master/releases/" } } } ``` From dab6a64c167fbf9202c37ad267544425c2ddbb1b Mon Sep 17 00:00:00 2001 From: cuiz Date: Thu, 24 Dec 2020 17:55:49 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=89=A9=E7=90=86?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E9=94=AE=E4=BA=8B=E4=BB=B6=E6=8B=A6=E6=88=AA?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/per/goweii/anylayer/ViewManager.java | 41 +++++++++++++++---- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/anylayer/src/main/java/per/goweii/anylayer/ViewManager.java b/anylayer/src/main/java/per/goweii/anylayer/ViewManager.java index 7958ac5..6b2aa36 100644 --- a/anylayer/src/main/java/per/goweii/anylayer/ViewManager.java +++ b/anylayer/src/main/java/per/goweii/anylayer/ViewManager.java @@ -97,17 +97,15 @@ public void setOnKeyListener(@Nullable OnKeyListener onKeyListener) { * 添加到父View */ private void onAttach() { + mParent.addView(mChild); if (mOnKeyListener != null) { mChild.setFocusable(true); mChild.setFocusableInTouchMode(true); - mChild.requestFocus(); - currentKeyView = mChild; + mLayerKeyListener = new LayerKeyListener(); + findFocusViewAndBindKeyListener(); mLayerGlobalFocusChangeListener = new LayerGlobalFocusChangeListener(); mChild.getViewTreeObserver().addOnGlobalFocusChangeListener(mLayerGlobalFocusChangeListener); - mLayerKeyListener = new LayerKeyListener(); - currentKeyView.setOnKeyListener(mLayerKeyListener); } - mParent.addView(mChild); if (mOnLifeListener != null) { mOnLifeListener.onAttach(); } @@ -129,17 +127,42 @@ private void onDetach() { } } + private void findFocusViewAndBindKeyListener() { + Utils.onViewLayout(mChild, new Runnable() { + @Override + public void run() { + currentKeyView = mChild.findFocus(); + if (currentKeyView != null) { + currentKeyView.setOnKeyListener(mLayerKeyListener); + return; + } + mChild.requestFocus(); + currentKeyView = mChild.findFocus(); + if (currentKeyView != null) { + currentKeyView.setOnKeyListener(mLayerKeyListener); + } + } + }); + } + private final class LayerGlobalFocusChangeListener implements ViewTreeObserver.OnGlobalFocusChangeListener { @Override public void onGlobalFocusChanged(View oldFocus, View newFocus) { if (currentKeyView != null) { currentKeyView.setOnKeyListener(null); } - if (oldFocus != null) { - oldFocus.setOnKeyListener(null); + currentKeyView = mChild.findFocus(); + if (currentKeyView != null) { + currentKeyView.setOnKeyListener(mLayerKeyListener); + return; + } + View rootFocus = mChild.getRootView().findFocus(); + if (rootFocus != null) { + return; } - if (newFocus != null) { - currentKeyView = newFocus; + mChild.requestFocus(); + currentKeyView = mChild.findFocus(); + if (currentKeyView != null) { currentKeyView.setOnKeyListener(mLayerKeyListener); } } From 37b0bb41117eb1f0980a9ba401da204c9f8fbd04 Mon Sep 17 00:00:00 2001 From: cuiz Date: Thu, 24 Dec 2020 18:13:52 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=B8=A6=E8=BE=93?= =?UTF-8?q?=E5=85=A5=E6=A1=86=E5=BC=B9=E7=AA=97=E7=82=B9=E5=87=BB=E5=A4=96?= =?UTF-8?q?=E9=83=A8=E5=85=B3=E9=97=AD=E9=9C=80=E8=A6=812=E6=AC=A1?= =?UTF-8?q?=E6=89=8D=E8=83=BD=E8=A7=A6=E5=8F=91=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/per/goweii/anylayer/dialog/DialogLayer.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/anylayer/src/main/java/per/goweii/anylayer/dialog/DialogLayer.java b/anylayer/src/main/java/per/goweii/anylayer/dialog/DialogLayer.java index 143e2b7..2973f5b 100644 --- a/anylayer/src/main/java/per/goweii/anylayer/dialog/DialogLayer.java +++ b/anylayer/src/main/java/per/goweii/anylayer/dialog/DialogLayer.java @@ -380,9 +380,9 @@ public void run() { protected void initContainer() { if (getConfig().mOutsideInterceptTouchEvent) { - getViewHolder().getChild().setClickable(true); + getViewHolder().getBackground().setClickable(true); if (getConfig().mCancelableOnTouchOutside) { - getViewHolder().getChild().setOnClickListener(new View.OnClickListener() { + getViewHolder().getBackground().setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dismiss(); @@ -390,8 +390,8 @@ public void onClick(View v) { }); } } else { - getViewHolder().getChild().setOnClickListener(null); - getViewHolder().getChild().setClickable(false); + getViewHolder().getBackground().setOnClickListener(null); + getViewHolder().getBackground().setClickable(false); } if (getConfig().mOutsideTouchedToDismiss || getConfig().mOutsideTouchedListener != null) { getViewHolder().getChild().setOnTouchedListener(new ContainerLayout.OnTouchedListener() { From 18425a68644c234453f7faa36b18292997d0d4c2 Mon Sep 17 00:00:00 2001 From: cuiz Date: Thu, 24 Dec 2020 18:16:08 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E6=9B=B4=E6=96=B0README?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index dfc1aa5..36d0f69 100644 --- a/README.md +++ b/README.md @@ -139,6 +139,11 @@ dependencies { [点击查看详细更新说明](https://github.com/goweii/AnyLayer/releases) +### 4.1.1 + +- 修复物理返回键事件拦截问题 +- 修复带输入框弹窗点击外部关闭需要2次才能触发的问题 + ### 4.1.0 - 适配分屏小窗和横竖屏切换 From a616daca3160188b9dd8c1e2379f22b7d3c44cd7 Mon Sep 17 00:00:00 2001 From: cuiz Date: Thu, 24 Dec 2020 18:16:42 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E6=9B=B4=E6=96=B0maven=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- maven-upload.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maven-upload.gradle b/maven-upload.gradle index c2b2f32..c873477 100644 --- a/maven-upload.gradle +++ b/maven-upload.gradle @@ -1,7 +1,7 @@ apply plugin: 'maven' group "per.goweii.anylayer" -version "4.1.0" +version "4.1.1" uploadArchives { repositories {