Jacksgong / JKeyboardPanelSwitch

For resolve the layout conflict when keybord & panel are switching (Android键盘面板冲突 布局闪动处理方案)
Apache License 2.0
4.18k stars 684 forks source link

设置了windowsTranslucentStatus为true的时候,计算有问题 #27

Closed waldenana closed 8 years ago

waldenana commented 8 years ago

这几行的判断有些问题,透明状态栏时会进入这个判断

 if (phoneDisplayHeight == actionBarOverlayLayoutHeight) {
          // no space to settle down the status bar, switch to fullscreen,
          // only in the case of paused and opened the fullscreen page.
          Log.w(TAG, String.format("skip the keyboard status calculate, the current" +
                     " activity is paused. and phone-display-height %d," +
                    " root-height+actionbar-height %d", phoneDisplayHeight,
                    actionBarOverlayLayoutHeight));
         return;

}

问题我已经解决了,希望你有时间能merge一下

Jacksgong commented 8 years ago

是的。如果设置为透明的时候确实就会进入这里,这个就是为了覆盖这个case的。我不清楚你是遇到了什么问题。

waldenana commented 8 years ago

如果是透明状态栏,这个判断就横是true,下面的就不会进入了,以至于KPSwitchConflictUtil.showPanel会闪烁

waldenana commented 8 years ago

我增加了透明状态栏的判断

 if (!isTranslucentStatus && phoneDisplayHeight == actionBarOverlayLayoutHeight) 

并且maxOverlayLayoutHeight最大高度好像也不对,我改成了下面这样

                Rect r = new Rect();
                actionBarOverlayLayout.getWindowVisibleDisplayFrame(r);
                int maxHeight = r.height();//最大高度应该是可见区域的
                if (maxOverlayLayoutHeight == 0) {
                    // non-used.
                    isKeyboardShowing = lastKeyboardShowing;
                } else isKeyboardShowing = displayHeight < maxOverlayLayoutHeight;

                maxOverlayLayoutHeight = Math.max(maxOverlayLayoutHeight, maxHeight);
Jacksgong commented 8 years ago

...sorry,我看错了。你说的这个很有可能前段时间的最新代码中的已经修复了。

你看下这个commit ,原因我都已经写好了。

https://github.com/Jacksgong/JKeyboardPanelSwitch/commit/c737e971c51b55b11ee5d6cecc628e3cd4a2afee

21号的最新版本上面有体现。

waldenana commented 8 years ago

我有的是最新代码测试的,在透明状态栏的时候 phoneDisplayHeight == actionBarOverlayLayoutHeight 这句一直是成立的,所以我在这里加了 !isTranslucentStatus 的判断 你可以在theme里加一个

        <item name="android:windowTranslucentStatus">true</item>

测试下

Jacksgong commented 8 years ago

@anzewei 💯

Jacksgong commented 8 years ago

@anzewei 要不你提下PR,还是我直接修改了?

Jacksgong commented 8 years ago

提PR的时候,留意下这几个点就行。

image

Jacksgong commented 8 years ago

@anzewei @anjiao 我已经在最新的demo中体现覆盖这个Case了,可以拉最新代码下来看看:

1 pic

waldenana commented 8 years ago

周末在家休息,没看到回复,抱歉 刚刚试了,这个问题已经ok了 @Jacksgong

Jacksgong commented 8 years ago

@anzewei 恩。

LynLin0 commented 8 years ago

我用 compile 'cn.dreamtobe.kpswitch:library:1.4.5' 看里面的代码没有以上的修改,是不是还没有更新 @Jacksgong

Jacksgong commented 8 years ago

@LynLin0 你留意下changelog,还没有更新版本。我这几天更新下版本吧。

Jacksgong commented 8 years ago

@LynLin0 我更新了新的版本 1.4.6。

Jacksgong commented 8 years ago

已在 v1.4.6 带上。

anjiao commented 8 years ago

6666

waldenana commented 8 years ago

:100: