JingYeoh / JingYeoh/SlideMenuLayout

INAPPROPRIATE code inside onMeasure function

Open
#19 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
247
Forks
62
PR merge metrics
No merged PRs in 30d

Description

```
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
//默认全屏
int widthMode = MeasureSpec.getMode(widthMeasureSpec);
int widthSize = MeasureSpec.getSize(widthMeasureSpec);
int widthResult = 0;
if (widthMode == MeasureSpec.EXACTLY) {
widthResult = widthSize;
} else {
widthResult = **screenWidth**;
}
int heightMode = MeasureSpec.getMode(heightMeasureSpec);
int heightSize = MeasureSpec.getSize(heightMeasureSpec);
int heightResult = 0;
if (heightMode == MeasureSpec.EXACTLY) {
heightResult = heightSize;
} else {
heightResult = **screenHeight**;
}
//初始化侧滑菜单
initSlideView(widthResult, heightResult);

measureSlideChild(mContentView, widthMeasureSpec, heightMeasureSpec);
measureSlideChild(mLeftView, widthMeasureSpec, heightMeasureSpec);
measureSlideChild(mRightView, widthMeasureSpec, heightMeasureSpec);

setMeasuredDimension(mContentWidth, mContentHeight);
}
```

**using screen width and screen height is not appropriate
use parent width or height minus both paddings [case of : _MATH PARENT_]**

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.