123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064 |
- package kr.co.icontrols.wallpadconfig;
- import android.annotation.SuppressLint;
- import android.content.BroadcastReceiver;
- import android.content.Context;
- import android.content.Intent;
- import android.content.IntentFilter;
- import android.graphics.Color;
- import android.os.Bundle;
- import android.os.Handler;
- import android.os.Message;
- import android.util.Log;
- import android.view.Gravity;
- import android.view.KeyEvent;
- import android.view.MotionEvent;
- import android.view.View;
- import android.view.View.OnTouchListener;
- import android.view.animation.AccelerateInterpolator;
- import android.view.animation.Animation;
- import android.view.animation.Animation.AnimationListener;
- import android.view.animation.TranslateAnimation;
- import android.widget.Button;
- import android.widget.ExpandableListView;
- import android.widget.ExpandableListView.OnGroupClickListener;
- import android.widget.ExpandableListView.OnGroupCollapseListener;
- import android.widget.ExpandableListView.OnGroupExpandListener;
- import android.widget.RelativeLayout;
- import com.artncore.WallPadDataMgr.WallpadDeviceSet;
- import com.artncore.WallPadDataMgr.WallpadStatusData;
- import com.artncore.WallPadDataMgr.wallpaddbmgr;
- import com.artncore.commons.API_Menu;
- import com.artncore.commons.API_Menu.MenuListDataClass;
- import com.artncore.commons.API_Menu.MenuListDataClass.ChildIDMapping;
- import com.artncore.commons.define;
- import com.artncore.wallpadapi.WallPadAPI;
- import com.util.LogUtil;
- import org.json.JSONArray;
- import org.json.JSONException;
- import org.json.JSONObject;
- import java.io.File;
- import java.io.ObjectInputStream;
- import java.io.ObjectOutputStream;
- import java.net.InetSocketAddress;
- import java.net.Socket;
- import java.sql.Timestamp;
- import java.text.SimpleDateFormat;
- import java.util.ArrayList;
- import kr.co.icontrols.ReliefCall.ReliefCallInterface;
- import kr.co.icontrols.wallpadconfig.declare.Common;
- import kr.co.icontrols.wallpadconfig.declare.Common.JSON;
- import kr.co.icontrols.wallpadconfig.declare.ID;
- import kr.co.icontrols.wallpadconfig.screen.ConfigCleanLcdMainScreen;
- import kr.co.icontrols.wallpadconfig.screen.ConfigHSPlatformDeviceListScreen;
- import kr.co.icontrols.wallpadconfig.screen.ConfigInKakaoiMainScreen;
- import kr.co.icontrols.wallpadconfig.screen.ConfigInRoomSensorMainScreen;
- import kr.co.icontrols.wallpadconfig.screen.ConfigInWifiMainScreen;
- import kr.co.icontrols.wallpadconfig.screen.ConfigMobileDeviceAddScreen;
- import kr.co.icontrols.wallpadconfig.screen.ConfigMoningCallMainScreen;
- import kr.co.icontrols.wallpadconfig.screen.ConfigPwChangeMainScreen;
- import kr.co.icontrols.wallpadconfig.screen.ConfigRfCardMainScreen;
- import kr.co.icontrols.wallpadconfig.screen.ConfigSettingMainScreen;
- import kr.co.icontrols.wallpadconfig.screen.ConfigSmartKeyMainScreen;
- import kr.co.icontrols.wallpadconfig.screen.ConfigTimeSetScreen;
- import kr.co.icontrols.wallpadsupport.Version;
- import kr.co.icontrols.wallpadsupport.WpadActivity;
- import kr.co.icontrols.wallpadsupport.WpadImageView;
- import kr.co.icontrols.wallpadsupport.WpadImageView.TOUCH_KIND;
- import kr.co.icontrols.wallpadsupport.WpadScale;
- import kr.co.icontrols.wallpadsupport.WpadSound;
- import kr.co.icontrols.wallpadsupport.WpadSound.SND;
- import kr.co.icontrols.wallpadsupport.WpadTextView;
- import kr.co.icontrols.wallpadsupport.WpadUtil;
- import static android.content.Intent.ACTION_TIME_TICK;
- import static kr.co.icontrols.wallpadconfig.screen.ConfigInRoomSensorMainScreen.SELECT_START_TIME;
- /**
- * @description
- * 월패드 [설정기능] 메인화면 이다.<br>
- * 상단의 Top 메뉴, [홈] [돌아가기]<br>
- * 좌측의 Tab 메뉴, [환경설정] [화면청소] [비밀번호변경] ... 등 선택 메뉴<br>
- * 를 여기서 처리한다.
- */
- public class MainActivity extends WpadActivity
- {
- private final static String TAG = "MainActivity";
- private final boolean DEBUG_LOG_ON = true;
- private void DebugLogOutput(String s) { if(DEBUG_LOG_ON) Log.d(TAG, s); }
- // =================================================================================================
- // [[ Declaration ]] region
- // =================================================================================================
- protected Context mContext = null;
- public Context getContext() { return mContext; }
- private WallPadAPI mWallPadAPI = null;
- private int OPERATION_MODE = Common.MODE;
- private WallpadStatusData wdb = null;
- public static ReliefCallInterface mReliefCallIF; // 안심통화 솔루션 라이브러리
- // Layout
- private RelativeLayout AllLayout; // 화면 전체
- private RelativeLayout TopLayout; // 상단 메뉴
- private RelativeLayout ScreenLayout; // 메인 화면
- private RelativeLayout MenuLayout; // 메뉴 화면
- // Top Menu
- private WpadImageView TopBackground;
- private WpadTextView TopTitle;
- private WpadImageView TopHomeBtn,TopBackBtn, TopMenuBtn, TopSetBtn;
- private WpadImageView TopManualBtn;
- private WpadImageView BackBtn_InRoom;
- // Main
- private WpadImageView ScreenBackground;
- // Menu
- private WpadImageView MenuBackground;
- private WpadImageView MenuClose;
- private WpadTextView MenuTitle;
- private static ExpandableListView mListView;
- private Menu_AdptMain adptMain;
- private MenuListDataClass menueListDataClass;
- private Menu mMenu = null; //WPadAPI의 Menu class
- private boolean MenuOpen = false;
- private int mTempCurrentScreenId = -1;
- public static boolean bRemoteCallUse = false; // 방문객원격통화 사용 설정 유무
- // PopupActivityRun
- private static boolean PopupActivityRun = false;
- public static boolean getPopupActivityRun() { return PopupActivityRun; }
- public static void setPopupActivityRun(boolean run) { PopupActivityRun = run; }
- // CurrentScreenId
- private int mCurrentScreenId = -1;
- public static WpadSound mSound;
- // Screen
- private ConfigSettingMainScreen configSettingMainScreen = null;
- private ConfigCleanLcdMainScreen configCleanLcdMainScreen = null;
- private ConfigPwChangeMainScreen configPwChangeMainScreen = null;
- //private ConfigSkinChangeScreen configGLESkinChangeMainScreen = null;
- private ConfigMoningCallMainScreen configMoningCallMainScreen = null;
- private ConfigSmartKeyMainScreen configSmartKeyMainScreen = null;
- private ConfigRfCardMainScreen configRfCardMainScreen = null;
- private ConfigTimeSetScreen configTimeSetScreen = null;
- //private ConfigHandicappedModeScreen configHandicappedModeScreen = null;
- //private ConfigNoiseLogMainScreen configNoiseLogMainScreen = null;
- private ConfigMobileDeviceAddScreen configMobileDeviceAddScreen = null;
- private ConfigInRoomSensorMainScreen configInRoomSensorMainScreen = null;
- private ConfigHSPlatformDeviceListScreen configHSPlatformDeviceListScreen = null;
- //Wifi
- private ConfigInWifiMainScreen configWifiMainScreen = null;
- private ConfigInKakaoiMainScreen configInKakaoiMainScreen = null;
- public WallpadStatusData GetDBObj()
- {
- return wdb;
- }
- public static int mCurrentManualScreenId = -1;
- // =================================================================================================
- // [[ Activity Life Cycle ]] region
- // =================================================================================================
- /**
- * Activity Constructors
- */
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- Log.i(TAG, "-------------------------------------------------------------");
- Log.i(TAG, "------------------ [START - MainActivity] -------------------");
- Log.i(TAG, "-------------------------------------------------------------");
- super.onCreate(savedInstanceState);
- // @ AutoScale 설정
- WpadScale.setAutoScale(true);
- super.AppVersionLogOut(); // [APP Version] + [WallPadSupport Lib Version] 을 로그로 출력한다.
- Log.i("Version", "<><><><> WallPadAPI Version = [" + define.WALLPADAPI_VERSION + "] " + "<><><><>");
- // 1. 변수 초기화
- DebugLogOutput("[Create] - Step1 : Data Create");
- PopupActivityRun = false;
- mContext = this;
- mSound = new WpadSound(this);
- // 2. 자동 종료 셋팅
- DebugLogOutput("[Create] - Step2 : Auto Finish Setting");
- // 2-1. 자동종료 타이머 셋팅
- if(Common.FINISH_TIME_ENABLE) super.setFinishTimerCreate(Common.FINISH_TIME_SEC);
- // 3. API 호출
- DebugLogOutput("[Create] - Step3 : API Call");
- // 3.1. mWallPadAPI 생성
- if (OPERATION_MODE == Common.MODE_NOMAL) {
- mTempCurrentScreenId = API_Menu.SubMenuConfig.Configuration;
- Log.d(TAG, "OperationMode = MODE_NOMAL");
- try {
- mWallPadAPI = new WallPadAPI(this);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch(Exception e) {
- Log.e(TAG, "[ExceptionError] - new WallPadAPI : " + e);
- }
- }
- else if (OPERATION_MODE == Common.MODE_BUSINESS_SAMPLE) {
- Log.d(TAG, "OperationMode = MODE_BUSINESS_SAMPLE");
- }
- try {
- wdb = new WallpadStatusData(this);
- wallpaddbmgr.AddressSet addc = wdb.getAddressMGR(); //DB에서 동호 정보 받아옴
- //동, 호, ip 정보 저장
- myIP = addc.IPAddress;
- myHo = addc.Ho;
- ho = Integer.valueOf(myHo.substring(0,1));
- }
- catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) { Log.e(TAG, "[ExceptionError] - onCreate->WallpadStatusData Create : " + e); }
- CheckIsFolderMake();
- // 4. Layout registration
- DebugLogOutput("[Create] - Step4 : Layout registration");
- // 4-1. mainLayout
- AllLayout = new RelativeLayout(this);
- RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(WpadScale.getWidthPixels(), WpadScale.getHeightPixels());
- AllLayout.setLayoutParams(params);
- AllLayout.setId(ID.main.layout.ALL);
- super.setAllLayoutRegistration(AllLayout);
- // 4-2. TopLayout
- TopLayout = new RelativeLayout(this);
- WpadUtil.LayoutRegistration(AllLayout, TopLayout, 1280, 110, 0, 0, ID.main.layout.TOP);
- // 4-4. ScreenLayout
- ScreenLayout = new RelativeLayout(this);
- WpadUtil.LayoutRegistration(AllLayout, ScreenLayout, 1280, 690, 0, 110, ID.main.layout.SCREEN);
- ScreenBackground = new WpadImageView(this, TOUCH_KIND.NONE, 1280, 690, R.drawable.bg_body, R.drawable.bg_body, ID.main.image.SCREEN_BACKGROUND);
- ViewRegistration(ScreenLayout, ScreenBackground, 0, 0);
- // 5. Top Menu - ImageView registration
- DebugLogOutput("[Create] - Step5 : Top Menu - ImageView registration");
- TopBackground = new WpadImageView(this, TOUCH_KIND.NONE, 1280, 110, R.drawable.bg_topbar, R.drawable.bg_topbar, ID.main.image.TOP_BACKGROUND);
- ViewRegistration(TopLayout, TopBackground, 0, 0);
- TopTitle = new WpadTextView(this, false, 247+180, 80, Gravity.LEFT, Color.WHITE, Common.fontsize._44, true, ID.main.text.TITLE);
- ViewRegistration(TopLayout, TopTitle, 133, 15);
- TopHomeBtn = new WpadImageView(this, TOUCH_KIND.BUTTON, 110, 110, R.drawable.topbar_icon_home_normal, R.drawable.topbar_icon_home_pressed, ID.main.button.HOME);
- ViewRegistration(TopLayout, TopHomeBtn, 1145, 0);
- TopBackBtn = new WpadImageView(this, TOUCH_KIND.BUTTON, 110, 110, R.drawable.topbar_icon_back_normal, R.drawable.topbar_icon_back_pressed, ID.main.button.BACK);
- ViewRegistration(TopLayout, TopBackBtn, 1019, 0);
- setTopBackBtnVisible(false);
- TopMenuBtn = new WpadImageView(this, TOUCH_KIND.BUTTON, 110, 110, R.drawable.topbar_icon_menu_normal, R.drawable.topbar_icon_menu_pressed, ID.main.button.MENU);
- ViewRegistration(TopLayout, TopMenuBtn, 0, 0);
- TopSetBtn = new WpadImageView(this, TOUCH_KIND.BUTTON, 110, 110, R.drawable.topbar_icon_set_normal, R.drawable.topbar_icon_set_pressed, ID.main.button.SETTING);
- ViewRegistration(TopLayout, TopSetBtn, 1019, 0);
- setTopSetBtnVisible(false);
- TopManualBtn = new WpadImageView(this, TOUCH_KIND.BUTTON, 110, 110, R.drawable.topbar_icon_manual_normal, R.drawable.topbar_icon_manual_pressed, ID.main.button.MENUAL);
- setManualBtnVisible(getManualUse(), 1019);
- BackBtn_InRoom = new WpadImageView(this, TOUCH_KIND.BUTTON, 110, 110, R.drawable.topbar_icon_back_normal, R.drawable.topbar_icon_back_pressed, ID.main.button.BACK_INROOM);
- ViewRegistration(TopLayout, BackBtn_InRoom, 1020, 0);
- Set_BackBtn_InroomVisible(false);
- WallpadDeviceSet wallpadDeviceSet = new WallpadDeviceSet(mContext);
- int[] DoorCamKind = wallpadDeviceSet.Get_RFDoorCAM_Info(); // 현관카메라 종류 파악
- //int noiseUse = wallpadDeviceSet.Get_NoiseSensor_Use();
- int mobileAuth = wallpadDeviceSet.Get_MobileAppAuth_Use();
- bRemoteCallUse = wallpadDeviceSet.Get_RemoteCall_Use() > 0 ? true : false;
- int inroomDetectUse = wallpadDeviceSet.Get_InnerRoomDetectSensor_Use();
- int[] naKeyType = wallpadDeviceSet.Get_BLESmartKey_Info(); // 출입키 종류
- boolean bHSPlatform = wallpadDeviceSet.Get_HS_PlatformUse(); // 효성플랫폼 연동
- wallpadDeviceSet.closeDB();
- int DcamSetting = 0;
- if (DoorCamKind.length == 2) {
- if (DoorCamKind[0] == 1) {
- // 사용함
- if (DoorCamKind[1] == WallpadDeviceSet.DOORTYPE_SMARTKEY) {
- DcamSetting = WallpadDeviceSet.DOORTYPE_SMARTKEY;
- }
- else if (DoorCamKind[1] == WallpadDeviceSet.DOORTYPE_SMARTKEY_EXTERNAL) {
- DcamSetting = WallpadDeviceSet.DOORTYPE_SMARTKEY_EXTERNAL;
- }
- else if (DoorCamKind[1] == WallpadDeviceSet.DOORTYPE_RFCAM) {
- DcamSetting = WallpadDeviceSet.DOORTYPE_RFCAM;
- }
- else if (DoorCamKind[1] == WallpadDeviceSet.DOORTYPE_IOT_SMART) {
- DcamSetting = WallpadDeviceSet.DOORTYPE_IOT_SMART;
- }
- else if (DoorCamKind[1] == WallpadDeviceSet.DOORTYPE_HYOSUNG_SMART) {
- DcamSetting = WallpadDeviceSet.DOORTYPE_HYOSUNG_SMART;
- }
- else if (DoorCamKind[1] == WallpadDeviceSet.DOORTYPE_DAEWOO_SMART) {
- DcamSetting = WallpadDeviceSet.DOORTYPE_DAEWOO_SMART;
- }
- else if (DoorCamKind[1] == WallpadDeviceSet.DOORTYPE_HDCAM) {
- DcamSetting = WallpadDeviceSet.DOORTYPE_HDCAM;
- }
- else {
- //DOORTYPE_BASIC
- DcamSetting = WallpadDeviceSet.DOORTYPE_BASIC;
- }
- }
- }
- // 6. Menu Loading
- // 6-1. 메뉴 정보를 가져온다 (DB에서 가져온다)
- wallpaddbmgr WallpadDBMGR = new wallpaddbmgr(getApplicationContext());
- //test
- WallpadDBMGR.DeleteMenuList();
- ArrayList<ArrayList<Integer>> mGroupList = null;
- ArrayList<Integer> mChildList = null;
- mGroupList = new ArrayList<ArrayList<Integer>>();
- mChildList = new ArrayList<Integer>();
- mChildList.add(API_Menu.SubMenuConfig.Configuration);
- mChildList.add(API_Menu.SubMenuConfig.CleanLcd);
- mChildList.add(API_Menu.SubMenuConfig.PassWordChange);
- //mChildList.add(API_Menu.SubMenuConfig.SkinChange);
- //mChildList.add(API_Menu.SubMenuConfig.MorningCall);
- mChildList.add(API_Menu.SubMenuConfig.TimeSetting);
- Log.w(TAG, "[Create] DcamSetting = " + DcamSetting);
- if ((DcamSetting == WallpadDeviceSet.DOORTYPE_SMARTKEY) || (DcamSetting == WallpadDeviceSet.DOORTYPE_SMARTKEY_EXTERNAL) || (DcamSetting == WallpadDeviceSet.DOORTYPE_IOT_SMART) ) {
- if (naKeyType[1] == WallpadDeviceSet.BLESMARTKEY_BAND) mChildList.add(API_Menu.SubMenuConfig.SmartBand);
- else {
- //mChildList.add(API_Menu.SubMenuConfig.SmartKey);
- Log.w(TAG, "[Create] Smart IoT Doorcam suppots only Smartband(BLE)!!");
- }
- }
- else if (DcamSetting == WallpadDeviceSet.DOORTYPE_RFCAM) {
- mChildList.add(API_Menu.SubMenuConfig.RfCard);
- }
- else {
- Log.w(TAG, "[Create] DcamSetting is not available!!! -> " + DcamSetting);
- }
- /*if(noiseUse == 1)
- {
- mChildList.add(API_Menu.SubMenuConfig.NoiseLog);
- }*/
- Log.w(TAG, "[Create] mobileAuth = " + mobileAuth);
- if (mobileAuth == 1) {
- mChildList.add(API_Menu.SubMenuConfig.MobileDeviceReg);
- }
- else {
- Log.w(TAG, "[Create] mobileAuth is not available!!! -> " + mobileAuth);
- }
- Log.w(TAG, "[Create] inroomDetectUse = " + inroomDetectUse);
- if (inroomDetectUse == 1) {
- mChildList.add(API_Menu.SubMenuConfig.InRoomDetectSet);
- }
- else {
- Log.w(TAG, "[Create] inroomDetectUse is not available!!! -> " + inroomDetectUse);
- }
- //mChildList.add(API_Menu.SubMenuConfig.HandicappedPerson);
- //이진규
- //카카오 홈 판단 여부 체크
- WallpadDeviceSet wdst_ = new WallpadDeviceSet(getApplicationContext());
- boolean kakaohomeuse = wdst_.Get_KakaoUse();
- wdst_.closeDB();
- if (kakaohomeuse) {
- mChildList.add(API_Menu.SubMenuConfig.KakaoHome);
- mChildList.add(API_Menu.SubMenuConfig.Wifi);
- }
- mGroupList.add(mChildList);
- if (bHSPlatform) {
- mChildList.add(API_Menu.SubMenuConfig.HSPlatformDevice);
- }
- else {
- Log.w(TAG, "[Create] bHSPlatform is not available!!! -> " + bHSPlatform);
- }
- for (int i = 0; i < mGroupList.size(); i++) {
- Log.i(TAG, "[Create] mGroupList.get(" + i + ") = " + mGroupList.get(i));
- }
- WallpadDBMGR.SetMenuList(mGroupList);
- menueListDataClass = WallpadDBMGR.GetMenuList();
- WallpadDBMGR.closeDB();
- Log.i(TAG, "[Create] menueListDataClass.arrayChild = " + menueListDataClass.arrayChild.toString());
- // for (int i = 0; i < menueListDataClass.arrayChild.size(); i++) {
- // Log.i(TAG, "[Create] mGroupList.get(" + i + ") = " + menueListDataClass.arrayChild.toString());
- // }
- if (menueListDataClass == null) {
- Log.e(TAG, "[Create] menueListDataClass == null, Load Default List");
- menueListDataClass = LoadDefaultMenuList();
- }
- // 6-2. 시작 화면을 main APP으로 부터 받아서 처리한다.
- Log.i(TAG, "[Create] OPERATION_MODE is " + OPERATION_MODE);
- mMenu = new Menu();
- mMenu = super.getIntentParsingMenu(getIntent());
- if (mMenu == null) {
- //mWallPadApiCheckHandler.sendEmptyMessage(0);
- //setChangeScreen(API_Menu.SubMenuConfig.Configuration, false);
- Log.i(TAG, "[Create] mMenu = null");
- if(CheckIntent())
- {
- mTempCurrentScreenId = API_Menu.SubMenuConfig.Configuration;
- SetTitleText(API_Menu.SubMenuConfig.Name_Configuration);
- mWallPadApiCheckHandler.sendEmptyMessage(0);
- StartPopup(ID.screen.PopupWIFIConnect);
- }
- else
- {
- if (OPERATION_MODE == Common.MODE_NOMAL) {
- mTempCurrentScreenId = API_Menu.SubMenuConfig.Configuration;
- SetTitleText(API_Menu.SubMenuConfig.Name_Configuration);
- mWallPadApiCheckHandler.sendEmptyMessage(0);
- }
- else {
- setChangeScreen(API_Menu.SubMenuConfig.Configuration, false);
- }
- }
- }
- else {
- /*boolean result = setChangeScreen(mMenu.getStartId(), false);
- if(result == false)
- {
- mWallPadApiCheckHandler.sendEmptyMessage(0);
- //setChangeScreen(API_Menu.SubMenuConfig.Configuration, false);
- }*/
- Log.i(TAG, "[Create] mMenu != null");
- if (OPERATION_MODE == Common.MODE_NOMAL) {
- mTempCurrentScreenId = API_Menu.SubMenuConfig.Configuration;
- SetTitleText(API_Menu.SubMenuConfig.Name_Configuration);
- mWallPadApiCheckHandler.sendEmptyMessage(0);
- mTempCurrentScreenId = mMenu.getStartId();
- setTitleName(mTempCurrentScreenId);
- mWallPadApiCheckHandler.sendEmptyMessage(0);
- }
- else {
- boolean result = setChangeScreen(mMenu.getStartId(), false);
- Log.i(TAG, "[Create] Menu Sample result = " + result);
- if (result == false) {
- setChangeScreen(API_Menu.SubMenuConfig.Configuration, false);
- }
- }
- }
- // 7. Draw
- DebugLogOutput("[Create] - Step7 : setContentView");
- setContentView(AllLayout);
- // 8. Window ReSize
- DebugLogOutput("[Create] - Step8 : Window ReSize");
- //super.WindowReSize(Common.SCREEN_SIZE_MAIN_W, Common.SCREEN_SIZE_MAIN_H, false);
- // 9. BR Receiver 등록(메뉴에서 다른 화면이 눌린 경우 BR처리)
- reg_Receiver();
- registerKaKaOIBR();
- WallpadDeviceSet wdst = new WallpadDeviceSet(getContext());
- int[] lights = wdst.Get_Light_info();
- wdst.closeDB();
- for(int i = 0; i < lights.length; i++)
- {
- Log.i(TAG, "lights[" + i + "] = " + lights[i] + " ########################");
- }
- String str = String.format("%.0f", 0.7);
- str += " kWh";
- Log.i(TAG, "[Create] - DOT str = " + str + " ########################");
- WallpadStatusData wsd = new WallpadStatusData(getContext());
- String welcomeSaved = wsd.Get_WelcomeLight_Selected();
- wsd.closeDB();
- Log.i(TAG, "welcomeSaved = " + welcomeSaved + " $$$$$$$$$$$$$$$$$$$$$$$$$$");
- // 안심통화 솔루션 라이브러리 import
- // if (getReliefCallUse()) {
- // Log.i(TAG, "[onCreate] --------------- ReliefCallInterface ---------------");
- // mReliefCallIF = new ReliefCallInterface();
- // }
- // 거주자 안전확인 서비스 사용여부 확인하고, 화면 WallPadSupport Lib.에 관련 설정을 한다.
- getResidentSafetyCheckSetting();
- Log.i(TAG, "End onCreate -------------------------------------------------");
- }
-
-
- //kr.co.icontrols.WIFIScreen 등록
- BroadcastReceiver kakaoBroadCastReceiver = new BroadcastReceiver() {
- @Override
- public void onReceive(Context context, Intent intent) {
- if(intent.getAction().equals("kr.co.icontrols.WIFIScreen"))
- {
- // mTempCurrentScreenId = API_Menu.SubMenuConfig.Configuration;
- // SetTitleText(API_Menu.SubMenuConfig.Name_Configuration);
- mWallPadApiCheckHandler.sendEmptyMessage(0);
- StartPopup(ID.screen.PopupWIFIConnect);
- }
- }
- };
- private void registerKaKaOIBR() {
- try {
- IntentFilter filter = new IntentFilter();
- filter.addAction("kr.co.icontrols.WIFIScreen");
- mContext.registerReceiver(kakaoBroadCastReceiver, filter);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] registerMainActivityBR()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- /**
- * 카카오에서 환경설정을 호출하는 경우
- */
- private boolean CheckIntent()
- {
- boolean result = false;
- //카카오 홈에서 WIFI를 호출하는 경우
- Intent received_intent = getIntent();
- if(received_intent!=null)
- {
- result = received_intent.getBooleanExtra("WIFI", false);
- }
- return result;
- }
- /**
- * (평생코드) WallPadAPI 초기생성시 Connect 에 시간이 걸리며, <br>
- * WallPadAPI 초기화후 바로 Get_GasValveController 등을 사용하여 API 를 가져올수 없기에, <br>
- * 본 딜레이 코드를 임시로 적용한다.
- */
- @SuppressLint("HandlerLeak")
- protected Handler mWallPadApiCheckHandler = new Handler() {
- @SuppressLint("HandlerLeak")
- @Override
- public void handleMessage(Message msg) {
- if (msg.what == 0) {
- if (mWallPadAPI != null) {
- Log.w(TAG, "[mWallPadApiCheckHandler] WallPad API Loading!!!");
- if (mWallPadAPI.Check_Connect()) {
- Log.d(TAG, "[mWallPadApiCheckHandler] WallPad API Connected!!");
- mWallPadApiCheckHandler.sendEmptyMessageDelayed(1, 10);
- }
- else {
- Log.w(TAG, "[mWallPadApiCheckHandler] WallPad API not Connected, yet!!");
- mWallPadApiCheckHandler.sendEmptyMessageDelayed(0, 10);
- }
- }
- }
- else if (msg.what == 1) {
- Log.d(TAG, "[mWallPadApiCheckHandler] WallPad API Loaded!!");
- boolean bChangeScreen = setChangeScreen(mTempCurrentScreenId, false);
- Log.d(TAG, "[mWallPadApiCheckHandler] bChangeScreen [" + bChangeScreen + "]");
- if (bChangeScreen == false) {
- setChangeScreen(API_Menu.SubMenuConfig.Configuration, false);
- }
- }
- //새로 추가한 부분
- if (msg.what == 3) {
- if (mWallPadAPI != null) {
- Log.w(TAG, "[mWallPadApiCheckHandler] WallPad API Loading!!!");
- if (mWallPadAPI.Check_Connect()) {
- Log.d(TAG, "[mWallPadApiCheckHandler] WallPad API Connected!!");
- mWallPadApiCheckHandler.sendEmptyMessageDelayed(1, 10);
- }
- else {
- Log.w(TAG, "[mWallPadApiCheckHandler] WallPad API not Connected, yet!!");
- mWallPadApiCheckHandler.sendEmptyMessageDelayed(0, 10);
- }
- }
- }
- else {
- Log.d(TAG, "[mWallPadApiCheckHandler] Not expected value!! Handler stop!! msg.what [" + msg.what +"]");
- }
- }
- };
- /**
- * TOP 설정 버튼 활성화 & 비활성화
- *
- * @param bEnable - true : 활성화, false : 비활성화
- * @return (boolean) true : 성공, false : 실패
- */
- public boolean setTopSetBtnVisible(boolean bEnable) {
- if (bEnable) {
- if (TopSetBtn.getVisibility() != View.VISIBLE) TopSetBtn.setVisibility(View.VISIBLE);
- TopSetBtn.bringToFront();
- if (TopSetBtn.getVisibility() == View.VISIBLE) {
- WpadUtil.ViewMove(TopManualBtn, 893, 0);
- }
- } else {
- if (TopSetBtn.getVisibility() != View.INVISIBLE)
- TopSetBtn.setVisibility(View.INVISIBLE);
- if (TopSetBtn.getVisibility() == View.INVISIBLE) {
- WpadUtil.ViewMove(TopManualBtn, 1019, 0);
- }
- }
- return true;
- }
- /* ================================================================================================
- * [Manual Activity] Section
- ================================================================================================ */
- public static ManualActivity mManualActivity;
- public void setManualBtnVisible(boolean bEnable, int marginLeft)
- {
- try
- {
- Log.d(TAG, "[setManualBtnVisible] bEnable [" + bEnable + "], marginLeft [" + marginLeft + "]");
- if (bEnable) TopManualBtn.setVisibility(View.VISIBLE);
- else TopManualBtn.setVisibility(View.INVISIBLE);
- TopLayout.removeView(TopManualBtn);
- ViewRegistration(TopLayout, TopManualBtn, marginLeft, 0);
- }
- catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e)
- {
- Log.e(TAG, "[Exception] setManualBtnVisible(boolean bEnable)");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- /**
- * 매뉴얼 버튼 사용 유무
- * @return boolean 타입 - true: 사용, false: 미사용
- */
- public boolean getManualUse()
- {
- try
- {
- WallpadDeviceSet devSet = new WallpadDeviceSet(mContext);
- String[] DBinfo = devSet.GetSettingData("매뉴얼");
- devSet.closeDB();
- if (DBinfo != null)
- {
- if (DBinfo[1].indexOf("사용함") > 0)
- {
- Log.d(TAG, "[getManualUse] Use Manual");
- return true;
- }
- else
- {
- // 미사용
- Log.d(TAG, "[getManualUse] Not Use Manual [1]");
- return false;
- }
- }
- else
- {
- // 미사용
- Log.d(TAG, "[getManualUse] Not Use Manual [2]");
- return false;
- }
- }
- catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception ex)
- {
- Log.e(TAG, "[getManualUse] - Exception !!!");
- //ex.printStackTrace();
- LogUtil.errorLogInfo("", TAG, ex);
- }
- return false;
- }
- // ManualActivityRun
- private static boolean ManualActivityRun = false;
- public static boolean getManualActivityRun() {
- Log.d(TAG, "[getManualActivityRun] ManualActivityRun: " + ManualActivityRun);
- return ManualActivityRun;
- }
- public static void setManualActivityRun(boolean run)
- {
- ManualActivityRun = run;
- if (!ManualActivityRun) resetCurrentManualScreenID();
- }
- public boolean StartManual(int screenId)
- {
- Log.d(TAG, "[StartManual] ScreenId [" + screenId + "], mCurrentManualScreenId [" + mCurrentManualScreenId + "]");
- if (getManualActivityRun())
- {
- mCurrentManualScreenId = screenId;
- return ((WpadActivity) (ManualActivity.getContext())).ChangeScreen(screenId);
- }
- else
- {
- if (mCurrentManualScreenId == screenId) return false;
- mCurrentManualScreenId = screenId;
- setManualActivityRun(true);
- Intent intent = new Intent(mContext, ManualActivity.class);
- intent.putExtra("ScreenId", screenId);
- if(mCurrentScreenId == API_Menu.SubMenuConfig.Configuration)
- {
- intent.putExtra("SettingData", configSettingMainScreen.setting_manual_str);
- intent.putExtra("NowPage", configSettingMainScreen.m_CurPage);
- intent.putExtra("TotalPage", configSettingMainScreen.m_ToTalPage);
- }
- overridePendingTransition(0, 0);
- startActivityForResult(intent, 0);
- return true;
- }
- }
- public static void resetCurrentManualScreenID()
- {
- try
- {
- mCurrentManualScreenId = -1;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e)
- {
- Log.e(TAG, "[Exception] resetCurrentManualScreenID()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- public static void FinishManualActivity()
- {
- Log.i(TAG, "[FinishManualActivity]");
- try
- {
- if (mManualActivity != null)
- {
- mCurrentManualScreenId = -1;
- mManualActivity.finish();
- }
- }
- catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e)
- {
- Log.e(TAG, "[Exception] FinishManualActivity()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- /**
- * onDestroy
- */
- @Override
- protected void onDestroy() {
- // 혹시 돌고 있을수 있는 핸들러를 종료한다.
- // mWallPadApiCheckHandler.sendEmptyMessageDelayed(99, 0);
- setChangeScreen(mCurrentScreenId, true);
- if (wdb != null) wdb.closeDB();
- this.unregisterReceiver(mWallPadAlertBR);
- this.unregisterReceiver(mWallPadJogBR);
- this.unregisterReceiver(kakaoBroadCastReceiver);
- mSound.Release();
- super.setFinishTimerDestroy();
- super.onDestroy();
- Log.i(TAG, "*************************************************************");
- Log.i(TAG, "****************** [END - MainActivity] *******************");
- Log.i(TAG, "*************************************************************");
- }
- /**
- * onResume
- */
- @Override
- protected void onResume() {
- super.onResume();
- if (mWallPadAPI != null) mWallPadAPI.Resume();
- DebugLogOutput("@@@@@@@@ [onResume] @@@@@@@@");
- }
- /**
- * onPause
- */
- @Override
- protected void onPause() {
- // 혹시 돌고 있을수 있는 핸들러를 종료한다.
- mWallPadApiCheckHandler.sendEmptyMessageDelayed(99, 0);
- if (mWallPadAPI != null) mWallPadAPI.Pause();
- DebugLogOutput("@@@@@@@@ [onPause] @@@@@@@@");
- super.onPause();
- }
- /* ================================================================================================
- * [BroadcastReceiver] Section
- ================================================================================================ */
- /**
- * BroadcastReceiver.onReceive for [WpadActivity]
- */
- @Override
- protected void onBrReceive(Intent intent)
- {
- super.onBrReceive(intent);
- DebugLogOutput("Receive BR " + intent.getAction());
- }
- /* ================================================================================================
- * [Touch & Key Event] Section
- ================================================================================================ */
- /**
- * TouchEvent for [WpadActivity]
- */
- @Override
- protected void onTouchEvent(View v, MotionEvent event)
- {
- super.onTouchEvent(v, event);
- int TargetId = v.getId();
- int MoveEvent = event.getAction();
- //DebugLogOutput("onTouch - " + "id : " + v.getId() + " / Action : " + event.getAction());
- if(MoveEvent == MotionEvent.ACTION_UP)
- {
- if(TargetId == ID.main.button.HOME)
- {
- DebugLogOutput("onTouchEvent [HOME] BUTTON !!!");
- Sound().Play(SND.effect.TOUCH_LATCHED);
- Intent intent = new Intent();
- intent.putExtra("Finish_Kind", "HomeButton");
- setResult(RESULT_OK, intent);
- finish();
- }
- else if(TargetId == ID.main.button.BACK)
- {
- DebugLogOutput("onTouchEvent [BACK] BUTTON !!!");
- Sound().Play(SND.effect.TOUCH_LATCHED);
- /**
- *[수정필요]Back Button 필요한 화면은 아래 부분 추가 후 사용 필요
- * **/
- /*
- if((mCurrentScreenId == API_Menu.SubMenuConfig.SmartKey) || (mCurrentScreenId == API_Menu.SubMenuConfig.RfCard)||(mCurrentScreenId == API_Menu.SubMenuConfig.CleanLcd)
- ||(mCurrentScreenId == API_Menu.SubMenuConfig.MorningCall)||(mCurrentScreenId == API_Menu.SubMenuConfig.PassWordChange)||(mCurrentScreenId == API_Menu.SubMenuConfig.TimeSetting))
- {
- setChangeScreen(API_Menu.SubMenuConfig.Configuration, false);
- }*/
- }
- else if(TargetId == ID.main.button.MENU)
- {
- DebugLogOutput("onTouchEvent [MENU] BUTTON !!!");
- if(MenuOpen == true)
- {
- return;
- }
- Sound().Play(SND.effect.TOUCH_LATCHED);
- OpenMenuLayout();
- }
- else if (TargetId == ID.main.button.MENUCLOSE)
- {
- if(MenuOpen == true)
- {
- Sound().Play(SND.effect.TOUCH_LATCHED);
- CloseMenuLayout();
- }
- }
- else if (TargetId == ID.main.button.MENUAL)
- {
- Log.i(TAG, "onTouchEvent [MANUAL] BUTTON [mCurrentScreenId = " + mCurrentScreenId + "]");
- Sound().Play(SND.effect.TOUCH_LATCHED);
- if(mCurrentScreenId == API_Menu.SubMenuConfig.Configuration) { StartManual(ID.MANUAL.MANUAL_SettingMain); }
- else if(mCurrentScreenId == API_Menu.SubMenuConfig.CleanLcd) { StartManual(ID.MANUAL.MANUAL_CleanLcdMain); }
- else if(mCurrentScreenId == API_Menu.SubMenuConfig.PassWordChange) { StartManual(ID.MANUAL.MANUAL_PWD_CHANGE); }
- else if(mCurrentScreenId == API_Menu.SubMenuConfig.MorningCall) { StartManual(ID.MANUAL.MANUAL_MORNINGCALL); }
- else if(mCurrentScreenId == API_Menu.SubMenuConfig.TimeSetting) { StartManual(ID.MANUAL.MANUAL_TIMESETTING); }
- else if(mCurrentScreenId == API_Menu.SubMenuConfig.RfCard) { StartManual(ID.MANUAL.MANUAL_RFCARD); }
- else if(mCurrentScreenId == API_Menu.SubMenuConfig.SmartKey) { StartManual(ID.MANUAL.MANUAL_SMARTKEY); }
- else if(mCurrentScreenId == API_Menu.SubMenuConfig.MobileDeviceReg) { StartManual(ID.MANUAL.MANUAL_MOBILEDEVREG); }
- else if(mCurrentScreenId == API_Menu.SubMenuConfig.InRoomDetectSet) { /*StartManual(ID.MANUAL.MANUAL_MOBILEDEVREG);*/ }
- // else if(mCurrentScreenId == API_Menu.SubMenuConfig.HSPlatformDevice) { StartManual(ID.MANUAL.MANUAL_HSPLATFORMDEVICE); } // TODO 추후 매뉴얼 작업 필요
- }
- else if (TargetId == ID.main.button.SETTING)
- {
- Sound().Play(SND.effect.TOUCH_LATCHED);
- if (mCurrentScreenId == API_Menu.SubMenuConfig.MobileDeviceReg)
- StartPopup(ID.screen.PopupRemoteCallUserSetting);
- }
- else if(TargetId == ID.main.button.BACK_INROOM)
- {
- DebugLogOutput("onTouchEvent [BACK_INROOM] BUTTON !!!");
- Sound().Play(SND.effect.TOUCH_LATCHED);
- Set_BackBtn_InroomVisible(false);
- try
- {
- // 시나리오 선택화면으로 복귀.
- configInRoomSensorMainScreen.NowScreenMode = ConfigInRoomSensorMainScreen.ScreenMode.MODE_SCENARIO_SELECT;
- configInRoomSensorMainScreen.NowSelectedTimeArea = SELECT_START_TIME;
- configInRoomSensorMainScreen.Info_NowSelected = null;
- configInRoomSensorMainScreen.DrawUpdate(configInRoomSensorMainScreen.NowScreenMode);
- }
- catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e)
- {
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- }
- }
- /**
- * H/W Key Event
- */
- private static final int BTN_CALL_IHN1010 = 264;
- @Override
- public boolean onKeyDown(int keyCode, KeyEvent event) {
- Log.i(TAG, "[onKeyDown] keyCode : " + keyCode + ", Action : " + event.getAction());
- return super.onKeyDown(keyCode, event);
- }
- /* ================================================================================================
- * [TOP - Back] Section
- ================================================================================================ */
- /**
- * TOP 돌아가기 버튼 활성화 & 비활성화
- *
- * @param Enabled - true : 활성화, false : 비활성화
- * @return (boolean) true : 성공, false : 실패
- */
- public boolean setTopBackBtnVisible(boolean Enabled)
- {
- if(Enabled == true)
- {
- if(TopBackBtn.getVisibility() != View.VISIBLE) TopBackBtn.setVisibility(View.VISIBLE);
- TopBackBtn.bringToFront();
- }
- else
- {
- if(TopBackBtn.getVisibility() != View.INVISIBLE) TopBackBtn.setVisibility(View.INVISIBLE);
- }
- return true;
- }
- /* ================================================================================================
- * [Popup Activity] Section
- ================================================================================================ */
- /**
- * Popup Activity 를 시작시킨다.
- *
- * @param ScreenId - 팝업시작시 Screen ID
- * @return (boolean) true : 성공, false : 실패
- */
- public boolean StartPopup(int ScreenId)
- {
- if(getPopupActivityRun() == true)
- {
- return ((WpadActivity)(PopupActivity.getContext())).ChangeScreen(ScreenId);
- }
- else
- {
- setPopupActivityRun(true);
- Intent intent = new Intent(mContext, PopupActivity.class);
- intent.putExtra("ScreenId", ScreenId);
- overridePendingTransition(0, 0);
- startActivityForResult(intent, 0);
- return true;
- }
- }
- /**
- * Wifi 아이디 정보와 비밀번호 정보를 넘겨주기 위해 추가
- * @param ScreenId
- * @param capabilities
- * @return
- */
- public boolean StartWifiSetting(int ScreenId,String SSID, String capabilities)
- {
- if(getPopupActivityRun() == true)
- {
- Intent intent = new Intent(mContext, PopupActivity.class);
- intent.putExtra("ScreenId", ScreenId);
- intent.putExtra("SSID", SSID);
- intent.putExtra("WIFISSID", capabilities);
- return ((WpadActivity)(PopupActivity.getContext())).ChangeScreen(ScreenId);
- }
- else
- {
- setPopupActivityRun(true);
- Intent intent = new Intent(mContext, PopupActivity.class);
- intent.putExtra("ScreenId", ScreenId);
- intent.putExtra("SSID", SSID);
- intent.putExtra("WIFISSID", capabilities);
- overridePendingTransition(0, 0);
- startActivityForResult(intent, 0);
- return true;
- }
- }
- /**
- * Popup Activity 를 시작시킨다. (시작시 Intent Type 데이터를 전달한다)
- *
- * @param ScreenId - 팝업시작시 Screen ID
- * @param data - 전달할 데이터
- * @return (boolean) true : 성공, false : 실패
- */
- public boolean StartPopup(int ScreenId, Intent data)
- {
- if(getPopupActivityRun() == true)
- {
- return false;
- }
- else
- {
- setPopupActivityRun(true);
- Intent intent = new Intent(mContext, PopupActivity.class);
- intent.putExtra("ScreenId", ScreenId);
- intent.putExtra("PopupScreenDataIntent", data);
- overridePendingTransition(0, 0);
- startActivityForResult(intent, 0);
- return true;
- }
- }
- /**
- * Activity Result Reception
- */
- @Override
- protected void onActivityResult(int requestCode, int resultCode, Intent data)
- {
- super.onActivityResult(requestCode, resultCode, data);
- Log.d(TAG, "@@@@@@@@ [onActivityResult] @@@@@@@@");
- if(resultCode == RESULT_OK)
- {
- try
- {
- // PopupActivity 에서 FinishTimer 로 인하여 종료가 되었을 경우
- // MainActivity 도 즉시 종료시킨다.
- String code = (String) data.getExtras().get("Finish_Kind");
- Log.d(TAG, "Finish_Kind : " + code);
- boolean runWIFI = (boolean) data.getBooleanExtra("KAKAOUSE", false);
- if(runWIFI)
- {
- if(mTempCurrentScreenId!=API_Menu.SubMenuConfig.Wifi)
- {
- mTempCurrentScreenId = API_Menu.SubMenuConfig.Wifi;
- SetTitleText(API_Menu.SubMenuConfig.Name_Wifi);
- mWallPadApiCheckHandler.sendEmptyMessage(3);
- }
- }
- else
- {
- if(code.equals("FinishTimer") == true)
- {
- Log.d(TAG, "FinishTimer finish");
- finish();
- }
- }
- }
- catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e)
- {
- Log.e(TAG, "[Exception Error] [onActivityResult] - data.getExtras().get");
- }
- }
- }
- /* ================================================================================================
- * [Screen] Section
- ================================================================================================ */
- /**
- * Screen 에서 Screen 변경을 요청할 경우 호출된다.<br>
- * Override 사용하여 Screen 변경을 처리한다.<br>
- *
- * @param nScreenId - 변경할 Screen ID
- * @return (boolean) true : 성공, false : 실패
- */
- @Override
- protected boolean onChangeScreen(int nScreenId) {
- super.onChangeScreen(nScreenId);
- return setChangeScreen(nScreenId, false);
- }
- /**
- * Screen 등록자<br>
- * ScreenLayout 에 현재 Screen 을 삭제하고, 새로운 Screen 을 등록시킨다.
- *
- * @param nScreenId - 변경할 Screen ID
- * @param OnlyRemove - 현재 Screen 을 삭제만 할 경우 (onDestroy 에서 사용)
- * @return (boolean) true : 성공, false : 실패
- */
- private boolean setChangeScreen(int nScreenId, boolean OnlyRemove)
- {
- DebugLogOutput("setChangeScreen - " + "CurrentSelectDeviceId : " + mCurrentScreenId
- + " / NextLayoutId : " + nScreenId + " / OnlyRemove : " + OnlyRemove);
- // 1. 현재 Layout 삭제
- if(mCurrentScreenId > 0)
- {
- ScreenLayout.removeAllViews();
- super.setCurrentScreen(null);
- }
- if(OnlyRemove) return true;
- mCurrentScreenId = nScreenId;
- setTopBackBtnVisible(false);
- setTopSetBtnVisible(false);
- // 2. 새로운 Layout 표시
- try
- {
- switch(nScreenId)
- {
- /**
- * [수정필요]
- * Back Button 필요한 화면은 setTopBackBtnVisible(true) 호출 필요
- * 추가 또는 수정해야할 부분 1. - 스크린 별 layout 생성
- * **/
- case API_Menu.SubMenuConfig.Configuration:
- SetTitleText(API_Menu.SubMenuConfig.Name_Configuration);
- configSettingMainScreen = new ConfigSettingMainScreen(this, ScreenLayout, mWallPadAPI, OPERATION_MODE);
- super.setCurrentScreen(configSettingMainScreen);
- break;
- case API_Menu.SubMenuConfig.CleanLcd:
- SetTitleText(API_Menu.SubMenuConfig.Name_CleanLcd);
- configCleanLcdMainScreen = new ConfigCleanLcdMainScreen(this, ScreenLayout, mWallPadAPI, OPERATION_MODE);
- //setTopBackBtnVisible(true);
- super.setCurrentScreen(configCleanLcdMainScreen);
- break;
- case API_Menu.SubMenuConfig.PassWordChange:
- SetTitleText(API_Menu.SubMenuConfig.Name_PassWordChange);
- configPwChangeMainScreen = new ConfigPwChangeMainScreen(this, ScreenLayout, mWallPadAPI, OPERATION_MODE);
- //setTopBackBtnVisible(true);
- super.setCurrentScreen(configPwChangeMainScreen);
- break;
- /*case API_Menu.SubMenuConfig.SkinChange:
- SetTitleText(API_Menu.SubMenuConfig.Name_SkinChange);
- configGLESkinChangeMainScreen = new ConfigSkinChangeScreen(this, ScreenLayout, mWallPadAPI, OPERATION_MODE);
- super.setCurrentScreen(configGLESkinChangeMainScreen);
- break;*/
- case API_Menu.SubMenuConfig.MorningCall:
- SetTitleText(API_Menu.SubMenuConfig.Name_MorningCall);
- configMoningCallMainScreen = new ConfigMoningCallMainScreen(this, ScreenLayout, mWallPadAPI, OPERATION_MODE);
- //setTopBackBtnVisible(true);
- super.setCurrentScreen(configMoningCallMainScreen);
- break;
- case API_Menu.SubMenuConfig.SmartKey:
- SetTitleText(API_Menu.SubMenuConfig.Name_SmartKey);
- configSmartKeyMainScreen = new ConfigSmartKeyMainScreen(this, ScreenLayout, mWallPadAPI, OPERATION_MODE);
- super.setCurrentScreen(configSmartKeyMainScreen);
- break;
- case API_Menu.SubMenuConfig.SmartBand:
- SetTitleText(API_Menu.SubMenuConfig.Name_SmartBand);
- configSmartKeyMainScreen = new ConfigSmartKeyMainScreen(this, ScreenLayout, mWallPadAPI, OPERATION_MODE);
- super.setCurrentScreen(configSmartKeyMainScreen);
- break;
- case API_Menu.SubMenuConfig.RfCard:
- SetTitleText(API_Menu.SubMenuConfig.Name_RfCard);
- configRfCardMainScreen = new ConfigRfCardMainScreen(this, ScreenLayout, mWallPadAPI, OPERATION_MODE);
- super.setCurrentScreen(configRfCardMainScreen);
- break;
- case API_Menu.SubMenuConfig.TimeSetting:
- SetTitleText(API_Menu.SubMenuConfig.Name_TimeSetting);
- configTimeSetScreen = new ConfigTimeSetScreen(this, ScreenLayout, mWallPadAPI, OPERATION_MODE);
- // setTopBackBtnVisible(true);
- super.setCurrentScreen(configTimeSetScreen);
- break;
- /*case API_Menu.SubMenuConfig.NoiseLog:
- SetTitleText(API_Menu.SubMenuConfig.Name_NoiseLog);
- configNoiseLogMainScreen = new ConfigNoiseLogMainScreen(this, ScreenLayout, mWallPadAPI, OPERATION_MODE);
- // setTopBackBtnVisible(true);
- super.setCurrentScreen(configNoiseLogMainScreen);
- break;*/
- /*case API_Menu.SubMenuConfig.HandicappedPerson:
- SetTitleText(API_Menu.SubMenuConfig.Name_Handicapped);
- configHandicappedModeScreen = new ConfigHandicappedModeScreen(this, ScreenLayout, mWallPadAPI, OPERATION_MODE);
- // setTopBackBtnVisible(true);
- super.setCurrentScreen(configHandicappedModeScreen);
- break;*/
- case API_Menu.SubMenuConfig.MobileDeviceReg:
- SetTitleText(API_Menu.SubMenuConfig.Name_MobileDeviceReg);
- configMobileDeviceAddScreen = new ConfigMobileDeviceAddScreen(this, ScreenLayout, mWallPadAPI, OPERATION_MODE);
- // setTopBackBtnVisible(true);
- super.setCurrentScreen(configMobileDeviceAddScreen);
- break;
- case API_Menu.SubMenuConfig.InRoomDetectSet:
- SetTitleText(API_Menu.SubMenuConfig.Name_InRoomDetectSetting);
- configInRoomSensorMainScreen = new ConfigInRoomSensorMainScreen(this, ScreenLayout, mWallPadAPI, OPERATION_MODE);
- super.setCurrentScreen(configInRoomSensorMainScreen);
- break;
- case API_Menu.SubMenuConfig.KakaoHome:
- SetTitleText(API_Menu.SubMenuConfig.Name_KakaoHome);
- configInKakaoiMainScreen = new ConfigInKakaoiMainScreen(this, ScreenLayout, mWallPadAPI, OPERATION_MODE);
- super.setCurrentScreen(configSettingMainScreen);
- break;
-
- //Wifi 화면
- case API_Menu.SubMenuConfig.Wifi:
- SetTitleText(API_Menu.SubMenuConfig.Name_Wifi);
- configWifiMainScreen = new ConfigInWifiMainScreen(this, ScreenLayout, mWallPadAPI, OPERATION_MODE);
- super.setCurrentScreen(configWifiMainScreen);
- break;
- case API_Menu.SubMenuConfig.HSPlatformDevice:
- SetTitleText(API_Menu.SubMenuConfig.Name_HSPlatformDevice);
- configHSPlatformDeviceListScreen = new ConfigHSPlatformDeviceListScreen(this, ScreenLayout, mWallPadAPI, OPERATION_MODE);
- super.setCurrentScreen(configHSPlatformDeviceListScreen);
- break;
- //추가 또는 수정해야할 부분 1. - 스크린 별 layout 생성
- default:
- Log.e(TAG, "[Error] setChangeScreen - nScreenId Not found!!! (" + mCurrentScreenId + ")");
- //mCurrentScreenId = -1;
- return false;
- }
- }
- catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- return false;
- } catch(Exception e)
- {
- Log.e(TAG, "[ExceptionError] - setChangeScreen->Screen Create : " + e);
- return false;
- }
- return true;
- }
- private void CheckIsFolderMake()
- {
- File folderCheck = new File(Common.BESTIN_ROOT);
- if( folderCheck.isDirectory() == false )
- {
- boolean bRet = folderCheck.mkdir();
- Log.d(TAG, "[SKIN_PATH] ---------Common.BESTIN_ROOT----mkdir------" + bRet);
- }
- folderCheck = new File(Common.SKIN_PATH);
- if( folderCheck.isDirectory() == false )
- {
- boolean bRet = folderCheck.mkdir();
- Log.d(TAG, "[SKIN_PATH] ---------Common.SKIN_PATH----mkdir------" + bRet);
- }
- folderCheck = new File(Common.USERSKIN_PATH );
- if( folderCheck.isDirectory() == false )
- {
- boolean bRet = folderCheck.mkdir();
- Log.d(TAG, "[SKIN_PATH] ---------Common.USERSKIN_PATH----mkdir------" + bRet);
- }
- }
- /**
- * 상단 타이틀 텍스트 수정
- * @param SetText 수정할 타이틀 이름
- * **/
- private void SetTitleText(String SetText)
- {
- if(SetText != null)
- {
- TopTitle.setText(SetText);
- }
- }
- /* ================================================================================================
- * [Menu Layout] Section
- ================================================================================================ */
- /**
- * 메뉴 레이아웃 생성
- * **/
- private void OpenMenuLayout() {
- try {
- Log.i(TAG, "[OpenMenuLayout] ========== START ==========");
- if (MenuOpen == true) {
- return;
- }
- if (menueListDataClass == null) {
- return;
- }
- //0. 현재 ID 및 리스트 불러오기
- String Title = API_Menu.GetGroupNameByID((mCurrentScreenId / 1000) * 1000);
- Log.i(TAG, "[OpenMenuLayout] Title = " + Title + ", mCurrentScreenId = " + mCurrentScreenId);
- String TempChildName = null;
- int ChooseGroup = 0;
- int ChooseChild = 0;
- for (int i = 0; i < menueListDataClass.arrayGroup.size(); i++) {
- Log.i(TAG, "[OpenMenuLayout] menueListDataClass.arrayGroup.get(" + i + ") = " + menueListDataClass.arrayGroup.get(i));
- if (menueListDataClass.arrayGroup.get(i).equals(Title)) {
- ChooseGroup = i;
- break;
- }
- }
- Log.i(TAG, "[OpenMenuLayout] menueListDataClass.idMappingTable.length = " + menueListDataClass.idMappingTable.length);
- for (int i = 0; i < menueListDataClass.idMappingTable.length; i++) {
- Log.i(TAG, "[OpenMenuLayout] menueListDataClass.idMappingTable[" + i + "].Id = " + menueListDataClass.idMappingTable[i].Id);
- if (menueListDataClass.idMappingTable[i].Id == mCurrentScreenId) {
- TempChildName = menueListDataClass.idMappingTable[i].Name;
- break;
- }
- }
- if (TempChildName == null) {
- Log.w(TAG, "[OpenMenuLayout] TempChildName is null!!!");
- return;
- }
- for (int i = 0; i < menueListDataClass.arrayChild.get(Title).size(); i++) {
- Log.i(TAG, "[OpenMenuLayout] menueListDataClass.arrayChild.get(Title).get(" + i + ") = " + menueListDataClass.arrayChild.get(Title).get(i) + ", TempChildName = " + TempChildName);
- if (menueListDataClass.arrayChild.get(Title).get(i).equals(TempChildName) == true) {
- ChooseChild = i;
- break;
- }
- }
- //1. 기존 화면 투명도 변경
- TopLayout.setAlpha(0.5f);
- ScreenLayout.setAlpha(0.5f);
- //2. Layout 생성 및 처리 이벤트 등록
- MenuLayout = new RelativeLayout(this);
- WpadUtil.LayoutRegistration(AllLayout, MenuLayout, 1280, 800, 0, 0, ID.main.layout.MENU);
- MenuLayout.setOnTouchListener(new Button.OnTouchListener()
- {
- @Override
- public boolean onTouch(View v, MotionEvent event)
- {
- if (event.getAction() == MotionEvent.ACTION_UP) {
- setFinishTimerReset();
- CloseMenuLayout();
- }
- return true;
- }
- });
- //3. 배경 이미지 생성 및 에니메이션 등록
- MenuBackground = new WpadImageView(this, TOUCH_KIND.BUTTON, 460, 800, R.drawable.bg_menu, R.drawable.bg_menu, ID.main.image.TAB_BACKGROUND);
- TranslateAnimation anim = new TranslateAnimation(WpadScale.getWidth(-460), 0, 0, 0);
- anim.setDuration(200);
- anim.setInterpolator(new AccelerateInterpolator());
- MenuLayout.setAnimation(anim);
- ViewRegistration(MenuLayout, MenuBackground, 0, 0);
- //4. 타이틀 등록
- MenuTitle = new WpadTextView(this, false, 247, 80, Gravity.LEFT, Color.WHITE, Common.fontsize._44, true, ID.main.text.TITLE);
- ViewRegistration(MenuLayout, MenuTitle, 133, 15);
- MenuTitle.setText(Title);
- //5. 종료 버튼 등록
- MenuClose = new WpadImageView(this, TOUCH_KIND.BUTTON, 80, 80, R.drawable.topbar_icon_close_normal, R.drawable.topbar_icon_close_pressed, ID.main.button.MENUCLOSE);
- MenuClose.setTouchDelayMs(1000);
- ViewRegistration(MenuLayout, MenuClose, 380, 15);
- //6. 리스트뷰 초기화 및 등록
- mListView = new ExpandableListView(this);
- ExpandableListView.LayoutParams params = new ExpandableListView.LayoutParams(WpadScale.getWidth(460), WpadScale.getHeight(690));
- mListView.setLayoutParams(params);
- mListView.setX(WpadScale.getWidth(0));
- mListView.setY(WpadScale.getHeight(112));
- mListView.setBackgroundColor(Color.BLACK);
- mListView.setId(ID.main.liveview.lv);
- mListView.setGroupIndicator(null);
- mListView.setDividerHeight(0);
- mListView.setDivider(null);
- mListView.setFocusable(true);
- mListView.setSmoothScrollbarEnabled(true);
- mListView.setTranscriptMode(android.widget.AbsListView.TRANSCRIPT_MODE_DISABLED);
- mListView.setScrollbarFadingEnabled(true);
- MenuLayout.addView(mListView);
- adptMain = new Menu_AdptMain(this, menueListDataClass.arrayGroup, menueListDataClass.arrayChild, ChooseGroup, ChooseChild);
- mListView.setAdapter(adptMain);
- //7. 선택된 그룹 열기
- mListView.setSelectedGroup(ChooseGroup);
- mListView.expandGroup(ChooseGroup);
- // 8. 리스트뷰 터치 이벤트 등록
- mListView.setOnTouchListener(new OnTouchListener() {
- @Override
- public boolean onTouch(View v, MotionEvent event) {
- if((event.getAction() == MotionEvent.ACTION_DOWN) || (event.getAction() == MotionEvent.ACTION_UP)) {
- WpadActivity.setFinishTimerReset();
- }
- return false;
- }});
- // 9. 그룹 터치 이벤트 등록
- mListView.setOnGroupClickListener(new OnGroupClickListener() {
- @Override
- public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
- DebugLogOutput("group click = " + groupPosition);
- WpadActivity.setFinishTimerReset();
- return false;
- }
- });
- // 10. 차일드 터치 이벤트 등록
- /*
- mListView.setOnChildClickListener(new OnChildClickListener()
- {
- @Override
- public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id)
- {
- DebugLogOutput("onChildClick");
- DebugLogOutput("groupPosition = " + groupPosition);
- DebugLogOutput("childPosition = " + childPosition);
- WpadActivity.setFinishTimerReset();
- return false;
- }
- });
- */
- // 11. 그룹 열리는 경우 이벤트
- mListView.setOnGroupExpandListener(new OnGroupExpandListener() {
- @Override
- public void onGroupExpand(int groupPosition) {
- DebugLogOutput("groupPosition Open Event = " + groupPosition);
- Sound().Play(SND.effect.TOUCH_LATCHED);
- WpadActivity.setFinishTimerReset();
- }
- });
- // 12. 그룹 닫히는 경우 이벤트
- mListView.setOnGroupCollapseListener(new OnGroupCollapseListener() {
- @Override
- public void onGroupCollapse(int groupPosition) {
- DebugLogOutput("groupPosition Close Event = " + groupPosition);
- Sound().Play(SND.effect.TOUCH_LATCHED);
- WpadActivity.setFinishTimerReset();
- }
- });
- // 13. MenuOpen True 설정
- MenuOpen = true;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] OpenMenuLayout()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- /**
- * 메뉴 layout 닫힘 처리
- * **/
- private void CloseMenuLayout()
- {
- if(MenuOpen == false)
- {
- return;
- }
- TranslateAnimation anim = new TranslateAnimation(0, WpadScale.getWidth(-460), 0, 0);
- anim.setDuration(200);
- anim.setInterpolator(new AccelerateInterpolator());
- anim.setAnimationListener(new AnimationListener()
- {
- @Override
- public void onAnimationStart(Animation animation)
- {
- MenuOpen = false;
- }
- @Override
- public void onAnimationRepeat(Animation animation)
- {
- }
- @Override
- public void onAnimationEnd(Animation animation)
- {
- AllLayout.removeView(MenuLayout);
- TopLayout.setAlpha(1.0f);
- ScreenLayout.setAlpha(1.0f);
- }
- });
- MenuLayout.startAnimation(anim);
- }
- /**
- * 메뉴 그룹 터치시 처리 (Menu_AdptMain에서 호출)
- * **/
- public static void SetListViewGroupExpand_Collapse(int GroupID, boolean ExpandEnable)
- {
- if(ExpandEnable == true)
- {
- mListView.expandGroup(GroupID);
- }
- else
- {
- mListView.collapseGroup(GroupID);
- }
- }
- /**
- * Menu정보가 DB에 없을 경우 불러올 스크린 로딩
- * @return MenuListDataClass 타입의 초기정보
- * **/
- private MenuListDataClass LoadDefaultMenuList()
- {
- MenuListDataClass Temp_menueListDataClass = new MenuListDataClass();
- Temp_menueListDataClass.SetArrayGroup(API_Menu.SubMenuConfig.Name);
- ArrayList<String> arrayList = new ArrayList<String>();
- int ChildCount = 0;
- //[수정필요]
- //추가 또는 수정해야할 부분 1. - Menu정보가 DB에 없을 경우 불러올 스크린 종류(시작)
- arrayList.add(API_Menu.SubMenuConfig.Name_Configuration); ChildCount++;
- arrayList.add(API_Menu.SubMenuConfig.Name_CleanLcd); ChildCount++;
- //추가 또는 수정해야할 부분 1. - Menu정보가 DB에 없을 경우 불러올 스크린 종류(끝)
- Temp_menueListDataClass.SetArrayChild(API_Menu.SubMenuConfig.Name, arrayList);
- Temp_menueListDataClass.idMappingTable = new ChildIDMapping[ChildCount];
- for (int i = 0; i < ChildCount; i++)
- {
- Temp_menueListDataClass.idMappingTable[i] = new ChildIDMapping();
- //[수정필요]
- //추가 또는 수정해야할 부분 2. - 불러올 스크린의 ID를 임의로 입력(시작)
- if(arrayList.get(i).equals(API_Menu.SubMenuConfig.Name_Configuration) == true)
- {
- Temp_menueListDataClass.idMappingTable[i].Id = API_Menu.SubMenuConfig.Configuration;
- Temp_menueListDataClass.idMappingTable[i].Name = API_Menu.SubMenuConfig.Name_Configuration;
- }
- else if(arrayList.get(i).equals(API_Menu.SubMenuConfig.Name_CleanLcd) == true)
- {
- Temp_menueListDataClass.idMappingTable[i].Id = API_Menu.SubMenuConfig.CleanLcd;
- Temp_menueListDataClass.idMappingTable[i].Name = API_Menu.SubMenuConfig.Name_CleanLcd;
- }
- //추가 또는 수정해야할 부분 2. - 불러올 스크린의 ID를 임의로 입력(끝)
- }
- return Temp_menueListDataClass;
- }
- /**
- * Menu Event intent filter 등록
- **/
- private void reg_Receiver()
- {
- try
- {
- IntentFilter filter = new IntentFilter();
- filter.addAction("MENU_EVENT");
- registerReceiver(mWallPadAlertBR, filter);
- filter = new IntentFilter();
- filter.addAction(define.NOTIFY_DAIL);
- filter.addAction("WALLPAD_DIAL_GLOBALSCREEN_TOUCH");
- registerReceiver(mWallPadJogBR, filter);
- }
- catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- /**
- * 조그버튼 입력 받을 시 처리
- **/
- BroadcastReceiver mWallPadJogBR = new BroadcastReceiver()
- {
- @Override
- public void onReceive(Context context, Intent intent)
- {
- WpadActivity.setFinishTimerReset();
- }
- };
- /**
- * 메뉴에서 버튼 터치 처리
- * **/
- BroadcastReceiver mWallPadAlertBR = new BroadcastReceiver()
- {
- @Override
- public void onReceive(Context context, Intent intent)
- {
- int groupPosition = intent.getIntExtra("groupPosition", -1);
- int childPosition = intent.getIntExtra("childPosition", -1);
- Log.i(TAG, "groupPosition :" +groupPosition + ", childPosition :" + childPosition);
- if((groupPosition >= 0) && (childPosition >= 0))
- {
- if(MenuOpen == true)
- {
- Sound().Play(SND.effect.TOUCH_LATCHED);
- CloseMenuLayout();
- if(menueListDataClass == null)
- {
- return;
- }
- String childName = menueListDataClass.arrayChild.get(menueListDataClass.arrayGroup.get(groupPosition)).get(childPosition);
- for (int i = 0; i < menueListDataClass.idMappingTable.length; i++)
- {
- if(menueListDataClass.idMappingTable[i].Name.equals(childName) == true)
- {
- API_Menu api_Menu = new API_Menu();
- int TempID = api_Menu.GetMyGroupID(getApplicationContext().getPackageName());
- int ChildID = menueListDataClass.idMappingTable[i].Id;
- int ChildGroupID = (ChildID / 1000) * 1000;
- Log.i(TAG, "Child ID :" + ChildID);
- if(TempID == 0)
- {
- return;
- }
- if(ChildGroupID == TempID)
- {
- //해당 APP내에서 스크린 전환 필요
- //[수정필요]
- /*boolean result = setChangeScreen(ChildID, false);
- if(result == false)
- {
- setChangeScreen(API_Menu.SubMenuConfig.Configuration, false);
- }
- WpadActivity.setFinishTimerReset();*/
- if (OPERATION_MODE == Common.MODE_NOMAL)
- {
- mTempCurrentScreenId = ChildID;
- mWallPadApiCheckHandler.sendEmptyMessage(0);
- } else
- {
- boolean result = setChangeScreen(ChildID, false);
- if(result == false)
- {
- setChangeScreen(API_Menu.SubMenuConfig.Configuration, false);
- }
- }
- WpadActivity.setFinishTimerReset();
- }
- else
- {
- //외부 앱 호출 후, 본 APP Finish 필요
- api_Menu.startSubScreenActivity(getApplicationContext(),
- menueListDataClass.idMappingTable[i].Id, API_Menu.MENU_START_OPTION_1, api_Menu.GetAPK_Name_ByID(ChildGroupID));
- Intent mIntent = new Intent();
- mIntent.putExtra("Finish_Kind", "HomeButton");
- MainActivity.this.setResult(RESULT_OK, mIntent);
- finish();
- }
- break;
- }
- }
- }
- }
- }
- };
- /**
- * @param nScreenId - 변경할 Screen ID
- * @return (boolean) true : 성공, false : 실패
- **/
- private boolean setTitleName(int nScreenId)
- {
- boolean ret = false;
- Log.d(TAG, "setTitleName " + nScreenId);
- switch (nScreenId)
- {
- case API_Menu.SubMenuConfig.Configuration:
- SetTitleText(API_Menu.SubMenuConfig.Name_Configuration);
- ret = true;
- break;
- case API_Menu.SubMenuConfig.CleanLcd:
- SetTitleText(API_Menu.SubMenuConfig.Name_CleanLcd);
- ret = true;
- break;
- case API_Menu.SubMenuConfig.PassWordChange:
- SetTitleText(API_Menu.SubMenuConfig.Name_PassWordChange);
- ret = true;
- break;
- case API_Menu.SubMenuConfig.SkinChange:
- SetTitleText(API_Menu.SubMenuConfig.Name_SkinChange);
- ret = true;
- break;
- case API_Menu.SubMenuConfig.MorningCall:
- SetTitleText(API_Menu.SubMenuConfig.Name_MorningCall);
- ret = true;
- break;
- case API_Menu.SubMenuConfig.SmartKey:
- SetTitleText(API_Menu.SubMenuConfig.Name_SmartKey);
- ret = true;
- break;
- case API_Menu.SubMenuConfig.SmartBand:
- SetTitleText(API_Menu.SubMenuConfig.Name_SmartBand);
- ret = true;
- break;
- case API_Menu.SubMenuConfig.RfCard:
- SetTitleText(API_Menu.SubMenuConfig.Name_RfCard);
- ret = true;
- break;
- case API_Menu.SubMenuConfig.TimeSetting:
- SetTitleText(API_Menu.SubMenuConfig.Name_TimeSetting);
- ret = true;
- break;
- case API_Menu.SubMenuConfig.HandicappedPerson:
- SetTitleText(API_Menu.SubMenuConfig.Name_Handicapped);
- ret = true;
- break;
- case API_Menu.SubMenuConfig.RemoteCallUser:
- SetTitleText(API_Menu.SubMenuConfig.Name_RemoteCallUser);
- ret = true;
- break;
- default:
- Log.e(TAG, "[Error] setChangeScreen - nScreenId Not found!!! (" + mCurrentScreenId + ")");
- //mCurrentScreenId = -1;
- SetTitleText(API_Menu.SubMenuConfig.Name_Configuration);
- ret = false;
- break;
- }
- return ret;
- }
- // 안심통화 사용유무
- public boolean getReliefCallUse() {
- try {
- String RELIEF_CALL = "안심통화";
- WallpadDeviceSet mWallpadDeviceSet = new WallpadDeviceSet(mContext);
- if (mWallpadDeviceSet != null) {
- String[] astrReliefCall = mWallpadDeviceSet.GetSettingData(RELIEF_CALL);
- mWallpadDeviceSet.closeDB();
- if (astrReliefCall != null) {
- if (astrReliefCall[1].contains(RELIEF_CALL)) {
- if (astrReliefCall[1].contains("사용함")) return true;
- }
- }
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getReliefCallUse()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- return false;
- }
- /**
- * 재실센서 시나리오 선택화면 돌아가기 버튼 활성화 & 비활성화
- *
- * @param Enabled - true : 활성화, false : 비활성화
- * @return (boolean) true : 성공, false : 실패
- */
- public boolean Set_BackBtn_InroomVisible(boolean Enabled)
- {
- if(Enabled == true)
- {
- if(BackBtn_InRoom.getVisibility() != View.VISIBLE) BackBtn_InRoom.setVisibility(View.VISIBLE);
- BackBtn_InRoom.bringToFront();
- if(TopManualBtn.getVisibility() == View.VISIBLE)
- {
- WpadUtil.ViewMove(TopManualBtn, 893, 0);
- }
- }
- else
- {
- if(BackBtn_InRoom.getVisibility() != View.INVISIBLE) BackBtn_InRoom.setVisibility(View.INVISIBLE);
- if(TopManualBtn.getVisibility() == View.VISIBLE)
- {
- WpadUtil.ViewMove(TopManualBtn, 1019, 0);
- }
- }
- return true;
- }
- public boolean GetEasyModeUXUse() {
- try
- {
- WallpadDeviceSet deviceSet = new WallpadDeviceSet(this.getContext());
- boolean EasymodeSupport = deviceSet.Get_EasyModeUX_Support();
- deviceSet.closeDB();
- WallpadStatusData data = new WallpadStatusData(this.getContext());
- boolean EasyModeUse = data.GetEasyModeUxUse();
- data.closeDB();
- Log.d(TAG, "[GetEasyModeUXUse] EasymodeSupport" + EasymodeSupport + "], bUse [" + EasyModeUse + "]");
- return EasymodeSupport & EasyModeUse;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] GetEasyModeUXUse()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- return false;
- }
- public static int nResidentSafetyCheckSetting = WallpadDeviceSet.RESIDENT_SAFETY_CHECK_DISABLE;
- private void getResidentSafetyCheckSetting() {
- try {
- WallpadDeviceSet mWallpadDeviceSet = new WallpadDeviceSet(getApplicationContext());
- nResidentSafetyCheckSetting = mWallpadDeviceSet.getResidentSafetyCheck();
- mWallpadDeviceSet.closeDB();
- Log.e(TAG, "[getResidentSafetyCheckSetting] nResidentSafetyCheckSetting: " + nResidentSafetyCheckSetting);
- if (nResidentSafetyCheckSetting == WallpadDeviceSet.RESIDENT_SAFETY_CHECK_ENABLE) Version.setResidentSafety();
- else Version.unsetResidentSafety();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- } catch (Exception e) {
- Log.e(TAG, "[Exception] getResidentSafetyCheckSetting()");
- //e.printStackTrace();
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- /**
- * 멀티제어 관련.
- *
- * */
- int mMultiAddress;
- String myIP = "NONE";
- String myHo = "NONE";
- int ho = 0;
- public String millToDate(long mills) {
- String pattern = "yyyy-MM-dd'T'HH:mm:ss";
- SimpleDateFormat formatter = new SimpleDateFormat(pattern);
- String date = (String) formatter.format(new Timestamp(mills));
- return date;
- }
- class ClientThread extends Thread {
- private Handler handler;
- private String value1;
- private String value2;
- private int menu, reason, state, position;
- private int roomNumber;
- public ClientThread(Handler handler, int menu, int reason, int position, String value1, String value2) {
- this.handler = handler;
- this.menu = menu;
- this.reason = reason;
- this.position = position;
- this.value1 = value1;
- this.value2 = value2;
- }
- public void run() {
- //String host = "10.1.1.1";
- //String host = "10.1.1." + position;
- String host = "10.1."+position+".1";
- int port = 9998;
- String json = "";
- JSONObject jsonObject = new JSONObject();
- try {
- jsonObject.accumulate("type", "request");
- jsonObject.accumulate("timestamp", millToDate(System.currentTimeMillis()));
- jsonObject.accumulate("wallpadip", myIP);
- jsonObject.accumulate("menu", menu);
- jsonObject.accumulate("reason", reason);
- jsonObject.accumulate("position", position);
- //비밀번호 변경
- if (menu == JSON.MENU.PASSWORD) {
- jsonObject.accumulate("number", value1);
- }
- //모바일 기기 등록
- else if (menu == JSON.MENU.MOBILE) {
- if(reason == JSON.REASON.MobileRegister) {
- jsonObject.accumulate("name", value1);
- jsonObject.accumulate("id", value2);
- } else if(reason == JSON.REASON.MobileDelete) {
- jsonObject.accumulate("id", value2);
- }
- }
- } catch (JSONException e) {
- e.printStackTrace();
- }
- // convert JSONObject to JSON to String
- json = jsonObject.toString();
- try {
- Socket socket = new Socket();
- InetSocketAddress ipep = new InetSocketAddress(host, port); // 방법 2
- socket.connect(ipep);
- ObjectOutputStream outputStream = new ObjectOutputStream(socket.getOutputStream());
- outputStream.writeObject(json);
- Log.d("ClientThread", "서버로 보냄.");
- ObjectInputStream inputStream = new ObjectInputStream(socket.getInputStream());
- StringBuffer stb = new StringBuffer();
- String data;
- while (true) {
- try {
- socket.setSoTimeout(5000);
- data = (String) inputStream.readObject();
- if (data == null) {
- break;
- }
- stb.append(data);
- } catch (Exception e) {
- if (socket != null) {
- socket.close();
- }
- if (inputStream != null) {
- inputStream.close();
- }
- if (outputStream != null) {
- outputStream.close();
- }
- break;
- }
- }
- final String response = String.valueOf(stb);
- Log.d("ClientThread", "response=" + response);
- final String finalResponse = response;
- Message message = handler.obtainMessage();
- message.what = 1000;
- Bundle bundle = new Bundle();
- bundle.putString("response", finalResponse);
- message.setData(bundle);
- handler.sendMessage(message);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- public void requestMultiControl(Handler handler, int menu, int reason, int position, String value1, String value2) {
- if(position!=ho) {
- ClientThread thread = new ClientThread(handler, menu, reason, position, value1, value2);
- thread.start();
- }
- }
- }
|