|
@@ -7,13 +7,18 @@ import android.graphics.Bitmap;
|
|
|
import android.graphics.BitmapFactory;
|
|
|
import android.graphics.Color;
|
|
|
import android.graphics.drawable.Drawable;
|
|
|
+import android.text.InputFilter;
|
|
|
import android.util.Log;
|
|
|
+import android.util.TypedValue;
|
|
|
import android.view.Gravity;
|
|
|
import android.view.MotionEvent;
|
|
|
import android.view.View;
|
|
|
+import android.view.inputmethod.InputMethodManager;
|
|
|
+import android.widget.EditText;
|
|
|
import android.widget.ImageView;
|
|
|
import android.widget.RelativeLayout;
|
|
|
import android.widget.SeekBar;
|
|
|
+import android.widget.Toast;
|
|
|
|
|
|
import com.artncore.WallPadDataMgr.WallpadDeviceSet;
|
|
|
import com.artncore.WallPadDataMgr.WallpadStatusData;
|
|
@@ -29,6 +34,7 @@ import com.util.LogUtil;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
+import kr.co.icontrols.wallpadhomectrl.MainActivity;
|
|
|
import kr.co.icontrols.wallpadhomectrl.PopupActivity;
|
|
|
import kr.co.icontrols.wallpadhomectrl.R;
|
|
|
import kr.co.icontrols.wallpadhomectrl.declare.Common;
|
|
@@ -67,6 +73,8 @@ public class LightKnxPopupRoomScreen extends WpadScreen {
|
|
|
private WpadImageView AllOnBtn, AllOffBtn; // 전체켜기 / 끄기
|
|
|
private WpadImageView Light1, Light2, Light3, Light4, Light5, Light6, Light7, Light8;
|
|
|
private WpadImageView[] LightImageArray = new WpadImageView[]{Light1, Light2, Light3, Light4, Light5, Light6, Light7, Light8};
|
|
|
+ private WpadImageView EditBtn; // 방명칭 편집 버튼
|
|
|
+ private EditText nameEditText; // 방명칭 편집 에디트박스
|
|
|
|
|
|
// [Text]
|
|
|
private WpadTextView TitleText; // 방이름
|
|
@@ -74,9 +82,27 @@ public class LightKnxPopupRoomScreen extends WpadScreen {
|
|
|
|
|
|
// [Variables]
|
|
|
private int OPERATION_MODE = -1;
|
|
|
- private ArrayList<String> mRoomNameList = null; // 각방 명칭
|
|
|
+ private String[] mRoomNameList = null; // 각방 명칭 // 각방 명칭
|
|
|
private Data_KnxLiv mData = null; // 데이터
|
|
|
|
|
|
+ WallpadStatusData wallpadStatusData = null;
|
|
|
+ private String originRoomName = "";
|
|
|
+
|
|
|
+ private InputMethodManager inputMethodManager;
|
|
|
+
|
|
|
+ private EDIT_STATE edit_state = EDIT_STATE.Normal;
|
|
|
+
|
|
|
+ public enum EDIT_STATE {
|
|
|
+ Normal(0),
|
|
|
+ Edit(1),
|
|
|
+ Other(100);
|
|
|
+ private int mIdx;
|
|
|
+
|
|
|
+ private EDIT_STATE(int idx) {
|
|
|
+ this.mIdx = idx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private int mCurrentRoomIndex = 0;
|
|
|
private int mRoomIndex = 0;
|
|
|
public int AllEMcount = 0;
|
|
@@ -92,11 +118,8 @@ public class LightKnxPopupRoomScreen extends WpadScreen {
|
|
|
//private final int[] ROOM_POS = {10,11,12,13,14,15,16,7,8,9,0,1,2,3,4,5,6,17,18,19,20};
|
|
|
|
|
|
|
|
|
- private String[] mDefaultRoomNameList = new String[]{"거실", "거실", "침실4", "침실1", "파우더룸", "침실2", "주방1", "침실3",
|
|
|
- "복도1", "욕실1", "욕실2","보조주방","욕실3","욕실4","욕실5","복도2", "현관", "신발장", "창고", "주방2", "간이주방"};
|
|
|
-
|
|
|
- private String[] mDefaultRoomNameList_PH = new String[]{"거실", "거실", "침실4", "침실1", "파우더룸", "침실2", "주방1", "침실3",
|
|
|
- "복도1", "욕실1", "욕실2","보조주방","욕실3","욕실4","욕실5","복도2", "현관", "신발장", "창고", "주방2", "간이주방", "임시","임시","임시","임시"};
|
|
|
+ private String[] mKNXDefaultRoomNameList = new String[]{"거실", "거실", "침실4", "침실1", "파우더룸", "침실2", "주방1", "침실3",
|
|
|
+ "복도1", "욕실1", "욕실2","보조주방","욕실3","욕실4","욕실5","복도2", "현관", "신발장", "창고", "주방2", "간이주방", "서재1", "작업실","드레스룸3","추가룸1","추가룸2","추가룸3","추가룸4","추가룸5"};
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -208,9 +231,7 @@ public class LightKnxPopupRoomScreen extends WpadScreen {
|
|
|
|
|
|
WallpadStatusData wd = new WallpadStatusData(this.getContext());
|
|
|
Log.d(TAG, "[Step 0] - prev db val = " + wd.GetCurrentScreenIDValue());
|
|
|
-
|
|
|
wallpaddbmgr.AddressSet addc = wd.getAddressMGR(); // DB에서 동호 정보 받아옴
|
|
|
-
|
|
|
wd.closeDB();
|
|
|
|
|
|
// 동, 호, ip 정보 저장
|
|
@@ -218,30 +239,21 @@ public class LightKnxPopupRoomScreen extends WpadScreen {
|
|
|
myDong = addc.Dong;
|
|
|
myHo = addc.Ho;
|
|
|
|
|
|
- if(Integer.parseInt(myHo)>2000){
|
|
|
- mDefaultRoomNameList = new String[]{"거실", "거실", "침실4", "침실1", "파우더룸", "침실2", "침실3", "복도1",
|
|
|
- "욕실1", "주방1", "세탁실","욕실2","간이주방","욕실3","테라스","현관", "신발장", "창고", "화장실", "계단", "테라스", "키친룸","세탁실","간이주방","욕실3"};
|
|
|
- }
|
|
|
-
|
|
|
// 1. Data Create
|
|
|
DebugLogOutput("[Create] - Step1 : Data Create");
|
|
|
OPERATION_MODE = operationMode;
|
|
|
- //OPERATION_MODE = Common.MODE_BUSINESS_SAMPLE;
|
|
|
+ OPERATION_MODE = Common.MODE_BUSINESS_SAMPLE;
|
|
|
mData = new Data_KnxLiv();
|
|
|
-
|
|
|
-
|
|
|
+ if (wallpadStatusData == null) wallpadStatusData = new WallpadStatusData(context);
|
|
|
|
|
|
// 2. Device API Load & Update
|
|
|
DebugLogOutput("[Create] - Step2 : Device API Load & Update");
|
|
|
if (OPERATION_MODE == Common.MODE_NOMAL) {
|
|
|
- DebugLogOutput("OPERATION_MODE = MODE_NOMAL");
|
|
|
if (Device_ApiLoad(wpapi) >= 0) Device_Update(false, Common.INDEX_ALL);
|
|
|
} else if (OPERATION_MODE == Common.MODE_BUSINESS_SAMPLE) {
|
|
|
- DebugLogOutput("OPERATION_MODE = MODE_BUSINESS_SAMPLE");
|
|
|
// 샘플 데이터 로드
|
|
|
LoadSampleData_NewLiv();
|
|
|
} else {
|
|
|
- DebugLogOutput("OPERATION_MODE = Other (" + OPERATION_MODE + " ... Change Mode -> MODE_NOMAL");
|
|
|
OPERATION_MODE = Common.MODE_NOMAL;
|
|
|
}
|
|
|
|
|
@@ -251,18 +263,15 @@ public class LightKnxPopupRoomScreen extends WpadScreen {
|
|
|
String[] strValue = devSet.GetSettingData("UI순서");
|
|
|
devSet.closeDB();
|
|
|
|
|
|
- // 현대건설 더 펜트하우스 서버에서 설정된 UI 순서를 이용하도록 한다.
|
|
|
+ //서버에서 설정된 UI 순서를 이용하도록 한다.
|
|
|
if( strValue != null ) {
|
|
|
String strLight = strValue[1].substring( (strValue[1].indexOf("조명(") + 3) , (strValue[1].indexOf(")난방(")));
|
|
|
//String strHeating = strValue[1].substring( (strValue[1].indexOf("난방(") + 3) , (strValue[1].indexOf(")에어컨(")));
|
|
|
//String strAircon = strValue[1].substring( (strValue[1].indexOf("에어컨(") + 4) , (strValue[1].indexOf("))")));
|
|
|
- //DebugLogOutput("[Create] - room name strlight " + strLight);
|
|
|
- //DebugLogOutput("[Create] - room name strHeating " + strHeating);
|
|
|
- //DebugLogOutput("[Create] - room name strAircon " + strAircon);
|
|
|
|
|
|
int strLightCount = Integer.valueOf(strLight.substring(0, strLight.indexOf(":")));
|
|
|
|
|
|
- if(strLightCount==(mData.MasterController.Info.Bad_EnergyMeterCount + mData.MasterController.Info.Liv_EnergyMeterCount)){
|
|
|
+ if(strLightCount==(mData.MasterController.Info.Light_SwitchCount + mData.MasterController.Info.Bad_EnergyMeterCount + mData.MasterController.Info.Liv_EnergyMeterCount)){
|
|
|
//개수가 일치하는 경우에 적용
|
|
|
strLight = strLight.substring(strLight.indexOf(":")+1);
|
|
|
String[] strDataSeq = strLight.split("_");
|
|
@@ -284,12 +293,11 @@ public class LightKnxPopupRoomScreen extends WpadScreen {
|
|
|
Log.d(TAG, "mCurrentRoomIndex = " + mCurrentRoomIndex);
|
|
|
|
|
|
// 방명칭
|
|
|
- mRoomNameList = intent.getStringArrayListExtra("ROOM_NAME_ARRAY");
|
|
|
- if (mRoomNameList == null) {
|
|
|
- Log.d(TAG, "mRoomNameList = null");
|
|
|
- } else {
|
|
|
- for (int i = 0; i < mRoomNameList.size(); i++)
|
|
|
- Log.d(TAG, "mRoomNameList[" + i + "] " + mRoomNameList.get(i));
|
|
|
+ String[] RoomNameArray = null;
|
|
|
+ RoomNameArray = intent.getStringArrayExtra("ROOM_NAME_ARRAY");
|
|
|
+ if (RoomNameArray != null) {
|
|
|
+ mRoomNameList = RoomNameArray;
|
|
|
+ originRoomName = mRoomNameList[mCurrentRoomIndex];
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -330,6 +338,31 @@ public class LightKnxPopupRoomScreen extends WpadScreen {
|
|
|
TitleText = new WpadTextView(context, false, 322, 90, Gravity.CENTER, Color.WHITE, Common.fontsize._36, true, ID.lightKnxPopupRoom.text.TITLE);
|
|
|
ViewRegistration(getLayout(), TitleText, Common.PopupNomalMarginLEFT(465), Common.PopupNomalMarginTOP(62));
|
|
|
|
|
|
+ if (MainActivity.bRoomNameEditUse) {
|
|
|
+ nameEditText = new EditText(context);
|
|
|
+ RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(WpadScale.getWidth(282), WpadScale.getHeight(59));
|
|
|
+ params.setMargins(WpadScale.getWidth(Common.PopupNomalMarginLEFT(482)), WpadScale.getHeight(Common.PopupNomalMarginTOP(79)), 0, 0);
|
|
|
+ nameEditText.setLayoutParams(params);
|
|
|
+ nameEditText.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER);
|
|
|
+ nameEditText.setTextSize(TypedValue.COMPLEX_UNIT_PX, (float) Common.fontsize._26_DEFAULT);
|
|
|
+ nameEditText.setTextColor(Color.BLACK);
|
|
|
+ nameEditText.setSingleLine(true);
|
|
|
+
|
|
|
+ int maxLength = 6;
|
|
|
+ InputFilter[] filterArray = new InputFilter[1];
|
|
|
+ filterArray[0] = new InputFilter.LengthFilter(maxLength);
|
|
|
+ nameEditText.setFilters(filterArray);
|
|
|
+ layout.addView(nameEditText);
|
|
|
+ nameEditText.setVisibility(View.INVISIBLE);
|
|
|
+
|
|
|
+ EditBtn = new WpadImageView(context, TOUCH_KIND.BUTTON, 78, 78, R.drawable.btn_edit_normal, R.drawable.btn_edit_pressed, ID.heatingV2Popup.button.EDIT);
|
|
|
+ int leftMargin = Common.PopupAlarmMarginLEFT(153);
|
|
|
+ if (PopupActivity.getManualUse()) leftMargin = Common.PopupAlarmMarginLEFT(269);
|
|
|
+ ViewRegistration(layout, EditBtn, leftMargin, Common.PopupNomalMarginTOP(68));
|
|
|
+
|
|
|
+ inputMethodManager = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
|
|
|
+ }
|
|
|
+
|
|
|
//SeekBar 등록
|
|
|
Registration_SeekBar();
|
|
|
|
|
@@ -352,6 +385,7 @@ public class LightKnxPopupRoomScreen extends WpadScreen {
|
|
|
super.onClose();
|
|
|
// 등록된 BR 을 해제 한다.
|
|
|
if (KnxApi != null) Device_BrRegistration(false);
|
|
|
+ if (wallpadStatusData != null) wallpadStatusData.closeDB();
|
|
|
Log.i(TAG, "[END - Screen] ********************************************");
|
|
|
}
|
|
|
|
|
@@ -363,6 +397,7 @@ public class LightKnxPopupRoomScreen extends WpadScreen {
|
|
|
super.onOutSideTouchExit();
|
|
|
// (영업샘플모드) 변경 데이터 전달
|
|
|
if (OPERATION_MODE == Common.MODE_BUSINESS_SAMPLE) Sample_setPopupResult();
|
|
|
+ if (edit_state == EDIT_STATE.Normal) setPopupResult();
|
|
|
}
|
|
|
|
|
|
// =================================================================================================
|
|
@@ -588,11 +623,14 @@ public class LightKnxPopupRoomScreen extends WpadScreen {
|
|
|
if (TargetId == ID.lightKnxPopupRoom.button.EXIT) {
|
|
|
DebugLogOutput("onTouchEvent [EXIT] BUTTON !!!");
|
|
|
Sound().Play(SND.effect.TOUCH_LATCHED);
|
|
|
- if (OPERATION_MODE == Common.MODE_BUSINESS_SAMPLE) Sample_setPopupResult();
|
|
|
+ //if (OPERATION_MODE == Common.MODE_BUSINESS_SAMPLE) Sample_setPopupResult();
|
|
|
+ if (edit_state == EDIT_STATE.Normal) setPopupResult();
|
|
|
super.finish();
|
|
|
} else if (TargetId == ID.lightKnxPopupRoom.button.ROOMSEL_LEFT) {
|
|
|
DebugLogOutput("onTouchEvent [ROOMSEL_LEFT] BUTTON !!!");
|
|
|
Sound().Play(SND.effect.TOUCH_LATCHED);
|
|
|
+ edit_state = EDIT_STATE.Normal;
|
|
|
+ setEditStatus();
|
|
|
|
|
|
mRoomIndex--;
|
|
|
if (mRoomIndex < 0) mRoomIndex = AllEMcount - 1;
|
|
@@ -605,6 +643,8 @@ public class LightKnxPopupRoomScreen extends WpadScreen {
|
|
|
} else if (TargetId == ID.lightKnxPopupRoom.button.ROOMSEL_RIGHT) {
|
|
|
DebugLogOutput("onTouchEvent [ROOMSEL_RIGHT] BUTTON !!!");
|
|
|
Sound().Play(SND.effect.TOUCH_LATCHED);
|
|
|
+ edit_state = EDIT_STATE.Normal;
|
|
|
+ setEditStatus();
|
|
|
|
|
|
mRoomIndex++;
|
|
|
if (mRoomIndex >= AllEMcount) mRoomIndex = 0;
|
|
@@ -657,6 +697,10 @@ public class LightKnxPopupRoomScreen extends WpadScreen {
|
|
|
Log.d(TAG, "[onTouchEvent] MANUAL BUTTON");
|
|
|
Sound().Play(SND.effect.TOUCH_LATCHED);
|
|
|
((PopupActivity) (getContext())).StartManual(ID.MANUAL.MANUAL_EtcMultiLightPop);
|
|
|
+ } else if (TargetId == ID.heatingV2Popup.button.EDIT) {
|
|
|
+ Log.d(TAG, "[onTouchEvent] EDIT BUTTON");
|
|
|
+ Sound().Play(SND.effect.TOUCH_LATCHED);
|
|
|
+ editRoomName();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -846,7 +890,9 @@ public class LightKnxPopupRoomScreen extends WpadScreen {
|
|
|
*/
|
|
|
private void Draw_TitleChange(int index) {
|
|
|
if ((index < 0) || (index > 31)) return;
|
|
|
- TitleText.setText(mDefaultRoomNameList[index]);
|
|
|
+ //TitleText.setText(mKNXDefaultRoomNameList[index]);
|
|
|
+ TitleText.setText(mRoomNameList[index]);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
@@ -939,6 +985,66 @@ public class LightKnxPopupRoomScreen extends WpadScreen {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 룸 명칭을 편집한다.
|
|
|
+ */
|
|
|
+ private void editRoomName() {
|
|
|
+ Log.d(TAG, "[editRoomName] edit_state [" + edit_state + "]");
|
|
|
+ if (edit_state == EDIT_STATE.Normal) {
|
|
|
+ edit_state = EDIT_STATE.Edit;
|
|
|
+ setEditStatus();
|
|
|
+ } else if (edit_state == EDIT_STATE.Edit) {
|
|
|
+
|
|
|
+ String editNameRoom = nameEditText.getText().toString();
|
|
|
+ if (editNameRoom.equals("")) {
|
|
|
+ Sound().Play(SND.effect.TOUCH_UNLATCHED);
|
|
|
+ Toast.makeText(getContext(), "방 명칭을 정확히 입력하세요.", Toast.LENGTH_SHORT).show();
|
|
|
+ } else {
|
|
|
+ edit_state = EDIT_STATE.Normal;
|
|
|
+ setEditStatus();
|
|
|
+ if (!editNameRoom.equals(originRoomName)) {
|
|
|
+ if (!wallpadStatusData.GetRoomNameChangeByUser(define.ROOM_NAME_LIGHT))
|
|
|
+ wallpadStatusData.SetRoomNameChangeByUser(1, define.ROOM_NAME_LIGHT); // 사용자에 의해 방명칭 수정시 1로 저장 (추후 방명칭 변경 여부 판단 기준)
|
|
|
+ }
|
|
|
+ mRoomNameList[mCurrentRoomIndex] = editNameRoom;
|
|
|
+ if (wallpadStatusData.SetDevRoomNameList(mRoomNameList, define.ROOM_NAME_LIGHT) < 0) {
|
|
|
+ wallpadStatusData.GetDevRoomNameList(define.ROOM_NAME_LIGHT);
|
|
|
+ int nRet = wallpadStatusData.SetDevRoomNameList(mRoomNameList, define.ROOM_NAME_LIGHT);
|
|
|
+ Log.d(TAG, "[editRoomName] nRet [" + nRet + "]");
|
|
|
+ }
|
|
|
+ TitleText.setText(editNameRoom);
|
|
|
+ setPopupResult();
|
|
|
+ inputMethodManager.hideSoftInputFromWindow(nameEditText.getWindowToken(), 0);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ Log.w(TAG, "[editRoomName] Not invalid EDIT_STATE [" + edit_state + "]");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void setEditStatus() {
|
|
|
+ Log.d(TAG, "[setEditStatus] edit_state [" + edit_state + "]");
|
|
|
+ if (edit_state == EDIT_STATE.Normal) {
|
|
|
+ if (EditBtn != null) EditBtn.setImageChange(R.drawable.btn_edit_normal, R.drawable.btn_edit_pressed);
|
|
|
+ if (nameEditText != null) nameEditText.setVisibility(View.INVISIBLE);
|
|
|
+ if (TitleText != null) {
|
|
|
+ TitleText.setVisibility(View.VISIBLE);
|
|
|
+ TitleText.bringToFront();
|
|
|
+ }
|
|
|
+ } else if (edit_state == EDIT_STATE.Edit) {
|
|
|
+ if (EditBtn != null) EditBtn.setImageChange(R.drawable.btn_edit_ok_normal, R.drawable.btn_edit_ok_pressed);
|
|
|
+ if (nameEditText != null) {
|
|
|
+ nameEditText.setText(TitleText.getText().toString());
|
|
|
+ nameEditText.setVisibility(View.VISIBLE);
|
|
|
+ nameEditText.bringToFront();
|
|
|
+ }
|
|
|
+ if (TitleText != null) TitleText.setVisibility(View.INVISIBLE);
|
|
|
+ } else {
|
|
|
+ Log.w(TAG, "[setEditStatus] Not invalid EDIT_STATE [" + edit_state + "]");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
// =================================================================================================
|
|
|
// [[ Device ]] region
|
|
|
// =================================================================================================
|
|
@@ -1245,6 +1351,16 @@ public class LightKnxPopupRoomScreen extends WpadScreen {
|
|
|
return LightOnOff;
|
|
|
}
|
|
|
|
|
|
+ private void setPopupResult() {
|
|
|
+ Intent data = new Intent();
|
|
|
+
|
|
|
+ // SCREEN
|
|
|
+ data.putExtra("SCREEN", ID.screen.LightKnxPopupRoomScreen);
|
|
|
+ data.putExtra("REFRESH", true);
|
|
|
+
|
|
|
+ super.setPopupResult(data);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
// =================================================================================================
|
|
|
// [[ Sample ]] region
|