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

refactor:调整系统浮窗安全区逻辑 #190

Merged
merged 2 commits into from
Dec 10, 2024
Merged

Conversation

Petterpx
Copy link
Owner

@Petterpx Petterpx commented Dec 10, 2024

Summary by Sourcery

重构系统浮动窗口逻辑以改善安全区域和窗口标志的处理。更新文档以反映库的最新版本。

增强功能:

  • 通过引入一种新方法来检查和应用窗口标志,重构系统浮动窗口中安全区域的处理逻辑。

文档:

  • 更新README和README_EN文件中的版本号以反映最新的库版本。
Original summary in English

Summary by Sourcery

Refactor the system floating window logic to improve the handling of safe areas and window flags. Update documentation to reflect the latest version of the library.

Enhancements:

  • Refactor the logic for handling the safe area in system floating windows by introducing a new method to check and apply window flags.

Documentation:

  • Update the version numbers in the README and README_EN files to reflect the latest library version.

Copy link
Contributor

sourcery-ai bot commented Dec 10, 2024

审核者指南由 Sourcery 提供

此 PR 通过改进系统窗口标志和屏幕高度计算的处理来重构浮动窗口的安全区域逻辑。更改主要集中在重新组织窗口布局标志管理和引入更明确的安全区域控制。

更新后的 FxSystemContainerView 类图

classDiagram
    class FxSystemContainerView {
        +Pair<Int, Int> parentSize()
        +void updateEnableHalfStatus(Boolean enableHalfHide)
        +void updateKeyBoardStatus(Boolean showKeyBoard)
        +void initWLParams()
        +void safeUpdateViewLayout(WindowManager.LayoutParams lp)
        +Int defaultFlags
        +Int checkFullFlags(Boolean enableHalfHide, Boolean enableSafeArea)
    }
    note for FxSystemContainerView "重构以使用 realScreenHeight 和 checkFullFlags 进行窗口布局管理。"
Loading

更新后的 FxAppHelper 类图

classDiagram
    class FxAppHelper {
        -Boolean isEnableSafeArea
        +Boolean enableSafeArea
        +Builder setEnableSafeArea(Boolean isEnable)
    }
    note for FxAppHelper "重命名 isEnableSafeArea 为 enableSafeArea 以保持一致性。"
Loading

文件级更改

更改 详情 文件
重构窗口布局标志管理
  • 引入了一个新的 checkFullFlags 扩展函数来处理窗口布局标志
  • 移除 findFlags 函数并将逻辑合并到 checkFullFlags 中
  • 在标志计算中添加对半隐藏和安全区域配置的支持
  • 在禁用安全区域时添加 FLAG_LAYOUT_IN_SCREEN 标志
floatingx/src/main/java/com/petterp/floatingx/view/FxSystemContainerView.kt
更新屏幕高度计算和安全区域处理
  • 将 screenHeight 更改为 realScreenHeight 以获得更准确的测量
  • 将 isEnableSafeArea 重命名为 enableSafeArea 以保持一致性
  • 更新半隐藏功能的文档
floatingx/src/main/java/com/petterp/floatingx/view/FxSystemContainerView.kt
floatingx/src/main/java/com/petterp/floatingx/assist/helper/FxAppHelper.kt
floatingx/src/main/java/com/petterp/floatingx/assist/helper/FxBasisHelper.kt
改进视图管理安全性
  • 在 safeRemoveView 中移除不必要的 isAttachedToWindow 检查
floatingx/src/main/java/com/petterp/floatingx/util/FxExt.kt
文档中的版本更新
  • 将版本号从 2.3.1 更新到 2.3.2
README.md
README_EN.md

提示和命令

与 Sourcery 互动

  • 触发新审核: 在拉取请求中评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的审核评论。
  • 从审核评论生成 GitHub 问题: 通过回复审核评论请求 Sourcery 创建一个问题。
  • 生成拉取请求标题: 在拉取请求标题的任何地方写 @sourcery-ai 以随时生成标题。
  • 生成拉取请求摘要: 在拉取请求正文的任何地方写 @sourcery-ai summary 以随时生成 PR 摘要。您也可以使用此命令指定摘要应插入的位置。

自定义您的体验

访问您的仪表板以:

  • 启用或禁用审核功能,例如 Sourcery 生成的拉取请求摘要、审核者指南等。
  • 更改审核语言。
  • 添加、删除或编辑自定义审核说明。
  • 调整其他审核设置。

获取帮助

Original review guide in English

Reviewer's Guide by Sourcery

This PR refactors the floating window's safe area logic by improving the handling of system window flags and screen height calculations. The changes primarily focus on reorganizing the window layout flags management and introducing more explicit safe area control.

Updated class diagram for FxSystemContainerView

classDiagram
    class FxSystemContainerView {
        +Pair<Int, Int> parentSize()
        +void updateEnableHalfStatus(Boolean enableHalfHide)
        +void updateKeyBoardStatus(Boolean showKeyBoard)
        +void initWLParams()
        +void safeUpdateViewLayout(WindowManager.LayoutParams lp)
        +Int defaultFlags
        +Int checkFullFlags(Boolean enableHalfHide, Boolean enableSafeArea)
    }
    note for FxSystemContainerView "Refactored to use realScreenHeight and checkFullFlags for window layout management."
Loading

Updated class diagram for FxAppHelper

classDiagram
    class FxAppHelper {
        -Boolean isEnableSafeArea
        +Boolean enableSafeArea
        +Builder setEnableSafeArea(Boolean isEnable)
    }
    note for FxAppHelper "Renamed isEnableSafeArea to enableSafeArea for consistency."
Loading

File-Level Changes

Change Details Files
Refactored window layout flags management
  • Introduced a new checkFullFlags extension function to handle window layout flags
  • Removed findFlags function and consolidated logic into checkFullFlags
  • Added support for both half-hide and safe area configurations in flag calculations
  • Added FLAG_LAYOUT_IN_SCREEN flag when safe area is disabled
floatingx/src/main/java/com/petterp/floatingx/view/FxSystemContainerView.kt
Updated screen height calculation and safe area handling
  • Changed screenHeight to realScreenHeight for more accurate measurements
  • Renamed isEnableSafeArea to enableSafeArea for consistency
  • Updated documentation for half-hide functionality
floatingx/src/main/java/com/petterp/floatingx/view/FxSystemContainerView.kt
floatingx/src/main/java/com/petterp/floatingx/assist/helper/FxAppHelper.kt
floatingx/src/main/java/com/petterp/floatingx/assist/helper/FxBasisHelper.kt
Improved view management safety
  • Removed unnecessary isAttachedToWindow check in safeRemoveView
floatingx/src/main/java/com/petterp/floatingx/util/FxExt.kt
Version bump in documentation
  • Updated version numbers from 2.3.1 to 2.3.2
README.md
README_EN.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Petterpx - 我已经审查了你的更改 - 这里有一些反馈:

总体评论

  • 在 safeRemoveView() 中移除 isAttachedToWindow 检查可能会导致问题。考虑保留此检查以防止尝试移除未附加到窗口的视图。
这是我在审查期间查看的内容
  • 🟡 一般问题:发现 1 个问题
  • 🟢 安全性:一切看起来都很好
  • 🟢 测试:一切看起来都很好
  • 🟢 复杂性:一切看起来都很好
  • 🟢 文档:一切看起来都很好

Sourcery 对开源项目免费 - 如果你喜欢我们的评论,请考虑分享它们 ✨
帮助我变得更有用!请在每条评论上点击 👍 或 👎,我将使用反馈来改进你的评论。
Original comment in English

Hey @Petterpx - I've reviewed your changes - here's some feedback:

Overall Comments:

  • The removal of the isAttachedToWindow check in safeRemoveView() could potentially cause issues. Consider keeping this check to prevent attempting to remove views that aren't attached to the window.
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@Petterpx Petterpx merged commit 31b00e1 into main Dec 10, 2024
2 of 3 checks passed
@Petterpx Petterpx deleted the refacor_system_rule branch December 10, 2024 16:55
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

Successfully merging this pull request may close these issues.

1 participant