/*
 * Copyright 2018 JessYan
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package me.jessyan.autosize;

import android.app.Activity;
import android.app.Application;

import java.util.Locale;

import me.jessyan.autosize.internal.CancelAdapt;
import me.jessyan.autosize.internal.CustomAdapt;
import me.jessyan.autosize.utils.LogUtils;

/**
 * ================================================
 * 屏幕适配逻辑策略默认实现类, 可通过 {@link AutoSizeConfig#init(Application, boolean, AutoAdaptStrategy)}
 * 和 {@link AutoSizeConfig#setAutoAdaptStrategy(AutoAdaptStrategy)} 切换策略
 *
 * @see AutoAdaptStrategy
 * Created by JessYan on 2018/8/9 15:57
 * <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
 * <a href="https://github.com/JessYanCoding">Follow me</a>
 * ================================================
 */
public class DefaultAutoAdaptStrategy implements AutoAdaptStrategy {
    @Override
    public void applyAdapt(Activity activity) {
        //如果 activity 实现 CancelAdapt 接口表示放弃适配, 所有的适配效果都将失效
        if (activity instanceof CancelAdapt) {
            LogUtils.w(String.format(Locale.ENGLISH, "%s canceled the adaptation!", activity.getClass().getName()));
            return;
        }

        //如果 activity 实现 CustomAdapt 接口表示该 activity 想自定义一些用于适配的参数, 从而改变最终的适配效果
        if (activity instanceof CustomAdapt) {
            LogUtils.d(String.format(Locale.ENGLISH, "%s implemented by %s!", activity.getClass().getName(), CustomAdapt.class.getName()));
            AutoSize.autoConvertDensityOfCustomAdapt(activity, (CustomAdapt) activity);
        } else {
            LogUtils.d(String.format(Locale.ENGLISH, "%s used the global configuration.", activity.getClass().getName()));
            AutoSize.autoConvertDensityOfGlobal(activity);
        }
    }
}

@@ -699,24 +699,79 @@
 il.Locale;%0A%0A
+import me.jessyan.autosize.external.ExternalAdaptInfo;%0A
 import me.je
@@ -1493,24 +1493,976 @@
 activity) %7B%0A
+%0A        //%E6%A3%80%E6%9F%A5%E6%98%AF%E5%90%A6%E5%BC%80%E5%90%AF%E4%BA%86%E5%A4%96%E9%83%A8%E4%B8%89%E6%96%B9%E5%BA%93%E7%9A%84%E9%80%82%E9%85%8D%E6%A8%A1%E5%BC%8F, %E5%8F%AA%E8%A6%81%E4%B8%8D%E4%B8%BB%E5%8A%A8%E8%B0%83%E7%94%A8 ExternalAdaptManager %E7%9A%84%E6%96%B9%E6%B3%95, %E4%B8%8B%E9%9D%A2%E7%9A%84%E4%BB%A3%E7%A0%81%E5%B0%B1%E4%B8%8D%E4%BC%9A%E6%89%A7%E8%A1%8C%0A        if (AutoSizeConfig.getInstance().getExternalAdaptManager().isRun()) %7B%0A            if (AutoSizeConfig.getInstance().getExternalAdaptManager().isCancelAdapt(activity.getClass())) %7B%0A                LogUtils.w(String.format(Locale.ENGLISH, %22%25s canceled the adaptation!%22, activity.getClass().getName()));%0A                return;%0A            %7D else %7B%0A                ExternalAdaptInfo info = AutoSizeConfig.getInstance().getExternalAdaptManager()%0A                        .getExternalAdaptInfoOfActivity(activity.getClass());%0A                if (info != null) %7B%0A                    LogUtils.d(String.format(Locale.ENGLISH, %22%25s used %25s for adaptation!%22, activity.getClass().getName(), ExternalAdaptInfo.class.getName()));%0A                    AutoSize.autoConvertDensityOfExternalAdaptInfo(activity, info);%0A                    return;%0A                %7D%0A            %7D%0A        %7D%0A%0A
         //%E5%A6%82%E6%9E%9C

Improve DefaultAutoAdaptStrategy