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.ConfigValKey;
import kr.co.icontrols.ilp300_700.global.Configure.ConfigValue;
import kr.co.icontrols.ilp300_700.global.Configure.SetValue;
import kr.co.icontrols.ilp300_700.global.DataClasses.POSITION;
import kr.co.icontrols.ilp300_700.global.Declare;
import kr.co.icontrols.ilp300_700.global.Declare.Button;
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.wallpadsupport.WpadImageView;
import kr.co.icontrols.wallpadsupport.WpadScreen;
import kr.co.icontrols.wallpadsupport.WpadTextView;

public class AdminSet_Setting_Melody extends WpadScreen {

    String TAG = "AdminSet_Setting_Melody";

    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_07_Item;
    WpadTextView Text_Line_08_Item;
    WpadTextView Text_Line_09_Item;
    int TextColor_Normal = Color.WHITE;
    int TextColor_Highlight = Color.GREEN;
    int nFontSize_Instruction = 28;
    int nFontSize_Instruction_Bottom = 20;
    boolean bFontNonBold = false;
    boolean bFontBold = true;
    String strText_Title = "호출음 설정";
    String strText_Line_01_Item = "1] 세대 호출음";
    String strText_Line_02_Item = "2] 경비실 호출음";
    String strText_Line_03_Item = "01] 멜로디 1";
    String strText_Line_04_Item = "02] 멜로디 2";
    String strText_Line_05_Item = "03] 멜로디 3";
    String strText_Line_06_Item = "04] 멜로디 4";
    String strText_Line_07_Item = "05] 멜로디 5";
    String strText_Line_08_Item = "06] 멜로디 6";
    String strText_Line_09_Item = "- 호출음 선택 후 '경비실'버튼을 누르세요. -";
    SetValue eSelectedMelody = SetValue.NONE;
    public AdminSet_Setting_Melody(Context context, RelativeLayout layout) {
        super(context, layout);
        try {
            LOG("------------------ [START - AdminSet_Setting_Melody] -------------------");

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

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

            Text_Line_01_Item = new WpadTextView(context, false, getPosition(ID.SCREENS.ADMINSET_SETTING_MELODY.ELEMENTS.TEXTS.LINE_01_Item).W, getPosition(ID.SCREENS.ADMINSET_SETTING_MELODY.ELEMENTS.TEXTS.LINE_01_Item).H, Gravity.LEFT, Color.WHITE, nFontSize_Instruction, bFontNonBold, ID.SCREENS.ADMINSET_SETTING_MELODY.ELEMENTS.TEXTS.LINE_01_Item);
            ViewRegistration(layout, Text_Line_01_Item, getPosition(ID.SCREENS.ADMINSET_SETTING_MELODY.ELEMENTS.TEXTS.LINE_01_Item).X, getPosition(ID.SCREENS.ADMINSET_SETTING_MELODY.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_MELODY.ELEMENTS.TEXTS.LINE_02_Item).W, getPosition(ID.SCREENS.ADMINSET_SETTING_MELODY.ELEMENTS.TEXTS.LINE_02_Item).H, Gravity.LEFT, Color.WHITE, nFontSize_Instruction, bFontNonBold, ID.SCREENS.ADMINSET_SETTING_MELODY.ELEMENTS.TEXTS.LINE_02_Item);
            ViewRegistration(layout, Text_Line_02_Item, getPosition(ID.SCREENS.ADMINSET_SETTING_MELODY.ELEMENTS.TEXTS.LINE_02_Item).X, getPosition(ID.SCREENS.ADMINSET_SETTING_MELODY.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_MELODY.ELEMENTS.TEXTS.LINE_03_Item).W, getPosition(ID.SCREENS.ADMINSET_SETTING_MELODY.ELEMENTS.TEXTS.LINE_03_Item).H, Gravity.LEFT, Color.WHITE, nFontSize_Instruction, bFontNonBold, ID.SCREENS.ADMINSET_SETTING_MELODY.ELEMENTS.TEXTS.LINE_03_Item);
            ViewRegistration(layout, Text_Line_03_Item, getPosition(ID.SCREENS.ADMINSET_SETTING_MELODY.ELEMENTS.TEXTS.LINE_03_Item).X, getPosition(ID.SCREENS.ADMINSET_SETTING_MELODY.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_SETTING_MELODY.ELEMENTS.TEXTS.LINE_04_Item).W, getPosition(ID.SCREENS.ADMINSET_SETTING_MELODY.ELEMENTS.TEXTS.LINE_04_Item).H, Gravity.LEFT, Color.WHITE, nFontSize_Instruction, bFontNonBold, ID.SCREENS.ADMINSET_SETTING_MELODY.ELEMENTS.TEXTS.LINE_04_Item);
            ViewRegistration(layout, Text_Line_04_Item, getPosition(ID.SCREENS.ADMINSET_SETTING_MELODY.ELEMENTS.TEXTS.LINE_04_Item).X, getPosition(ID.SCREENS.ADMINSET_SETTING_MELODY.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_SETTING_MELODY.ELEMENTS.TEXTS.LINE_05_Item).W, getPosition(ID.SCREENS.ADMINSET_SETTING_MELODY.ELEMENTS.TEXTS.LINE_05_Item).H, Gravity.LEFT, Color.WHITE, nFontSize_Instruction, bFontNonBold, ID.SCREENS.ADMINSET_SETTING_MELODY.ELEMENTS.TEXTS.LINE_05_Item);
            ViewRegistration(layout, Text_Line_05_Item, getPosition(ID.SCREENS.ADMINSET_SETTING_MELODY.ELEMENTS.TEXTS.LINE_05_Item).X, getPosition(ID.SCREENS.ADMINSET_SETTING_MELODY.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_SETTING_MELODY.ELEMENTS.TEXTS.LINE_06_Item).W, getPosition(ID.SCREENS.ADMINSET_SETTING_MELODY.ELEMENTS.TEXTS.LINE_06_Item).H, Gravity.LEFT, Color.WHITE, nFontSize_Instruction, bFontNonBold, ID.SCREENS.ADMINSET_SETTING_MELODY.ELEMENTS.TEXTS.LINE_06_Item);
            ViewRegistration(layout, Text_Line_06_Item, getPosition(ID.SCREENS.ADMINSET_SETTING_MELODY.ELEMENTS.TEXTS.LINE_06_Item).X, getPosition(ID.SCREENS.ADMINSET_SETTING_MELODY.ELEMENTS.TEXTS.LINE_06_Item).Y);
            Text_Line_06_Item.setText(strText_Line_06_Item);

            Text_Line_07_Item = new WpadTextView(context, false, getPosition(ID.SCREENS.ADMINSET_SETTING_MELODY.ELEMENTS.TEXTS.LINE_07_Item).W, getPosition(ID.SCREENS.ADMINSET_SETTING_MELODY.ELEMENTS.TEXTS.LINE_07_Item).H, Gravity.LEFT, Color.WHITE, nFontSize_Instruction, bFontNonBold, ID.SCREENS.ADMINSET_SETTING_MELODY.ELEMENTS.TEXTS.LINE_07_Item);
            ViewRegistration(layout, Text_Line_07_Item, getPosition(ID.SCREENS.ADMINSET_SETTING_MELODY.ELEMENTS.TEXTS.LINE_07_Item).X, getPosition(ID.SCREENS.ADMINSET_SETTING_MELODY.ELEMENTS.TEXTS.LINE_07_Item).Y);
            Text_Line_07_Item.setText(strText_Line_07_Item);

            Text_Line_08_Item = new WpadTextView(context, false, getPosition(ID.SCREENS.ADMINSET_SETTING_MELODY.ELEMENTS.TEXTS.LINE_08_Item).W, getPosition(ID.SCREENS.ADMINSET_SETTING_MELODY.ELEMENTS.TEXTS.LINE_08_Item).H, Gravity.LEFT, Color.WHITE, nFontSize_Instruction, bFontNonBold, ID.SCREENS.ADMINSET_SETTING_MELODY.ELEMENTS.TEXTS.LINE_08_Item);
            ViewRegistration(layout, Text_Line_08_Item, getPosition(ID.SCREENS.ADMINSET_SETTING_MELODY.ELEMENTS.TEXTS.LINE_08_Item).X, getPosition(ID.SCREENS.ADMINSET_SETTING_MELODY.ELEMENTS.TEXTS.LINE_08_Item).Y);
            Text_Line_08_Item.setText(strText_Line_08_Item);

            Text_Line_09_Item = new WpadTextView(context, false, getPosition(ID.SCREENS.ADMINSET_SETTING_MELODY.ELEMENTS.TEXTS.LINE_09_Item).W, getPosition(ID.SCREENS.ADMINSET_SETTING_MELODY.ELEMENTS.TEXTS.LINE_09_Item).H, Gravity.LEFT, Color.WHITE, nFontSize_Instruction_Bottom, bFontNonBold, ID.SCREENS.ADMINSET_SETTING_MELODY.ELEMENTS.TEXTS.LINE_09_Item);
            ViewRegistration(layout, Text_Line_09_Item, getPosition(ID.SCREENS.ADMINSET_SETTING_MELODY.ELEMENTS.TEXTS.LINE_09_Item).X, getPosition(ID.SCREENS.ADMINSET_SETTING_MELODY.ELEMENTS.TEXTS.LINE_09_Item).Y);
            Text_Line_09_Item.setText(strText_Line_09_Item);

            UpdateScreen();
            ((MainActivity) mContext).setAutoScreenChange(ID.SCREENS.Main, MainActivity.nAdminScreenTimeout);
        } catch (Exception e) {
            Log.e(TAG, "[Exception] AdminSet_Setting_Melody(...) : " + 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);
    }

    // 화면 정의
    // Global.DATAINPUTSCREEN.DETAIL_01 : 호출음 설정 메인
    // Global.DATAINPUTSCREEN.DETAIL_02 : 세대 호출음 설정
    // Global.DATAINPUTSCREEN.DETAIL_03 : 경비실 호출음 설정

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

    private void Initialize() {
        try {
            LOG("[Initialize] ===== START =====");
            Global.DataInputScreen = DATAINPUTSCREEN.DETAIL_01;
        } catch (Exception e) {
            Log.e(TAG, "[Exception] Initialize() : " + e);
            e.printStackTrace();
        }
    }

    @Override
    protected void onClose() {
        try {
            LOG("------------------ [onClose - AdminSet_Setting_Melody] -------------------");
            Global.stopMelodyRepeat();
        } 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 (Global.DataInputScreen == DATAINPUTSCREEN.DETAIL_01) {
                if (keyCode == Button.NUMBER_01) {
                    // 세대 호출음 선택
                    Global.DataInputScreen = DATAINPUTSCREEN.DETAIL_02;
                    UpdateScreen();
                } else if (keyCode == Button.NUMBER_02) {
                    // 경비실 호출음 선택
                    Global.DataInputScreen = DATAINPUTSCREEN.DETAIL_03;
                    UpdateScreen();
                } else if (keyCode == Button.CANCEL) {
                    // 메뉴화면으로 이동
                    super.setChangeScreen(ID.SCREENS.AdminSet_Setting);
                }
            } else if (Global.DataInputScreen == DATAINPUTSCREEN.DETAIL_02 || Global.DataInputScreen == DATAINPUTSCREEN.DETAIL_03) {
                // 세대 호출음 선택화면
                if (Button.NUMBER_00 < keyCode && keyCode < Button.NUMBER_07) {
                    if (keyCode == Button.NUMBER_01) eSelectedMelody = SetValue.Bell_1;
                    else if (keyCode == Button.NUMBER_02) eSelectedMelody = SetValue.Bell_2;
                    else if (keyCode == Button.NUMBER_03) eSelectedMelody = SetValue.Bell_3;
                    else if (keyCode == Button.NUMBER_04) eSelectedMelody = SetValue.Bell_4;
                    else if (keyCode == Button.NUMBER_05) eSelectedMelody = SetValue.Bell_5;
                    else if (keyCode == Button.NUMBER_06) eSelectedMelody = SetValue.Bell_6;
                    Global.stopMelodyRepeat();
                    Global.playMelodyRepeat(eSelectedMelody);
                } else if (keyCode == Button.GUARD) {
                    Global.stopMelodyRepeat();
                    if (setMelody(eSelectedMelody)) {
                        MainActivity.mSound.PlayMent_lobby(R.raw.setting);
                        eSelectedMelody = SetValue.NONE;
                        Global.DataInputScreen = DATAINPUTSCREEN.DETAIL_01;
                        UpdateScreen();
                    } else {
                        MainActivity.mSound.PlayMent_lobby(R.raw.retryinput);
                        eSelectedMelody = SetValue.NONE;
                        showSeletedItem(eSelectedMelody);
                    }
                } else if (keyCode == Button.CANCEL) {
                    eSelectedMelody = SetValue.NONE;
                    Global.stopMelodyRepeat();
                    Global.DataInputScreen = DATAINPUTSCREEN.DETAIL_01;
                    UpdateScreen();
                } else {
                    eSelectedMelody = SetValue.NONE;
                    Global.stopMelodyRepeat();
                }
                showSeletedItem(eSelectedMelody);
            }
        } catch (Exception e) {
            Log.e(TAG, "[Exception] onKeyDown(...) : " + e);
            e.printStackTrace();
        }
        super.onKeyDown(keyCode, event);
    }

    private 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.VISIBLE);
                Text_Line_03_Item.setVisibility(View.INVISIBLE);
                Text_Line_04_Item.setVisibility(View.INVISIBLE);
                Text_Line_05_Item.setVisibility(View.INVISIBLE);
                Text_Line_06_Item.setVisibility(View.INVISIBLE);
                Text_Line_07_Item.setVisibility(View.INVISIBLE);
                Text_Line_08_Item.setVisibility(View.INVISIBLE);
                Text_Line_09_Item.setVisibility(View.INVISIBLE);
            } else if (Global.DataInputScreen == DATAINPUTSCREEN.DETAIL_02 || Global.DataInputScreen == DATAINPUTSCREEN.DETAIL_03) {
                Text_Line_01_Item.setVisibility(View.INVISIBLE);
                Text_Line_02_Item.setVisibility(View.INVISIBLE);
                Text_Line_03_Item.setVisibility(View.VISIBLE);
                Text_Line_04_Item.setVisibility(View.VISIBLE);
                Text_Line_05_Item.setVisibility(View.VISIBLE);
                Text_Line_06_Item.setVisibility(View.VISIBLE);
                Text_Line_07_Item.setVisibility(View.VISIBLE);
                Text_Line_08_Item.setVisibility(View.VISIBLE);
                Text_Line_09_Item.setVisibility(View.VISIBLE);
            }
        } catch (Exception e) {
            Log.e(TAG, "[Exception] UpdateVisibility() : " + e);
            e.printStackTrace();
        }
    }

    private void UpdateScreen() {
        try {
//            LOG("[updateScreen] ===== START =====");
            if (Global.DataInputScreen == DATAINPUTSCREEN.DETAIL_01) {
                strText_Title = "호출음 설정";
                Text_Title.setText(strText_Title);
                UpdateVisibility();
            } else if (Global.DataInputScreen == DATAINPUTSCREEN.DETAIL_02) {
                strText_Title = "세대 호출음";
                Text_Title.setText(strText_Title);
                UpdateVisibility();
            } else if (Global.DataInputScreen == DATAINPUTSCREEN.DETAIL_03) {
                strText_Title = "경비실 호출음";
                Text_Title.setText(strText_Title);
                UpdateVisibility();
            }
        } catch (Exception e) {
            Log.e(TAG, "[Exception] updateScreen() : " + e);
            e.printStackTrace();
        }
    }

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

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

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

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

                case ID.SCREENS.ADMINSET_SETTING_MELODY.ELEMENTS.TEXTS.LINE_03_Item:
                    position.SetPosition(30, 84, 210, 40);
                    return position;

                case ID.SCREENS.ADMINSET_SETTING_MELODY.ELEMENTS.TEXTS.LINE_04_Item:
                    position.SetPosition(240, 84, 210, 40);
                    return position;

                case ID.SCREENS.ADMINSET_SETTING_MELODY.ELEMENTS.TEXTS.LINE_05_Item:
                    position.SetPosition(30, 134, 210, 40);
                    return position;

                case ID.SCREENS.ADMINSET_SETTING_MELODY.ELEMENTS.TEXTS.LINE_06_Item:
                    position.SetPosition(240, 134, 210, 40);
                    return position;

                case ID.SCREENS.ADMINSET_SETTING_MELODY.ELEMENTS.TEXTS.LINE_07_Item:
                    position.SetPosition(30, 184, 210, 40);
                    return position;

                case ID.SCREENS.ADMINSET_SETTING_MELODY.ELEMENTS.TEXTS.LINE_08_Item:
                    position.SetPosition(240, 184, 210, 40);
                    return position;

                case ID.SCREENS.ADMINSET_SETTING_MELODY.ELEMENTS.TEXTS.LINE_09_Item:
                    position.SetPosition(30, 220, 450, 40);
                    return position;

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

    private void showSeletedItem(SetValue seleted) {
        try {
            if (seleted == SetValue.Bell_1) {
                Text_Line_03_Item.setTextColor(TextColor_Highlight);
                Text_Line_04_Item.setTextColor(TextColor_Normal);
                Text_Line_05_Item.setTextColor(TextColor_Normal);
                Text_Line_06_Item.setTextColor(TextColor_Normal);
                Text_Line_07_Item.setTextColor(TextColor_Normal);
                Text_Line_08_Item.setTextColor(TextColor_Normal);
            } else if (seleted == SetValue.Bell_2) {
                Text_Line_03_Item.setTextColor(TextColor_Normal);
                Text_Line_04_Item.setTextColor(TextColor_Highlight);
                Text_Line_05_Item.setTextColor(TextColor_Normal);
                Text_Line_06_Item.setTextColor(TextColor_Normal);
                Text_Line_07_Item.setTextColor(TextColor_Normal);
                Text_Line_08_Item.setTextColor(TextColor_Normal);
            } else if (seleted == SetValue.Bell_3) {
                Text_Line_03_Item.setTextColor(TextColor_Normal);
                Text_Line_04_Item.setTextColor(TextColor_Normal);
                Text_Line_05_Item.setTextColor(TextColor_Highlight);
                Text_Line_06_Item.setTextColor(TextColor_Normal);
                Text_Line_07_Item.setTextColor(TextColor_Normal);
                Text_Line_08_Item.setTextColor(TextColor_Normal);
            } else if (seleted == SetValue.Bell_4) {
                Text_Line_03_Item.setTextColor(TextColor_Normal);
                Text_Line_04_Item.setTextColor(TextColor_Normal);
                Text_Line_05_Item.setTextColor(TextColor_Normal);
                Text_Line_06_Item.setTextColor(TextColor_Highlight);
                Text_Line_07_Item.setTextColor(TextColor_Normal);
                Text_Line_08_Item.setTextColor(TextColor_Normal);
            } else if (seleted == SetValue.Bell_5) {
                Text_Line_03_Item.setTextColor(TextColor_Normal);
                Text_Line_04_Item.setTextColor(TextColor_Normal);
                Text_Line_05_Item.setTextColor(TextColor_Normal);
                Text_Line_06_Item.setTextColor(TextColor_Normal);
                Text_Line_07_Item.setTextColor(TextColor_Highlight);
                Text_Line_08_Item.setTextColor(TextColor_Normal);
            } else if (seleted == SetValue.Bell_6) {
                Text_Line_03_Item.setTextColor(TextColor_Normal);
                Text_Line_04_Item.setTextColor(TextColor_Normal);
                Text_Line_05_Item.setTextColor(TextColor_Normal);
                Text_Line_06_Item.setTextColor(TextColor_Normal);
                Text_Line_07_Item.setTextColor(TextColor_Normal);
                Text_Line_08_Item.setTextColor(TextColor_Highlight);
            } else {
                Text_Line_03_Item.setTextColor(TextColor_Normal);
                Text_Line_04_Item.setTextColor(TextColor_Normal);
                Text_Line_05_Item.setTextColor(TextColor_Normal);
                Text_Line_06_Item.setTextColor(TextColor_Normal);
                Text_Line_07_Item.setTextColor(TextColor_Normal);
                Text_Line_08_Item.setTextColor(TextColor_Normal);
            }
        } catch (Exception e) {
            Log.e(TAG, "[Exception] showSeletedItem(seleted)");
            e.printStackTrace();
        }
    }

    private boolean setMelody(SetValue eSetValue) {
        try {
            LOG("[setMelody] eSetValue [" + eSetValue + "]");

            if (eSetValue == SetValue.NONE) return false;

            if (Global.DataInputScreen == DATAINPUTSCREEN.DETAIL_02) {
                // 세대호출 멜로디
                ConfigValue.eCallMelody_Resi = eSetValue;
                if (!MainActivity.ConfigDBManager.setData(Declare.DBInfo.TABLE_NAME_CONFIG, ConfigValKey.CallMelody_Resi, ConfigValue.eCallMelody_Resi))
                    return false;
            } else if (Global.DataInputScreen == DATAINPUTSCREEN.DETAIL_03) {
                // 경비실호출 멜로디
                ConfigValue.eCallMelody_Guard = eSetValue;
                if (!MainActivity.ConfigDBManager.setData(Declare.DBInfo.TABLE_NAME_CONFIG, ConfigValKey.CallMelody_Guard, ConfigValue.eCallMelody_Guard))
                    return false;
            }
            return true;
        } catch (Exception e) {
            Log.e(TAG, "[Exception] setMelody(eSetValue)");
            e.printStackTrace();
            return false;
        }
    }


}