| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938 |
- /*
- * Copyright (C) 2014 Android WallPad Project
- *
- * FileName : PopupActivity.java
- * Project : Android WallPad Project
- * Company : HDC I-CONTROLS ( www.icontrols.co.kr )
- * Author : Kang Sang Ho , lairu@icontrols.co.kr
- */
- package kr.co.icontrols.wallpadmain;
- import com.artncore.WallPadDataMgr.WallpadDeviceSet;
- import com.artncore.WallPadDataMgr.WallpadStatusData;
- import com.artncore.commons.define;
- import com.artncore.wallpadapi.WallPadAPI;
- import com.util.LogUtil;
- import android.annotation.SuppressLint;
- import android.content.Context;
- import android.content.Intent;
- import android.os.Bundle;
- import android.os.Handler;
- import android.os.Message;
- import android.util.Log;
- import android.view.KeyEvent;
- import android.view.MotionEvent;
- import android.view.View;
- import android.view.WindowManager;
- import android.widget.RelativeLayout;
- import kr.co.icontrols.wallpadmain.declare.Common;
- import kr.co.icontrols.wallpadmain.declare.ID;
- import kr.co.icontrols.wallpadmain.declare.ID_OLD;
- import kr.co.icontrols.wallpadmain.popup.AddShortcut;
- import kr.co.icontrols.wallpadmain.popup.AdminPWInput;
- import kr.co.icontrols.wallpadmain.popup.AlarmUseEnergy_ServerConnect;
- import kr.co.icontrols.wallpadmain.popup.BandLocationAlarmReceived;
- import kr.co.icontrols.wallpadmain.popup.ChargingElectricVehicle;
- import kr.co.icontrols.wallpadmain.popup.ConfigurePreset;
- import kr.co.icontrols.wallpadmain.popup.DeviceLoading;
- import kr.co.icontrols.wallpadmain.popup.DuplicatedShortcut;
- import kr.co.icontrols.wallpadmain.popup.EventNotification;
- import kr.co.icontrols.wallpadmain.popup.GroupAdd;
- import kr.co.icontrols.wallpadmain.popup.GroupCtrl;
- import kr.co.icontrols.wallpadmain.popup.GroupEnergy;
- import kr.co.icontrols.wallpadmain.popup.GroupSecurity;
- import kr.co.icontrols.wallpadmain.popup.GroupSetting;
- import kr.co.icontrols.wallpadmain.popup.GroupTalk;
- import kr.co.icontrols.wallpadmain.popup.InterFloorNoiseError;
- import kr.co.icontrols.wallpadmain.popup.InterFloorNoiseOccured;
- import kr.co.icontrols.wallpadmain.popup.NoMoreShortcut;
- import kr.co.icontrols.wallpadmain.popup.NoticeDetectStranger;
- import kr.co.icontrols.wallpadmain.popup.PostReceived;
- import kr.co.icontrols.wallpadmain.popup.ReleaseInMode;
- import kr.co.icontrols.wallpadmain.popup.SmartKeyEmergency;
- import kr.co.icontrols.wallpadmain.popup.ParcelReceived;
- import kr.co.icontrols.wallpadmain.popup.ScheduleNotification;
- import kr.co.icontrols.wallpadmain.popup.EnergyUsageAlert;
- import kr.co.icontrols.wallpadmain.popup.VehicleArrived;
- import kr.co.icontrols.wallpadmain.popup.DeleteShortcut;
- import kr.co.icontrols.wallpadmain.popup.DiagnosticMode;
- import kr.co.icontrols.wallpadmain.popup.ElevatorCall;
- import kr.co.icontrols.wallpadmain.popup.CollectiveLightCTRL;
- import kr.co.icontrols.wallpadmain.popup.ModeLamp;
- import kr.co.icontrols.wallpadmain.popup.MorningCall;
- import kr.co.icontrols.wallpadmain.popup.ReleaseOutMode;
- import kr.co.icontrols.wallpadsupport.WpadActivity;
- import kr.co.icontrols.wallpadsupport.WpadScale;
- /**
- * @description
- * 월패드 [설정화면] 팝업화면 관리자 이다.<br>
- */
- public class PopupActivity extends WpadActivity {
- private final static String TAG = "PopupActivity";
-
- private final boolean DEBUG_LOG_ON = true;
- private void DebugLogOutput(String s) { if(DEBUG_LOG_ON) Log.d(TAG, s); }
-
- // =================================================================================================
- // [[ Declaration ]] region
- // =================================================================================================
- private static Context mContext = null;
- public static Context getContext() { return mContext; }
- private WallPadAPI mWallPadAPI = null;
- private int OPERATION_MODE = Common.MODE;
- private WallpadStatusData wdb;
-
- // Layout
- private RelativeLayout AllLayout;
-
- // CurrentScreenId & mCurrentStyle
- private int mCurrentScreenId = -1;
- private int mCurrentStyle = -1;
- private int mTempCurrentScreenId = -1;
- public IOInterface mIOInterface = null;
-
- // CreateComplete
- private static boolean mCreateComplete = false;
- protected static boolean getCreateComplete() { return mCreateComplete; }
- protected static void setCreateComplete(boolean set) { mCreateComplete = set; }
-
- // Screen
- static AdminPWInput AdminPWInputPopup;
- static DeleteShortcut DeleteShortcutPopup;
- static AddShortcut AddShortcutPopup;
- static NoMoreShortcut NoMoreShortcutPopup;
- static DuplicatedShortcut DuplicatedShortcutPopup;
- static ElevatorCall ElevatorCallPopup;
- static ReleaseInMode ReleaseInModePopup;
- static ReleaseOutMode ReleaseOutModePopup;
- static MorningCall MorningCallPopup;
- static ParcelReceived ParcelReceivedPopup;
- static PostReceived PostReceivedPopup;
- static BandLocationAlarmReceived BandLocationPopup;
- static CollectiveLightCTRL CollectiveLightCTRLPopup;
- static ModeLamp ModeLampPopup;
- static DiagnosticMode DiagnosticPopup;
- static ScheduleNotification ScheduleNotificationPopup; // 등록된 일정 알림 팝업
- static EnergyUsageAlert EnergyUsageAlertPopup; // 에너지 목표값 대비 사용량 근접 및 초과 알림 팝업
- static VehicleArrived VehicleArrivedPopup; // 등록된 차량 도착 알림
- static ChargingElectricVehicle ChargingElectricVehiclePopup; // 전기차 충전 알림 팝업
- static AlarmUseEnergy_ServerConnect AlarmUseEnergy_ServerConnectPopup; // 에너지관리서버 연동 시 에너지 사용 알림 팝업
- static SmartKeyEmergency SmartKeyEmergencyPopup; // 스마트키 비상 팝업
- static EventNotification EventNotificationPopup;
- static ConfigurePreset ConfigurePresetPopup;
- static InterFloorNoiseOccured InterFloorNoiseOccuredPopup;
- static InterFloorNoiseError InterFloorNoiseErrorPopup;
- static DeviceLoading DeviceLoadingPopup;
- static GroupCtrl GroupCtrlPopup;
- static GroupTalk GroupTalkPopup;
- static GroupSecurity GroupSecurityPopup;
- static GroupAdd GroupAddPopup;
- static GroupEnergy GroupEnergyPopup;
- static GroupSetting GroupSettingPopup;
- static NoticeDetectStranger NoticeDetectStrangerPopup;
-
- public WallpadStatusData GetDBObj()
- {
- return wdb;
- }
-
-
- /**
- * Static Variables 초기화<br>
- * onCreate 도입부, onDestroy 종료시 삽입한다.
- */
- private void setStaticVariablesInit() {
- mContext = null;
- mCreateComplete = false;
- if (AllLayout != null) {
- AllLayout.removeAllViews();
- AllLayout = null;
- }
- }
-
- // =================================================================================================
- // [[ Activity Life Cycle ]] region
- // =================================================================================================
- /**
- * Activity Constructors
- */
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- Log.i(TAG, "-------------------------------------------------------------");
- Log.i(TAG, "------------------ [START - PopupActivity] ------------------");
- Log.i(TAG, "-------------------------------------------------------------");
-
- super.onCreate(savedInstanceState);
-
- // 1. 변수 초기화
- DebugLogOutput("[Create] - Step1 : EMData Create");
- setStaticVariablesInit();
- mContext = this;
-
- // 2. 자동 종료 셋팅
- DebugLogOutput("[Create] - Step2 : Auto Finish Setting");
- // 2-1. APP 종료 BR을 활성화 한다.
- super.setFinishBrEnable(true);
-
- // 3. API 호출
- DebugLogOutput("[Create] - Step3 : API Call");
- if (OPERATION_MODE == Common.MODE_NOMAL) {
- Log.d(TAG, "OperationMode = MODE_NOMAL");
- mWallPadAPI = new WallPadAPI(this);
- }
- else if (OPERATION_MODE == Common.MODE_BUSINESS_SAMPLE) {
- Log.d(TAG, "OperationMode = MODE_BUSINESS_SAMPLE");
- }
-
- try { wdb = new WallpadStatusData(this); }
- catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) { Log.e(TAG, "[ExceptionError] - onCreate->WallpadStatusData Create : " + e); }
-
- // 4. Layout registration
- DebugLogOutput("[Create] - Step4 : Layout registration");
- // 4-1. mainLayout
- AllLayout = new RelativeLayout(this);
- AllLayout.setId(ID_OLD.popup.layout.ALL);
- super.setAllLayoutRegistration(AllLayout);
-
- // 5. Start ScreenId EMData Get
- Intent intent = getIntent();
- int ScreenId = intent.getIntExtra("ScreenId", -1);
- Log.d(TAG, "ScreenId = " + ScreenId);
-
- if (ScreenId < 0) {
- Log.e(TAG, "[Error] ScreenId Out of range (" + ScreenId + ")");
- finish();
- }
- else {
- // 6. First Show Layout Find
- mCreateComplete = true;
- if (OPERATION_MODE == Common.MODE_NOMAL) {
- mTempCurrentScreenId = ScreenId;
- mWallPadApiCheckHandler.sendEmptyMessage(0);
- }
- else {
- if (setChangeScreen(ScreenId, false) == false) {
- Log.e(TAG, "[Error] setChangeScreen false...");
- finish();
- }
- }
- }
-
- Log.i(TAG, "End onCreate -------------------------------------------------");
- }
-
- /**
- * (임시코드) WallPadAPI 초기생성시 Connect 에 시간이 걸리며, <br>
- * WallPadAPI 초기화후 바로 Get_GasValveController 등을 사용하여 API 를 가져올수 없기에, <br>
- * 본 딜레이 코드를 임시로 적용한다.
- */
- @SuppressLint("HandlerLeak")
- protected Handler mWallPadApiCheckHandler = new Handler()
- {
- @SuppressLint("HandlerLeak")
- @Override
- public void handleMessage(Message msg)
- {
- if (msg.what == 0) {
- if (mWallPadAPI != null) {
- if (mWallPadAPI.Check_Connect()) mWallPadApiCheckHandler.sendEmptyMessageDelayed(1, 10);
- else mWallPadApiCheckHandler.sendEmptyMessageDelayed(0, 10);
- }
- } else if (msg.what == 1) {
- setChangeScreen(mTempCurrentScreenId, false);
- mIOInterface = new IOInterface(getContext(), mWallPadAPI);
- }
- }
- };
-
- /**
- * onDestroy
- */
- @Override
- protected void onDestroy() {
- try {
- super.onDestroy();
- setChangeScreen(mCurrentScreenId, true);
- setStaticVariablesInit();
- MainActivity.setPopupActivityRun(false);
- MainActivity.setInfoActivityRun(false);
- setInfoActivityRun(false);
- mCreateComplete = false;
- if( wdb != null )wdb.closeDB();
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- LogUtil.errorLogInfo("", TAG, e);
- }
- Log.d(TAG, "*************************************************************");
- Log.d(TAG, "****************** [END - PopupActivity] ******************");
- Log.d(TAG, "*************************************************************");
- }
- /**
- * onResume
- */
- @Override
- protected void onResume() {
- super.onResume();
- if(mWallPadAPI != null) mWallPadAPI.Resume();
- NoticeDetectStranger.bTouch = false;
- Log.d(TAG, "@@@@@@@@ [onResume] @@@@@@@@");
- }
-
- /**
- * onPause
- */
- @Override
- protected void onPause() {
- super.onPause();
- if(mWallPadAPI != null) mWallPadAPI.Pause();
- Log.d(TAG, "[onPause] mCurrentScreenId [" + mCurrentScreenId + "]");
- if (mCurrentScreenId == ID.POPUPS.POPUP_BANDLOCATIONALARM) ctrlLCDOff();
- else if (mCurrentScreenId == ID.POPUPS.POPUP_NOTICESTRANGER) {
- // 타임아웃 종료시(화면터치로 인한 종료가 아닐 경우) 거동수상자 녹화 시작
- boolean bResult = NoticeDetectStranger.bTouch;
- Log.d(TAG, "[onPause] bResult [" + bResult + "]");
- if (!bResult) {
- int kind = -1;
- if (getSmartDoorCamType() == WallpadDeviceSet.DOORTYPE_IOT_SMART
- || getSmartDoorCamType() == WallpadDeviceSet.DOORTYPE_HYOSUNG_SMART
- || getSmartDoorCamType() == WallpadDeviceSet.DOORTYPE_DAEWOO_SMART)
- kind = define.NOTIFY_ACCEPT_RECORD_STRANGER;
- // BR 전송
- Intent notiIntent = new Intent();
- notiIntent.setAction(define.NOTIFY_ACNAME);
- notiIntent.putExtra(define.NOTIBR_KIND, kind);
- mContext.sendBroadcast(notiIntent);
- }
- }
- Log.d(TAG, "@@@@@@@@ [onPause] @@@@@@@@");
- }
-
-
-
-
-
-
- /* ================================================================================================
- * [BroadcastReceiver] Section
- ================================================================================================ */
- /**
- * BroadcastReceiver.onReceive for [WpadActivity]
- */
- @Override
- protected void onBrReceive(Intent intent) {
- super.onBrReceive(intent);
-
- Log.d(TAG, "Receive alert BR " + intent.getAction());
- }
-
-
- /* ================================================================================================
- * [Touch & Key Event] Section
- ================================================================================================ */
- /**
- * TouchEvent for [WpadActivity]
- */
- @Override
- protected void onTouchEvent(View v, MotionEvent event) {
- super.onTouchEvent(v, event);
- }
-
- /**
- * H/W Key Event
- */
- @Override
- public boolean onKeyDown(int keyCode, KeyEvent event) {
- DebugLogOutput("onKeyDown - " + " / keyCode : " + keyCode + " / Action : " + event.getAction());
- return super.onKeyDown(keyCode, event);
- }
-
-
- /* ================================================================================================
- * [Screen] Section
- ================================================================================================ */
- /**
- * Screen 에서 Screen 변경을 요청할 경우 호출된다.<br>
- * Override 사용하여 Screen 변경을 처리한다.<br>
- *
- * @param nScreenId - 변경할 Screen ID_OLD
- * @return (boolean) true : 성공, false : 실패
- */
- @Override
- protected boolean onChangeScreen(int nScreenId) {
- super.onChangeScreen(nScreenId);
-
- return setChangeScreen(nScreenId, false);
- }
-
- /**
- * Screen 등록자<br>
- * ScreenLayout 에 현재 Screen 을 삭제하고, 새로운 Screen 을 등록시킨다.
- *
- * @param nScreenId - 변경할 Screen ID_OLD
- * @param OnlyRemove - 현재 Screen 을 삭제만 할 경우 (onDestroy 에서 사용)
- * @return (boolean) true : 성공, false : 실패
- */
- public boolean setChangeScreen(int nScreenId, boolean OnlyRemove) {
- Log.d(TAG, "[setChangeScreen] CurrentScreenId [" + mCurrentScreenId + "], NextLayoutId [" + nScreenId + "], OnlyRemove [" + OnlyRemove + "]");
-
- if (getCreateComplete() == false) {
- Log.w(TAG, "[Waring] setChangeLayout - CreateComplete is false !!!");
- return false;
- }
- if (mCurrentScreenId == nScreenId && !OnlyRemove) {
- Log.w(TAG, "[Waring] Same Screen Called!!!");
- return false;
- }
-
- //boolean remove = false;
- if (mCurrentScreenId > 0) {
- //remove = true;
- AllLayout.removeAllViews();
- super.setCurrentScreen(null);
- }
- if (OnlyRemove) {
- switch (mCurrentScreenId) {
- case ID.POPUPS.POPUP_ADMINPWINPUT:
- AdminPWInputPopup.Close();
- break;
- case ID.POPUPS.POPUP_RELEASEINMODE:
- ReleaseInModePopup.Close();
- break;
- case ID.POPUPS.POPUP_RELEASEOUTMODE:
- ReleaseOutModePopup.Close();
- break;
- case ID.POPUPS.POPUP_DELETESHORTCUT:
- DeleteShortcutPopup.Close();
- break;
- case ID.POPUPS.POPUP_MORNINGCALL:
- MorningCallPopup.Close();
- break;
- case ID.POPUPS.POPUP_PARCELRECEIVED:
- ParcelReceivedPopup.Close();
- break;
- case ID.POPUPS.POPUP_POSTRECEIVED:
- PostReceivedPopup.Close();
- break;
- case ID.POPUPS.POPUP_BANDLOCATIONALARM:
- BandLocationPopup.Close();
- break;
- case ID.POPUPS.POPUP_COLLECTIVELIGHTCTRL:
- CollectiveLightCTRLPopup.Close();
- break;
- case ID.POPUPS.POPUP_MOODLAMP:
- ModeLampPopup.Close();
- break;
- case ID.POPUPS.POPUP_ADDSHORTCUT:
- AddShortcutPopup.Close();
- break;
- case ID.POPUPS.POPUP_NOMORESHORTCUT:
- NoMoreShortcutPopup.Close();
- break;
- case ID.POPUPS.POPUP_DUPLICATEDSHORTCUT:
- DuplicatedShortcutPopup.Close();
- break;
- case ID.POPUPS.POPUP_ELEVATORCALL:
- ElevatorCallPopup.Close();
- break;
- case ID.POPUPS.POPUP_SCHEDULENOTIFICATION:
- ScheduleNotificationPopup.Close();
- break;
- case ID.POPUPS.POPUP_ENERGYUSAGEALERT:
- EnergyUsageAlertPopup.Close();
- break;
- case ID.POPUPS.POPUP_VEHICLEARRIVED:
- VehicleArrivedPopup.Close();
- break;
- case ID.POPUPS.POPUP_CHARGINGELECTRICVEHICLE:
- ChargingElectricVehiclePopup.Close();
- break;
- case ID.POPUPS.POPUP_DIAGNOSTICMODE:
- DiagnosticPopup.Close();
- break;
- case ID.POPUPS.POPUP_ENERGYMETERAGE:
- AlarmUseEnergy_ServerConnectPopup.Close();
- break;
- case ID.POPUPS.POPUP_SMARTKEYEMERGENCY:
- SmartKeyEmergencyPopup.Close();
- break;
- case ID.POPUPS.POPUP_EVENTNOTIFICATION:
- EventNotificationPopup.Close();
- break;
- case ID.POPUPS.POPUP_CONFIGUREPRESET:
- ConfigurePresetPopup.Close();
- break;
- case ID.POPUPS.POPUP_DEVICELOADING:
- DeviceLoadingPopup.Close();
- break;
- case ID.POPUPS.POPUP_GROUP_CTRL:
- GroupCtrlPopup.Close();
- break;
- case ID.POPUPS.POPUP_GROUP_TALK:
- GroupTalkPopup.Close();
- break;
- case ID.POPUPS.POPUP_GROUP_SECURITY:
- GroupSecurityPopup.Close();
- break;
- case ID.POPUPS.POPUP_GROUP_ADD:
- GroupAddPopup.Close();
- break;
- case ID.POPUPS.POPUP_GROUP_ENERGY:
- GroupEnergyPopup.Close();
- break;
- case ID.POPUPS.POPUP_GROUP_SETTING:
- GroupSettingPopup.Close();
- break;
- case ID.POPUPS.POPUP_INTERFLOORNOISEOCCURED:
- InterFloorNoiseOccuredPopup.Close();
- break;
- case ID.POPUPS.POPUP_INTERFLOORNOISEERROR:
- InterFloorNoiseErrorPopup.Close();
- break;
- case ID.POPUPS.POPUP_NOTICESTRANGER:
- NoticeDetectStrangerPopup.Close();
- break;
- default:
- Log.e(TAG, "[Error] setChangeLayout - OnlyRemove Input ID_OLD Not found!!!");
- return false;
- }
- return true;
- }
- if(Common.GetDeviceSampleMode(this)) OPERATION_MODE = Common.MODE_BUSINESS_SAMPLE;
- else OPERATION_MODE = Common.MODE_NOMAL;
-
- // 1. 새로운 Layout 표시
- int Style = Common.POPUP_STYLE_NOMAL;
- int FinishTime = Common.FINISH_TIME_POPUP_NORMAL_SEC;
- try {
- switch (nScreenId) {
- case ID.POPUPS.POPUP_ADMINPWINPUT:
- AdminPWInputPopup = new AdminPWInput(mContext, AllLayout);
- super.setCurrentScreen(AdminPWInputPopup);
- Style = Common.POPUP_STYLE_INPUT;
- break;
- case ID.POPUPS.POPUP_RELEASEINMODE:
- ReleaseInModePopup = new ReleaseInMode(mContext, AllLayout);
- super.setCurrentScreen(ReleaseInModePopup);
- Style = Common.POPUP_STYLE_NOMAL;
- break;
- case ID.POPUPS.POPUP_RELEASEOUTMODE :
- ReleaseOutModePopup = new ReleaseOutMode(mContext, AllLayout);
- super.setCurrentScreen(ReleaseOutModePopup);
- Style = Common.POPUP_STYLE_NOMAL;
- break;
- case ID.POPUPS.POPUP_DELETESHORTCUT:
- DeleteShortcutPopup = new DeleteShortcut(mContext, AllLayout);
- super.setCurrentScreen(DeleteShortcutPopup);
- Style = Common.POPUP_STYLE_NOMAL;
- break;
- case ID.POPUPS.POPUP_MORNINGCALL:
- FinishTime = 60 * 5 + 60 * 5 + 60 * 3 + 60;
- MorningCallPopup = new MorningCall(mContext, AllLayout);
- super.setCurrentScreen(MorningCallPopup);
- Style = Common.POPUP_STYLE_NOMAL;
- break;
- case ID.POPUPS.POPUP_PARCELRECEIVED:
- ParcelReceivedPopup = new ParcelReceived(mContext, AllLayout);
- super.setCurrentScreen(ParcelReceivedPopup);
- Style = Common.POPUP_STYLE_NOMAL;
- break;
- case ID.POPUPS.POPUP_POSTRECEIVED:
- PostReceivedPopup = new PostReceived(mContext, AllLayout);
- super.setCurrentScreen(PostReceivedPopup);
- Style = Common.POPUP_STYLE_NOMAL;
- break;
- case ID.POPUPS.POPUP_BANDLOCATIONALARM:
- BandLocationPopup = new BandLocationAlarmReceived(mContext, AllLayout);
- super.setCurrentScreen(BandLocationPopup);
- Style = Common.POPUP_STYLE_NOMAL;
- break;
- case ID.POPUPS.POPUP_COLLECTIVELIGHTCTRL:
- CollectiveLightCTRLPopup = new CollectiveLightCTRL(mContext, AllLayout , mWallPadAPI, OPERATION_MODE);
- super.setCurrentScreen(CollectiveLightCTRLPopup);
- Style = Common.POPUP_STYLE_NOMAL;
- break;
- case ID.POPUPS.POPUP_MOODLAMP:
- ModeLampPopup = new ModeLamp(mContext, AllLayout);
- super.setCurrentScreen(ModeLampPopup);
- Style = Common.POPUP_STYLE_INPUT;
- break;
- case ID.POPUPS.POPUP_ADDSHORTCUT:
- AddShortcutPopup = new AddShortcut(mContext, AllLayout);
- super.setCurrentScreen(AddShortcutPopup);
- Style = Common.POPUP_STYLE_NOMAL;
- break;
- case ID.POPUPS.POPUP_NOMORESHORTCUT:
- NoMoreShortcutPopup = new NoMoreShortcut(mContext, AllLayout);
- super.setCurrentScreen(NoMoreShortcutPopup);
- Style = Common.POPUP_STYLE_NOMAL;
- break;
- case ID.POPUPS.POPUP_DUPLICATEDSHORTCUT:
- DuplicatedShortcutPopup = new DuplicatedShortcut(mContext, AllLayout);
- super.setCurrentScreen(DuplicatedShortcutPopup);
- Style = Common.POPUP_STYLE_NOMAL;
- break;
- case ID.POPUPS.POPUP_ELEVATORCALL:
- ElevatorCallPopup = new ElevatorCall(mContext, AllLayout);
- super.setCurrentScreen(ElevatorCallPopup);
- Style = Common.POPUP_STYLE_NOMAL;
- break;
-
- case ID.POPUPS.POPUP_SCHEDULENOTIFICATION:
- ScheduleNotificationPopup = new ScheduleNotification(mContext, AllLayout);
- super.setCurrentScreen(ScheduleNotificationPopup);
- Style = Common.POPUP_STYLE_NOMAL;
- break;
- case ID.POPUPS.POPUP_ENERGYUSAGEALERT:
- FinishTime = 60 * 50;
- EnergyUsageAlertPopup = new EnergyUsageAlert(mContext, AllLayout);
- super.setCurrentScreen(EnergyUsageAlertPopup);
- Style = Common.POPUP_STYLE_NOMAL;
- break;
- case ID.POPUPS.POPUP_VEHICLEARRIVED:
- VehicleArrivedPopup = new VehicleArrived(mContext, AllLayout);
- super.setCurrentScreen(VehicleArrivedPopup);
- Style = Common.POPUP_STYLE_NOMAL;
- break;
- case ID.POPUPS.POPUP_CHARGINGELECTRICVEHICLE:
- ChargingElectricVehiclePopup = new ChargingElectricVehicle(mContext, AllLayout);
- super.setCurrentScreen(ChargingElectricVehiclePopup);
- Style = Common.POPUP_STYLE_NOMAL;
- break;
- case ID.POPUPS.POPUP_DIAGNOSTICMODE :
- FinishTime = 60 * 5 + 60 * 5 + 60 * 3 + 60;
- DiagnosticPopup = new DiagnosticMode(mContext, AllLayout, mWallPadAPI);
- super.setCurrentScreen(DiagnosticPopup);
- Style = Common.FULL_SCREEN;
- break;
- case ID.POPUPS.POPUP_ENERGYMETERAGE:
- AlarmUseEnergy_ServerConnectPopup = new AlarmUseEnergy_ServerConnect(mContext, AllLayout, mWallPadAPI);
- super.setCurrentScreen(AlarmUseEnergy_ServerConnectPopup);
- Style = Common.POPUP_STYLE_NOMAL;
- break;
- case ID.POPUPS.POPUP_SMARTKEYEMERGENCY:
- SmartKeyEmergencyPopup = new SmartKeyEmergency(mContext, AllLayout);
- super.setCurrentScreen(SmartKeyEmergencyPopup);
- Style = Common.POPUP_STYLE_NOMAL;
- break;
- case ID.POPUPS.POPUP_EVENTNOTIFICATION:
- EventNotificationPopup = new EventNotification(mContext, AllLayout);
- super.setCurrentScreen(EventNotificationPopup);
- Style = Common.POPUP_STYLE_EVENTNOTIFICATION;
- break;
- case ID.POPUPS.POPUP_CONFIGUREPRESET:
- ConfigurePresetPopup = new ConfigurePreset(mContext, AllLayout, mWallPadAPI);
- super.setCurrentScreen(ConfigurePresetPopup);
- Style = Common.POPUP_STYLE_LIGHTPRESET;
- break;
- case ID.POPUPS.POPUP_DEVICELOADING:
- DeviceLoadingPopup = new DeviceLoading(mContext, AllLayout);
- super.setCurrentScreen(DeviceLoadingPopup);
- Style = Common.POPUP_STYLE_NOMAL;
- break;
- case ID.POPUPS.POPUP_GROUP_CTRL:
- GroupCtrlPopup = new GroupCtrl(mContext, AllLayout, mWallPadAPI);
- super.setCurrentScreen(GroupCtrlPopup);
- Style = Common.POPUP_STYLE_FUNCGROUP;
- break;
- case ID.POPUPS.POPUP_GROUP_TALK:
- GroupTalkPopup = new GroupTalk(mContext, AllLayout, mWallPadAPI);
- super.setCurrentScreen(GroupTalkPopup);
- Style = Common.POPUP_STYLE_FUNCGROUP;
- break;
- case ID.POPUPS.POPUP_GROUP_SECURITY:
- GroupSecurityPopup = new GroupSecurity(mContext, AllLayout, mWallPadAPI);
- super.setCurrentScreen(GroupSecurityPopup);
- Style = Common.POPUP_STYLE_FUNCGROUP;
- break;
- case ID.POPUPS.POPUP_GROUP_ADD:
- GroupAddPopup = new GroupAdd(mContext, AllLayout, mWallPadAPI);
- super.setCurrentScreen(GroupAddPopup);
- Style = Common.POPUP_STYLE_FUNCGROUP;
- break;
- case ID.POPUPS.POPUP_GROUP_ENERGY:
- GroupEnergyPopup = new GroupEnergy(mContext, AllLayout, mWallPadAPI);
- super.setCurrentScreen(GroupEnergyPopup);
- Style = Common.POPUP_STYLE_FUNCGROUP;
- break;
- case ID.POPUPS.POPUP_GROUP_SETTING:
- GroupSettingPopup = new GroupSetting(mContext, AllLayout, mWallPadAPI);
- super.setCurrentScreen(GroupSettingPopup);
- Style = Common.POPUP_STYLE_FUNCGROUP;
- break;
- case ID.POPUPS.POPUP_INTERFLOORNOISEOCCURED:
- InterFloorNoiseOccuredPopup = new InterFloorNoiseOccured(mContext, AllLayout);
- super.setCurrentScreen(InterFloorNoiseOccuredPopup);
- Style = Common.POPUP_STYLE_NOMAL;
- break;
- case ID.POPUPS.POPUP_INTERFLOORNOISEERROR:
- InterFloorNoiseErrorPopup = new InterFloorNoiseError(mContext, AllLayout);
- super.setCurrentScreen(InterFloorNoiseErrorPopup);
- Style = Common.POPUP_STYLE_NOMAL;
- break;
- case ID.POPUPS.POPUP_NOTICESTRANGER:
- FinishTime = 3;
- NoticeDetectStrangerPopup = new NoticeDetectStranger(mContext, AllLayout);
- super.setCurrentScreen(NoticeDetectStrangerPopup);
- Style = Common.POPUP_STYLE_NOMAL;
- break;
- default:
- Log.e(TAG, "[Error] setChangeLayout - OnlyRemove Input ID_OLD Not found!!!");
- return false;
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- mCurrentScreenId = -1;
- return false;
- }
- catch (Exception e) {
- Log.e(TAG, "[ExceptionError] - setChangeScreen->Screen Create : " + e);
- mCurrentScreenId = -1;
- LogUtil.errorLogInfo("", TAG, e);
- return false;
- }
-
- // 2. Style 변경시 WindowReSize
- if (mCurrentStyle != Style) {
- int ScreenWidth = WpadScale.getWidth(Common.getPopupScreenSize_W(Style));
- int ScreenHigh = WpadScale.getHeight(Common.getPopupScreenSize_H(Style));
- Log.e(TAG, "[setChangeScreen] ScreenWidth [" + ScreenWidth + "], ScreenHigh [" + ScreenHigh + "]");
- if ((ScreenWidth <= 0) || (ScreenHigh <= 0)) {
- Log.e(TAG, "[Error] Style UnDefined !!! (" + Style + ")");
- return false;
- }
- RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ScreenWidth, ScreenHigh);
- AllLayout.setLayoutParams(params);
- setContentView(AllLayout);
- super.WindowReSize(ScreenWidth, ScreenHigh, false);
- mCurrentStyle = Style;
- }
-
- // 3. FinishTimer Setting
- if(Common.FINISH_TIME_ENABLE) super.setFinishTimerCreate(FinishTime);
-
- mCurrentScreenId = nScreenId;
-
- return true;
- }
-
- // 팝업화면에서 매뉴얼 화면을 호출하기 위함(PopupActivity -> ManualActivity)
- private static int mCurrentInfoScreenId = -1;
- private static boolean InfoActivityRun = false;
- public static boolean getInfoActivityRun() {
- Log.d(TAG, "[getInfoActivityRun] InfoActivityRun [" + InfoActivityRun + "]");
- return InfoActivityRun;
- }
- public static void setInfoActivityRun(boolean run) {
- InfoActivityRun = run;
- Log.d(TAG, "[setInfopActivityRun] InfoActivityRun [" + InfoActivityRun + "]");
- if (!InfoActivityRun) resetCurrentInfoScreenID();
- }
-
- public boolean StartInfo(int screenId) {
- Log.d(TAG, "[startManualPopup] ScreenId [" + screenId +"], mCurrentInfoScreenId [" + mCurrentInfoScreenId + "]" );
- if (getInfoActivityRun() == true) {
- mCurrentInfoScreenId = screenId;
- return ((WpadActivity)(ManualActivity.getContext())).ChangeScreen(screenId);
- } else {
- if (mCurrentInfoScreenId == screenId) return false;
- mCurrentInfoScreenId = screenId;
- setInfoActivityRun(true);
- Intent intent = new Intent(mContext, ManualActivity.class);
- intent.putExtra("ScreenId", screenId);
- overridePendingTransition(0, 0);
- startActivityForResult(intent, 0);
- return true;
- }
- }
-
- public static void resetCurrentInfoScreenID() {
- try {
- mCurrentInfoScreenId = -1;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] resetCurrentInfoScreenID()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- /**
- * 매뉴얼 버튼 사용 유무
- *
- * @return boolean 타입 - true:사용, false:미사용
- */
- public boolean GetManualUse() {
- WallpadDeviceSet devSet = new WallpadDeviceSet(mContext);
- String[] DBinfo = devSet.GetSettingData("매뉴얼");
- devSet.closeDB();
- if (DBinfo != null) {
- if (DBinfo[1].indexOf("사용함") > 0) {
- Log.d(TAG, "[GetManualUse] Use Manual");
- return true;
- }
- else {
- // 미사용
- Log.d(TAG, "[GetManualUse] Not Use Manual");
- return false;
- }
- }
- else {
- // 미사용
- return false;
- }
- }
- private void ctrlLCDOff() {
- try {
- Log.d(TAG, "[ctrlLCDOff]");
- getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] ctrlLCDOff()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- }
- private final int COMPONENT_USE = 1;
- private int getSmartDoorCamType() {
- try {
- WallpadDeviceSet mWallpadDeviceSet = new WallpadDeviceSet(getApplicationContext());
- int[] nFrontCam = mWallpadDeviceSet.Get_RFDoorCAM_Info();
- if (nFrontCam[0] == COMPONENT_USE) {
- if (nFrontCam[1] == WallpadDeviceSet.DOORTYPE_IOT_SMART
- || nFrontCam[1] == WallpadDeviceSet.DOORTYPE_HYOSUNG_SMART
- || nFrontCam[1] == WallpadDeviceSet.DOORTYPE_DAEWOO_SMART) {
- return nFrontCam[1];
- }
- }
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] getSmartDoorCamType()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- return -1;
- }
- public boolean GetEasyModeUXUse() {
- try {
- WallpadDeviceSet deviceSet = new WallpadDeviceSet(mContext);
- boolean bSupport = deviceSet.Get_EasyModeUX_Support();
- deviceSet.closeDB();
- WallpadStatusData data = new WallpadStatusData(mContext);
- boolean bUse = data.GetEasyModeUxUse();
- data.closeDB();
- Log.d(TAG, "[GetEasyModeUXUse] bSupport [" + bSupport + "], bUse [" + bUse + "]");
- return bSupport & bUse;
- } catch (RuntimeException re) {
- LogUtil.errorLogInfo("", TAG, re);
- }
- catch (Exception e) {
- Log.e(TAG, "[Exception] GetEasyModeUXUse()");
- LogUtil.errorLogInfo("", TAG, e);
- }
- return false;
- }
- @Override
- public void setFinishOnTouchOutside(boolean finish) {
- super.setFinishOnTouchOutside(finish);
- Log.d(TAG, "[setFinishOnTouchOutside] finish [" + finish + "]");
- }
- }
|