PopupActivity.java 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938
  1. /*
  2. * Copyright (C) 2014 Android WallPad Project
  3. *
  4. * FileName : PopupActivity.java
  5. * Project : Android WallPad Project
  6. * Company : HDC I-CONTROLS ( www.icontrols.co.kr )
  7. * Author : Kang Sang Ho , lairu@icontrols.co.kr
  8. */
  9. package kr.co.icontrols.wallpadmain;
  10. import com.artncore.WallPadDataMgr.WallpadDeviceSet;
  11. import com.artncore.WallPadDataMgr.WallpadStatusData;
  12. import com.artncore.commons.define;
  13. import com.artncore.wallpadapi.WallPadAPI;
  14. import com.util.LogUtil;
  15. import android.annotation.SuppressLint;
  16. import android.content.Context;
  17. import android.content.Intent;
  18. import android.os.Bundle;
  19. import android.os.Handler;
  20. import android.os.Message;
  21. import android.util.Log;
  22. import android.view.KeyEvent;
  23. import android.view.MotionEvent;
  24. import android.view.View;
  25. import android.view.WindowManager;
  26. import android.widget.RelativeLayout;
  27. import kr.co.icontrols.wallpadmain.declare.Common;
  28. import kr.co.icontrols.wallpadmain.declare.ID;
  29. import kr.co.icontrols.wallpadmain.declare.ID_OLD;
  30. import kr.co.icontrols.wallpadmain.popup.AddShortcut;
  31. import kr.co.icontrols.wallpadmain.popup.AdminPWInput;
  32. import kr.co.icontrols.wallpadmain.popup.AlarmUseEnergy_ServerConnect;
  33. import kr.co.icontrols.wallpadmain.popup.BandLocationAlarmReceived;
  34. import kr.co.icontrols.wallpadmain.popup.ChargingElectricVehicle;
  35. import kr.co.icontrols.wallpadmain.popup.ConfigurePreset;
  36. import kr.co.icontrols.wallpadmain.popup.DeviceLoading;
  37. import kr.co.icontrols.wallpadmain.popup.DuplicatedShortcut;
  38. import kr.co.icontrols.wallpadmain.popup.EventNotification;
  39. import kr.co.icontrols.wallpadmain.popup.GroupAdd;
  40. import kr.co.icontrols.wallpadmain.popup.GroupCtrl;
  41. import kr.co.icontrols.wallpadmain.popup.GroupEnergy;
  42. import kr.co.icontrols.wallpadmain.popup.GroupSecurity;
  43. import kr.co.icontrols.wallpadmain.popup.GroupSetting;
  44. import kr.co.icontrols.wallpadmain.popup.GroupTalk;
  45. import kr.co.icontrols.wallpadmain.popup.InterFloorNoiseError;
  46. import kr.co.icontrols.wallpadmain.popup.InterFloorNoiseOccured;
  47. import kr.co.icontrols.wallpadmain.popup.NoMoreShortcut;
  48. import kr.co.icontrols.wallpadmain.popup.NoticeDetectStranger;
  49. import kr.co.icontrols.wallpadmain.popup.PostReceived;
  50. import kr.co.icontrols.wallpadmain.popup.ReleaseInMode;
  51. import kr.co.icontrols.wallpadmain.popup.SmartKeyEmergency;
  52. import kr.co.icontrols.wallpadmain.popup.ParcelReceived;
  53. import kr.co.icontrols.wallpadmain.popup.ScheduleNotification;
  54. import kr.co.icontrols.wallpadmain.popup.EnergyUsageAlert;
  55. import kr.co.icontrols.wallpadmain.popup.VehicleArrived;
  56. import kr.co.icontrols.wallpadmain.popup.DeleteShortcut;
  57. import kr.co.icontrols.wallpadmain.popup.DiagnosticMode;
  58. import kr.co.icontrols.wallpadmain.popup.ElevatorCall;
  59. import kr.co.icontrols.wallpadmain.popup.CollectiveLightCTRL;
  60. import kr.co.icontrols.wallpadmain.popup.ModeLamp;
  61. import kr.co.icontrols.wallpadmain.popup.MorningCall;
  62. import kr.co.icontrols.wallpadmain.popup.ReleaseOutMode;
  63. import kr.co.icontrols.wallpadsupport.WpadActivity;
  64. import kr.co.icontrols.wallpadsupport.WpadScale;
  65. /**
  66. * @description
  67. * 월패드 [설정화면] 팝업화면 관리자 이다.<br>
  68. */
  69. public class PopupActivity extends WpadActivity {
  70. private final static String TAG = "PopupActivity";
  71. private final boolean DEBUG_LOG_ON = true;
  72. private void DebugLogOutput(String s) { if(DEBUG_LOG_ON) Log.d(TAG, s); }
  73. // =================================================================================================
  74. // [[ Declaration ]] region
  75. // =================================================================================================
  76. private static Context mContext = null;
  77. public static Context getContext() { return mContext; }
  78. private WallPadAPI mWallPadAPI = null;
  79. private int OPERATION_MODE = Common.MODE;
  80. private WallpadStatusData wdb;
  81. // Layout
  82. private RelativeLayout AllLayout;
  83. // CurrentScreenId & mCurrentStyle
  84. private int mCurrentScreenId = -1;
  85. private int mCurrentStyle = -1;
  86. private int mTempCurrentScreenId = -1;
  87. public IOInterface mIOInterface = null;
  88. // CreateComplete
  89. private static boolean mCreateComplete = false;
  90. protected static boolean getCreateComplete() { return mCreateComplete; }
  91. protected static void setCreateComplete(boolean set) { mCreateComplete = set; }
  92. // Screen
  93. static AdminPWInput AdminPWInputPopup;
  94. static DeleteShortcut DeleteShortcutPopup;
  95. static AddShortcut AddShortcutPopup;
  96. static NoMoreShortcut NoMoreShortcutPopup;
  97. static DuplicatedShortcut DuplicatedShortcutPopup;
  98. static ElevatorCall ElevatorCallPopup;
  99. static ReleaseInMode ReleaseInModePopup;
  100. static ReleaseOutMode ReleaseOutModePopup;
  101. static MorningCall MorningCallPopup;
  102. static ParcelReceived ParcelReceivedPopup;
  103. static PostReceived PostReceivedPopup;
  104. static BandLocationAlarmReceived BandLocationPopup;
  105. static CollectiveLightCTRL CollectiveLightCTRLPopup;
  106. static ModeLamp ModeLampPopup;
  107. static DiagnosticMode DiagnosticPopup;
  108. static ScheduleNotification ScheduleNotificationPopup; // 등록된 일정 알림 팝업
  109. static EnergyUsageAlert EnergyUsageAlertPopup; // 에너지 목표값 대비 사용량 근접 및 초과 알림 팝업
  110. static VehicleArrived VehicleArrivedPopup; // 등록된 차량 도착 알림
  111. static ChargingElectricVehicle ChargingElectricVehiclePopup; // 전기차 충전 알림 팝업
  112. static AlarmUseEnergy_ServerConnect AlarmUseEnergy_ServerConnectPopup; // 에너지관리서버 연동 시 에너지 사용 알림 팝업
  113. static SmartKeyEmergency SmartKeyEmergencyPopup; // 스마트키 비상 팝업
  114. static EventNotification EventNotificationPopup;
  115. static ConfigurePreset ConfigurePresetPopup;
  116. static InterFloorNoiseOccured InterFloorNoiseOccuredPopup;
  117. static InterFloorNoiseError InterFloorNoiseErrorPopup;
  118. static DeviceLoading DeviceLoadingPopup;
  119. static GroupCtrl GroupCtrlPopup;
  120. static GroupTalk GroupTalkPopup;
  121. static GroupSecurity GroupSecurityPopup;
  122. static GroupAdd GroupAddPopup;
  123. static GroupEnergy GroupEnergyPopup;
  124. static GroupSetting GroupSettingPopup;
  125. static NoticeDetectStranger NoticeDetectStrangerPopup;
  126. public WallpadStatusData GetDBObj()
  127. {
  128. return wdb;
  129. }
  130. /**
  131. * Static Variables 초기화<br>
  132. * onCreate 도입부, onDestroy 종료시 삽입한다.
  133. */
  134. private void setStaticVariablesInit() {
  135. mContext = null;
  136. mCreateComplete = false;
  137. if (AllLayout != null) {
  138. AllLayout.removeAllViews();
  139. AllLayout = null;
  140. }
  141. }
  142. // =================================================================================================
  143. // [[ Activity Life Cycle ]] region
  144. // =================================================================================================
  145. /**
  146. * Activity Constructors
  147. */
  148. @Override
  149. protected void onCreate(Bundle savedInstanceState) {
  150. Log.i(TAG, "-------------------------------------------------------------");
  151. Log.i(TAG, "------------------ [START - PopupActivity] ------------------");
  152. Log.i(TAG, "-------------------------------------------------------------");
  153. super.onCreate(savedInstanceState);
  154. // 1. 변수 초기화
  155. DebugLogOutput("[Create] - Step1 : EMData Create");
  156. setStaticVariablesInit();
  157. mContext = this;
  158. // 2. 자동 종료 셋팅
  159. DebugLogOutput("[Create] - Step2 : Auto Finish Setting");
  160. // 2-1. APP 종료 BR을 활성화 한다.
  161. super.setFinishBrEnable(true);
  162. // 3. API 호출
  163. DebugLogOutput("[Create] - Step3 : API Call");
  164. if (OPERATION_MODE == Common.MODE_NOMAL) {
  165. Log.d(TAG, "OperationMode = MODE_NOMAL");
  166. mWallPadAPI = new WallPadAPI(this);
  167. }
  168. else if (OPERATION_MODE == Common.MODE_BUSINESS_SAMPLE) {
  169. Log.d(TAG, "OperationMode = MODE_BUSINESS_SAMPLE");
  170. }
  171. try { wdb = new WallpadStatusData(this); }
  172. catch (RuntimeException re) {
  173. LogUtil.errorLogInfo("", TAG, re);
  174. }
  175. catch (Exception e) { Log.e(TAG, "[ExceptionError] - onCreate->WallpadStatusData Create : " + e); }
  176. // 4. Layout registration
  177. DebugLogOutput("[Create] - Step4 : Layout registration");
  178. // 4-1. mainLayout
  179. AllLayout = new RelativeLayout(this);
  180. AllLayout.setId(ID_OLD.popup.layout.ALL);
  181. super.setAllLayoutRegistration(AllLayout);
  182. // 5. Start ScreenId EMData Get
  183. Intent intent = getIntent();
  184. int ScreenId = intent.getIntExtra("ScreenId", -1);
  185. Log.d(TAG, "ScreenId = " + ScreenId);
  186. if (ScreenId < 0) {
  187. Log.e(TAG, "[Error] ScreenId Out of range (" + ScreenId + ")");
  188. finish();
  189. }
  190. else {
  191. // 6. First Show Layout Find
  192. mCreateComplete = true;
  193. if (OPERATION_MODE == Common.MODE_NOMAL) {
  194. mTempCurrentScreenId = ScreenId;
  195. mWallPadApiCheckHandler.sendEmptyMessage(0);
  196. }
  197. else {
  198. if (setChangeScreen(ScreenId, false) == false) {
  199. Log.e(TAG, "[Error] setChangeScreen false...");
  200. finish();
  201. }
  202. }
  203. }
  204. Log.i(TAG, "End onCreate -------------------------------------------------");
  205. }
  206. /**
  207. * (임시코드) WallPadAPI 초기생성시 Connect 에 시간이 걸리며, <br>
  208. * WallPadAPI 초기화후 바로 Get_GasValveController 등을 사용하여 API 를 가져올수 없기에, <br>
  209. * 본 딜레이 코드를 임시로 적용한다.
  210. */
  211. @SuppressLint("HandlerLeak")
  212. protected Handler mWallPadApiCheckHandler = new Handler()
  213. {
  214. @SuppressLint("HandlerLeak")
  215. @Override
  216. public void handleMessage(Message msg)
  217. {
  218. if (msg.what == 0) {
  219. if (mWallPadAPI != null) {
  220. if (mWallPadAPI.Check_Connect()) mWallPadApiCheckHandler.sendEmptyMessageDelayed(1, 10);
  221. else mWallPadApiCheckHandler.sendEmptyMessageDelayed(0, 10);
  222. }
  223. } else if (msg.what == 1) {
  224. setChangeScreen(mTempCurrentScreenId, false);
  225. mIOInterface = new IOInterface(getContext(), mWallPadAPI);
  226. }
  227. }
  228. };
  229. /**
  230. * onDestroy
  231. */
  232. @Override
  233. protected void onDestroy() {
  234. try {
  235. super.onDestroy();
  236. setChangeScreen(mCurrentScreenId, true);
  237. setStaticVariablesInit();
  238. MainActivity.setPopupActivityRun(false);
  239. MainActivity.setInfoActivityRun(false);
  240. setInfoActivityRun(false);
  241. mCreateComplete = false;
  242. if( wdb != null )wdb.closeDB();
  243. } catch (RuntimeException re) {
  244. LogUtil.errorLogInfo("", TAG, re);
  245. }
  246. catch (Exception e) {
  247. LogUtil.errorLogInfo("", TAG, e);
  248. }
  249. Log.d(TAG, "*************************************************************");
  250. Log.d(TAG, "****************** [END - PopupActivity] ******************");
  251. Log.d(TAG, "*************************************************************");
  252. }
  253. /**
  254. * onResume
  255. */
  256. @Override
  257. protected void onResume() {
  258. super.onResume();
  259. if(mWallPadAPI != null) mWallPadAPI.Resume();
  260. NoticeDetectStranger.bTouch = false;
  261. Log.d(TAG, "@@@@@@@@ [onResume] @@@@@@@@");
  262. }
  263. /**
  264. * onPause
  265. */
  266. @Override
  267. protected void onPause() {
  268. super.onPause();
  269. if(mWallPadAPI != null) mWallPadAPI.Pause();
  270. Log.d(TAG, "[onPause] mCurrentScreenId [" + mCurrentScreenId + "]");
  271. if (mCurrentScreenId == ID.POPUPS.POPUP_BANDLOCATIONALARM) ctrlLCDOff();
  272. else if (mCurrentScreenId == ID.POPUPS.POPUP_NOTICESTRANGER) {
  273. // 타임아웃 종료시(화면터치로 인한 종료가 아닐 경우) 거동수상자 녹화 시작
  274. boolean bResult = NoticeDetectStranger.bTouch;
  275. Log.d(TAG, "[onPause] bResult [" + bResult + "]");
  276. if (!bResult) {
  277. int kind = -1;
  278. if (getSmartDoorCamType() == WallpadDeviceSet.DOORTYPE_IOT_SMART
  279. || getSmartDoorCamType() == WallpadDeviceSet.DOORTYPE_HYOSUNG_SMART
  280. || getSmartDoorCamType() == WallpadDeviceSet.DOORTYPE_DAEWOO_SMART)
  281. kind = define.NOTIFY_ACCEPT_RECORD_STRANGER;
  282. // BR 전송
  283. Intent notiIntent = new Intent();
  284. notiIntent.setAction(define.NOTIFY_ACNAME);
  285. notiIntent.putExtra(define.NOTIBR_KIND, kind);
  286. mContext.sendBroadcast(notiIntent);
  287. }
  288. }
  289. Log.d(TAG, "@@@@@@@@ [onPause] @@@@@@@@");
  290. }
  291. /* ================================================================================================
  292. * [BroadcastReceiver] Section
  293. ================================================================================================ */
  294. /**
  295. * BroadcastReceiver.onReceive for [WpadActivity]
  296. */
  297. @Override
  298. protected void onBrReceive(Intent intent) {
  299. super.onBrReceive(intent);
  300. Log.d(TAG, "Receive alert BR " + intent.getAction());
  301. }
  302. /* ================================================================================================
  303. * [Touch & Key Event] Section
  304. ================================================================================================ */
  305. /**
  306. * TouchEvent for [WpadActivity]
  307. */
  308. @Override
  309. protected void onTouchEvent(View v, MotionEvent event) {
  310. super.onTouchEvent(v, event);
  311. }
  312. /**
  313. * H/W Key Event
  314. */
  315. @Override
  316. public boolean onKeyDown(int keyCode, KeyEvent event) {
  317. DebugLogOutput("onKeyDown - " + " / keyCode : " + keyCode + " / Action : " + event.getAction());
  318. return super.onKeyDown(keyCode, event);
  319. }
  320. /* ================================================================================================
  321. * [Screen] Section
  322. ================================================================================================ */
  323. /**
  324. * Screen 에서 Screen 변경을 요청할 경우 호출된다.<br>
  325. * Override 사용하여 Screen 변경을 처리한다.<br>
  326. *
  327. * @param nScreenId - 변경할 Screen ID_OLD
  328. * @return (boolean) true : 성공, false : 실패
  329. */
  330. @Override
  331. protected boolean onChangeScreen(int nScreenId) {
  332. super.onChangeScreen(nScreenId);
  333. return setChangeScreen(nScreenId, false);
  334. }
  335. /**
  336. * Screen 등록자<br>
  337. * ScreenLayout 에 현재 Screen 을 삭제하고, 새로운 Screen 을 등록시킨다.
  338. *
  339. * @param nScreenId - 변경할 Screen ID_OLD
  340. * @param OnlyRemove - 현재 Screen 을 삭제만 할 경우 (onDestroy 에서 사용)
  341. * @return (boolean) true : 성공, false : 실패
  342. */
  343. public boolean setChangeScreen(int nScreenId, boolean OnlyRemove) {
  344. Log.d(TAG, "[setChangeScreen] CurrentScreenId [" + mCurrentScreenId + "], NextLayoutId [" + nScreenId + "], OnlyRemove [" + OnlyRemove + "]");
  345. if (getCreateComplete() == false) {
  346. Log.w(TAG, "[Waring] setChangeLayout - CreateComplete is false !!!");
  347. return false;
  348. }
  349. if (mCurrentScreenId == nScreenId && !OnlyRemove) {
  350. Log.w(TAG, "[Waring] Same Screen Called!!!");
  351. return false;
  352. }
  353. //boolean remove = false;
  354. if (mCurrentScreenId > 0) {
  355. //remove = true;
  356. AllLayout.removeAllViews();
  357. super.setCurrentScreen(null);
  358. }
  359. if (OnlyRemove) {
  360. switch (mCurrentScreenId) {
  361. case ID.POPUPS.POPUP_ADMINPWINPUT:
  362. AdminPWInputPopup.Close();
  363. break;
  364. case ID.POPUPS.POPUP_RELEASEINMODE:
  365. ReleaseInModePopup.Close();
  366. break;
  367. case ID.POPUPS.POPUP_RELEASEOUTMODE:
  368. ReleaseOutModePopup.Close();
  369. break;
  370. case ID.POPUPS.POPUP_DELETESHORTCUT:
  371. DeleteShortcutPopup.Close();
  372. break;
  373. case ID.POPUPS.POPUP_MORNINGCALL:
  374. MorningCallPopup.Close();
  375. break;
  376. case ID.POPUPS.POPUP_PARCELRECEIVED:
  377. ParcelReceivedPopup.Close();
  378. break;
  379. case ID.POPUPS.POPUP_POSTRECEIVED:
  380. PostReceivedPopup.Close();
  381. break;
  382. case ID.POPUPS.POPUP_BANDLOCATIONALARM:
  383. BandLocationPopup.Close();
  384. break;
  385. case ID.POPUPS.POPUP_COLLECTIVELIGHTCTRL:
  386. CollectiveLightCTRLPopup.Close();
  387. break;
  388. case ID.POPUPS.POPUP_MOODLAMP:
  389. ModeLampPopup.Close();
  390. break;
  391. case ID.POPUPS.POPUP_ADDSHORTCUT:
  392. AddShortcutPopup.Close();
  393. break;
  394. case ID.POPUPS.POPUP_NOMORESHORTCUT:
  395. NoMoreShortcutPopup.Close();
  396. break;
  397. case ID.POPUPS.POPUP_DUPLICATEDSHORTCUT:
  398. DuplicatedShortcutPopup.Close();
  399. break;
  400. case ID.POPUPS.POPUP_ELEVATORCALL:
  401. ElevatorCallPopup.Close();
  402. break;
  403. case ID.POPUPS.POPUP_SCHEDULENOTIFICATION:
  404. ScheduleNotificationPopup.Close();
  405. break;
  406. case ID.POPUPS.POPUP_ENERGYUSAGEALERT:
  407. EnergyUsageAlertPopup.Close();
  408. break;
  409. case ID.POPUPS.POPUP_VEHICLEARRIVED:
  410. VehicleArrivedPopup.Close();
  411. break;
  412. case ID.POPUPS.POPUP_CHARGINGELECTRICVEHICLE:
  413. ChargingElectricVehiclePopup.Close();
  414. break;
  415. case ID.POPUPS.POPUP_DIAGNOSTICMODE:
  416. DiagnosticPopup.Close();
  417. break;
  418. case ID.POPUPS.POPUP_ENERGYMETERAGE:
  419. AlarmUseEnergy_ServerConnectPopup.Close();
  420. break;
  421. case ID.POPUPS.POPUP_SMARTKEYEMERGENCY:
  422. SmartKeyEmergencyPopup.Close();
  423. break;
  424. case ID.POPUPS.POPUP_EVENTNOTIFICATION:
  425. EventNotificationPopup.Close();
  426. break;
  427. case ID.POPUPS.POPUP_CONFIGUREPRESET:
  428. ConfigurePresetPopup.Close();
  429. break;
  430. case ID.POPUPS.POPUP_DEVICELOADING:
  431. DeviceLoadingPopup.Close();
  432. break;
  433. case ID.POPUPS.POPUP_GROUP_CTRL:
  434. GroupCtrlPopup.Close();
  435. break;
  436. case ID.POPUPS.POPUP_GROUP_TALK:
  437. GroupTalkPopup.Close();
  438. break;
  439. case ID.POPUPS.POPUP_GROUP_SECURITY:
  440. GroupSecurityPopup.Close();
  441. break;
  442. case ID.POPUPS.POPUP_GROUP_ADD:
  443. GroupAddPopup.Close();
  444. break;
  445. case ID.POPUPS.POPUP_GROUP_ENERGY:
  446. GroupEnergyPopup.Close();
  447. break;
  448. case ID.POPUPS.POPUP_GROUP_SETTING:
  449. GroupSettingPopup.Close();
  450. break;
  451. case ID.POPUPS.POPUP_INTERFLOORNOISEOCCURED:
  452. InterFloorNoiseOccuredPopup.Close();
  453. break;
  454. case ID.POPUPS.POPUP_INTERFLOORNOISEERROR:
  455. InterFloorNoiseErrorPopup.Close();
  456. break;
  457. case ID.POPUPS.POPUP_NOTICESTRANGER:
  458. NoticeDetectStrangerPopup.Close();
  459. break;
  460. default:
  461. Log.e(TAG, "[Error] setChangeLayout - OnlyRemove Input ID_OLD Not found!!!");
  462. return false;
  463. }
  464. return true;
  465. }
  466. if(Common.GetDeviceSampleMode(this)) OPERATION_MODE = Common.MODE_BUSINESS_SAMPLE;
  467. else OPERATION_MODE = Common.MODE_NOMAL;
  468. // 1. 새로운 Layout 표시
  469. int Style = Common.POPUP_STYLE_NOMAL;
  470. int FinishTime = Common.FINISH_TIME_POPUP_NORMAL_SEC;
  471. try {
  472. switch (nScreenId) {
  473. case ID.POPUPS.POPUP_ADMINPWINPUT:
  474. AdminPWInputPopup = new AdminPWInput(mContext, AllLayout);
  475. super.setCurrentScreen(AdminPWInputPopup);
  476. Style = Common.POPUP_STYLE_INPUT;
  477. break;
  478. case ID.POPUPS.POPUP_RELEASEINMODE:
  479. ReleaseInModePopup = new ReleaseInMode(mContext, AllLayout);
  480. super.setCurrentScreen(ReleaseInModePopup);
  481. Style = Common.POPUP_STYLE_NOMAL;
  482. break;
  483. case ID.POPUPS.POPUP_RELEASEOUTMODE :
  484. ReleaseOutModePopup = new ReleaseOutMode(mContext, AllLayout);
  485. super.setCurrentScreen(ReleaseOutModePopup);
  486. Style = Common.POPUP_STYLE_NOMAL;
  487. break;
  488. case ID.POPUPS.POPUP_DELETESHORTCUT:
  489. DeleteShortcutPopup = new DeleteShortcut(mContext, AllLayout);
  490. super.setCurrentScreen(DeleteShortcutPopup);
  491. Style = Common.POPUP_STYLE_NOMAL;
  492. break;
  493. case ID.POPUPS.POPUP_MORNINGCALL:
  494. FinishTime = 60 * 5 + 60 * 5 + 60 * 3 + 60;
  495. MorningCallPopup = new MorningCall(mContext, AllLayout);
  496. super.setCurrentScreen(MorningCallPopup);
  497. Style = Common.POPUP_STYLE_NOMAL;
  498. break;
  499. case ID.POPUPS.POPUP_PARCELRECEIVED:
  500. ParcelReceivedPopup = new ParcelReceived(mContext, AllLayout);
  501. super.setCurrentScreen(ParcelReceivedPopup);
  502. Style = Common.POPUP_STYLE_NOMAL;
  503. break;
  504. case ID.POPUPS.POPUP_POSTRECEIVED:
  505. PostReceivedPopup = new PostReceived(mContext, AllLayout);
  506. super.setCurrentScreen(PostReceivedPopup);
  507. Style = Common.POPUP_STYLE_NOMAL;
  508. break;
  509. case ID.POPUPS.POPUP_BANDLOCATIONALARM:
  510. BandLocationPopup = new BandLocationAlarmReceived(mContext, AllLayout);
  511. super.setCurrentScreen(BandLocationPopup);
  512. Style = Common.POPUP_STYLE_NOMAL;
  513. break;
  514. case ID.POPUPS.POPUP_COLLECTIVELIGHTCTRL:
  515. CollectiveLightCTRLPopup = new CollectiveLightCTRL(mContext, AllLayout , mWallPadAPI, OPERATION_MODE);
  516. super.setCurrentScreen(CollectiveLightCTRLPopup);
  517. Style = Common.POPUP_STYLE_NOMAL;
  518. break;
  519. case ID.POPUPS.POPUP_MOODLAMP:
  520. ModeLampPopup = new ModeLamp(mContext, AllLayout);
  521. super.setCurrentScreen(ModeLampPopup);
  522. Style = Common.POPUP_STYLE_INPUT;
  523. break;
  524. case ID.POPUPS.POPUP_ADDSHORTCUT:
  525. AddShortcutPopup = new AddShortcut(mContext, AllLayout);
  526. super.setCurrentScreen(AddShortcutPopup);
  527. Style = Common.POPUP_STYLE_NOMAL;
  528. break;
  529. case ID.POPUPS.POPUP_NOMORESHORTCUT:
  530. NoMoreShortcutPopup = new NoMoreShortcut(mContext, AllLayout);
  531. super.setCurrentScreen(NoMoreShortcutPopup);
  532. Style = Common.POPUP_STYLE_NOMAL;
  533. break;
  534. case ID.POPUPS.POPUP_DUPLICATEDSHORTCUT:
  535. DuplicatedShortcutPopup = new DuplicatedShortcut(mContext, AllLayout);
  536. super.setCurrentScreen(DuplicatedShortcutPopup);
  537. Style = Common.POPUP_STYLE_NOMAL;
  538. break;
  539. case ID.POPUPS.POPUP_ELEVATORCALL:
  540. ElevatorCallPopup = new ElevatorCall(mContext, AllLayout);
  541. super.setCurrentScreen(ElevatorCallPopup);
  542. Style = Common.POPUP_STYLE_NOMAL;
  543. break;
  544. case ID.POPUPS.POPUP_SCHEDULENOTIFICATION:
  545. ScheduleNotificationPopup = new ScheduleNotification(mContext, AllLayout);
  546. super.setCurrentScreen(ScheduleNotificationPopup);
  547. Style = Common.POPUP_STYLE_NOMAL;
  548. break;
  549. case ID.POPUPS.POPUP_ENERGYUSAGEALERT:
  550. FinishTime = 60 * 50;
  551. EnergyUsageAlertPopup = new EnergyUsageAlert(mContext, AllLayout);
  552. super.setCurrentScreen(EnergyUsageAlertPopup);
  553. Style = Common.POPUP_STYLE_NOMAL;
  554. break;
  555. case ID.POPUPS.POPUP_VEHICLEARRIVED:
  556. VehicleArrivedPopup = new VehicleArrived(mContext, AllLayout);
  557. super.setCurrentScreen(VehicleArrivedPopup);
  558. Style = Common.POPUP_STYLE_NOMAL;
  559. break;
  560. case ID.POPUPS.POPUP_CHARGINGELECTRICVEHICLE:
  561. ChargingElectricVehiclePopup = new ChargingElectricVehicle(mContext, AllLayout);
  562. super.setCurrentScreen(ChargingElectricVehiclePopup);
  563. Style = Common.POPUP_STYLE_NOMAL;
  564. break;
  565. case ID.POPUPS.POPUP_DIAGNOSTICMODE :
  566. FinishTime = 60 * 5 + 60 * 5 + 60 * 3 + 60;
  567. DiagnosticPopup = new DiagnosticMode(mContext, AllLayout, mWallPadAPI);
  568. super.setCurrentScreen(DiagnosticPopup);
  569. Style = Common.FULL_SCREEN;
  570. break;
  571. case ID.POPUPS.POPUP_ENERGYMETERAGE:
  572. AlarmUseEnergy_ServerConnectPopup = new AlarmUseEnergy_ServerConnect(mContext, AllLayout, mWallPadAPI);
  573. super.setCurrentScreen(AlarmUseEnergy_ServerConnectPopup);
  574. Style = Common.POPUP_STYLE_NOMAL;
  575. break;
  576. case ID.POPUPS.POPUP_SMARTKEYEMERGENCY:
  577. SmartKeyEmergencyPopup = new SmartKeyEmergency(mContext, AllLayout);
  578. super.setCurrentScreen(SmartKeyEmergencyPopup);
  579. Style = Common.POPUP_STYLE_NOMAL;
  580. break;
  581. case ID.POPUPS.POPUP_EVENTNOTIFICATION:
  582. EventNotificationPopup = new EventNotification(mContext, AllLayout);
  583. super.setCurrentScreen(EventNotificationPopup);
  584. Style = Common.POPUP_STYLE_EVENTNOTIFICATION;
  585. break;
  586. case ID.POPUPS.POPUP_CONFIGUREPRESET:
  587. ConfigurePresetPopup = new ConfigurePreset(mContext, AllLayout, mWallPadAPI);
  588. super.setCurrentScreen(ConfigurePresetPopup);
  589. Style = Common.POPUP_STYLE_LIGHTPRESET;
  590. break;
  591. case ID.POPUPS.POPUP_DEVICELOADING:
  592. DeviceLoadingPopup = new DeviceLoading(mContext, AllLayout);
  593. super.setCurrentScreen(DeviceLoadingPopup);
  594. Style = Common.POPUP_STYLE_NOMAL;
  595. break;
  596. case ID.POPUPS.POPUP_GROUP_CTRL:
  597. GroupCtrlPopup = new GroupCtrl(mContext, AllLayout, mWallPadAPI);
  598. super.setCurrentScreen(GroupCtrlPopup);
  599. Style = Common.POPUP_STYLE_FUNCGROUP;
  600. break;
  601. case ID.POPUPS.POPUP_GROUP_TALK:
  602. GroupTalkPopup = new GroupTalk(mContext, AllLayout, mWallPadAPI);
  603. super.setCurrentScreen(GroupTalkPopup);
  604. Style = Common.POPUP_STYLE_FUNCGROUP;
  605. break;
  606. case ID.POPUPS.POPUP_GROUP_SECURITY:
  607. GroupSecurityPopup = new GroupSecurity(mContext, AllLayout, mWallPadAPI);
  608. super.setCurrentScreen(GroupSecurityPopup);
  609. Style = Common.POPUP_STYLE_FUNCGROUP;
  610. break;
  611. case ID.POPUPS.POPUP_GROUP_ADD:
  612. GroupAddPopup = new GroupAdd(mContext, AllLayout, mWallPadAPI);
  613. super.setCurrentScreen(GroupAddPopup);
  614. Style = Common.POPUP_STYLE_FUNCGROUP;
  615. break;
  616. case ID.POPUPS.POPUP_GROUP_ENERGY:
  617. GroupEnergyPopup = new GroupEnergy(mContext, AllLayout, mWallPadAPI);
  618. super.setCurrentScreen(GroupEnergyPopup);
  619. Style = Common.POPUP_STYLE_FUNCGROUP;
  620. break;
  621. case ID.POPUPS.POPUP_GROUP_SETTING:
  622. GroupSettingPopup = new GroupSetting(mContext, AllLayout, mWallPadAPI);
  623. super.setCurrentScreen(GroupSettingPopup);
  624. Style = Common.POPUP_STYLE_FUNCGROUP;
  625. break;
  626. case ID.POPUPS.POPUP_INTERFLOORNOISEOCCURED:
  627. InterFloorNoiseOccuredPopup = new InterFloorNoiseOccured(mContext, AllLayout);
  628. super.setCurrentScreen(InterFloorNoiseOccuredPopup);
  629. Style = Common.POPUP_STYLE_NOMAL;
  630. break;
  631. case ID.POPUPS.POPUP_INTERFLOORNOISEERROR:
  632. InterFloorNoiseErrorPopup = new InterFloorNoiseError(mContext, AllLayout);
  633. super.setCurrentScreen(InterFloorNoiseErrorPopup);
  634. Style = Common.POPUP_STYLE_NOMAL;
  635. break;
  636. case ID.POPUPS.POPUP_NOTICESTRANGER:
  637. FinishTime = 3;
  638. NoticeDetectStrangerPopup = new NoticeDetectStranger(mContext, AllLayout);
  639. super.setCurrentScreen(NoticeDetectStrangerPopup);
  640. Style = Common.POPUP_STYLE_NOMAL;
  641. break;
  642. default:
  643. Log.e(TAG, "[Error] setChangeLayout - OnlyRemove Input ID_OLD Not found!!!");
  644. return false;
  645. }
  646. } catch (RuntimeException re) {
  647. LogUtil.errorLogInfo("", TAG, re);
  648. mCurrentScreenId = -1;
  649. return false;
  650. }
  651. catch (Exception e) {
  652. Log.e(TAG, "[ExceptionError] - setChangeScreen->Screen Create : " + e);
  653. mCurrentScreenId = -1;
  654. LogUtil.errorLogInfo("", TAG, e);
  655. return false;
  656. }
  657. // 2. Style 변경시 WindowReSize
  658. if (mCurrentStyle != Style) {
  659. int ScreenWidth = WpadScale.getWidth(Common.getPopupScreenSize_W(Style));
  660. int ScreenHigh = WpadScale.getHeight(Common.getPopupScreenSize_H(Style));
  661. Log.e(TAG, "[setChangeScreen] ScreenWidth [" + ScreenWidth + "], ScreenHigh [" + ScreenHigh + "]");
  662. if ((ScreenWidth <= 0) || (ScreenHigh <= 0)) {
  663. Log.e(TAG, "[Error] Style UnDefined !!! (" + Style + ")");
  664. return false;
  665. }
  666. RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ScreenWidth, ScreenHigh);
  667. AllLayout.setLayoutParams(params);
  668. setContentView(AllLayout);
  669. super.WindowReSize(ScreenWidth, ScreenHigh, false);
  670. mCurrentStyle = Style;
  671. }
  672. // 3. FinishTimer Setting
  673. if(Common.FINISH_TIME_ENABLE) super.setFinishTimerCreate(FinishTime);
  674. mCurrentScreenId = nScreenId;
  675. return true;
  676. }
  677. // 팝업화면에서 매뉴얼 화면을 호출하기 위함(PopupActivity -> ManualActivity)
  678. private static int mCurrentInfoScreenId = -1;
  679. private static boolean InfoActivityRun = false;
  680. public static boolean getInfoActivityRun() {
  681. Log.d(TAG, "[getInfoActivityRun] InfoActivityRun [" + InfoActivityRun + "]");
  682. return InfoActivityRun;
  683. }
  684. public static void setInfoActivityRun(boolean run) {
  685. InfoActivityRun = run;
  686. Log.d(TAG, "[setInfopActivityRun] InfoActivityRun [" + InfoActivityRun + "]");
  687. if (!InfoActivityRun) resetCurrentInfoScreenID();
  688. }
  689. public boolean StartInfo(int screenId) {
  690. Log.d(TAG, "[startManualPopup] ScreenId [" + screenId +"], mCurrentInfoScreenId [" + mCurrentInfoScreenId + "]" );
  691. if (getInfoActivityRun() == true) {
  692. mCurrentInfoScreenId = screenId;
  693. return ((WpadActivity)(ManualActivity.getContext())).ChangeScreen(screenId);
  694. } else {
  695. if (mCurrentInfoScreenId == screenId) return false;
  696. mCurrentInfoScreenId = screenId;
  697. setInfoActivityRun(true);
  698. Intent intent = new Intent(mContext, ManualActivity.class);
  699. intent.putExtra("ScreenId", screenId);
  700. overridePendingTransition(0, 0);
  701. startActivityForResult(intent, 0);
  702. return true;
  703. }
  704. }
  705. public static void resetCurrentInfoScreenID() {
  706. try {
  707. mCurrentInfoScreenId = -1;
  708. } catch (RuntimeException re) {
  709. LogUtil.errorLogInfo("", TAG, re);
  710. }
  711. catch (Exception e) {
  712. Log.e(TAG, "[Exception] resetCurrentInfoScreenID()");
  713. LogUtil.errorLogInfo("", TAG, e);
  714. }
  715. }
  716. /**
  717. * 매뉴얼 버튼 사용 유무
  718. *
  719. * @return boolean 타입 - true:사용, false:미사용
  720. */
  721. public boolean GetManualUse() {
  722. WallpadDeviceSet devSet = new WallpadDeviceSet(mContext);
  723. String[] DBinfo = devSet.GetSettingData("매뉴얼");
  724. devSet.closeDB();
  725. if (DBinfo != null) {
  726. if (DBinfo[1].indexOf("사용함") > 0) {
  727. Log.d(TAG, "[GetManualUse] Use Manual");
  728. return true;
  729. }
  730. else {
  731. // 미사용
  732. Log.d(TAG, "[GetManualUse] Not Use Manual");
  733. return false;
  734. }
  735. }
  736. else {
  737. // 미사용
  738. return false;
  739. }
  740. }
  741. private void ctrlLCDOff() {
  742. try {
  743. Log.d(TAG, "[ctrlLCDOff]");
  744. getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
  745. } catch (RuntimeException re) {
  746. LogUtil.errorLogInfo("", TAG, re);
  747. }
  748. catch (Exception e) {
  749. Log.e(TAG, "[Exception] ctrlLCDOff()");
  750. LogUtil.errorLogInfo("", TAG, e);
  751. }
  752. }
  753. private final int COMPONENT_USE = 1;
  754. private int getSmartDoorCamType() {
  755. try {
  756. WallpadDeviceSet mWallpadDeviceSet = new WallpadDeviceSet(getApplicationContext());
  757. int[] nFrontCam = mWallpadDeviceSet.Get_RFDoorCAM_Info();
  758. if (nFrontCam[0] == COMPONENT_USE) {
  759. if (nFrontCam[1] == WallpadDeviceSet.DOORTYPE_IOT_SMART
  760. || nFrontCam[1] == WallpadDeviceSet.DOORTYPE_HYOSUNG_SMART
  761. || nFrontCam[1] == WallpadDeviceSet.DOORTYPE_DAEWOO_SMART) {
  762. return nFrontCam[1];
  763. }
  764. }
  765. } catch (RuntimeException re) {
  766. LogUtil.errorLogInfo("", TAG, re);
  767. }
  768. catch (Exception e) {
  769. Log.e(TAG, "[Exception] getSmartDoorCamType()");
  770. LogUtil.errorLogInfo("", TAG, e);
  771. }
  772. return -1;
  773. }
  774. public boolean GetEasyModeUXUse() {
  775. try {
  776. WallpadDeviceSet deviceSet = new WallpadDeviceSet(mContext);
  777. boolean bSupport = deviceSet.Get_EasyModeUX_Support();
  778. deviceSet.closeDB();
  779. WallpadStatusData data = new WallpadStatusData(mContext);
  780. boolean bUse = data.GetEasyModeUxUse();
  781. data.closeDB();
  782. Log.d(TAG, "[GetEasyModeUXUse] bSupport [" + bSupport + "], bUse [" + bUse + "]");
  783. return bSupport & bUse;
  784. } catch (RuntimeException re) {
  785. LogUtil.errorLogInfo("", TAG, re);
  786. }
  787. catch (Exception e) {
  788. Log.e(TAG, "[Exception] GetEasyModeUXUse()");
  789. LogUtil.errorLogInfo("", TAG, e);
  790. }
  791. return false;
  792. }
  793. @Override
  794. public void setFinishOnTouchOutside(boolean finish) {
  795. super.setFinishOnTouchOutside(finish);
  796. Log.d(TAG, "[setFinishOnTouchOutside] finish [" + finish + "]");
  797. }
  798. }