Skip to content

Commit

Permalink
Add AutoSizeConfig#setDesignWidthInDp(int) and AutoSizeConfig#setDesi…
Browse files Browse the repository at this point in the history
…gnHeightInDp(int)
  • Loading branch information
JessYanCoding committed Oct 22, 2018
1 parent afb8353 commit 9903e86
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions autosize/src/main/java/me/jessyan/autosize/AutoSizeConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,7 @@ public void setVertical(boolean vertical) {
* @param screenWidth 屏幕宽度
*/
public void setScreenWidth(int screenWidth) {
Preconditions.checkArgument(screenWidth > 0, "screenWidth must be > 0");
mScreenWidth = screenWidth;
}

Expand All @@ -458,9 +459,30 @@ public void setScreenWidth(int screenWidth) {
* @param screenHeight 屏幕高度 (包含状态栏和导航栏)
*/
public void setScreenHeight(int screenHeight) {
Preconditions.checkArgument(screenHeight > 0, "screenHeight must be > 0");
mScreenHeight = screenHeight;
}

/**
* 设置全局设计图宽度
*
* @param designWidthInDp 设计图宽度
*/
public void setDesignWidthInDp(int designWidthInDp) {
Preconditions.checkArgument(designWidthInDp > 0, "designWidthInDp must be > 0");
mDesignWidthInDp = designWidthInDp;
}

/**
* 设置全局设计图高度
*
* @param designHeightInDp 设计图高度
*/
public void setDesignHeightInDp(int designHeightInDp) {
Preconditions.checkArgument(designHeightInDp > 0, "designHeightInDp must be > 0");
mDesignHeightInDp = designHeightInDp;
}

/**
* 获取使用者在 AndroidManifest 中填写的 Meta 信息
* <p>
Expand Down

0 comments on commit 9903e86

Please sign in to comment.