Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DialogFragment有适配吗? #35

Closed
SjAndy88 opened this issue Jul 26, 2017 · 12 comments
Closed

DialogFragment有适配吗? #35

SjAndy88 opened this issue Jul 26, 2017 · 12 comments
Labels

Comments

@SjAndy88
Copy link

No description provided.

@SjAndy88
Copy link
Author

遇到全屏DialogFragment会出现状态栏出现半透明,使用sdk也不能做成透明

@gyf-dev
Copy link
Owner

gyf-dev commented Jul 27, 2017

@flztsj 没有适配,我刚才试验了一下,在onCreateDialog方法里,可以实现,准备下个版本适配,代码如下:

    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        Dialog dialog = super.onCreateDialog(savedInstanceState);
        Window window = dialog.getWindow();
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {

            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && !OSUtils.isEMUI3_1()) {
                int flags = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                        | View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
                window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
                window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
                window.setStatusBarColor(Color.TRANSPARENT);
                window.getDecorView().setSystemUiVisibility(flags);
            } else
                window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        }
        return dialog;
    }

@SjAndy88
Copy link
Author

还有Dialog中的有输入框的问题,我也基本实现了,主要就是window和contentview这两个,不过和现在代码不是很契合,因为现在代码主体还是用Activity去弄的。 代码的逻辑和目前sdk中的逻辑没有区别,主要是看如何吧dialog给兼容进去,个人觉得如果不好改的话可以单独实现个dialog相关的sdk

@gyf-dev
Copy link
Owner

gyf-dev commented Jul 31, 2017

@flztsj 2.2.7版本更新dialog使用,现在已经改的差不多了,测试中

@SjAndy88
Copy link
Author

SjAndy88 commented Aug 2, 2017

Ok,辛苦

@gyf-dev
Copy link
Owner

gyf-dev commented Aug 2, 2017

@flztsj 已经更新2.2.7版本

@SjAndy88
Copy link
Author

SjAndy88 commented Aug 2, 2017

全屏DialogFragment有Bug,多次切换会出现空白

device-2017-08-03-003641.mp4.zip

@gyf-dev
Copy link
Owner

gyf-dev commented Aug 3, 2017

@flztsj 看图
wx20170803-104928 2x

@SjAndy88
Copy link
Author

SjAndy88 commented Aug 3, 2017

了解,现在我用最新的版本demo泡在Api19的模拟器上 输入法弹不出来,你那边有这个情况吗?

@SjAndy88
Copy link
Author

SjAndy88 commented Aug 3, 2017

建议加入https://github.com/square/leakcanary 检测内存泄露

@SjAndy88
Copy link
Author

SjAndy88 commented Aug 3, 2017

@gyf-dev
KeyboardPatch里面的mActivity.getWindow()在Dialog的情况下应该替换成Dialog自己的window,我这边换了,那个多次切换会出现空白好像Ok了。

@gyf-dev
Copy link
Owner

gyf-dev commented Aug 3, 2017

@flztsj 模拟器上输入法无法弹出,你要到设置界面设置一下,我现在就是使用的dialog的Window

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants