package com.yyrh.utils;


import android.content.Context;
import android.view.View;
import android.widget.RelativeLayout;

import com.yyrh.constant.InitConfig;
import com.yyrh.constant.SDKSettings;

import org.json.JSONArray;
import org.json.JSONException;

import java.text.DecimalFormat;


/**
 * Created by admin on 2017/1/10.
 */

public class SwitchUtil {
    private static final String switchState = "1";



    public static void ControlKFSwitch(int bswitch) {
        String binaryStr = Integer.toBinaryString(bswitch);
        DecimalFormat df=new DecimalFormat("000000");
        String bwstr=df.format(Integer.parseInt(binaryStr));
        SDKSettings.isOpenRealName = false;
        SDKSettings.isOpenFloatView = false;
        SDKSettings.isForceRealName = false;

        for (int i = 0; i < bwstr.length(); i++) {
            int a = bwstr.length()-i -1;
            int b = bwstr.length()-i;
            String s2 = bwstr.substring(a,b);
            switch (i) {
                case 0:
                    if (s2.equals(switchState)){
                        SDKSettings.isOpenRealName = true;
                    }

                    break;
                case 1:
                    if (s2.equals(switchState)){
                        SDKSettings.isOpenFloatView = true;
                    }
                    break;
                case 2:
                    if (s2.equals(switchState)){
                        SDKSettings.isForceRealName = true;
                    }
                    break;


            }

        }

    }


}
