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

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.view.View;
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;
import kr.co.icontrols.ilp300_700.global.Configure.ConfigValKey;
import kr.co.icontrols.ilp300_700.global.Configure.ConfigValue;
import kr.co.icontrols.ilp300_700.global.DataClasses.ElevDisableFloorTable;
import kr.co.icontrols.ilp300_700.global.DataClasses.POSITION;
import kr.co.icontrols.ilp300_700.global.Declare;
import kr.co.icontrols.ilp300_700.global.Enumeration.DATAINPUTSCREEN;
import kr.co.icontrols.ilp300_700.global.Global;
import kr.co.icontrols.ilp300_700.global.ID;
import kr.co.icontrols.ilp300_700.rfreader.STDAccessKeyManager;
import kr.co.icontrols.wallpadsupport.WpadImageView;
import kr.co.icontrols.wallpadsupport.WpadScreen;
import kr.co.icontrols.wallpadsupport.WpadTextView;

public class AdminSet_Setting_ElevDisableFloor extends WpadScreen {

    String TAG = "AdminSet_Setting_ElevDisableFloor";

    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_01_Input;
    WpadTextView Text_Line_02_Input;
    WpadTextView Text_Line_03_Input;
    int TextColor_Normal = Color.WHITE;
    int TextColor_Highlight = Color.GREEN;
    int nFontSize_Instruction = 28;
    boolean bFontNonBold = false;
    boolean bFontBold = true;
    String strText_Title = "Elev. 비연동층 설정";
    String strText_Line_01_Item = "비연동층 개수";
    String strText_Line_02_Item = "순서";
    String strText_Line_03_Item = " 비연동층";
    String strText_Line_01_Input = "";   // 비연동층 개수
    String strText_Line_02_Input = "";   // 사용안함
    String strText_Line_03_Input = "";   // 비연동층 정보
    int nTempElevDisableFloorCnt = 0;   // 화면용 비연동층 개수
    int[] anTempElevDisableFloor;   // 화면용 비연동층
    int nPageNo = 0;   // 층정보 입력화면 페이지 번호
    boolean bSetReady = false;   // 층정보 세부 페이지 순환완료
    public AdminSet_Setting_ElevDisableFloor(Context context, RelativeLayout layout) {
        super(context, layout);
        try {
            LOG("------------------ [START - AdminSet_Setting_ElevDisableFloor] -------------------");

            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_SETTING_ELEVDISABLEFLOOR.ELEMENTS.IMAGES.BACKGROUND);
            ViewRegistration(layout, Image_Background, 0, 0);

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

            Text_Line_01_Item = new WpadTextView(context, false, getPosition(ID.SCREENS.ADMINSET_SETTING_ELEVDISABLEFLOOR.ELEMENTS.TEXTS.LINE_01_Item).W, getPosition(ID.SCREENS.ADMINSET_SETTING_ELEVDISABLEFLOOR.ELEMENTS.TEXTS.LINE_01_Item).H, Gravity.CENTER, Color.WHITE, nFontSize_Instruction, bFontNonBold, ID.SCREENS.ADMINSET_SETTING_ELEVDISABLEFLOOR.ELEMENTS.TEXTS.LINE_01_Item);
            ViewRegistration(layout, Text_Line_01_Item, getPosition(ID.SCREENS.ADMINSET_SETTING_ELEVDISABLEFLOOR.ELEMENTS.TEXTS.LINE_01_Item).X, getPosition(ID.SCREENS.ADMINSET_SETTING_ELEVDISABLEFLOOR.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_SETTING_ELEVDISABLEFLOOR.ELEMENTS.TEXTS.LINE_02_Item).W, getPosition(ID.SCREENS.ADMINSET_SETTING_ELEVDISABLEFLOOR.ELEMENTS.TEXTS.LINE_02_Item).H, Gravity.CENTER, Color.WHITE, nFontSize_Instruction, bFontNonBold, ID.SCREENS.ADMINSET_SETTING_ELEVDISABLEFLOOR.ELEMENTS.TEXTS.LINE_02_Item);
            ViewRegistration(layout, Text_Line_02_Item, getPosition(ID.SCREENS.ADMINSET_SETTING_ELEVDISABLEFLOOR.ELEMENTS.TEXTS.LINE_02_Item).X, getPosition(ID.SCREENS.ADMINSET_SETTING_ELEVDISABLEFLOOR.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_SETTING_ELEVDISABLEFLOOR.ELEMENTS.TEXTS.LINE_03_Item).W, getPosition(ID.SCREENS.ADMINSET_SETTING_ELEVDISABLEFLOOR.ELEMENTS.TEXTS.LINE_03_Item).H, Gravity.CENTER, Color.WHITE, nFontSize_Instruction, bFontNonBold, ID.SCREENS.ADMINSET_SETTING_ELEVDISABLEFLOOR.ELEMENTS.TEXTS.LINE_03_Item);
            ViewRegistration(layout, Text_Line_03_Item, getPosition(ID.SCREENS.ADMINSET_SETTING_ELEVDISABLEFLOOR.ELEMENTS.TEXTS.LINE_03_Item).X, getPosition(ID.SCREENS.ADMINSET_SETTING_ELEVDISABLEFLOOR.ELEMENTS.TEXTS.LINE_03_Item).Y);
            Text_Line_03_Item.setText(strText_Line_03_Item);

            Text_Line_01_Input = new WpadTextView(context, false, getPosition(ID.SCREENS.ADMINSET_SETTING_ELEVDISABLEFLOOR.ELEMENTS.TEXTS.LINE_01_Input).W, getPosition(ID.SCREENS.ADMINSET_SETTING_ELEVDISABLEFLOOR.ELEMENTS.TEXTS.LINE_01_Input).H, Gravity.CENTER, Color.WHITE, nFontSize_Instruction, bFontNonBold, ID.SCREENS.ADMINSET_SETTING_ELEVDISABLEFLOOR.ELEMENTS.TEXTS.LINE_01_Input);
            ViewRegistration(layout, Text_Line_01_Input, getPosition(ID.SCREENS.ADMINSET_SETTING_ELEVDISABLEFLOOR.ELEMENTS.TEXTS.LINE_01_Input).X, getPosition(ID.SCREENS.ADMINSET_SETTING_ELEVDISABLEFLOOR.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_SETTING_ELEVDISABLEFLOOR.ELEMENTS.TEXTS.LINE_02_Input).W, getPosition(ID.SCREENS.ADMINSET_SETTING_ELEVDISABLEFLOOR.ELEMENTS.TEXTS.LINE_02_Input).H, Gravity.CENTER, Color.WHITE, nFontSize_Instruction, bFontNonBold, ID.SCREENS.ADMINSET_SETTING_ELEVDISABLEFLOOR.ELEMENTS.TEXTS.LINE_02_Input);
            ViewRegistration(layout, Text_Line_02_Input, getPosition(ID.SCREENS.ADMINSET_SETTING_ELEVDISABLEFLOOR.ELEMENTS.TEXTS.LINE_02_Input).X, getPosition(ID.SCREENS.ADMINSET_SETTING_ELEVDISABLEFLOOR.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_SETTING_ELEVDISABLEFLOOR.ELEMENTS.TEXTS.LINE_03_Input).W, getPosition(ID.SCREENS.ADMINSET_SETTING_ELEVDISABLEFLOOR.ELEMENTS.TEXTS.LINE_03_Input).H, Gravity.CENTER, Color.WHITE, nFontSize_Instruction, bFontNonBold, ID.SCREENS.ADMINSET_SETTING_ELEVDISABLEFLOOR.ELEMENTS.TEXTS.LINE_03_Input);
            ViewRegistration(layout, Text_Line_03_Input, getPosition(ID.SCREENS.ADMINSET_SETTING_ELEVDISABLEFLOOR.ELEMENTS.TEXTS.LINE_03_Input).X, getPosition(ID.SCREENS.ADMINSET_SETTING_ELEVDISABLEFLOOR.ELEMENTS.TEXTS.LINE_03_Input).Y);
            Text_Line_03_Input.setText("[ " + strText_Line_03_Input + " ]");

            UpdateScreen();

            ((MainActivity) mContext).setAutoScreenChange(ID.SCREENS.Main, MainActivity.nAdminScreenTimeout);
        } catch (Exception e) {
            Log.e(TAG, "[Exception] AdminSet_Setting_ElevDisableFloor(...) : " + 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!!");
            Global.DataInputScreen = DATAINPUTSCREEN.DETAIL_01;

            strText_Line_01_Input = "0";
        } catch (Exception e) {
            Log.e(TAG, "[Exception] Initialize() : " + e);
            e.printStackTrace();
        }
    }

    @Override
    protected void onClose() {
        try {
            LOG("------------------ [onClose - AdminSet_Setting_ElevDisableFloor] -------------------");
        } 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("[onKeyDown] keyCode [" + keyCode + "], event [" + event + "]");
            if (Declare.Button.NUMBER_00 <= keyCode && keyCode <= Declare.Button.NUMBER_09) {
                if (Global.DataInputScreen == DATAINPUTSCREEN.DETAIL_01) {
                    strText_Line_01_Input += keyCode - 7;

                    if (strText_Line_01_Input.length() > 2) {
                        strText_Line_01_Input = strText_Line_01_Input.substring(1);
                    }
                } else if (Global.DataInputScreen == DATAINPUTSCREEN.DETAIL_02) {
                    strText_Line_03_Input += keyCode - 7;

                    if (strText_Line_03_Input.length() > 2) {
                        strText_Line_03_Input = strText_Line_03_Input.substring(1);
                    }
                }
                UpdateScreen();
            } else if (keyCode == Declare.Button.SHARP) {
                if (Global.DataInputScreen == DATAINPUTSCREEN.DETAIL_02) {
                    if (checkValidityInputValues()) {
                        if (!changeDetailScreen(nPageNo - 1, true, strText_Line_03_Input)) {
                            MainActivity.mSound.PlayMent_lobby(R.raw.retryinput);
                        }
                    } else {
                        MainActivity.mSound.PlayMent_lobby(R.raw.retryinput);
                    }
                    setDetailScreenValues();
                    UpdateScreen();
                }
            } else if (keyCode == Declare.Button.GUARD) {
                // 설정정보를 저장하는 기능을 정의한다.
                if (Global.DataInputScreen == DATAINPUTSCREEN.DETAIL_01) {
                    // 입력된 층정보개수를 임시저장합니다.
                    nTempElevDisableFloorCnt = Integer.parseInt(strText_Line_01_Input);
                    if (nTempElevDisableFloorCnt == 0) {
                        if (setElevDisableFloorInfo(nTempElevDisableFloorCnt, null)) {
                            MainActivity.mSound.PlayMent_lobby(R.raw.setting);
                            super.setChangeScreen(ID.SCREENS.AdminSet_Setting);
                        } else {
                            MainActivity.mSound.PlayMent_lobby(R.raw.retryinput);
                        }
                    } else {
                        Global.DataInputScreen = DATAINPUTSCREEN.DETAIL_02;
                        initLineDetails();
                        setDetailScreenValues();
                        UpdateScreen();
                    }
                } else if (Global.DataInputScreen == DATAINPUTSCREEN.DETAIL_02) {
                    // 라인정보를 최종저장합니다.
                    if (!bSetReady) {
                        MainActivity.mSound.PlayMent_lobby(R.raw.retryinput);
                        return;
                    }

                    if (setElevDisableFloorInfo(nTempElevDisableFloorCnt, anTempElevDisableFloor)) {
                        MainActivity.mSound.PlayMent_lobby(R.raw.setting);
                        STDAccessKeyManager.procLineInfoChanged();   // 세대카드정보를 갱신된 라인정보에 맞추어 갱신합니다.
                        super.setChangeScreen(ID.SCREENS.AdminSet_Setting);
                    } else {
                        MainActivity.mSound.PlayMent_lobby(R.raw.retryinput);
                        Initialize();
                        UpdateScreen();
                    }
                }
            } else if (keyCode == Declare.Button.CANCEL || keyCode == Declare.Button.TACT_CANCEL) {
                if (Global.DataInputScreen == DATAINPUTSCREEN.DETAIL_01) {
                    super.setChangeScreen(ID.SCREENS.AdminSet_Setting);
                } else if (Global.DataInputScreen == DATAINPUTSCREEN.DETAIL_02) {
                    strText_Line_01_Input = String.valueOf(nTempElevDisableFloorCnt);
                    Global.DataInputScreen = DATAINPUTSCREEN.DETAIL_01;
                    UpdateScreen();
                }
            }
        } catch (Exception e) {
            Log.e(TAG, "[Exception] onKeyDown(...) : " + e);
            e.printStackTrace();
        }
        super.onKeyDown(keyCode, event);
    }

    protected void UpdateVisibility() {
        try {
//            LOG("[UpdateVisibility] Start!!");
            if (Global.DataInputScreen == DATAINPUTSCREEN.DETAIL_01) {
                Text_Line_01_Item.setVisibility(View.VISIBLE);
                Text_Line_02_Item.setVisibility(View.INVISIBLE);
                Text_Line_03_Item.setVisibility(View.INVISIBLE);

                Text_Line_01_Input.setVisibility(View.VISIBLE);
                Text_Line_02_Input.setVisibility(View.INVISIBLE);
                Text_Line_03_Input.setVisibility(View.INVISIBLE);
            } else if (Global.DataInputScreen == DATAINPUTSCREEN.DETAIL_02) {
                Text_Line_01_Item.setVisibility(View.INVISIBLE);
                Text_Line_02_Item.setVisibility(View.VISIBLE);
                Text_Line_03_Item.setVisibility(View.VISIBLE);

                Text_Line_01_Input.setVisibility(View.INVISIBLE);
                Text_Line_02_Input.setVisibility(View.INVISIBLE);
                Text_Line_03_Input.setVisibility(View.VISIBLE);
            }
        } catch (Exception e) {
            Log.e(TAG, "[Exception] UpdateVisibility() : " + e);
            e.printStackTrace();
        }
    }

    protected void UpdateScreen() {
        try {
//            LOG("[updateScreen] Start!!");
            if (Global.DataInputScreen == DATAINPUTSCREEN.DETAIL_01) {
                UpdateVisibility();

                Text_Line_01_Input.setText("[ " + Integer.parseInt(strText_Line_01_Input) + " ]");

                Text_Line_01_Item.setTextColor(TextColor_Normal);
                Text_Line_01_Input.setTextColor(TextColor_Highlight);
            } else if (Global.DataInputScreen == DATAINPUTSCREEN.DETAIL_02) {
                UpdateVisibility();
                Text_Line_02_Item.setText("순서 (" + nPageNo + ")");
                Text_Line_03_Item.setText("층정보");
                Text_Line_03_Input.setText("[ " + Integer.parseInt(strText_Line_03_Input) + " ]");

                Text_Line_02_Item.setTextColor(TextColor_Normal);
                Text_Line_03_Item.setTextColor(TextColor_Normal);
                Text_Line_03_Input.setTextColor(TextColor_Highlight);
            }
        } catch (Exception e) {
            Log.e(TAG, "[Exception] updateScreen() : " + e);
            e.printStackTrace();
        }
    }

    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_SETTING_ELEVDISABLEFLOOR.ELEMENTS.IMAGES.BACKGROUND:
                    position.SetPosition(0, 0, 480, 272);
                    return position;

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

                case ID.SCREENS.ADMINSET_SETTING_ELEVDISABLEFLOOR.ELEMENTS.TEXTS.LINE_01_Item:
                    position.SetPosition(30, 104, 420, 40);
                    return position;

                case ID.SCREENS.ADMINSET_SETTING_ELEVDISABLEFLOOR.ELEMENTS.TEXTS.LINE_02_Item:
                    position.SetPosition(30, 84, 420, 40);
                    return position;

                case ID.SCREENS.ADMINSET_SETTING_ELEVDISABLEFLOOR.ELEMENTS.TEXTS.LINE_03_Item:
                    position.SetPosition(30, 134, 420, 40);
                    return position;

                case ID.SCREENS.ADMINSET_SETTING_ELEVDISABLEFLOOR.ELEMENTS.TEXTS.LINE_01_Input:
                    position.SetPosition(30, 154, 420, 40);
                    return position;

                case ID.SCREENS.ADMINSET_SETTING_ELEVDISABLEFLOOR.ELEMENTS.TEXTS.LINE_02_Input:
                    position.SetPosition(205, 154, 205, 40);
                    return position;

                case ID.SCREENS.ADMINSET_SETTING_ELEVDISABLEFLOOR.ELEMENTS.TEXTS.LINE_03_Input:
                    position.SetPosition(30, 184, 420, 40);
                    return position;

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

    private void initLineDetails() {
        try {
            LOG("[initLineDetail] ===== START =====");
            bSetReady = false;
            nPageNo = 1;
            anTempElevDisableFloor = new int[nTempElevDisableFloorCnt];

            for (int i = 0; i < nTempElevDisableFloorCnt; i++) {
                anTempElevDisableFloor[i] = 0;
            }
        } catch (Exception e) {
            Log.e(TAG, "[Exception] initLineDetail() : " + e);
            e.printStackTrace();
        }
    }

    private boolean setDetailScreenValues() {
        try {
            LOG("[setDetailPageValues] ===== START =====");
            int index = nPageNo - 1;
            LOG("[setDetailPageValues] nPageNo [" + nPageNo + "], anTempElevDisableFloor[" + index + "] = " + anTempElevDisableFloor[index]);
            strText_Line_03_Input = Integer.toString(anTempElevDisableFloor[index]);
            return true;
        } catch (Exception e) {
            Log.e(TAG, "[Exception] setDetailPageValues() : " + e);
            e.printStackTrace();
            return false;
        }
    }

    private void PageUp() {
        try {
            if (nPageNo < nTempElevDisableFloorCnt) nPageNo++;
            else {
                bSetReady = true;
                nPageNo = 1;
            }
        } catch (Exception e) {
            Log.e(TAG, "[Exception] PageUp() : " + e);
            e.printStackTrace();
        }
    }

    private void PageDown() {
        try {
            if (nPageNo > 1) nPageNo--;
            else nPageNo = nTempElevDisableFloorCnt;
        } catch (Exception e) {
            Log.e(TAG, "[Exception] PageDown() : " + e);
            e.printStackTrace();
        }
    }

    private boolean changeDetailScreen(int nIndex, boolean bPageUp, String strFloor) {
        try {
            LOG("[changeDetailScreen] nIndex [" + nIndex + "], bPageUp [" + bPageUp + "], strFloor [" + strFloor + "]");

            int nFloor = Integer.parseInt(strFloor);

            if (nFloor < 1 || 99 < nFloor) return false;

            if (!saveTempValues(nIndex, nFloor)) return false;

            if (bPageUp) PageUp();
            else PageDown();

            return setDetailScreenValues();
        } catch (Exception e) {
            Log.e(TAG, "[Exception] changeDetailScreen(index, bPageUp, strFloor)");
            e.printStackTrace();
            return false;
        }
    }

    private boolean saveTempValues(int nIndex, int nFloor) {
        try {
            LOG("[saveTempValues] nIndex [" + nIndex + "], nFloor [" + nFloor + "]");
            anTempElevDisableFloor[nIndex] = nFloor;
            return true;
        } catch (Exception e) {
            Log.e(TAG, "[Exception] saveTempValues(nIndex, nFloor) : " + e);
            e.printStackTrace();
            return false;
        }
    }

    private boolean setElevDisableFloorInfo(int nCnt, int[] nFloors) {
        try {
            LOG("[setElevDisableFloorInfo] nCnt [" + nCnt + "]");

            if (nFloors == null) LOG("[setElevDisableFloorInfo] nFloors is null");
            else LOG("[setElevDisableFloorInfo] nFloors is not null");

            String strResult = "ERROR";

            if (1 > nCnt) {
                // 개수가 1보다 작은 경우, Elev. 비연동층이 없는 경우
                strResult = "NONE";
            } else {
                // Elev. 비연동층이 있는 경우
                if (nCnt != nFloors.length) return false;
                ElevDisableFloorTable mElevDisableFloorTable = new ElevDisableFloorTable();
                for (int i = 0; i < nCnt; i++) {
                    mElevDisableFloorTable.addElevDisableFloorTable(nFloors[i], null);
                }
                strResult = Configure.makeElevDisableFloorString(mElevDisableFloorTable);
            }
            LOG("[setLineInfo] strResult = " + strResult);
            if (!strResult.matches(".*ERROR.*")) {
                ConfigValue.strElevDisableFloorsInfo = strResult;
                if (!MainActivity.ConfigDBManager.setData(Declare.DBInfo.TABLE_NAME_CONFIG, ConfigValKey.ElevDisableFloorsInfo, ConfigValue.strElevDisableFloorsInfo))
                    return false;
                return Configure.extractElevDisableFloor(ConfigValue.strElevDisableFloorsInfo);
            }
            return false;
        } catch (Exception e) {
            Log.e(TAG, "[Exception] setElevDisableFloorInfo(nCnt, nFloors)");
            e.printStackTrace();
            return false;
        }
    }

    private boolean checkValidityInputValues() {
        try {
            int nFloor = Integer.parseInt(strText_Line_03_Input);
            if (nFloor < 1 || 99 < nFloor) {
                LOG("[checkValidityInputValues] Out of range!!");
                return false;
            }

            for (int i = 0; i < anTempElevDisableFloor.length; i++) {
                if (anTempElevDisableFloor[i] == nFloor) {
                    if (nPageNo - 1 != i) {
                        LOG("[checkValidityInputValues] There is a same floor!! anTempElevDisableFloor[" + i + "] = " + anTempElevDisableFloor[i] + ", strText_Line_03_Input = " + strText_Line_03_Input);
                        return false;
                    }
                }
            }
            return true;
        } catch (Exception e) {
            Log.e(TAG, "[Exception] checkValidityInputValues() : " + e);
            e.printStackTrace();
            return false;
        }
    }


}