Skip to content

Commit 81ffb88

Browse files
committed
Improve subunits/CustomAdaptActivity
1 parent dde8563 commit 81ffb88

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

demo-subunits/src/main/java/me/jessyan/autosize/demo/subunits/CustomAdaptActivity.java

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616
package me.jessyan.autosize.demo.subunits;
1717

18-
import android.app.Activity;
1918
import android.os.Bundle;
2019
import android.support.v7.app.AppCompatActivity;
2120

@@ -25,11 +24,6 @@
2524
* ================================================
2625
* 本框架核心原理来自于 <a href="https://mp.weixin.qq.com/s/d9QCoBP6kV9VSWvVldVVwA">今日头条官方适配方案</a>
2726
* <p>
28-
* {@link CustomAdaptActivity} 展示项目内部的 {@link Activity} 自定义适配参数的用法, 需要实现 {@link CustomAdapt}
29-
* 现在 AndroidAutoSize 是全局以屏幕宽度为基准进行适配的, 并且全局的设计图尺寸为 360 * 640
30-
* 这里就展示怎么让 {@link CustomAdaptActivity} 单个页面, 有别于全局设置, 以屏幕高度为基准进行适配, 并且更改设计图尺寸为 IPhone 的设计图尺寸
31-
* 如果这个页面的设计图尺寸有别于其他页面, AndroidAutoSize 允许您改变单个页面的设计图尺寸, {@link #getSizeInDp()}
32-
* <p>
3327
* Created by JessYan on 2018/8/11 11:31
3428
* <a href="mailto:[email protected]">Contact me</a>
3529
* <a href="https://github.com/JessYanCoding">Follow me</a>
@@ -54,18 +48,19 @@ public boolean isBaseOnWidth() {
5448
}
5549

5650
/**
57-
* 这里使用 IPhone 的设计图, IPhone 的设计图尺寸为 750px * 1334px, 高换算成 dp 为 667 (1334px / 2 = 667dp)
51+
* 这里使用 IPhone 的设计图, IPhone 的设计图尺寸为 750px * 1334px, 因为这个页面使用副单位进行布局
52+
* 所以可以直接以像素作为单位返回设计图的尺寸
5853
* <p>
59-
* 返回设计图上的设计尺寸, 单位 dp
54+
* 返回设计图上的设计尺寸
6055
* {@link #getSizeInDp} 须配合 {@link #isBaseOnWidth()} 使用, 规则如下:
6156
* 如果 {@link #isBaseOnWidth()} 返回 {@code true}, {@link #getSizeInDp} 则应该返回设计图的总宽度
6257
* 如果 {@link #isBaseOnWidth()} 返回 {@code false}, {@link #getSizeInDp} 则应该返回设计图的总高度
6358
* 如果您不需要自定义设计图上的设计尺寸, 想继续使用在 AndroidManifest 中填写的设计图尺寸, {@link #getSizeInDp} 则返回 {@code 0}
6459
*
65-
* @return 设计图上的设计尺寸, 单位 dp
60+
* @return 设计图上的设计尺寸
6661
*/
6762
@Override
6863
public float getSizeInDp() {
69-
return 667;
64+
return 1334;
7065
}
7166
}

0 commit comments

Comments
 (0)