package kr.co.icontrols.ilp300_700.admin.inquiry;

import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.util.Log;
import android.view.Gravity;
import android.view.KeyEvent;
import android.widget.RelativeLayout;

import kr.co.icontrols.ilp300_700.MainActivity;
import kr.co.icontrols.ilp300_700.R;
import kr.co.icontrols.ilp300_700.global.Configure.ConfigValue;
import kr.co.icontrols.ilp300_700.global.DataClasses.POSITION;
import kr.co.icontrols.ilp300_700.global.Declare;
import kr.co.icontrols.ilp300_700.global.ID;
import kr.co.icontrols.wallpadsupport.WpadImageView;
import kr.co.icontrols.wallpadsupport.WpadScreen;
import kr.co.icontrols.wallpadsupport.WpadTextView;

public class AdminSet_Inquiry_VerInfo extends WpadScreen {

    String TAG = "AdminSet_Inquiry_VerInfo";

    boolean bLOG = true;   // true, false
    boolean bLOG_DEBUG = false;   // true, false
    boolean bLOG_INFO = true;   // true, false
    Context mContext;
    WpadImageView Image_Background;
    WpadTextView Text_Title;
    WpadTextView Text_Line_01_Item;
    WpadTextView Text_Line_02_Item;
    WpadTextView Text_Line_03_Item;
    WpadTextView Text_Line_04_Item;
    WpadTextView Text_Line_05_Item;
    WpadTextView Text_Line_06_Item;
    WpadTextView Text_Line_01_Input;
    WpadTextView Text_Line_02_Input;
    WpadTextView Text_Line_03_Input;
    WpadTextView Text_Line_04_Input;
    WpadTextView Text_Line_05_Input;
    WpadTextView Text_Line_06_Input;
    int TextColor_Normal = Color.WHITE;
    int TextColor_Highlight = Color.GREEN;
    int TextColor_Red = Color.RED;
    int nFontSize_Title = 28;
    int nFontSize_Instruction = 22;
    boolean bFontNonBold = false;
    boolean bFontBold = true;
    String strText_Title = "버전정보";
    String strText_Line_01_Item = "BSP";
    String strText_Line_02_Item = "APP";
    String strText_Line_03_Item = "EBOOT";
    String strText_Line_04_Item = "SETTING";
    String strText_Line_05_Item = "MOVIE";
    String strText_Line_06_Item = "MOVIESETTING";
    String strText_Line_01_Input = "";
    String strText_Line_02_Input = "";
    String strText_Line_03_Input = "";
    String strText_Line_04_Input = "";
    String strText_Line_05_Input = "";
    String strText_Line_06_Input = "";
    public AdminSet_Inquiry_VerInfo(Context context, RelativeLayout layout) {
        super(context, layout);
        try {
            LOG("------------------ [START - AdminSet_Inquiry_VerInfo] -------------------");

            mContext = context;
            Initialize();

            Image_Background = new WpadImageView(context, 0, Declare.DeviceInfo.getScreenSizeFullW(ConfigValue.DEVICE_MODELTYPE), Declare.DeviceInfo.getScreenSizeFullH(ConfigValue.DEVICE_MODELTYPE), R.drawable.bg_back, 0, ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.IMAGES.BACKGROUND);
            ViewRegistration(layout, Image_Background, 0, 0);

            Text_Title = new WpadTextView(context, false, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.TITLE).W, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.TITLE).H, Gravity.CENTER, Color.WHITE, nFontSize_Title, bFontBold, ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.TITLE);
            ViewRegistration(layout, Text_Title, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.TITLE).X, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.TITLE).Y);
            Text_Title.setText(strText_Title);

            Text_Line_01_Item = new WpadTextView(context, false, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_01_Item).W, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_01_Item).H, Gravity.LEFT, Color.WHITE, nFontSize_Instruction, bFontNonBold, ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_01_Item);
            ViewRegistration(layout, Text_Line_01_Item, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_01_Item).X, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_01_Item).Y);
            Text_Line_01_Item.setText(strText_Line_01_Item);

            Text_Line_02_Item = new WpadTextView(context, false, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_02_Item).W, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_02_Item).H, Gravity.LEFT, Color.WHITE, nFontSize_Instruction, bFontNonBold, ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_02_Item);
            ViewRegistration(layout, Text_Line_02_Item, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_02_Item).X, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_02_Item).Y);
            Text_Line_02_Item.setText(strText_Line_02_Item);

            Text_Line_03_Item = new WpadTextView(context, false, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_03_Item).W, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_03_Item).H, Gravity.LEFT, Color.WHITE, nFontSize_Instruction, bFontNonBold, ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_03_Item);
            ViewRegistration(layout, Text_Line_03_Item, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_03_Item).X, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_03_Item).Y);
            Text_Line_03_Item.setText(strText_Line_03_Item);

            Text_Line_04_Item = new WpadTextView(context, false, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_04_Item).W, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_04_Item).H, Gravity.LEFT, Color.WHITE, nFontSize_Instruction, bFontNonBold, ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_04_Item);
            ViewRegistration(layout, Text_Line_04_Item, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_04_Item).X, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_04_Item).Y);
            Text_Line_04_Item.setText(strText_Line_04_Item);

            Text_Line_05_Item = new WpadTextView(context, false, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_05_Item).W, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_05_Item).H, Gravity.LEFT, Color.WHITE, nFontSize_Instruction, bFontNonBold, ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_05_Item);
            ViewRegistration(layout, Text_Line_05_Item, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_05_Item).X, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_05_Item).Y);
            Text_Line_05_Item.setText(strText_Line_05_Item);

            Text_Line_06_Item = new WpadTextView(context, false, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_06_Item).W, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_06_Item).H, Gravity.LEFT, Color.WHITE, nFontSize_Instruction, bFontNonBold, ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_06_Item);
            ViewRegistration(layout, Text_Line_06_Item, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_06_Item).X, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_06_Item).Y);
            Text_Line_06_Item.setText(strText_Line_06_Item);

            Text_Line_01_Input = new WpadTextView(context, false, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_01_Input).W, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_01_Input).H, Gravity.LEFT, Color.WHITE, nFontSize_Instruction, bFontNonBold, ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_01_Input);
            ViewRegistration(layout, Text_Line_01_Input, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_01_Input).X, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_01_Input).Y);
            Text_Line_01_Input.setText(strText_Line_01_Input);

            Text_Line_02_Input = new WpadTextView(context, false, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_02_Input).W, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_02_Input).H, Gravity.LEFT, Color.WHITE, nFontSize_Instruction, bFontNonBold, ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_02_Input);
            ViewRegistration(layout, Text_Line_02_Input, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_02_Input).X, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_02_Input).Y);
            Text_Line_02_Input.setText(strText_Line_02_Input);

            Text_Line_03_Input = new WpadTextView(context, false, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_03_Input).W, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_03_Input).H, Gravity.LEFT, Color.WHITE, nFontSize_Instruction, bFontNonBold, ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_03_Input);
            ViewRegistration(layout, Text_Line_03_Input, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_03_Input).X, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_03_Input).Y);
            Text_Line_03_Input.setText(strText_Line_03_Input);

            Text_Line_04_Input = new WpadTextView(context, false, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_04_Input).W, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_04_Input).H, Gravity.LEFT, Color.WHITE, nFontSize_Instruction, bFontNonBold, ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_04_Input);
            ViewRegistration(layout, Text_Line_04_Input, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_04_Input).X, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_04_Input).Y);
            Text_Line_04_Input.setText(strText_Line_04_Input);

            Text_Line_05_Input = new WpadTextView(context, false, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_05_Input).W, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_05_Input).H, Gravity.LEFT, Color.WHITE, nFontSize_Instruction, bFontNonBold, ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_05_Input);
            ViewRegistration(layout, Text_Line_05_Input, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_05_Input).X, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_05_Input).Y);
            Text_Line_05_Input.setText(strText_Line_05_Input);

            Text_Line_06_Input = new WpadTextView(context, false, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_06_Input).W, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_06_Input).H, Gravity.LEFT, Color.WHITE, nFontSize_Instruction, bFontNonBold, ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_06_Input);
            ViewRegistration(layout, Text_Line_06_Input, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_06_Input).X, getPosition(ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_06_Input).Y);
            Text_Line_06_Input.setText(strText_Line_06_Input);

            ((MainActivity) mContext).setAutoScreenChange(ID.SCREENS.Main, MainActivity.nAdminScreenTimeout);
        } catch (Exception e) {
            Log.e(TAG, "[Exception] AdminSet_Inquiry_VerInfo(...) : " + e);
            e.printStackTrace();
        }
    }

    private void LOG(String log) {
        if (bLOG) Log.v(TAG, log);
    }

    private void LOG_DEBUG(String log) {
        if (bLOG_DEBUG) Log.d(TAG, log);
    }

    private void LOG_INFO(String log) {
        if (bLOG_INFO) Log.i(TAG, log);
    }

    protected void Initialize() {
        try {
            LOG("[Initialize] ===== START =====");
            strText_Line_01_Input = "[ " + ConfigValue.strVer_BSP + " ]";
            strText_Line_02_Input = "[ " + ConfigValue.strVer_APP + " ]";
            strText_Line_03_Input = "[ " + ConfigValue.strVer_EBOOT + " ]";
            strText_Line_04_Input = "[ " + ConfigValue.strVer_SETTING + " ]";
            strText_Line_05_Input = "[ " + ConfigValue.strVer_MOVIE + " ]";
            strText_Line_06_Input = "[ " + ConfigValue.strVer_MOVIESETTING + " ]";
        } catch (Exception e) {
            Log.e(TAG, "[Exception] Initialize() : " + e);
            e.printStackTrace();
        }
    }

    @Override
    protected void onClose() {
        try {
            LOG("------------------ [onClose - AdminSet_Inquiry_VerInfo] -------------------");
        } catch (Exception e) {
            Log.e(TAG, "[Exception] onClose() : " + e);
            e.printStackTrace();
        }
        super.onClose();
    }

    @Override
    protected void onBrReceive(Intent intent) {
        try {
            LOG("[onBrReceive] Intent : " + intent);
        } catch (Exception e) {
            Log.e(TAG, "[Exception] onBrReceive(...) : " + e);
            e.printStackTrace();
        }
        super.onBrReceive(intent);
    }

    @Override
    protected void onKeyDown(int keyCode, KeyEvent event) {
        try {
//            Log.d(TAG, "[onKeyDown] keyCode [" + keyCode + "], event [" + event + "]");

            if (keyCode == Declare.Button.CANCEL || keyCode == Declare.Button.TACT_CANCEL) {
                super.setChangeScreen(ID.SCREENS.AdminSet_Inquiry);
            }
        } catch (Exception e) {
            Log.e(TAG, "[Exception] onKeyDown(...) : " + e);
            e.printStackTrace();
        }
        super.onKeyDown(keyCode, event);
    }

    private POSITION getPosition(int nID) {
//        LOG("[getPosition] Start!!");
        POSITION position = new POSITION();
        position.SetPosition(0, 0, 480, 272);
        try {
            switch (nID) {
                case ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.IMAGES.BACKGROUND:
                    position.SetPosition(0, 0, 480, 272);
                    return position;

                case ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.TITLE:
                    position.SetPosition(0, 24, 480, 40);
                    return position;

                case ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_01_Item:
                    position.SetPosition(20, 67, 215, 40);
                    return position;

                case ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_02_Item:
                    position.SetPosition(20, 133, 215, 40);
                    return position;

                case ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_03_Item:
                    position.SetPosition(20, 199, 215, 40);
                    return position;

                case ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_04_Item:
                    position.SetPosition(245, 67, 215, 40);
                    return position;

                case ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_05_Item:
                    position.SetPosition(245, 133, 215, 40);
                    return position;

                case ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_06_Item:
                    position.SetPosition(245, 199, 215, 40);
                    return position;

                case ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_01_Input:
                    position.SetPosition(20, 95, 215, 40);
                    return position;

                case ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_02_Input:
                    position.SetPosition(20, 161, 215, 40);
                    return position;

                case ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_03_Input:
                    position.SetPosition(20, 227, 215, 40);
                    return position;

                case ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_04_Input:
                    position.SetPosition(245, 95, 215, 40);
                    return position;

                case ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_05_Input:
                    position.SetPosition(245, 161, 215, 40);
                    return position;

                case ID.SCREENS.ADMINSET_INQUIRY_VERINFO.ELEMENTS.TEXTS.LINE_06_Input:
                    position.SetPosition(245, 227, 215, 40);
                    return position;

                default:
                    return position;
            }
        } catch (Exception e) {
            Log.e(TAG, "[Exception] getPosition() : " + e);
            e.printStackTrace();
            return position;
        }
    }


}