File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
autosize/src/main/java/me/jessyan/autosize Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -449,6 +449,7 @@ public void setVertical(boolean vertical) {
449449 * @param screenWidth 屏幕宽度
450450 */
451451 public void setScreenWidth (int screenWidth ) {
452+ Preconditions .checkArgument (screenWidth > 0 , "screenWidth must be > 0" );
452453 mScreenWidth = screenWidth ;
453454 }
454455
@@ -458,9 +459,30 @@ public void setScreenWidth(int screenWidth) {
458459 * @param screenHeight 屏幕高度 (包含状态栏和导航栏)
459460 */
460461 public void setScreenHeight (int screenHeight ) {
462+ Preconditions .checkArgument (screenHeight > 0 , "screenHeight must be > 0" );
461463 mScreenHeight = screenHeight ;
462464 }
463465
466+ /**
467+ * 设置全局设计图宽度
468+ *
469+ * @param designWidthInDp 设计图宽度
470+ */
471+ public void setDesignWidthInDp (int designWidthInDp ) {
472+ Preconditions .checkArgument (designWidthInDp > 0 , "designWidthInDp must be > 0" );
473+ mDesignWidthInDp = designWidthInDp ;
474+ }
475+
476+ /**
477+ * 设置全局设计图高度
478+ *
479+ * @param designHeightInDp 设计图高度
480+ */
481+ public void setDesignHeightInDp (int designHeightInDp ) {
482+ Preconditions .checkArgument (designHeightInDp > 0 , "designHeightInDp must be > 0" );
483+ mDesignHeightInDp = designHeightInDp ;
484+ }
485+
464486 /**
465487 * 获取使用者在 AndroidManifest 中填写的 Meta 信息
466488 * <p>
You can’t perform that action at this time.
0 commit comments