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

关于QuickPop无背景时使用问题。 #183

Closed
Zeng-Ke opened this issue May 7, 2019 · 2 comments
Closed

关于QuickPop无背景时使用问题。 #183

Zeng-Ke opened this issue May 7, 2019 · 2 comments

Comments

@Zeng-Ke
Copy link

Zeng-Ke commented May 7, 2019

  • 系统版本:
  • 库版本:v2.1.9
  • 问题描述/重现步骤: 关于QuickPop无背景问题。
  • 问题代码/截图:
    查看#BasePopWindow中设置无背景的代码是这样的逻辑:
 public BasePopupWindow setBackground(int drawableIds) {
        if (drawableIds == 0) {
            return setBackground(null);
        }
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            return setBackground(getContext().getDrawable(drawableIds));
        } else {
            return setBackground(getContext().getResources().getDrawable(drawableIds));
        }
    }

可以看到设置setBackground(null)最终调用#PopBackgroundView的PopupUtil.isBackgroundInvalidated(mHelper.getPopupBackground()逻辑 即可设置为无背景。
所以我想在QuickPop中也如此使用,但是发现#QuickPop中有以下的逻辑:

 if (config.getBackground() != null) {
            setBackground(config.getBackground());
        }

也就是说我通过QuickPopupConfig设置background(null)为实现无背景的方法无效的。我只能拿到#QuickPop去setBackground(null)才可以达到目的。

val pop = QuickPopupBuilder.with(context)
                    .contentView(com.footchat.chat.R.layout.pop_message_long_click)
                    .config(QuickPopupConfig().gravity(Gravity.TOP or Gravity.CENTER_HORIZONTAL)
                            .allowInterceptTouchEvent(false)
                        )).build()
            pop.setBackground(0)
            pop.showPopupWindow(tvMessageText)

这样就不是原有的链式结构了。所以希望能统一下,或者
能说明下是什么原有要在#QuickPop加了个非空处理呢?

@razerdp
Copy link
Owner

razerdp commented May 7, 2019

感谢反馈~ 其实现阶段可以用backgroundColor(0)来保持链式调用~

这个没保持一致是一个遗留问题(以前版本写过后来忘了删掉),待会的一个版本修复这个问题~

感谢回馈

razerdp added a commit that referenced this issue May 7, 2019
@razerdp
Copy link
Owner

razerdp commented May 7, 2019

candy 2.2.0-beta查看~

@razerdp razerdp closed this as completed May 7, 2019
razerdp added a commit that referenced this issue Jun 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants