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 device getSafeAreaEdge #2145

Merged
merged 2 commits into from Mar 9, 2020

Conversation

PatriceJiang
Copy link
Contributor

@PatriceJiang PatriceJiang commented Feb 18, 2020

@holycanvas holycanvas requested a review from minggo Feb 19, 2020
@PatriceJiang PatriceJiang requested a review from wuzhiming Feb 20, 2020

public static float[] getSafeArea() {

if (android.os.Build.VERSION.SDK_INT >= 28) {
Copy link
Contributor

@wuzhiming wuzhiming Feb 20, 2020

Choose a reason for hiding this comment

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

经过沟通,应该可以不用反射

Copy link
Contributor

@minggo minggo Feb 20, 2020

Choose a reason for hiding this comment

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

为什么可以不用反射?如果使用低版本的 SDK 编译就没法通过了。

Copy link
Contributor Author

@PatriceJiang PatriceJiang Feb 25, 2020

Choose a reason for hiding this comment

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

在 SDK 26 上验证编译会出错, 已经回滚对应的修改。

Copy link
Contributor

@minggo minggo Feb 25, 2020

Choose a reason for hiding this comment

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

有 Utils 类用于帮助反射调用的,可以简化代码。

int bottom = cutout.getSafeInsetBottom();
return new float[]{top, left, bottom, right};

}while(false);
Copy link
Contributor

@wuzhiming wuzhiming Feb 20, 2020

Choose a reason for hiding this comment

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

这行代码缩进貌似不对

Copy link
Contributor Author

@PatriceJiang PatriceJiang Feb 20, 2020

Choose a reason for hiding this comment

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

这里用了AS 的自动缩进

Copy link
Contributor

@wuzhiming wuzhiming left a comment

如果老版本不用反射也没啥问题的话,我觉得就没啥问题来,我觉得不用挺好,看着反射好累

@cocos-robot cocos-robot changed the base branch from v2.3.1 to v2.3.1-release Feb 24, 2020
Copy link
Contributor

@cocos-robot cocos-robot left a comment

@PatriceJiang, v2.3.1 branch will be deleted, so we edited the base branch to v2.3.1-release, or this PR will be killed by GitHub.
Please review the commits history to ensure that the PR does not polluted by unneeded commits from your origin branch.
If you need to merge to other branch, you can first click the Edit button on the right side of the PR title, then switch the base branch.
If necessary, welcome to resubmit a new PR. Thanks!

@cocos-robot cocos-robot changed the base branch from v2.3.1-release to v2.3.2 Mar 6, 2020
Copy link
Contributor

@cocos-robot cocos-robot left a comment

@PatriceJiang, v2.3.1-release branch will be deleted, so we edited the base branch to v2.3.2, or this PR will be killed by GitHub.
Please review the commits history to ensure that the PR does not polluted by unneeded commits from your origin branch.
If you need to merge to other branch, you can first click the Edit button on the right side of the PR title, then switch the base branch.
If necessary, welcome to resubmit a new PR. Thanks!

minggo
minggo approved these changes Mar 9, 2020
@cocos-robot cocos-robot changed the base branch from v2.3.2 to v2.3.3-release Mar 9, 2020
Copy link
Contributor

@cocos-robot cocos-robot left a comment

@PatriceJiang, v2.3.2 branch will be deleted, so we edited the base branch to v2.3.3-release, or this PR will be killed by GitHub.
Please review the commits history to ensure that the PR does not polluted by unneeded commits from your origin branch.
If you need to merge to other branch, you can first click the Edit button on the right side of the PR title, then switch the base branch.
If necessary, welcome to resubmit a new PR. Thanks!

@holycanvas holycanvas merged commit 9c73c2d into cocos:v2.3.3-release Mar 9, 2020
1 check passed
@PatriceJiang PatriceJiang deleted the v2.3-view-safe-area branch Jun 15, 2020
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.

None yet

5 participants