package com.hh.arome.common.deviceui;

import android.os.Build;

import com.hh.arome.common.Constants;
import com.hh.arome.utlis.device.DeviceUtils;
import com.hh.arome.utlis.log.AppLogUtils;

public class BaseDeviceUI {

    //用volatile关键字确保 instance 在多线程下的可见性
    private static volatile BaseDeviceUI instance = null;

    //将构造方法私有化，禁止外部通过构造方法创建实例
    private BaseDeviceUI() {}

    //提供一个公共的访问方法，用于获取该类的唯一实例
    public static BaseDeviceUI getInstance() {
        //如果instance为空，就进行实例化
        if (instance == null) {
            //保证多线程下只有一个线程进行实例化
            synchronized (BaseDeviceUI.class) {
                //第二次判断，避免多线程下创建多个实例
                if (instance == null) {
                    instance = new BaseDeviceUI();
                }
            }
        }
        return instance;
    }

    IDeviceUI iDeviceUI;


    public IDeviceUI getDeviceUI() {
        String model = DeviceUtils.getDeviceModel();
        AppLogUtils.e("model:"+model);

        if (Constants.DeviceModel.K8.equals(model)) {
            // K8
            iDeviceUI = K8DeviceUI.getInstance();
        } else if (Constants.DeviceModel.F10.equals(model)) {
            // F10
            iDeviceUI = K8DeviceUI.getInstance();
        } else if (Constants.DeviceModel.ZP.equals(model)) {
            // 紫鹏
            iDeviceUI = ZpDeviceUI.getInstance();
        }
        return iDeviceUI;
    }






}
