MainActivity.java 84 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064
  1. package kr.co.icontrols.wallpadconfig;
  2. import android.annotation.SuppressLint;
  3. import android.content.BroadcastReceiver;
  4. import android.content.Context;
  5. import android.content.Intent;
  6. import android.content.IntentFilter;
  7. import android.graphics.Color;
  8. import android.os.Bundle;
  9. import android.os.Handler;
  10. import android.os.Message;
  11. import android.util.Log;
  12. import android.view.Gravity;
  13. import android.view.KeyEvent;
  14. import android.view.MotionEvent;
  15. import android.view.View;
  16. import android.view.View.OnTouchListener;
  17. import android.view.animation.AccelerateInterpolator;
  18. import android.view.animation.Animation;
  19. import android.view.animation.Animation.AnimationListener;
  20. import android.view.animation.TranslateAnimation;
  21. import android.widget.Button;
  22. import android.widget.ExpandableListView;
  23. import android.widget.ExpandableListView.OnGroupClickListener;
  24. import android.widget.ExpandableListView.OnGroupCollapseListener;
  25. import android.widget.ExpandableListView.OnGroupExpandListener;
  26. import android.widget.RelativeLayout;
  27. import com.artncore.WallPadDataMgr.WallpadDeviceSet;
  28. import com.artncore.WallPadDataMgr.WallpadStatusData;
  29. import com.artncore.WallPadDataMgr.wallpaddbmgr;
  30. import com.artncore.commons.API_Menu;
  31. import com.artncore.commons.API_Menu.MenuListDataClass;
  32. import com.artncore.commons.API_Menu.MenuListDataClass.ChildIDMapping;
  33. import com.artncore.commons.define;
  34. import com.artncore.wallpadapi.WallPadAPI;
  35. import com.util.LogUtil;
  36. import org.json.JSONArray;
  37. import org.json.JSONException;
  38. import org.json.JSONObject;
  39. import java.io.File;
  40. import java.io.ObjectInputStream;
  41. import java.io.ObjectOutputStream;
  42. import java.net.InetSocketAddress;
  43. import java.net.Socket;
  44. import java.sql.Timestamp;
  45. import java.text.SimpleDateFormat;
  46. import java.util.ArrayList;
  47. import kr.co.icontrols.ReliefCall.ReliefCallInterface;
  48. import kr.co.icontrols.wallpadconfig.declare.Common;
  49. import kr.co.icontrols.wallpadconfig.declare.Common.JSON;
  50. import kr.co.icontrols.wallpadconfig.declare.ID;
  51. import kr.co.icontrols.wallpadconfig.screen.ConfigCleanLcdMainScreen;
  52. import kr.co.icontrols.wallpadconfig.screen.ConfigHSPlatformDeviceListScreen;
  53. import kr.co.icontrols.wallpadconfig.screen.ConfigInKakaoiMainScreen;
  54. import kr.co.icontrols.wallpadconfig.screen.ConfigInRoomSensorMainScreen;
  55. import kr.co.icontrols.wallpadconfig.screen.ConfigInWifiMainScreen;
  56. import kr.co.icontrols.wallpadconfig.screen.ConfigMobileDeviceAddScreen;
  57. import kr.co.icontrols.wallpadconfig.screen.ConfigMoningCallMainScreen;
  58. import kr.co.icontrols.wallpadconfig.screen.ConfigPwChangeMainScreen;
  59. import kr.co.icontrols.wallpadconfig.screen.ConfigRfCardMainScreen;
  60. import kr.co.icontrols.wallpadconfig.screen.ConfigSettingMainScreen;
  61. import kr.co.icontrols.wallpadconfig.screen.ConfigSmartKeyMainScreen;
  62. import kr.co.icontrols.wallpadconfig.screen.ConfigTimeSetScreen;
  63. import kr.co.icontrols.wallpadsupport.Version;
  64. import kr.co.icontrols.wallpadsupport.WpadActivity;
  65. import kr.co.icontrols.wallpadsupport.WpadImageView;
  66. import kr.co.icontrols.wallpadsupport.WpadImageView.TOUCH_KIND;
  67. import kr.co.icontrols.wallpadsupport.WpadScale;
  68. import kr.co.icontrols.wallpadsupport.WpadSound;
  69. import kr.co.icontrols.wallpadsupport.WpadSound.SND;
  70. import kr.co.icontrols.wallpadsupport.WpadTextView;
  71. import kr.co.icontrols.wallpadsupport.WpadUtil;
  72. import static android.content.Intent.ACTION_TIME_TICK;
  73. import static kr.co.icontrols.wallpadconfig.screen.ConfigInRoomSensorMainScreen.SELECT_START_TIME;
  74. /**
  75. * @description
  76. * 월패드 [설정기능] 메인화면 이다.<br>
  77. * 상단의 Top 메뉴, [홈] [돌아가기]<br>
  78. * 좌측의 Tab 메뉴, [환경설정] [화면청소] [비밀번호변경] ... 등 선택 메뉴<br>
  79. * 를 여기서 처리한다.
  80. */
  81. public class MainActivity extends WpadActivity
  82. {
  83. private final static String TAG = "MainActivity";
  84. private final boolean DEBUG_LOG_ON = true;
  85. private void DebugLogOutput(String s) { if(DEBUG_LOG_ON) Log.d(TAG, s); }
  86. // =================================================================================================
  87. // [[ Declaration ]] region
  88. // =================================================================================================
  89. protected Context mContext = null;
  90. public Context getContext() { return mContext; }
  91. private WallPadAPI mWallPadAPI = null;
  92. private int OPERATION_MODE = Common.MODE;
  93. private WallpadStatusData wdb = null;
  94. public static ReliefCallInterface mReliefCallIF; // 안심통화 솔루션 라이브러리
  95. // Layout
  96. private RelativeLayout AllLayout; // 화면 전체
  97. private RelativeLayout TopLayout; // 상단 메뉴
  98. private RelativeLayout ScreenLayout; // 메인 화면
  99. private RelativeLayout MenuLayout; // 메뉴 화면
  100. // Top Menu
  101. private WpadImageView TopBackground;
  102. private WpadTextView TopTitle;
  103. private WpadImageView TopHomeBtn,TopBackBtn, TopMenuBtn, TopSetBtn;
  104. private WpadImageView TopManualBtn;
  105. private WpadImageView BackBtn_InRoom;
  106. // Main
  107. private WpadImageView ScreenBackground;
  108. // Menu
  109. private WpadImageView MenuBackground;
  110. private WpadImageView MenuClose;
  111. private WpadTextView MenuTitle;
  112. private static ExpandableListView mListView;
  113. private Menu_AdptMain adptMain;
  114. private MenuListDataClass menueListDataClass;
  115. private Menu mMenu = null; //WPadAPI의 Menu class
  116. private boolean MenuOpen = false;
  117. private int mTempCurrentScreenId = -1;
  118. public static boolean bRemoteCallUse = false; // 방문객원격통화 사용 설정 유무
  119. // PopupActivityRun
  120. private static boolean PopupActivityRun = false;
  121. public static boolean getPopupActivityRun() { return PopupActivityRun; }
  122. public static void setPopupActivityRun(boolean run) { PopupActivityRun = run; }
  123. // CurrentScreenId
  124. private int mCurrentScreenId = -1;
  125. public static WpadSound mSound;
  126. // Screen
  127. private ConfigSettingMainScreen configSettingMainScreen = null;
  128. private ConfigCleanLcdMainScreen configCleanLcdMainScreen = null;
  129. private ConfigPwChangeMainScreen configPwChangeMainScreen = null;
  130. //private ConfigSkinChangeScreen configGLESkinChangeMainScreen = null;
  131. private ConfigMoningCallMainScreen configMoningCallMainScreen = null;
  132. private ConfigSmartKeyMainScreen configSmartKeyMainScreen = null;
  133. private ConfigRfCardMainScreen configRfCardMainScreen = null;
  134. private ConfigTimeSetScreen configTimeSetScreen = null;
  135. //private ConfigHandicappedModeScreen configHandicappedModeScreen = null;
  136. //private ConfigNoiseLogMainScreen configNoiseLogMainScreen = null;
  137. private ConfigMobileDeviceAddScreen configMobileDeviceAddScreen = null;
  138. private ConfigInRoomSensorMainScreen configInRoomSensorMainScreen = null;
  139. private ConfigHSPlatformDeviceListScreen configHSPlatformDeviceListScreen = null;
  140. //Wifi
  141. private ConfigInWifiMainScreen configWifiMainScreen = null;
  142. private ConfigInKakaoiMainScreen configInKakaoiMainScreen = null;
  143. public WallpadStatusData GetDBObj()
  144. {
  145. return wdb;
  146. }
  147. public static int mCurrentManualScreenId = -1;
  148. // =================================================================================================
  149. // [[ Activity Life Cycle ]] region
  150. // =================================================================================================
  151. /**
  152. * Activity Constructors
  153. */
  154. @Override
  155. protected void onCreate(Bundle savedInstanceState) {
  156. Log.i(TAG, "-------------------------------------------------------------");
  157. Log.i(TAG, "------------------ [START - MainActivity] -------------------");
  158. Log.i(TAG, "-------------------------------------------------------------");
  159. super.onCreate(savedInstanceState);
  160. // @ AutoScale 설정
  161. WpadScale.setAutoScale(true);
  162. super.AppVersionLogOut(); // [APP Version] + [WallPadSupport Lib Version] 을 로그로 출력한다.
  163. Log.i("Version", "<><><><> WallPadAPI Version = [" + define.WALLPADAPI_VERSION + "] " + "<><><><>");
  164. // 1. 변수 초기화
  165. DebugLogOutput("[Create] - Step1 : Data Create");
  166. PopupActivityRun = false;
  167. mContext = this;
  168. mSound = new WpadSound(this);
  169. // 2. 자동 종료 셋팅
  170. DebugLogOutput("[Create] - Step2 : Auto Finish Setting");
  171. // 2-1. 자동종료 타이머 셋팅
  172. if(Common.FINISH_TIME_ENABLE) super.setFinishTimerCreate(Common.FINISH_TIME_SEC);
  173. // 3. API 호출
  174. DebugLogOutput("[Create] - Step3 : API Call");
  175. // 3.1. mWallPadAPI 생성
  176. if (OPERATION_MODE == Common.MODE_NOMAL) {
  177. mTempCurrentScreenId = API_Menu.SubMenuConfig.Configuration;
  178. Log.d(TAG, "OperationMode = MODE_NOMAL");
  179. try {
  180. mWallPadAPI = new WallPadAPI(this);
  181. } catch (RuntimeException re) {
  182. LogUtil.errorLogInfo("", TAG, re);
  183. } catch(Exception e) {
  184. Log.e(TAG, "[ExceptionError] - new WallPadAPI : " + e);
  185. }
  186. }
  187. else if (OPERATION_MODE == Common.MODE_BUSINESS_SAMPLE) {
  188. Log.d(TAG, "OperationMode = MODE_BUSINESS_SAMPLE");
  189. }
  190. try {
  191. wdb = new WallpadStatusData(this);
  192. wallpaddbmgr.AddressSet addc = wdb.getAddressMGR(); //DB에서 동호 정보 받아옴
  193. //동, 호, ip 정보 저장
  194. myIP = addc.IPAddress;
  195. myHo = addc.Ho;
  196. ho = Integer.valueOf(myHo.substring(0,1));
  197. }
  198. catch (RuntimeException re) {
  199. LogUtil.errorLogInfo("", TAG, re);
  200. }
  201. catch (Exception e) { Log.e(TAG, "[ExceptionError] - onCreate->WallpadStatusData Create : " + e); }
  202. CheckIsFolderMake();
  203. // 4. Layout registration
  204. DebugLogOutput("[Create] - Step4 : Layout registration");
  205. // 4-1. mainLayout
  206. AllLayout = new RelativeLayout(this);
  207. RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(WpadScale.getWidthPixels(), WpadScale.getHeightPixels());
  208. AllLayout.setLayoutParams(params);
  209. AllLayout.setId(ID.main.layout.ALL);
  210. super.setAllLayoutRegistration(AllLayout);
  211. // 4-2. TopLayout
  212. TopLayout = new RelativeLayout(this);
  213. WpadUtil.LayoutRegistration(AllLayout, TopLayout, 1280, 110, 0, 0, ID.main.layout.TOP);
  214. // 4-4. ScreenLayout
  215. ScreenLayout = new RelativeLayout(this);
  216. WpadUtil.LayoutRegistration(AllLayout, ScreenLayout, 1280, 690, 0, 110, ID.main.layout.SCREEN);
  217. ScreenBackground = new WpadImageView(this, TOUCH_KIND.NONE, 1280, 690, R.drawable.bg_body, R.drawable.bg_body, ID.main.image.SCREEN_BACKGROUND);
  218. ViewRegistration(ScreenLayout, ScreenBackground, 0, 0);
  219. // 5. Top Menu - ImageView registration
  220. DebugLogOutput("[Create] - Step5 : Top Menu - ImageView registration");
  221. TopBackground = new WpadImageView(this, TOUCH_KIND.NONE, 1280, 110, R.drawable.bg_topbar, R.drawable.bg_topbar, ID.main.image.TOP_BACKGROUND);
  222. ViewRegistration(TopLayout, TopBackground, 0, 0);
  223. TopTitle = new WpadTextView(this, false, 247+180, 80, Gravity.LEFT, Color.WHITE, Common.fontsize._44, true, ID.main.text.TITLE);
  224. ViewRegistration(TopLayout, TopTitle, 133, 15);
  225. 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);
  226. ViewRegistration(TopLayout, TopHomeBtn, 1145, 0);
  227. 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);
  228. ViewRegistration(TopLayout, TopBackBtn, 1019, 0);
  229. setTopBackBtnVisible(false);
  230. 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);
  231. ViewRegistration(TopLayout, TopMenuBtn, 0, 0);
  232. 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);
  233. ViewRegistration(TopLayout, TopSetBtn, 1019, 0);
  234. setTopSetBtnVisible(false);
  235. 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);
  236. setManualBtnVisible(getManualUse(), 1019);
  237. 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);
  238. ViewRegistration(TopLayout, BackBtn_InRoom, 1020, 0);
  239. Set_BackBtn_InroomVisible(false);
  240. WallpadDeviceSet wallpadDeviceSet = new WallpadDeviceSet(mContext);
  241. int[] DoorCamKind = wallpadDeviceSet.Get_RFDoorCAM_Info(); // 현관카메라 종류 파악
  242. //int noiseUse = wallpadDeviceSet.Get_NoiseSensor_Use();
  243. int mobileAuth = wallpadDeviceSet.Get_MobileAppAuth_Use();
  244. bRemoteCallUse = wallpadDeviceSet.Get_RemoteCall_Use() > 0 ? true : false;
  245. int inroomDetectUse = wallpadDeviceSet.Get_InnerRoomDetectSensor_Use();
  246. int[] naKeyType = wallpadDeviceSet.Get_BLESmartKey_Info(); // 출입키 종류
  247. boolean bHSPlatform = wallpadDeviceSet.Get_HS_PlatformUse(); // 효성플랫폼 연동
  248. wallpadDeviceSet.closeDB();
  249. int DcamSetting = 0;
  250. if (DoorCamKind.length == 2) {
  251. if (DoorCamKind[0] == 1) {
  252. // 사용함
  253. if (DoorCamKind[1] == WallpadDeviceSet.DOORTYPE_SMARTKEY) {
  254. DcamSetting = WallpadDeviceSet.DOORTYPE_SMARTKEY;
  255. }
  256. else if (DoorCamKind[1] == WallpadDeviceSet.DOORTYPE_SMARTKEY_EXTERNAL) {
  257. DcamSetting = WallpadDeviceSet.DOORTYPE_SMARTKEY_EXTERNAL;
  258. }
  259. else if (DoorCamKind[1] == WallpadDeviceSet.DOORTYPE_RFCAM) {
  260. DcamSetting = WallpadDeviceSet.DOORTYPE_RFCAM;
  261. }
  262. else if (DoorCamKind[1] == WallpadDeviceSet.DOORTYPE_IOT_SMART) {
  263. DcamSetting = WallpadDeviceSet.DOORTYPE_IOT_SMART;
  264. }
  265. else if (DoorCamKind[1] == WallpadDeviceSet.DOORTYPE_HYOSUNG_SMART) {
  266. DcamSetting = WallpadDeviceSet.DOORTYPE_HYOSUNG_SMART;
  267. }
  268. else if (DoorCamKind[1] == WallpadDeviceSet.DOORTYPE_DAEWOO_SMART) {
  269. DcamSetting = WallpadDeviceSet.DOORTYPE_DAEWOO_SMART;
  270. }
  271. else if (DoorCamKind[1] == WallpadDeviceSet.DOORTYPE_HDCAM) {
  272. DcamSetting = WallpadDeviceSet.DOORTYPE_HDCAM;
  273. }
  274. else {
  275. //DOORTYPE_BASIC
  276. DcamSetting = WallpadDeviceSet.DOORTYPE_BASIC;
  277. }
  278. }
  279. }
  280. // 6. Menu Loading
  281. // 6-1. 메뉴 정보를 가져온다 (DB에서 가져온다)
  282. wallpaddbmgr WallpadDBMGR = new wallpaddbmgr(getApplicationContext());
  283. //test
  284. WallpadDBMGR.DeleteMenuList();
  285. ArrayList<ArrayList<Integer>> mGroupList = null;
  286. ArrayList<Integer> mChildList = null;
  287. mGroupList = new ArrayList<ArrayList<Integer>>();
  288. mChildList = new ArrayList<Integer>();
  289. mChildList.add(API_Menu.SubMenuConfig.Configuration);
  290. mChildList.add(API_Menu.SubMenuConfig.CleanLcd);
  291. mChildList.add(API_Menu.SubMenuConfig.PassWordChange);
  292. //mChildList.add(API_Menu.SubMenuConfig.SkinChange);
  293. //mChildList.add(API_Menu.SubMenuConfig.MorningCall);
  294. mChildList.add(API_Menu.SubMenuConfig.TimeSetting);
  295. Log.w(TAG, "[Create] DcamSetting = " + DcamSetting);
  296. if ((DcamSetting == WallpadDeviceSet.DOORTYPE_SMARTKEY) || (DcamSetting == WallpadDeviceSet.DOORTYPE_SMARTKEY_EXTERNAL) || (DcamSetting == WallpadDeviceSet.DOORTYPE_IOT_SMART) ) {
  297. if (naKeyType[1] == WallpadDeviceSet.BLESMARTKEY_BAND) mChildList.add(API_Menu.SubMenuConfig.SmartBand);
  298. else {
  299. //mChildList.add(API_Menu.SubMenuConfig.SmartKey);
  300. Log.w(TAG, "[Create] Smart IoT Doorcam suppots only Smartband(BLE)!!");
  301. }
  302. }
  303. else if (DcamSetting == WallpadDeviceSet.DOORTYPE_RFCAM) {
  304. mChildList.add(API_Menu.SubMenuConfig.RfCard);
  305. }
  306. else {
  307. Log.w(TAG, "[Create] DcamSetting is not available!!! -> " + DcamSetting);
  308. }
  309. /*if(noiseUse == 1)
  310. {
  311. mChildList.add(API_Menu.SubMenuConfig.NoiseLog);
  312. }*/
  313. Log.w(TAG, "[Create] mobileAuth = " + mobileAuth);
  314. if (mobileAuth == 1) {
  315. mChildList.add(API_Menu.SubMenuConfig.MobileDeviceReg);
  316. }
  317. else {
  318. Log.w(TAG, "[Create] mobileAuth is not available!!! -> " + mobileAuth);
  319. }
  320. Log.w(TAG, "[Create] inroomDetectUse = " + inroomDetectUse);
  321. if (inroomDetectUse == 1) {
  322. mChildList.add(API_Menu.SubMenuConfig.InRoomDetectSet);
  323. }
  324. else {
  325. Log.w(TAG, "[Create] inroomDetectUse is not available!!! -> " + inroomDetectUse);
  326. }
  327. //mChildList.add(API_Menu.SubMenuConfig.HandicappedPerson);
  328. //이진규
  329. //카카오 홈 판단 여부 체크
  330. WallpadDeviceSet wdst_ = new WallpadDeviceSet(getApplicationContext());
  331. boolean kakaohomeuse = wdst_.Get_KakaoUse();
  332. wdst_.closeDB();
  333. if (kakaohomeuse) {
  334. mChildList.add(API_Menu.SubMenuConfig.KakaoHome);
  335. mChildList.add(API_Menu.SubMenuConfig.Wifi);
  336. }
  337. mGroupList.add(mChildList);
  338. if (bHSPlatform) {
  339. mChildList.add(API_Menu.SubMenuConfig.HSPlatformDevice);
  340. }
  341. else {
  342. Log.w(TAG, "[Create] bHSPlatform is not available!!! -> " + bHSPlatform);
  343. }
  344. for (int i = 0; i < mGroupList.size(); i++) {
  345. Log.i(TAG, "[Create] mGroupList.get(" + i + ") = " + mGroupList.get(i));
  346. }
  347. WallpadDBMGR.SetMenuList(mGroupList);
  348. menueListDataClass = WallpadDBMGR.GetMenuList();
  349. WallpadDBMGR.closeDB();
  350. Log.i(TAG, "[Create] menueListDataClass.arrayChild = " + menueListDataClass.arrayChild.toString());
  351. // for (int i = 0; i < menueListDataClass.arrayChild.size(); i++) {
  352. // Log.i(TAG, "[Create] mGroupList.get(" + i + ") = " + menueListDataClass.arrayChild.toString());
  353. // }
  354. if (menueListDataClass == null) {
  355. Log.e(TAG, "[Create] menueListDataClass == null, Load Default List");
  356. menueListDataClass = LoadDefaultMenuList();
  357. }
  358. // 6-2. 시작 화면을 main APP으로 부터 받아서 처리한다.
  359. Log.i(TAG, "[Create] OPERATION_MODE is " + OPERATION_MODE);
  360. mMenu = new Menu();
  361. mMenu = super.getIntentParsingMenu(getIntent());
  362. if (mMenu == null) {
  363. //mWallPadApiCheckHandler.sendEmptyMessage(0);
  364. //setChangeScreen(API_Menu.SubMenuConfig.Configuration, false);
  365. Log.i(TAG, "[Create] mMenu = null");
  366. if(CheckIntent())
  367. {
  368. mTempCurrentScreenId = API_Menu.SubMenuConfig.Configuration;
  369. SetTitleText(API_Menu.SubMenuConfig.Name_Configuration);
  370. mWallPadApiCheckHandler.sendEmptyMessage(0);
  371. StartPopup(ID.screen.PopupWIFIConnect);
  372. }
  373. else
  374. {
  375. if (OPERATION_MODE == Common.MODE_NOMAL) {
  376. mTempCurrentScreenId = API_Menu.SubMenuConfig.Configuration;
  377. SetTitleText(API_Menu.SubMenuConfig.Name_Configuration);
  378. mWallPadApiCheckHandler.sendEmptyMessage(0);
  379. }
  380. else {
  381. setChangeScreen(API_Menu.SubMenuConfig.Configuration, false);
  382. }
  383. }
  384. }
  385. else {
  386. /*boolean result = setChangeScreen(mMenu.getStartId(), false);
  387. if(result == false)
  388. {
  389. mWallPadApiCheckHandler.sendEmptyMessage(0);
  390. //setChangeScreen(API_Menu.SubMenuConfig.Configuration, false);
  391. }*/
  392. Log.i(TAG, "[Create] mMenu != null");
  393. if (OPERATION_MODE == Common.MODE_NOMAL) {
  394. mTempCurrentScreenId = API_Menu.SubMenuConfig.Configuration;
  395. SetTitleText(API_Menu.SubMenuConfig.Name_Configuration);
  396. mWallPadApiCheckHandler.sendEmptyMessage(0);
  397. mTempCurrentScreenId = mMenu.getStartId();
  398. setTitleName(mTempCurrentScreenId);
  399. mWallPadApiCheckHandler.sendEmptyMessage(0);
  400. }
  401. else {
  402. boolean result = setChangeScreen(mMenu.getStartId(), false);
  403. Log.i(TAG, "[Create] Menu Sample result = " + result);
  404. if (result == false) {
  405. setChangeScreen(API_Menu.SubMenuConfig.Configuration, false);
  406. }
  407. }
  408. }
  409. // 7. Draw
  410. DebugLogOutput("[Create] - Step7 : setContentView");
  411. setContentView(AllLayout);
  412. // 8. Window ReSize
  413. DebugLogOutput("[Create] - Step8 : Window ReSize");
  414. //super.WindowReSize(Common.SCREEN_SIZE_MAIN_W, Common.SCREEN_SIZE_MAIN_H, false);
  415. // 9. BR Receiver 등록(메뉴에서 다른 화면이 눌린 경우 BR처리)
  416. reg_Receiver();
  417. registerKaKaOIBR();
  418. WallpadDeviceSet wdst = new WallpadDeviceSet(getContext());
  419. int[] lights = wdst.Get_Light_info();
  420. wdst.closeDB();
  421. for(int i = 0; i < lights.length; i++)
  422. {
  423. Log.i(TAG, "lights[" + i + "] = " + lights[i] + " ########################");
  424. }
  425. String str = String.format("%.0f", 0.7);
  426. str += " kWh";
  427. Log.i(TAG, "[Create] - DOT str = " + str + " ########################");
  428. WallpadStatusData wsd = new WallpadStatusData(getContext());
  429. String welcomeSaved = wsd.Get_WelcomeLight_Selected();
  430. wsd.closeDB();
  431. Log.i(TAG, "welcomeSaved = " + welcomeSaved + " $$$$$$$$$$$$$$$$$$$$$$$$$$");
  432. // 안심통화 솔루션 라이브러리 import
  433. // if (getReliefCallUse()) {
  434. // Log.i(TAG, "[onCreate] --------------- ReliefCallInterface ---------------");
  435. // mReliefCallIF = new ReliefCallInterface();
  436. // }
  437. // 거주자 안전확인 서비스 사용여부 확인하고, 화면 WallPadSupport Lib.에 관련 설정을 한다.
  438. getResidentSafetyCheckSetting();
  439. Log.i(TAG, "End onCreate -------------------------------------------------");
  440. }
  441. //kr.co.icontrols.WIFIScreen 등록
  442. BroadcastReceiver kakaoBroadCastReceiver = new BroadcastReceiver() {
  443. @Override
  444. public void onReceive(Context context, Intent intent) {
  445. if(intent.getAction().equals("kr.co.icontrols.WIFIScreen"))
  446. {
  447. // mTempCurrentScreenId = API_Menu.SubMenuConfig.Configuration;
  448. // SetTitleText(API_Menu.SubMenuConfig.Name_Configuration);
  449. mWallPadApiCheckHandler.sendEmptyMessage(0);
  450. StartPopup(ID.screen.PopupWIFIConnect);
  451. }
  452. }
  453. };
  454. private void registerKaKaOIBR() {
  455. try {
  456. IntentFilter filter = new IntentFilter();
  457. filter.addAction("kr.co.icontrols.WIFIScreen");
  458. mContext.registerReceiver(kakaoBroadCastReceiver, filter);
  459. } catch (RuntimeException re) {
  460. LogUtil.errorLogInfo("", TAG, re);
  461. }
  462. catch (Exception e) {
  463. Log.e(TAG, "[Exception] registerMainActivityBR()");
  464. LogUtil.errorLogInfo("", TAG, e);
  465. }
  466. }
  467. /**
  468. * 카카오에서 환경설정을 호출하는 경우
  469. */
  470. private boolean CheckIntent()
  471. {
  472. boolean result = false;
  473. //카카오 홈에서 WIFI를 호출하는 경우
  474. Intent received_intent = getIntent();
  475. if(received_intent!=null)
  476. {
  477. result = received_intent.getBooleanExtra("WIFI", false);
  478. }
  479. return result;
  480. }
  481. /**
  482. * (평생코드) WallPadAPI 초기생성시 Connect 에 시간이 걸리며, <br>
  483. * WallPadAPI 초기화후 바로 Get_GasValveController 등을 사용하여 API 를 가져올수 없기에, <br>
  484. * 본 딜레이 코드를 임시로 적용한다.
  485. */
  486. @SuppressLint("HandlerLeak")
  487. protected Handler mWallPadApiCheckHandler = new Handler() {
  488. @SuppressLint("HandlerLeak")
  489. @Override
  490. public void handleMessage(Message msg) {
  491. if (msg.what == 0) {
  492. if (mWallPadAPI != null) {
  493. Log.w(TAG, "[mWallPadApiCheckHandler] WallPad API Loading!!!");
  494. if (mWallPadAPI.Check_Connect()) {
  495. Log.d(TAG, "[mWallPadApiCheckHandler] WallPad API Connected!!");
  496. mWallPadApiCheckHandler.sendEmptyMessageDelayed(1, 10);
  497. }
  498. else {
  499. Log.w(TAG, "[mWallPadApiCheckHandler] WallPad API not Connected, yet!!");
  500. mWallPadApiCheckHandler.sendEmptyMessageDelayed(0, 10);
  501. }
  502. }
  503. }
  504. else if (msg.what == 1) {
  505. Log.d(TAG, "[mWallPadApiCheckHandler] WallPad API Loaded!!");
  506. boolean bChangeScreen = setChangeScreen(mTempCurrentScreenId, false);
  507. Log.d(TAG, "[mWallPadApiCheckHandler] bChangeScreen [" + bChangeScreen + "]");
  508. if (bChangeScreen == false) {
  509. setChangeScreen(API_Menu.SubMenuConfig.Configuration, false);
  510. }
  511. }
  512. //새로 추가한 부분
  513. if (msg.what == 3) {
  514. if (mWallPadAPI != null) {
  515. Log.w(TAG, "[mWallPadApiCheckHandler] WallPad API Loading!!!");
  516. if (mWallPadAPI.Check_Connect()) {
  517. Log.d(TAG, "[mWallPadApiCheckHandler] WallPad API Connected!!");
  518. mWallPadApiCheckHandler.sendEmptyMessageDelayed(1, 10);
  519. }
  520. else {
  521. Log.w(TAG, "[mWallPadApiCheckHandler] WallPad API not Connected, yet!!");
  522. mWallPadApiCheckHandler.sendEmptyMessageDelayed(0, 10);
  523. }
  524. }
  525. }
  526. else {
  527. Log.d(TAG, "[mWallPadApiCheckHandler] Not expected value!! Handler stop!! msg.what [" + msg.what +"]");
  528. }
  529. }
  530. };
  531. /**
  532. * TOP 설정 버튼 활성화 & 비활성화
  533. *
  534. * @param bEnable - true : 활성화, false : 비활성화
  535. * @return (boolean) true : 성공, false : 실패
  536. */
  537. public boolean setTopSetBtnVisible(boolean bEnable) {
  538. if (bEnable) {
  539. if (TopSetBtn.getVisibility() != View.VISIBLE) TopSetBtn.setVisibility(View.VISIBLE);
  540. TopSetBtn.bringToFront();
  541. if (TopSetBtn.getVisibility() == View.VISIBLE) {
  542. WpadUtil.ViewMove(TopManualBtn, 893, 0);
  543. }
  544. } else {
  545. if (TopSetBtn.getVisibility() != View.INVISIBLE)
  546. TopSetBtn.setVisibility(View.INVISIBLE);
  547. if (TopSetBtn.getVisibility() == View.INVISIBLE) {
  548. WpadUtil.ViewMove(TopManualBtn, 1019, 0);
  549. }
  550. }
  551. return true;
  552. }
  553. /* ================================================================================================
  554. * [Manual Activity] Section
  555. ================================================================================================ */
  556. public static ManualActivity mManualActivity;
  557. public void setManualBtnVisible(boolean bEnable, int marginLeft)
  558. {
  559. try
  560. {
  561. Log.d(TAG, "[setManualBtnVisible] bEnable [" + bEnable + "], marginLeft [" + marginLeft + "]");
  562. if (bEnable) TopManualBtn.setVisibility(View.VISIBLE);
  563. else TopManualBtn.setVisibility(View.INVISIBLE);
  564. TopLayout.removeView(TopManualBtn);
  565. ViewRegistration(TopLayout, TopManualBtn, marginLeft, 0);
  566. }
  567. catch (RuntimeException re) {
  568. LogUtil.errorLogInfo("", TAG, re);
  569. }
  570. catch (Exception e)
  571. {
  572. Log.e(TAG, "[Exception] setManualBtnVisible(boolean bEnable)");
  573. //e.printStackTrace();
  574. LogUtil.errorLogInfo("", TAG, e);
  575. }
  576. }
  577. /**
  578. * 매뉴얼 버튼 사용 유무
  579. * @return boolean 타입 - true: 사용, false: 미사용
  580. */
  581. public boolean getManualUse()
  582. {
  583. try
  584. {
  585. WallpadDeviceSet devSet = new WallpadDeviceSet(mContext);
  586. String[] DBinfo = devSet.GetSettingData("매뉴얼");
  587. devSet.closeDB();
  588. if (DBinfo != null)
  589. {
  590. if (DBinfo[1].indexOf("사용함") > 0)
  591. {
  592. Log.d(TAG, "[getManualUse] Use Manual");
  593. return true;
  594. }
  595. else
  596. {
  597. // 미사용
  598. Log.d(TAG, "[getManualUse] Not Use Manual [1]");
  599. return false;
  600. }
  601. }
  602. else
  603. {
  604. // 미사용
  605. Log.d(TAG, "[getManualUse] Not Use Manual [2]");
  606. return false;
  607. }
  608. }
  609. catch (RuntimeException re) {
  610. LogUtil.errorLogInfo("", TAG, re);
  611. }
  612. catch (Exception ex)
  613. {
  614. Log.e(TAG, "[getManualUse] - Exception !!!");
  615. //ex.printStackTrace();
  616. LogUtil.errorLogInfo("", TAG, ex);
  617. }
  618. return false;
  619. }
  620. // ManualActivityRun
  621. private static boolean ManualActivityRun = false;
  622. public static boolean getManualActivityRun() {
  623. Log.d(TAG, "[getManualActivityRun] ManualActivityRun: " + ManualActivityRun);
  624. return ManualActivityRun;
  625. }
  626. public static void setManualActivityRun(boolean run)
  627. {
  628. ManualActivityRun = run;
  629. if (!ManualActivityRun) resetCurrentManualScreenID();
  630. }
  631. public boolean StartManual(int screenId)
  632. {
  633. Log.d(TAG, "[StartManual] ScreenId [" + screenId + "], mCurrentManualScreenId [" + mCurrentManualScreenId + "]");
  634. if (getManualActivityRun())
  635. {
  636. mCurrentManualScreenId = screenId;
  637. return ((WpadActivity) (ManualActivity.getContext())).ChangeScreen(screenId);
  638. }
  639. else
  640. {
  641. if (mCurrentManualScreenId == screenId) return false;
  642. mCurrentManualScreenId = screenId;
  643. setManualActivityRun(true);
  644. Intent intent = new Intent(mContext, ManualActivity.class);
  645. intent.putExtra("ScreenId", screenId);
  646. if(mCurrentScreenId == API_Menu.SubMenuConfig.Configuration)
  647. {
  648. intent.putExtra("SettingData", configSettingMainScreen.setting_manual_str);
  649. intent.putExtra("NowPage", configSettingMainScreen.m_CurPage);
  650. intent.putExtra("TotalPage", configSettingMainScreen.m_ToTalPage);
  651. }
  652. overridePendingTransition(0, 0);
  653. startActivityForResult(intent, 0);
  654. return true;
  655. }
  656. }
  657. public static void resetCurrentManualScreenID()
  658. {
  659. try
  660. {
  661. mCurrentManualScreenId = -1;
  662. } catch (RuntimeException re) {
  663. LogUtil.errorLogInfo("", TAG, re);
  664. }
  665. catch (Exception e)
  666. {
  667. Log.e(TAG, "[Exception] resetCurrentManualScreenID()");
  668. //e.printStackTrace();
  669. LogUtil.errorLogInfo("", TAG, e);
  670. }
  671. }
  672. public static void FinishManualActivity()
  673. {
  674. Log.i(TAG, "[FinishManualActivity]");
  675. try
  676. {
  677. if (mManualActivity != null)
  678. {
  679. mCurrentManualScreenId = -1;
  680. mManualActivity.finish();
  681. }
  682. }
  683. catch (RuntimeException re) {
  684. LogUtil.errorLogInfo("", TAG, re);
  685. }
  686. catch (Exception e)
  687. {
  688. Log.e(TAG, "[Exception] FinishManualActivity()");
  689. //e.printStackTrace();
  690. LogUtil.errorLogInfo("", TAG, e);
  691. }
  692. }
  693. /**
  694. * onDestroy
  695. */
  696. @Override
  697. protected void onDestroy() {
  698. // 혹시 돌고 있을수 있는 핸들러를 종료한다.
  699. // mWallPadApiCheckHandler.sendEmptyMessageDelayed(99, 0);
  700. setChangeScreen(mCurrentScreenId, true);
  701. if (wdb != null) wdb.closeDB();
  702. this.unregisterReceiver(mWallPadAlertBR);
  703. this.unregisterReceiver(mWallPadJogBR);
  704. this.unregisterReceiver(kakaoBroadCastReceiver);
  705. mSound.Release();
  706. super.setFinishTimerDestroy();
  707. super.onDestroy();
  708. Log.i(TAG, "*************************************************************");
  709. Log.i(TAG, "****************** [END - MainActivity] *******************");
  710. Log.i(TAG, "*************************************************************");
  711. }
  712. /**
  713. * onResume
  714. */
  715. @Override
  716. protected void onResume() {
  717. super.onResume();
  718. if (mWallPadAPI != null) mWallPadAPI.Resume();
  719. DebugLogOutput("@@@@@@@@ [onResume] @@@@@@@@");
  720. }
  721. /**
  722. * onPause
  723. */
  724. @Override
  725. protected void onPause() {
  726. // 혹시 돌고 있을수 있는 핸들러를 종료한다.
  727. mWallPadApiCheckHandler.sendEmptyMessageDelayed(99, 0);
  728. if (mWallPadAPI != null) mWallPadAPI.Pause();
  729. DebugLogOutput("@@@@@@@@ [onPause] @@@@@@@@");
  730. super.onPause();
  731. }
  732. /* ================================================================================================
  733. * [BroadcastReceiver] Section
  734. ================================================================================================ */
  735. /**
  736. * BroadcastReceiver.onReceive for [WpadActivity]
  737. */
  738. @Override
  739. protected void onBrReceive(Intent intent)
  740. {
  741. super.onBrReceive(intent);
  742. DebugLogOutput("Receive BR " + intent.getAction());
  743. }
  744. /* ================================================================================================
  745. * [Touch & Key Event] Section
  746. ================================================================================================ */
  747. /**
  748. * TouchEvent for [WpadActivity]
  749. */
  750. @Override
  751. protected void onTouchEvent(View v, MotionEvent event)
  752. {
  753. super.onTouchEvent(v, event);
  754. int TargetId = v.getId();
  755. int MoveEvent = event.getAction();
  756. //DebugLogOutput("onTouch - " + "id : " + v.getId() + " / Action : " + event.getAction());
  757. if(MoveEvent == MotionEvent.ACTION_UP)
  758. {
  759. if(TargetId == ID.main.button.HOME)
  760. {
  761. DebugLogOutput("onTouchEvent [HOME] BUTTON !!!");
  762. Sound().Play(SND.effect.TOUCH_LATCHED);
  763. Intent intent = new Intent();
  764. intent.putExtra("Finish_Kind", "HomeButton");
  765. setResult(RESULT_OK, intent);
  766. finish();
  767. }
  768. else if(TargetId == ID.main.button.BACK)
  769. {
  770. DebugLogOutput("onTouchEvent [BACK] BUTTON !!!");
  771. Sound().Play(SND.effect.TOUCH_LATCHED);
  772. /**
  773. *[수정필요]Back Button 필요한 화면은 아래 부분 추가 후 사용 필요
  774. * **/
  775. /*
  776. if((mCurrentScreenId == API_Menu.SubMenuConfig.SmartKey) || (mCurrentScreenId == API_Menu.SubMenuConfig.RfCard)||(mCurrentScreenId == API_Menu.SubMenuConfig.CleanLcd)
  777. ||(mCurrentScreenId == API_Menu.SubMenuConfig.MorningCall)||(mCurrentScreenId == API_Menu.SubMenuConfig.PassWordChange)||(mCurrentScreenId == API_Menu.SubMenuConfig.TimeSetting))
  778. {
  779. setChangeScreen(API_Menu.SubMenuConfig.Configuration, false);
  780. }*/
  781. }
  782. else if(TargetId == ID.main.button.MENU)
  783. {
  784. DebugLogOutput("onTouchEvent [MENU] BUTTON !!!");
  785. if(MenuOpen == true)
  786. {
  787. return;
  788. }
  789. Sound().Play(SND.effect.TOUCH_LATCHED);
  790. OpenMenuLayout();
  791. }
  792. else if (TargetId == ID.main.button.MENUCLOSE)
  793. {
  794. if(MenuOpen == true)
  795. {
  796. Sound().Play(SND.effect.TOUCH_LATCHED);
  797. CloseMenuLayout();
  798. }
  799. }
  800. else if (TargetId == ID.main.button.MENUAL)
  801. {
  802. Log.i(TAG, "onTouchEvent [MANUAL] BUTTON [mCurrentScreenId = " + mCurrentScreenId + "]");
  803. Sound().Play(SND.effect.TOUCH_LATCHED);
  804. if(mCurrentScreenId == API_Menu.SubMenuConfig.Configuration) { StartManual(ID.MANUAL.MANUAL_SettingMain); }
  805. else if(mCurrentScreenId == API_Menu.SubMenuConfig.CleanLcd) { StartManual(ID.MANUAL.MANUAL_CleanLcdMain); }
  806. else if(mCurrentScreenId == API_Menu.SubMenuConfig.PassWordChange) { StartManual(ID.MANUAL.MANUAL_PWD_CHANGE); }
  807. else if(mCurrentScreenId == API_Menu.SubMenuConfig.MorningCall) { StartManual(ID.MANUAL.MANUAL_MORNINGCALL); }
  808. else if(mCurrentScreenId == API_Menu.SubMenuConfig.TimeSetting) { StartManual(ID.MANUAL.MANUAL_TIMESETTING); }
  809. else if(mCurrentScreenId == API_Menu.SubMenuConfig.RfCard) { StartManual(ID.MANUAL.MANUAL_RFCARD); }
  810. else if(mCurrentScreenId == API_Menu.SubMenuConfig.SmartKey) { StartManual(ID.MANUAL.MANUAL_SMARTKEY); }
  811. else if(mCurrentScreenId == API_Menu.SubMenuConfig.MobileDeviceReg) { StartManual(ID.MANUAL.MANUAL_MOBILEDEVREG); }
  812. else if(mCurrentScreenId == API_Menu.SubMenuConfig.InRoomDetectSet) { /*StartManual(ID.MANUAL.MANUAL_MOBILEDEVREG);*/ }
  813. // else if(mCurrentScreenId == API_Menu.SubMenuConfig.HSPlatformDevice) { StartManual(ID.MANUAL.MANUAL_HSPLATFORMDEVICE); } // TODO 추후 매뉴얼 작업 필요
  814. }
  815. else if (TargetId == ID.main.button.SETTING)
  816. {
  817. Sound().Play(SND.effect.TOUCH_LATCHED);
  818. if (mCurrentScreenId == API_Menu.SubMenuConfig.MobileDeviceReg)
  819. StartPopup(ID.screen.PopupRemoteCallUserSetting);
  820. }
  821. else if(TargetId == ID.main.button.BACK_INROOM)
  822. {
  823. DebugLogOutput("onTouchEvent [BACK_INROOM] BUTTON !!!");
  824. Sound().Play(SND.effect.TOUCH_LATCHED);
  825. Set_BackBtn_InroomVisible(false);
  826. try
  827. {
  828. // 시나리오 선택화면으로 복귀.
  829. configInRoomSensorMainScreen.NowScreenMode = ConfigInRoomSensorMainScreen.ScreenMode.MODE_SCENARIO_SELECT;
  830. configInRoomSensorMainScreen.NowSelectedTimeArea = SELECT_START_TIME;
  831. configInRoomSensorMainScreen.Info_NowSelected = null;
  832. configInRoomSensorMainScreen.DrawUpdate(configInRoomSensorMainScreen.NowScreenMode);
  833. }
  834. catch (RuntimeException re) {
  835. LogUtil.errorLogInfo("", TAG, re);
  836. }
  837. catch (Exception e)
  838. {
  839. //e.printStackTrace();
  840. LogUtil.errorLogInfo("", TAG, e);
  841. }
  842. }
  843. }
  844. }
  845. /**
  846. * H/W Key Event
  847. */
  848. private static final int BTN_CALL_IHN1010 = 264;
  849. @Override
  850. public boolean onKeyDown(int keyCode, KeyEvent event) {
  851. Log.i(TAG, "[onKeyDown] keyCode : " + keyCode + ", Action : " + event.getAction());
  852. return super.onKeyDown(keyCode, event);
  853. }
  854. /* ================================================================================================
  855. * [TOP - Back] Section
  856. ================================================================================================ */
  857. /**
  858. * TOP 돌아가기 버튼 활성화 & 비활성화
  859. *
  860. * @param Enabled - true : 활성화, false : 비활성화
  861. * @return (boolean) true : 성공, false : 실패
  862. */
  863. public boolean setTopBackBtnVisible(boolean Enabled)
  864. {
  865. if(Enabled == true)
  866. {
  867. if(TopBackBtn.getVisibility() != View.VISIBLE) TopBackBtn.setVisibility(View.VISIBLE);
  868. TopBackBtn.bringToFront();
  869. }
  870. else
  871. {
  872. if(TopBackBtn.getVisibility() != View.INVISIBLE) TopBackBtn.setVisibility(View.INVISIBLE);
  873. }
  874. return true;
  875. }
  876. /* ================================================================================================
  877. * [Popup Activity] Section
  878. ================================================================================================ */
  879. /**
  880. * Popup Activity 를 시작시킨다.
  881. *
  882. * @param ScreenId - 팝업시작시 Screen ID
  883. * @return (boolean) true : 성공, false : 실패
  884. */
  885. public boolean StartPopup(int ScreenId)
  886. {
  887. if(getPopupActivityRun() == true)
  888. {
  889. return ((WpadActivity)(PopupActivity.getContext())).ChangeScreen(ScreenId);
  890. }
  891. else
  892. {
  893. setPopupActivityRun(true);
  894. Intent intent = new Intent(mContext, PopupActivity.class);
  895. intent.putExtra("ScreenId", ScreenId);
  896. overridePendingTransition(0, 0);
  897. startActivityForResult(intent, 0);
  898. return true;
  899. }
  900. }
  901. /**
  902. * Wifi 아이디 정보와 비밀번호 정보를 넘겨주기 위해 추가
  903. * @param ScreenId
  904. * @param capabilities
  905. * @return
  906. */
  907. public boolean StartWifiSetting(int ScreenId,String SSID, String capabilities)
  908. {
  909. if(getPopupActivityRun() == true)
  910. {
  911. Intent intent = new Intent(mContext, PopupActivity.class);
  912. intent.putExtra("ScreenId", ScreenId);
  913. intent.putExtra("SSID", SSID);
  914. intent.putExtra("WIFISSID", capabilities);
  915. return ((WpadActivity)(PopupActivity.getContext())).ChangeScreen(ScreenId);
  916. }
  917. else
  918. {
  919. setPopupActivityRun(true);
  920. Intent intent = new Intent(mContext, PopupActivity.class);
  921. intent.putExtra("ScreenId", ScreenId);
  922. intent.putExtra("SSID", SSID);
  923. intent.putExtra("WIFISSID", capabilities);
  924. overridePendingTransition(0, 0);
  925. startActivityForResult(intent, 0);
  926. return true;
  927. }
  928. }
  929. /**
  930. * Popup Activity 를 시작시킨다. (시작시 Intent Type 데이터를 전달한다)
  931. *
  932. * @param ScreenId - 팝업시작시 Screen ID
  933. * @param data - 전달할 데이터
  934. * @return (boolean) true : 성공, false : 실패
  935. */
  936. public boolean StartPopup(int ScreenId, Intent data)
  937. {
  938. if(getPopupActivityRun() == true)
  939. {
  940. return false;
  941. }
  942. else
  943. {
  944. setPopupActivityRun(true);
  945. Intent intent = new Intent(mContext, PopupActivity.class);
  946. intent.putExtra("ScreenId", ScreenId);
  947. intent.putExtra("PopupScreenDataIntent", data);
  948. overridePendingTransition(0, 0);
  949. startActivityForResult(intent, 0);
  950. return true;
  951. }
  952. }
  953. /**
  954. * Activity Result Reception
  955. */
  956. @Override
  957. protected void onActivityResult(int requestCode, int resultCode, Intent data)
  958. {
  959. super.onActivityResult(requestCode, resultCode, data);
  960. Log.d(TAG, "@@@@@@@@ [onActivityResult] @@@@@@@@");
  961. if(resultCode == RESULT_OK)
  962. {
  963. try
  964. {
  965. // PopupActivity 에서 FinishTimer 로 인하여 종료가 되었을 경우
  966. // MainActivity 도 즉시 종료시킨다.
  967. String code = (String) data.getExtras().get("Finish_Kind");
  968. Log.d(TAG, "Finish_Kind : " + code);
  969. boolean runWIFI = (boolean) data.getBooleanExtra("KAKAOUSE", false);
  970. if(runWIFI)
  971. {
  972. if(mTempCurrentScreenId!=API_Menu.SubMenuConfig.Wifi)
  973. {
  974. mTempCurrentScreenId = API_Menu.SubMenuConfig.Wifi;
  975. SetTitleText(API_Menu.SubMenuConfig.Name_Wifi);
  976. mWallPadApiCheckHandler.sendEmptyMessage(3);
  977. }
  978. }
  979. else
  980. {
  981. if(code.equals("FinishTimer") == true)
  982. {
  983. Log.d(TAG, "FinishTimer finish");
  984. finish();
  985. }
  986. }
  987. }
  988. catch (RuntimeException re) {
  989. LogUtil.errorLogInfo("", TAG, re);
  990. }
  991. catch (Exception e)
  992. {
  993. Log.e(TAG, "[Exception Error] [onActivityResult] - data.getExtras().get");
  994. }
  995. }
  996. }
  997. /* ================================================================================================
  998. * [Screen] Section
  999. ================================================================================================ */
  1000. /**
  1001. * Screen 에서 Screen 변경을 요청할 경우 호출된다.<br>
  1002. * Override 사용하여 Screen 변경을 처리한다.<br>
  1003. *
  1004. * @param nScreenId - 변경할 Screen ID
  1005. * @return (boolean) true : 성공, false : 실패
  1006. */
  1007. @Override
  1008. protected boolean onChangeScreen(int nScreenId) {
  1009. super.onChangeScreen(nScreenId);
  1010. return setChangeScreen(nScreenId, false);
  1011. }
  1012. /**
  1013. * Screen 등록자<br>
  1014. * ScreenLayout 에 현재 Screen 을 삭제하고, 새로운 Screen 을 등록시킨다.
  1015. *
  1016. * @param nScreenId - 변경할 Screen ID
  1017. * @param OnlyRemove - 현재 Screen 을 삭제만 할 경우 (onDestroy 에서 사용)
  1018. * @return (boolean) true : 성공, false : 실패
  1019. */
  1020. private boolean setChangeScreen(int nScreenId, boolean OnlyRemove)
  1021. {
  1022. DebugLogOutput("setChangeScreen - " + "CurrentSelectDeviceId : " + mCurrentScreenId
  1023. + " / NextLayoutId : " + nScreenId + " / OnlyRemove : " + OnlyRemove);
  1024. // 1. 현재 Layout 삭제
  1025. if(mCurrentScreenId > 0)
  1026. {
  1027. ScreenLayout.removeAllViews();
  1028. super.setCurrentScreen(null);
  1029. }
  1030. if(OnlyRemove) return true;
  1031. mCurrentScreenId = nScreenId;
  1032. setTopBackBtnVisible(false);
  1033. setTopSetBtnVisible(false);
  1034. // 2. 새로운 Layout 표시
  1035. try
  1036. {
  1037. switch(nScreenId)
  1038. {
  1039. /**
  1040. * [수정필요]
  1041. * Back Button 필요한 화면은 setTopBackBtnVisible(true) 호출 필요
  1042. * 추가 또는 수정해야할 부분 1. - 스크린 별 layout 생성
  1043. * **/
  1044. case API_Menu.SubMenuConfig.Configuration:
  1045. SetTitleText(API_Menu.SubMenuConfig.Name_Configuration);
  1046. configSettingMainScreen = new ConfigSettingMainScreen(this, ScreenLayout, mWallPadAPI, OPERATION_MODE);
  1047. super.setCurrentScreen(configSettingMainScreen);
  1048. break;
  1049. case API_Menu.SubMenuConfig.CleanLcd:
  1050. SetTitleText(API_Menu.SubMenuConfig.Name_CleanLcd);
  1051. configCleanLcdMainScreen = new ConfigCleanLcdMainScreen(this, ScreenLayout, mWallPadAPI, OPERATION_MODE);
  1052. //setTopBackBtnVisible(true);
  1053. super.setCurrentScreen(configCleanLcdMainScreen);
  1054. break;
  1055. case API_Menu.SubMenuConfig.PassWordChange:
  1056. SetTitleText(API_Menu.SubMenuConfig.Name_PassWordChange);
  1057. configPwChangeMainScreen = new ConfigPwChangeMainScreen(this, ScreenLayout, mWallPadAPI, OPERATION_MODE);
  1058. //setTopBackBtnVisible(true);
  1059. super.setCurrentScreen(configPwChangeMainScreen);
  1060. break;
  1061. /*case API_Menu.SubMenuConfig.SkinChange:
  1062. SetTitleText(API_Menu.SubMenuConfig.Name_SkinChange);
  1063. configGLESkinChangeMainScreen = new ConfigSkinChangeScreen(this, ScreenLayout, mWallPadAPI, OPERATION_MODE);
  1064. super.setCurrentScreen(configGLESkinChangeMainScreen);
  1065. break;*/
  1066. case API_Menu.SubMenuConfig.MorningCall:
  1067. SetTitleText(API_Menu.SubMenuConfig.Name_MorningCall);
  1068. configMoningCallMainScreen = new ConfigMoningCallMainScreen(this, ScreenLayout, mWallPadAPI, OPERATION_MODE);
  1069. //setTopBackBtnVisible(true);
  1070. super.setCurrentScreen(configMoningCallMainScreen);
  1071. break;
  1072. case API_Menu.SubMenuConfig.SmartKey:
  1073. SetTitleText(API_Menu.SubMenuConfig.Name_SmartKey);
  1074. configSmartKeyMainScreen = new ConfigSmartKeyMainScreen(this, ScreenLayout, mWallPadAPI, OPERATION_MODE);
  1075. super.setCurrentScreen(configSmartKeyMainScreen);
  1076. break;
  1077. case API_Menu.SubMenuConfig.SmartBand:
  1078. SetTitleText(API_Menu.SubMenuConfig.Name_SmartBand);
  1079. configSmartKeyMainScreen = new ConfigSmartKeyMainScreen(this, ScreenLayout, mWallPadAPI, OPERATION_MODE);
  1080. super.setCurrentScreen(configSmartKeyMainScreen);
  1081. break;
  1082. case API_Menu.SubMenuConfig.RfCard:
  1083. SetTitleText(API_Menu.SubMenuConfig.Name_RfCard);
  1084. configRfCardMainScreen = new ConfigRfCardMainScreen(this, ScreenLayout, mWallPadAPI, OPERATION_MODE);
  1085. super.setCurrentScreen(configRfCardMainScreen);
  1086. break;
  1087. case API_Menu.SubMenuConfig.TimeSetting:
  1088. SetTitleText(API_Menu.SubMenuConfig.Name_TimeSetting);
  1089. configTimeSetScreen = new ConfigTimeSetScreen(this, ScreenLayout, mWallPadAPI, OPERATION_MODE);
  1090. // setTopBackBtnVisible(true);
  1091. super.setCurrentScreen(configTimeSetScreen);
  1092. break;
  1093. /*case API_Menu.SubMenuConfig.NoiseLog:
  1094. SetTitleText(API_Menu.SubMenuConfig.Name_NoiseLog);
  1095. configNoiseLogMainScreen = new ConfigNoiseLogMainScreen(this, ScreenLayout, mWallPadAPI, OPERATION_MODE);
  1096. // setTopBackBtnVisible(true);
  1097. super.setCurrentScreen(configNoiseLogMainScreen);
  1098. break;*/
  1099. /*case API_Menu.SubMenuConfig.HandicappedPerson:
  1100. SetTitleText(API_Menu.SubMenuConfig.Name_Handicapped);
  1101. configHandicappedModeScreen = new ConfigHandicappedModeScreen(this, ScreenLayout, mWallPadAPI, OPERATION_MODE);
  1102. // setTopBackBtnVisible(true);
  1103. super.setCurrentScreen(configHandicappedModeScreen);
  1104. break;*/
  1105. case API_Menu.SubMenuConfig.MobileDeviceReg:
  1106. SetTitleText(API_Menu.SubMenuConfig.Name_MobileDeviceReg);
  1107. configMobileDeviceAddScreen = new ConfigMobileDeviceAddScreen(this, ScreenLayout, mWallPadAPI, OPERATION_MODE);
  1108. // setTopBackBtnVisible(true);
  1109. super.setCurrentScreen(configMobileDeviceAddScreen);
  1110. break;
  1111. case API_Menu.SubMenuConfig.InRoomDetectSet:
  1112. SetTitleText(API_Menu.SubMenuConfig.Name_InRoomDetectSetting);
  1113. configInRoomSensorMainScreen = new ConfigInRoomSensorMainScreen(this, ScreenLayout, mWallPadAPI, OPERATION_MODE);
  1114. super.setCurrentScreen(configInRoomSensorMainScreen);
  1115. break;
  1116. case API_Menu.SubMenuConfig.KakaoHome:
  1117. SetTitleText(API_Menu.SubMenuConfig.Name_KakaoHome);
  1118. configInKakaoiMainScreen = new ConfigInKakaoiMainScreen(this, ScreenLayout, mWallPadAPI, OPERATION_MODE);
  1119. super.setCurrentScreen(configSettingMainScreen);
  1120. break;
  1121. //Wifi 화면
  1122. case API_Menu.SubMenuConfig.Wifi:
  1123. SetTitleText(API_Menu.SubMenuConfig.Name_Wifi);
  1124. configWifiMainScreen = new ConfigInWifiMainScreen(this, ScreenLayout, mWallPadAPI, OPERATION_MODE);
  1125. super.setCurrentScreen(configWifiMainScreen);
  1126. break;
  1127. case API_Menu.SubMenuConfig.HSPlatformDevice:
  1128. SetTitleText(API_Menu.SubMenuConfig.Name_HSPlatformDevice);
  1129. configHSPlatformDeviceListScreen = new ConfigHSPlatformDeviceListScreen(this, ScreenLayout, mWallPadAPI, OPERATION_MODE);
  1130. super.setCurrentScreen(configHSPlatformDeviceListScreen);
  1131. break;
  1132. //추가 또는 수정해야할 부분 1. - 스크린 별 layout 생성
  1133. default:
  1134. Log.e(TAG, "[Error] setChangeScreen - nScreenId Not found!!! (" + mCurrentScreenId + ")");
  1135. //mCurrentScreenId = -1;
  1136. return false;
  1137. }
  1138. }
  1139. catch (RuntimeException re) {
  1140. LogUtil.errorLogInfo("", TAG, re);
  1141. return false;
  1142. } catch(Exception e)
  1143. {
  1144. Log.e(TAG, "[ExceptionError] - setChangeScreen->Screen Create : " + e);
  1145. return false;
  1146. }
  1147. return true;
  1148. }
  1149. private void CheckIsFolderMake()
  1150. {
  1151. File folderCheck = new File(Common.BESTIN_ROOT);
  1152. if( folderCheck.isDirectory() == false )
  1153. {
  1154. boolean bRet = folderCheck.mkdir();
  1155. Log.d(TAG, "[SKIN_PATH] ---------Common.BESTIN_ROOT----mkdir------" + bRet);
  1156. }
  1157. folderCheck = new File(Common.SKIN_PATH);
  1158. if( folderCheck.isDirectory() == false )
  1159. {
  1160. boolean bRet = folderCheck.mkdir();
  1161. Log.d(TAG, "[SKIN_PATH] ---------Common.SKIN_PATH----mkdir------" + bRet);
  1162. }
  1163. folderCheck = new File(Common.USERSKIN_PATH );
  1164. if( folderCheck.isDirectory() == false )
  1165. {
  1166. boolean bRet = folderCheck.mkdir();
  1167. Log.d(TAG, "[SKIN_PATH] ---------Common.USERSKIN_PATH----mkdir------" + bRet);
  1168. }
  1169. }
  1170. /**
  1171. * 상단 타이틀 텍스트 수정
  1172. * @param SetText 수정할 타이틀 이름
  1173. * **/
  1174. private void SetTitleText(String SetText)
  1175. {
  1176. if(SetText != null)
  1177. {
  1178. TopTitle.setText(SetText);
  1179. }
  1180. }
  1181. /* ================================================================================================
  1182. * [Menu Layout] Section
  1183. ================================================================================================ */
  1184. /**
  1185. * 메뉴 레이아웃 생성
  1186. * **/
  1187. private void OpenMenuLayout() {
  1188. try {
  1189. Log.i(TAG, "[OpenMenuLayout] ========== START ==========");
  1190. if (MenuOpen == true) {
  1191. return;
  1192. }
  1193. if (menueListDataClass == null) {
  1194. return;
  1195. }
  1196. //0. 현재 ID 및 리스트 불러오기
  1197. String Title = API_Menu.GetGroupNameByID((mCurrentScreenId / 1000) * 1000);
  1198. Log.i(TAG, "[OpenMenuLayout] Title = " + Title + ", mCurrentScreenId = " + mCurrentScreenId);
  1199. String TempChildName = null;
  1200. int ChooseGroup = 0;
  1201. int ChooseChild = 0;
  1202. for (int i = 0; i < menueListDataClass.arrayGroup.size(); i++) {
  1203. Log.i(TAG, "[OpenMenuLayout] menueListDataClass.arrayGroup.get(" + i + ") = " + menueListDataClass.arrayGroup.get(i));
  1204. if (menueListDataClass.arrayGroup.get(i).equals(Title)) {
  1205. ChooseGroup = i;
  1206. break;
  1207. }
  1208. }
  1209. Log.i(TAG, "[OpenMenuLayout] menueListDataClass.idMappingTable.length = " + menueListDataClass.idMappingTable.length);
  1210. for (int i = 0; i < menueListDataClass.idMappingTable.length; i++) {
  1211. Log.i(TAG, "[OpenMenuLayout] menueListDataClass.idMappingTable[" + i + "].Id = " + menueListDataClass.idMappingTable[i].Id);
  1212. if (menueListDataClass.idMappingTable[i].Id == mCurrentScreenId) {
  1213. TempChildName = menueListDataClass.idMappingTable[i].Name;
  1214. break;
  1215. }
  1216. }
  1217. if (TempChildName == null) {
  1218. Log.w(TAG, "[OpenMenuLayout] TempChildName is null!!!");
  1219. return;
  1220. }
  1221. for (int i = 0; i < menueListDataClass.arrayChild.get(Title).size(); i++) {
  1222. Log.i(TAG, "[OpenMenuLayout] menueListDataClass.arrayChild.get(Title).get(" + i + ") = " + menueListDataClass.arrayChild.get(Title).get(i) + ", TempChildName = " + TempChildName);
  1223. if (menueListDataClass.arrayChild.get(Title).get(i).equals(TempChildName) == true) {
  1224. ChooseChild = i;
  1225. break;
  1226. }
  1227. }
  1228. //1. 기존 화면 투명도 변경
  1229. TopLayout.setAlpha(0.5f);
  1230. ScreenLayout.setAlpha(0.5f);
  1231. //2. Layout 생성 및 처리 이벤트 등록
  1232. MenuLayout = new RelativeLayout(this);
  1233. WpadUtil.LayoutRegistration(AllLayout, MenuLayout, 1280, 800, 0, 0, ID.main.layout.MENU);
  1234. MenuLayout.setOnTouchListener(new Button.OnTouchListener()
  1235. {
  1236. @Override
  1237. public boolean onTouch(View v, MotionEvent event)
  1238. {
  1239. if (event.getAction() == MotionEvent.ACTION_UP) {
  1240. setFinishTimerReset();
  1241. CloseMenuLayout();
  1242. }
  1243. return true;
  1244. }
  1245. });
  1246. //3. 배경 이미지 생성 및 에니메이션 등록
  1247. MenuBackground = new WpadImageView(this, TOUCH_KIND.BUTTON, 460, 800, R.drawable.bg_menu, R.drawable.bg_menu, ID.main.image.TAB_BACKGROUND);
  1248. TranslateAnimation anim = new TranslateAnimation(WpadScale.getWidth(-460), 0, 0, 0);
  1249. anim.setDuration(200);
  1250. anim.setInterpolator(new AccelerateInterpolator());
  1251. MenuLayout.setAnimation(anim);
  1252. ViewRegistration(MenuLayout, MenuBackground, 0, 0);
  1253. //4. 타이틀 등록
  1254. MenuTitle = new WpadTextView(this, false, 247, 80, Gravity.LEFT, Color.WHITE, Common.fontsize._44, true, ID.main.text.TITLE);
  1255. ViewRegistration(MenuLayout, MenuTitle, 133, 15);
  1256. MenuTitle.setText(Title);
  1257. //5. 종료 버튼 등록
  1258. 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);
  1259. MenuClose.setTouchDelayMs(1000);
  1260. ViewRegistration(MenuLayout, MenuClose, 380, 15);
  1261. //6. 리스트뷰 초기화 및 등록
  1262. mListView = new ExpandableListView(this);
  1263. ExpandableListView.LayoutParams params = new ExpandableListView.LayoutParams(WpadScale.getWidth(460), WpadScale.getHeight(690));
  1264. mListView.setLayoutParams(params);
  1265. mListView.setX(WpadScale.getWidth(0));
  1266. mListView.setY(WpadScale.getHeight(112));
  1267. mListView.setBackgroundColor(Color.BLACK);
  1268. mListView.setId(ID.main.liveview.lv);
  1269. mListView.setGroupIndicator(null);
  1270. mListView.setDividerHeight(0);
  1271. mListView.setDivider(null);
  1272. mListView.setFocusable(true);
  1273. mListView.setSmoothScrollbarEnabled(true);
  1274. mListView.setTranscriptMode(android.widget.AbsListView.TRANSCRIPT_MODE_DISABLED);
  1275. mListView.setScrollbarFadingEnabled(true);
  1276. MenuLayout.addView(mListView);
  1277. adptMain = new Menu_AdptMain(this, menueListDataClass.arrayGroup, menueListDataClass.arrayChild, ChooseGroup, ChooseChild);
  1278. mListView.setAdapter(adptMain);
  1279. //7. 선택된 그룹 열기
  1280. mListView.setSelectedGroup(ChooseGroup);
  1281. mListView.expandGroup(ChooseGroup);
  1282. // 8. 리스트뷰 터치 이벤트 등록
  1283. mListView.setOnTouchListener(new OnTouchListener() {
  1284. @Override
  1285. public boolean onTouch(View v, MotionEvent event) {
  1286. if((event.getAction() == MotionEvent.ACTION_DOWN) || (event.getAction() == MotionEvent.ACTION_UP)) {
  1287. WpadActivity.setFinishTimerReset();
  1288. }
  1289. return false;
  1290. }});
  1291. // 9. 그룹 터치 이벤트 등록
  1292. mListView.setOnGroupClickListener(new OnGroupClickListener() {
  1293. @Override
  1294. public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
  1295. DebugLogOutput("group click = " + groupPosition);
  1296. WpadActivity.setFinishTimerReset();
  1297. return false;
  1298. }
  1299. });
  1300. // 10. 차일드 터치 이벤트 등록
  1301. /*
  1302. mListView.setOnChildClickListener(new OnChildClickListener()
  1303. {
  1304. @Override
  1305. public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id)
  1306. {
  1307. DebugLogOutput("onChildClick");
  1308. DebugLogOutput("groupPosition = " + groupPosition);
  1309. DebugLogOutput("childPosition = " + childPosition);
  1310. WpadActivity.setFinishTimerReset();
  1311. return false;
  1312. }
  1313. });
  1314. */
  1315. // 11. 그룹 열리는 경우 이벤트
  1316. mListView.setOnGroupExpandListener(new OnGroupExpandListener() {
  1317. @Override
  1318. public void onGroupExpand(int groupPosition) {
  1319. DebugLogOutput("groupPosition Open Event = " + groupPosition);
  1320. Sound().Play(SND.effect.TOUCH_LATCHED);
  1321. WpadActivity.setFinishTimerReset();
  1322. }
  1323. });
  1324. // 12. 그룹 닫히는 경우 이벤트
  1325. mListView.setOnGroupCollapseListener(new OnGroupCollapseListener() {
  1326. @Override
  1327. public void onGroupCollapse(int groupPosition) {
  1328. DebugLogOutput("groupPosition Close Event = " + groupPosition);
  1329. Sound().Play(SND.effect.TOUCH_LATCHED);
  1330. WpadActivity.setFinishTimerReset();
  1331. }
  1332. });
  1333. // 13. MenuOpen True 설정
  1334. MenuOpen = true;
  1335. } catch (RuntimeException re) {
  1336. LogUtil.errorLogInfo("", TAG, re);
  1337. } catch (Exception e) {
  1338. Log.e(TAG, "[Exception] OpenMenuLayout()");
  1339. //e.printStackTrace();
  1340. LogUtil.errorLogInfo("", TAG, e);
  1341. }
  1342. }
  1343. /**
  1344. * 메뉴 layout 닫힘 처리
  1345. * **/
  1346. private void CloseMenuLayout()
  1347. {
  1348. if(MenuOpen == false)
  1349. {
  1350. return;
  1351. }
  1352. TranslateAnimation anim = new TranslateAnimation(0, WpadScale.getWidth(-460), 0, 0);
  1353. anim.setDuration(200);
  1354. anim.setInterpolator(new AccelerateInterpolator());
  1355. anim.setAnimationListener(new AnimationListener()
  1356. {
  1357. @Override
  1358. public void onAnimationStart(Animation animation)
  1359. {
  1360. MenuOpen = false;
  1361. }
  1362. @Override
  1363. public void onAnimationRepeat(Animation animation)
  1364. {
  1365. }
  1366. @Override
  1367. public void onAnimationEnd(Animation animation)
  1368. {
  1369. AllLayout.removeView(MenuLayout);
  1370. TopLayout.setAlpha(1.0f);
  1371. ScreenLayout.setAlpha(1.0f);
  1372. }
  1373. });
  1374. MenuLayout.startAnimation(anim);
  1375. }
  1376. /**
  1377. * 메뉴 그룹 터치시 처리 (Menu_AdptMain에서 호출)
  1378. * **/
  1379. public static void SetListViewGroupExpand_Collapse(int GroupID, boolean ExpandEnable)
  1380. {
  1381. if(ExpandEnable == true)
  1382. {
  1383. mListView.expandGroup(GroupID);
  1384. }
  1385. else
  1386. {
  1387. mListView.collapseGroup(GroupID);
  1388. }
  1389. }
  1390. /**
  1391. * Menu정보가 DB에 없을 경우 불러올 스크린 로딩
  1392. * @return MenuListDataClass 타입의 초기정보
  1393. * **/
  1394. private MenuListDataClass LoadDefaultMenuList()
  1395. {
  1396. MenuListDataClass Temp_menueListDataClass = new MenuListDataClass();
  1397. Temp_menueListDataClass.SetArrayGroup(API_Menu.SubMenuConfig.Name);
  1398. ArrayList<String> arrayList = new ArrayList<String>();
  1399. int ChildCount = 0;
  1400. //[수정필요]
  1401. //추가 또는 수정해야할 부분 1. - Menu정보가 DB에 없을 경우 불러올 스크린 종류(시작)
  1402. arrayList.add(API_Menu.SubMenuConfig.Name_Configuration); ChildCount++;
  1403. arrayList.add(API_Menu.SubMenuConfig.Name_CleanLcd); ChildCount++;
  1404. //추가 또는 수정해야할 부분 1. - Menu정보가 DB에 없을 경우 불러올 스크린 종류(끝)
  1405. Temp_menueListDataClass.SetArrayChild(API_Menu.SubMenuConfig.Name, arrayList);
  1406. Temp_menueListDataClass.idMappingTable = new ChildIDMapping[ChildCount];
  1407. for (int i = 0; i < ChildCount; i++)
  1408. {
  1409. Temp_menueListDataClass.idMappingTable[i] = new ChildIDMapping();
  1410. //[수정필요]
  1411. //추가 또는 수정해야할 부분 2. - 불러올 스크린의 ID를 임의로 입력(시작)
  1412. if(arrayList.get(i).equals(API_Menu.SubMenuConfig.Name_Configuration) == true)
  1413. {
  1414. Temp_menueListDataClass.idMappingTable[i].Id = API_Menu.SubMenuConfig.Configuration;
  1415. Temp_menueListDataClass.idMappingTable[i].Name = API_Menu.SubMenuConfig.Name_Configuration;
  1416. }
  1417. else if(arrayList.get(i).equals(API_Menu.SubMenuConfig.Name_CleanLcd) == true)
  1418. {
  1419. Temp_menueListDataClass.idMappingTable[i].Id = API_Menu.SubMenuConfig.CleanLcd;
  1420. Temp_menueListDataClass.idMappingTable[i].Name = API_Menu.SubMenuConfig.Name_CleanLcd;
  1421. }
  1422. //추가 또는 수정해야할 부분 2. - 불러올 스크린의 ID를 임의로 입력(끝)
  1423. }
  1424. return Temp_menueListDataClass;
  1425. }
  1426. /**
  1427. * Menu Event intent filter 등록
  1428. **/
  1429. private void reg_Receiver()
  1430. {
  1431. try
  1432. {
  1433. IntentFilter filter = new IntentFilter();
  1434. filter.addAction("MENU_EVENT");
  1435. registerReceiver(mWallPadAlertBR, filter);
  1436. filter = new IntentFilter();
  1437. filter.addAction(define.NOTIFY_DAIL);
  1438. filter.addAction("WALLPAD_DIAL_GLOBALSCREEN_TOUCH");
  1439. registerReceiver(mWallPadJogBR, filter);
  1440. }
  1441. catch (RuntimeException re) {
  1442. LogUtil.errorLogInfo("", TAG, re);
  1443. }
  1444. catch (Exception e) {
  1445. //e.printStackTrace();
  1446. LogUtil.errorLogInfo("", TAG, e);
  1447. }
  1448. }
  1449. /**
  1450. * 조그버튼 입력 받을 시 처리
  1451. **/
  1452. BroadcastReceiver mWallPadJogBR = new BroadcastReceiver()
  1453. {
  1454. @Override
  1455. public void onReceive(Context context, Intent intent)
  1456. {
  1457. WpadActivity.setFinishTimerReset();
  1458. }
  1459. };
  1460. /**
  1461. * 메뉴에서 버튼 터치 처리
  1462. * **/
  1463. BroadcastReceiver mWallPadAlertBR = new BroadcastReceiver()
  1464. {
  1465. @Override
  1466. public void onReceive(Context context, Intent intent)
  1467. {
  1468. int groupPosition = intent.getIntExtra("groupPosition", -1);
  1469. int childPosition = intent.getIntExtra("childPosition", -1);
  1470. Log.i(TAG, "groupPosition :" +groupPosition + ", childPosition :" + childPosition);
  1471. if((groupPosition >= 0) && (childPosition >= 0))
  1472. {
  1473. if(MenuOpen == true)
  1474. {
  1475. Sound().Play(SND.effect.TOUCH_LATCHED);
  1476. CloseMenuLayout();
  1477. if(menueListDataClass == null)
  1478. {
  1479. return;
  1480. }
  1481. String childName = menueListDataClass.arrayChild.get(menueListDataClass.arrayGroup.get(groupPosition)).get(childPosition);
  1482. for (int i = 0; i < menueListDataClass.idMappingTable.length; i++)
  1483. {
  1484. if(menueListDataClass.idMappingTable[i].Name.equals(childName) == true)
  1485. {
  1486. API_Menu api_Menu = new API_Menu();
  1487. int TempID = api_Menu.GetMyGroupID(getApplicationContext().getPackageName());
  1488. int ChildID = menueListDataClass.idMappingTable[i].Id;
  1489. int ChildGroupID = (ChildID / 1000) * 1000;
  1490. Log.i(TAG, "Child ID :" + ChildID);
  1491. if(TempID == 0)
  1492. {
  1493. return;
  1494. }
  1495. if(ChildGroupID == TempID)
  1496. {
  1497. //해당 APP내에서 스크린 전환 필요
  1498. //[수정필요]
  1499. /*boolean result = setChangeScreen(ChildID, false);
  1500. if(result == false)
  1501. {
  1502. setChangeScreen(API_Menu.SubMenuConfig.Configuration, false);
  1503. }
  1504. WpadActivity.setFinishTimerReset();*/
  1505. if (OPERATION_MODE == Common.MODE_NOMAL)
  1506. {
  1507. mTempCurrentScreenId = ChildID;
  1508. mWallPadApiCheckHandler.sendEmptyMessage(0);
  1509. } else
  1510. {
  1511. boolean result = setChangeScreen(ChildID, false);
  1512. if(result == false)
  1513. {
  1514. setChangeScreen(API_Menu.SubMenuConfig.Configuration, false);
  1515. }
  1516. }
  1517. WpadActivity.setFinishTimerReset();
  1518. }
  1519. else
  1520. {
  1521. //외부 앱 호출 후, 본 APP Finish 필요
  1522. api_Menu.startSubScreenActivity(getApplicationContext(),
  1523. menueListDataClass.idMappingTable[i].Id, API_Menu.MENU_START_OPTION_1, api_Menu.GetAPK_Name_ByID(ChildGroupID));
  1524. Intent mIntent = new Intent();
  1525. mIntent.putExtra("Finish_Kind", "HomeButton");
  1526. MainActivity.this.setResult(RESULT_OK, mIntent);
  1527. finish();
  1528. }
  1529. break;
  1530. }
  1531. }
  1532. }
  1533. }
  1534. }
  1535. };
  1536. /**
  1537. * @param nScreenId - 변경할 Screen ID
  1538. * @return (boolean) true : 성공, false : 실패
  1539. **/
  1540. private boolean setTitleName(int nScreenId)
  1541. {
  1542. boolean ret = false;
  1543. Log.d(TAG, "setTitleName " + nScreenId);
  1544. switch (nScreenId)
  1545. {
  1546. case API_Menu.SubMenuConfig.Configuration:
  1547. SetTitleText(API_Menu.SubMenuConfig.Name_Configuration);
  1548. ret = true;
  1549. break;
  1550. case API_Menu.SubMenuConfig.CleanLcd:
  1551. SetTitleText(API_Menu.SubMenuConfig.Name_CleanLcd);
  1552. ret = true;
  1553. break;
  1554. case API_Menu.SubMenuConfig.PassWordChange:
  1555. SetTitleText(API_Menu.SubMenuConfig.Name_PassWordChange);
  1556. ret = true;
  1557. break;
  1558. case API_Menu.SubMenuConfig.SkinChange:
  1559. SetTitleText(API_Menu.SubMenuConfig.Name_SkinChange);
  1560. ret = true;
  1561. break;
  1562. case API_Menu.SubMenuConfig.MorningCall:
  1563. SetTitleText(API_Menu.SubMenuConfig.Name_MorningCall);
  1564. ret = true;
  1565. break;
  1566. case API_Menu.SubMenuConfig.SmartKey:
  1567. SetTitleText(API_Menu.SubMenuConfig.Name_SmartKey);
  1568. ret = true;
  1569. break;
  1570. case API_Menu.SubMenuConfig.SmartBand:
  1571. SetTitleText(API_Menu.SubMenuConfig.Name_SmartBand);
  1572. ret = true;
  1573. break;
  1574. case API_Menu.SubMenuConfig.RfCard:
  1575. SetTitleText(API_Menu.SubMenuConfig.Name_RfCard);
  1576. ret = true;
  1577. break;
  1578. case API_Menu.SubMenuConfig.TimeSetting:
  1579. SetTitleText(API_Menu.SubMenuConfig.Name_TimeSetting);
  1580. ret = true;
  1581. break;
  1582. case API_Menu.SubMenuConfig.HandicappedPerson:
  1583. SetTitleText(API_Menu.SubMenuConfig.Name_Handicapped);
  1584. ret = true;
  1585. break;
  1586. case API_Menu.SubMenuConfig.RemoteCallUser:
  1587. SetTitleText(API_Menu.SubMenuConfig.Name_RemoteCallUser);
  1588. ret = true;
  1589. break;
  1590. default:
  1591. Log.e(TAG, "[Error] setChangeScreen - nScreenId Not found!!! (" + mCurrentScreenId + ")");
  1592. //mCurrentScreenId = -1;
  1593. SetTitleText(API_Menu.SubMenuConfig.Name_Configuration);
  1594. ret = false;
  1595. break;
  1596. }
  1597. return ret;
  1598. }
  1599. // 안심통화 사용유무
  1600. public boolean getReliefCallUse() {
  1601. try {
  1602. String RELIEF_CALL = "안심통화";
  1603. WallpadDeviceSet mWallpadDeviceSet = new WallpadDeviceSet(mContext);
  1604. if (mWallpadDeviceSet != null) {
  1605. String[] astrReliefCall = mWallpadDeviceSet.GetSettingData(RELIEF_CALL);
  1606. mWallpadDeviceSet.closeDB();
  1607. if (astrReliefCall != null) {
  1608. if (astrReliefCall[1].contains(RELIEF_CALL)) {
  1609. if (astrReliefCall[1].contains("사용함")) return true;
  1610. }
  1611. }
  1612. }
  1613. } catch (RuntimeException re) {
  1614. LogUtil.errorLogInfo("", TAG, re);
  1615. } catch (Exception e) {
  1616. Log.e(TAG, "[Exception] getReliefCallUse()");
  1617. //e.printStackTrace();
  1618. LogUtil.errorLogInfo("", TAG, e);
  1619. }
  1620. return false;
  1621. }
  1622. /**
  1623. * 재실센서 시나리오 선택화면 돌아가기 버튼 활성화 & 비활성화
  1624. *
  1625. * @param Enabled - true : 활성화, false : 비활성화
  1626. * @return (boolean) true : 성공, false : 실패
  1627. */
  1628. public boolean Set_BackBtn_InroomVisible(boolean Enabled)
  1629. {
  1630. if(Enabled == true)
  1631. {
  1632. if(BackBtn_InRoom.getVisibility() != View.VISIBLE) BackBtn_InRoom.setVisibility(View.VISIBLE);
  1633. BackBtn_InRoom.bringToFront();
  1634. if(TopManualBtn.getVisibility() == View.VISIBLE)
  1635. {
  1636. WpadUtil.ViewMove(TopManualBtn, 893, 0);
  1637. }
  1638. }
  1639. else
  1640. {
  1641. if(BackBtn_InRoom.getVisibility() != View.INVISIBLE) BackBtn_InRoom.setVisibility(View.INVISIBLE);
  1642. if(TopManualBtn.getVisibility() == View.VISIBLE)
  1643. {
  1644. WpadUtil.ViewMove(TopManualBtn, 1019, 0);
  1645. }
  1646. }
  1647. return true;
  1648. }
  1649. public boolean GetEasyModeUXUse() {
  1650. try
  1651. {
  1652. WallpadDeviceSet deviceSet = new WallpadDeviceSet(this.getContext());
  1653. boolean EasymodeSupport = deviceSet.Get_EasyModeUX_Support();
  1654. deviceSet.closeDB();
  1655. WallpadStatusData data = new WallpadStatusData(this.getContext());
  1656. boolean EasyModeUse = data.GetEasyModeUxUse();
  1657. data.closeDB();
  1658. Log.d(TAG, "[GetEasyModeUXUse] EasymodeSupport" + EasymodeSupport + "], bUse [" + EasyModeUse + "]");
  1659. return EasymodeSupport & EasyModeUse;
  1660. } catch (RuntimeException re) {
  1661. LogUtil.errorLogInfo("", TAG, re);
  1662. } catch (Exception e) {
  1663. Log.e(TAG, "[Exception] GetEasyModeUXUse()");
  1664. //e.printStackTrace();
  1665. LogUtil.errorLogInfo("", TAG, e);
  1666. }
  1667. return false;
  1668. }
  1669. public static int nResidentSafetyCheckSetting = WallpadDeviceSet.RESIDENT_SAFETY_CHECK_DISABLE;
  1670. private void getResidentSafetyCheckSetting() {
  1671. try {
  1672. WallpadDeviceSet mWallpadDeviceSet = new WallpadDeviceSet(getApplicationContext());
  1673. nResidentSafetyCheckSetting = mWallpadDeviceSet.getResidentSafetyCheck();
  1674. mWallpadDeviceSet.closeDB();
  1675. Log.e(TAG, "[getResidentSafetyCheckSetting] nResidentSafetyCheckSetting: " + nResidentSafetyCheckSetting);
  1676. if (nResidentSafetyCheckSetting == WallpadDeviceSet.RESIDENT_SAFETY_CHECK_ENABLE) Version.setResidentSafety();
  1677. else Version.unsetResidentSafety();
  1678. } catch (RuntimeException re) {
  1679. LogUtil.errorLogInfo("", TAG, re);
  1680. } catch (Exception e) {
  1681. Log.e(TAG, "[Exception] getResidentSafetyCheckSetting()");
  1682. //e.printStackTrace();
  1683. LogUtil.errorLogInfo("", TAG, e);
  1684. }
  1685. }
  1686. /**
  1687. * 멀티제어 관련.
  1688. *
  1689. * */
  1690. int mMultiAddress;
  1691. String myIP = "NONE";
  1692. String myHo = "NONE";
  1693. int ho = 0;
  1694. public String millToDate(long mills) {
  1695. String pattern = "yyyy-MM-dd'T'HH:mm:ss";
  1696. SimpleDateFormat formatter = new SimpleDateFormat(pattern);
  1697. String date = (String) formatter.format(new Timestamp(mills));
  1698. return date;
  1699. }
  1700. class ClientThread extends Thread {
  1701. private Handler handler;
  1702. private String value1;
  1703. private String value2;
  1704. private int menu, reason, state, position;
  1705. private int roomNumber;
  1706. public ClientThread(Handler handler, int menu, int reason, int position, String value1, String value2) {
  1707. this.handler = handler;
  1708. this.menu = menu;
  1709. this.reason = reason;
  1710. this.position = position;
  1711. this.value1 = value1;
  1712. this.value2 = value2;
  1713. }
  1714. public void run() {
  1715. //String host = "10.1.1.1";
  1716. //String host = "10.1.1." + position;
  1717. String host = "10.1."+position+".1";
  1718. int port = 9998;
  1719. String json = "";
  1720. JSONObject jsonObject = new JSONObject();
  1721. try {
  1722. jsonObject.accumulate("type", "request");
  1723. jsonObject.accumulate("timestamp", millToDate(System.currentTimeMillis()));
  1724. jsonObject.accumulate("wallpadip", myIP);
  1725. jsonObject.accumulate("menu", menu);
  1726. jsonObject.accumulate("reason", reason);
  1727. jsonObject.accumulate("position", position);
  1728. //비밀번호 변경
  1729. if (menu == JSON.MENU.PASSWORD) {
  1730. jsonObject.accumulate("number", value1);
  1731. }
  1732. //모바일 기기 등록
  1733. else if (menu == JSON.MENU.MOBILE) {
  1734. if(reason == JSON.REASON.MobileRegister) {
  1735. jsonObject.accumulate("name", value1);
  1736. jsonObject.accumulate("id", value2);
  1737. } else if(reason == JSON.REASON.MobileDelete) {
  1738. jsonObject.accumulate("id", value2);
  1739. }
  1740. }
  1741. } catch (JSONException e) {
  1742. e.printStackTrace();
  1743. }
  1744. // convert JSONObject to JSON to String
  1745. json = jsonObject.toString();
  1746. try {
  1747. Socket socket = new Socket();
  1748. InetSocketAddress ipep = new InetSocketAddress(host, port); // 방법 2
  1749. socket.connect(ipep);
  1750. ObjectOutputStream outputStream = new ObjectOutputStream(socket.getOutputStream());
  1751. outputStream.writeObject(json);
  1752. Log.d("ClientThread", "서버로 보냄.");
  1753. ObjectInputStream inputStream = new ObjectInputStream(socket.getInputStream());
  1754. StringBuffer stb = new StringBuffer();
  1755. String data;
  1756. while (true) {
  1757. try {
  1758. socket.setSoTimeout(5000);
  1759. data = (String) inputStream.readObject();
  1760. if (data == null) {
  1761. break;
  1762. }
  1763. stb.append(data);
  1764. } catch (Exception e) {
  1765. if (socket != null) {
  1766. socket.close();
  1767. }
  1768. if (inputStream != null) {
  1769. inputStream.close();
  1770. }
  1771. if (outputStream != null) {
  1772. outputStream.close();
  1773. }
  1774. break;
  1775. }
  1776. }
  1777. final String response = String.valueOf(stb);
  1778. Log.d("ClientThread", "response=" + response);
  1779. final String finalResponse = response;
  1780. Message message = handler.obtainMessage();
  1781. message.what = 1000;
  1782. Bundle bundle = new Bundle();
  1783. bundle.putString("response", finalResponse);
  1784. message.setData(bundle);
  1785. handler.sendMessage(message);
  1786. } catch (Exception e) {
  1787. e.printStackTrace();
  1788. }
  1789. }
  1790. }
  1791. public void requestMultiControl(Handler handler, int menu, int reason, int position, String value1, String value2) {
  1792. if(position!=ho) {
  1793. ClientThread thread = new ClientThread(handler, menu, reason, position, value1, value2);
  1794. thread.start();
  1795. }
  1796. }
  1797. }