Skip to content

Commit e8b679f

Browse files
committed
Add isCustomFragment to AutoSizeConfig
1 parent cfd0f55 commit e8b679f

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

autosize/src/main/java/me/jessyan/autosize/AutoSizeConfig.java

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import android.content.pm.PackageManager;
2424
import android.content.res.Configuration;
2525
import android.content.res.Resources;
26+
import android.support.v4.app.Fragment;
2627
import android.util.DisplayMetrics;
2728

2829
import me.jessyan.autosize.external.ExternalAdaptManager;
@@ -102,6 +103,10 @@ public final class AutoSizeConfig {
102103
* @see #restart()
103104
*/
104105
private boolean isStop;
106+
/**
107+
* 是否让框架支持自定义 {@link Fragment} 的适配参数, 由于这个需求是比较少见的, 所以须要使用者手动开启
108+
*/
109+
private boolean isCustomFragment;
105110

106111
public static AutoSizeConfig getInstance() {
107112
if (sInstance == null) {
@@ -266,6 +271,34 @@ public AutoSizeConfig setLog(boolean log) {
266271
return this;
267272
}
268273

274+
/**
275+
* 是否让框架支持自定义 {@link Fragment} 的适配参数, 由于这个需求是比较少见的, 所以须要使用者手动开启
276+
*
277+
* @param customFragment {@code true} 为支持
278+
*/
279+
public AutoSizeConfig setCustomFragment(boolean customFragment) {
280+
isCustomFragment = customFragment;
281+
return this;
282+
}
283+
284+
/**
285+
* 框架是否已经开启支持自定义 {@link Fragment} 的适配参数
286+
*
287+
* @return {@code true} 为支持
288+
*/
289+
public boolean isCustomFragment() {
290+
return isCustomFragment;
291+
}
292+
293+
/**
294+
* 框架是否已经停止运行
295+
*
296+
* @return {@code false} 框架正在运行, {@code true} 框架已经停止运行
297+
*/
298+
public boolean isStop() {
299+
return isStop;
300+
}
301+
269302
/**
270303
* {@link ExternalAdaptManager} 用来管理外部三方库 {@link Activity} 的适配
271304
*

0 commit comments

Comments
 (0)