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

fix:修复浮窗位置的初始化逻辑 #186

Merged
merged 4 commits into from
Nov 26, 2024
Merged

fix:修复浮窗位置的初始化逻辑 #186

merged 4 commits into from
Nov 26, 2024

Conversation

Petterpx
Copy link
Owner

@Petterpx Petterpx commented Nov 26, 2024

Summary by Sourcery

通过确保在设置坐标之前更新视图大小,修复浮动窗口位置的初始化逻辑。更新文档以反映最新的库版本。

错误修复:

  • 通过在确定坐标之前更新视图大小,修复浮动窗口位置的初始化逻辑。

文档:

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

Summary by Sourcery

Fix the initialization logic for the floating window position by ensuring the view size is updated before setting coordinates. Update documentation to reflect the latest library version.

Bug Fixes:

  • Fix the initialization logic of the floating window position by updating the view size before determining the coordinates.

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 Nov 26, 2024

审核者指南由 Sourcery 提供

此 PR 通过在设置初始坐标之前更新视图大小并改进安全坐标的日志记录,修复了浮动窗口位置的初始化逻辑。它还包括文档中的版本更新,并在演示应用中添加了位置保存实现。

浮动窗口初始化的序列图

sequenceDiagram
    participant User
    participant FxViewLocationHelper
    participant Config
    participant BasicView

    User->>FxViewLocationHelper: onInit()
    FxViewLocationHelper->>FxViewLocationHelper: updateViewSize()
    FxViewLocationHelper->>Config: check enableSaveDirection
    Config-->>FxViewLocationHelper: hasHistory
    alt hasHistory
        FxViewLocationHelper->>FxViewLocationHelper: getHistoryXY()
    else
        FxViewLocationHelper->>FxViewLocationHelper: getDefaultXY()
    end
    FxViewLocationHelper->>FxViewLocationHelper: safeX(defaultX), safeY(defaultY)
    FxViewLocationHelper->>BasicView: updateXY(safeX, safeY)
    FxViewLocationHelper->>Config: log initLocation with safeX, safeY
Loading

更新后的 FxViewLocationHelper 类图

classDiagram
    class FxViewLocationHelper {
        +onInit()
        +onSizeChanged(w: Int, h: Int, oldW: Int, oldH: Int)
        -updateViewSize()
        -safeX(defaultX: Int)
        -safeY(defaultY: Int)
    }
    class FxViewBasicHelper
    FxViewLocationHelper --|> FxViewBasicHelper
    class Config {
        +enableSaveDirection: Boolean
        +iFxConfigStorage: IFxConfigStorage
        +fxLog: FxLog
    }
    class BasicView {
        +updateXY(x: Int, y: Int)
    }
    class IFxConfigStorage {
        +hasConfig(): Boolean
    }
    class FxLog {
        +d(message: String)
    }
Loading

文件级更改

更改 详情 文件
改进的浮动窗口位置初始化逻辑
  • 在初始位置计算之前添加视图大小更新
  • 将安全坐标计算与视图更新分开
  • 更新日志以显示实际安全坐标而非默认值
floatingx/src/main/java/com/petterp/floatingx/view/helper/FxViewLocationHelper.kt
更新文档中的库版本
  • 将核心和 compose 依赖项的版本从 2.3.0 提升到 2.3.1
README.md
README_EN.md
增强的演示应用程序具有位置保存功能
  • 使用 FxConfigStorageToSpImpl 添加位置保存实现
app/src/main/java/com/petterp/floatingx/app/kotlin/FxSystemSimple.kt

可能相关的问题


提示和命令

与 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 fixes the initialization logic of floating window positions by updating the view size before setting initial coordinates and improving the logging of safe coordinates. It also includes version updates in documentation and adds position saving implementation in the demo app.

Sequence diagram for floating window initialization

sequenceDiagram
    participant User
    participant FxViewLocationHelper
    participant Config
    participant BasicView

    User->>FxViewLocationHelper: onInit()
    FxViewLocationHelper->>FxViewLocationHelper: updateViewSize()
    FxViewLocationHelper->>Config: check enableSaveDirection
    Config-->>FxViewLocationHelper: hasHistory
    alt hasHistory
        FxViewLocationHelper->>FxViewLocationHelper: getHistoryXY()
    else
        FxViewLocationHelper->>FxViewLocationHelper: getDefaultXY()
    end
    FxViewLocationHelper->>FxViewLocationHelper: safeX(defaultX), safeY(defaultY)
    FxViewLocationHelper->>BasicView: updateXY(safeX, safeY)
    FxViewLocationHelper->>Config: log initLocation with safeX, safeY
Loading

Updated class diagram for FxViewLocationHelper

classDiagram
    class FxViewLocationHelper {
        +onInit()
        +onSizeChanged(w: Int, h: Int, oldW: Int, oldH: Int)
        -updateViewSize()
        -safeX(defaultX: Int)
        -safeY(defaultY: Int)
    }
    class FxViewBasicHelper
    FxViewLocationHelper --|> FxViewBasicHelper
    class Config {
        +enableSaveDirection: Boolean
        +iFxConfigStorage: IFxConfigStorage
        +fxLog: FxLog
    }
    class BasicView {
        +updateXY(x: Int, y: Int)
    }
    class IFxConfigStorage {
        +hasConfig(): Boolean
    }
    class FxLog {
        +d(message: String)
    }
Loading

File-Level Changes

Change Details Files
Improved floating window position initialization logic
  • Added view size update before initial position calculation
  • Separated safe coordinate calculation from view update
  • Updated logging to show actual safe coordinates instead of default values
floatingx/src/main/java/com/petterp/floatingx/view/helper/FxViewLocationHelper.kt
Updated library version in documentation
  • Bumped version from 2.3.0 to 2.3.1 for both core and compose dependencies
README.md
README_EN.md
Enhanced demo application with position saving functionality
  • Added position saving implementation using FxConfigStorageToSpImpl
app/src/main/java/com/petterp/floatingx/app/kotlin/FxSystemSimple.kt

Possibly linked issues


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 - 我已经审查了你的更改,它们看起来很棒!

这是我在审查期间查看的内容
  • 🟢 一般问题:一切看起来都很好
  • 🟢 安全性:一切看起来都很好
  • 🟢 测试:一切看起来都很好
  • 🟢 复杂性:一切看起来都很好
  • 🟢 文档:一切看起来都很好

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

Hey @Petterpx - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 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 a5374fa into main Nov 26, 2024
2 of 3 checks passed
@Petterpx Petterpx deleted the fix_view_location branch November 26, 2024 14:23
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