Skip to content

Commit

Permalink
Add usage of AutoSizeConfig#setOnAdaptListener
Browse files Browse the repository at this point in the history
  • Loading branch information
JessYanCoding committed Oct 30, 2018
1 parent 93429b9 commit 54a166c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions demo/src/main/java/me/jessyan/autosize/demo/BaseApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,16 @@
import android.app.Application;
import android.util.DisplayMetrics;

import java.util.Locale;

import cat.ereza.customactivityoncrash.activity.DefaultErrorActivity;
import me.jessyan.autosize.AutoSize;
import me.jessyan.autosize.AutoSizeConfig;
import me.jessyan.autosize.external.ExternalAdaptInfo;
import me.jessyan.autosize.external.ExternalAdaptManager;
import me.jessyan.autosize.internal.CustomAdapt;
import me.jessyan.autosize.onAdaptListener;
import me.jessyan.autosize.utils.LogUtils;

/**
* ================================================
Expand Down Expand Up @@ -58,6 +62,19 @@ public void onCreate() {
//如果没有这个需求建议不开启
.setCustomFragment(true)

//屏幕适配监听器
.setOnAdaptListener(new onAdaptListener() {
@Override
public void onAdaptBefore(Object target, Activity activity) {
LogUtils.d(String.format(Locale.ENGLISH, "%s onAdaptBefore!", target.getClass().getName()));
}

@Override
public void onAdaptAfter(Object target, Activity activity) {
LogUtils.d(String.format(Locale.ENGLISH, "%s onAdaptAfter!", target.getClass().getName()));
}
})

//是否打印 AutoSize 的内部日志, 默认为 true, 如果您不想 AutoSize 打印日志, 则请设置为 false
// .setLog(false)

Expand Down

0 comments on commit 54a166c

Please sign in to comment.