|
@@ -15,19 +15,27 @@ import android.content.Intent;
|
|
|
import android.graphics.Color;
|
|
|
import android.os.Handler;
|
|
|
import android.os.Message;
|
|
|
+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.RelativeLayout;
|
|
|
+import android.widget.Toast;
|
|
|
|
|
|
import com.artncore.WallPadDataMgr.WallpadDeviceSet;
|
|
|
+import com.artncore.WallPadDataMgr.WallpadStatusData;
|
|
|
import com.artncore.commons.DataClasses.HeatingV2;
|
|
|
+import com.artncore.commons.define;
|
|
|
import com.util.LogUtil;
|
|
|
import com.artncore.wallpadapi.HeatingV2API;
|
|
|
import com.artncore.wallpadapi.HeatingV2API.POLLING_MODE;
|
|
|
import com.artncore.wallpadapi.WallPadAPI;
|
|
|
|
|
|
+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;
|
|
@@ -35,6 +43,7 @@ import kr.co.icontrols.wallpadhomectrl.declare.ID;
|
|
|
import kr.co.icontrols.wallpadsupport.Version;
|
|
|
import kr.co.icontrols.wallpadsupport.WpadImageView;
|
|
|
import kr.co.icontrols.wallpadsupport.WpadImageView.TOUCH_KIND;
|
|
|
+import kr.co.icontrols.wallpadsupport.WpadScale;
|
|
|
import kr.co.icontrols.wallpadsupport.WpadScreen;
|
|
|
import kr.co.icontrols.wallpadsupport.WpadSound.SND;
|
|
|
import kr.co.icontrols.wallpadsupport.WpadTextView;
|
|
@@ -70,6 +79,7 @@ public class HeatingV2PopupScreen extends WpadScreen {
|
|
|
private WpadImageView ExitBtn; // 종료버튼
|
|
|
private WpadImageView RoomSel_LeftBtn, RoomSel_RightBtn; // 방선택좌/우
|
|
|
private WpadImageView TabDefaultBtn, TabReservationBtn, TabSleepBtn; // 탭 : 기본설정 , 예약설정, 취침설정
|
|
|
+ private WpadImageView EditBtn; // 방명칭 편집 버튼
|
|
|
private WpadTextView TitleText; // 방이름
|
|
|
|
|
|
// [기본설정 - Image & Button & Text]
|
|
@@ -78,6 +88,7 @@ public class HeatingV2PopupScreen extends WpadScreen {
|
|
|
private WpadImageView D_NowTempBox, D_SetTempBox; // 현재온도, 설정온도 박스
|
|
|
//private WpadImageView D_ModeBox; // 운전모드 표시박스
|
|
|
private WpadImageView D_FireMark; // 불꽃표시
|
|
|
+ private EditText nameEditText; // 방명칭 편집 에디트박스
|
|
|
|
|
|
private WpadImageView D_OnOffBtn; // ON/OFF 버튼
|
|
|
private WpadImageView D_HeatingBtn, D_ReservationBtn, D_SleepBtn; // 난방,예약,취침 버튼
|
|
@@ -116,6 +127,24 @@ public class HeatingV2PopupScreen extends WpadScreen {
|
|
|
private int OPERATION_MODE = -1;
|
|
|
|
|
|
private int UX_MODE = -1; // UX 모드 (0: 일반 / 1: 간편모드)
|
|
|
+
|
|
|
+ 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 mCurrentTabStatus = -1;
|
|
|
private int mCurrentRoomIndex = 0;
|
|
@@ -184,6 +213,7 @@ public class HeatingV2PopupScreen extends WpadScreen {
|
|
|
DebugLogOutput("[Create] - Step1 : Data Create");
|
|
|
OPERATION_MODE = operationMode;
|
|
|
mData = new Data();
|
|
|
+ if (wallpadStatusData == null) wallpadStatusData = new WallpadStatusData(context);
|
|
|
|
|
|
UX_MODE = ((PopupActivity) context).GetEasyModeUXUse() ? Common.UX_EASY_MODE : Common.UX_NORMAL_MODE;
|
|
|
Log.d(TAG, "[HeatingV2PopupScreen] UX_MODE [" + UX_MODE + "]");
|
|
@@ -321,6 +351,31 @@ public class HeatingV2PopupScreen extends WpadScreen {
|
|
|
ViewRegistration(layout, m_Manual, Common.PopupAlarmMarginLEFT(169), Common.PopupAlarmMarginTOP(120));
|
|
|
setManualBtnVisible( PopupActivity.getManualUse() );
|
|
|
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+
|
|
|
// 현재탭은 이미지 변경이 아닌 텍스트 색 변경으로 표현하도록 한다(신규 월패드)
|
|
|
|
|
|
TabDefaultText = new WpadTextView(context, true, 174, 68, Gravity.CENTER, Color.rgb(0xff, 0x7d, 0x00), Common.fontsize._30, false, ID.heatingV2Popup.text.TAB_DEFAULT);
|
|
@@ -580,6 +635,8 @@ public class HeatingV2PopupScreen extends WpadScreen {
|
|
|
Device_SetPollingMode(POLLING_MODE.Normal, (byte) 0);
|
|
|
}
|
|
|
|
|
|
+ if (wallpadStatusData != null) wallpadStatusData.closeDB();
|
|
|
+
|
|
|
// (노말모드) 설정온도 변경이 있었을 경우 설정온도 셋팅
|
|
|
if (OPERATION_MODE == Common.MODE_NOMAL) {
|
|
|
Device_NowTempSet();
|
|
@@ -599,6 +656,7 @@ public class HeatingV2PopupScreen extends WpadScreen {
|
|
|
|
|
|
// (영업샘플모드) 변경 데이터 전달
|
|
|
if (OPERATION_MODE == Common.MODE_BUSINESS_SAMPLE) Sample_setPopupResult();
|
|
|
+ if (edit_state == EDIT_STATE.Normal) setPopupResult();
|
|
|
}
|
|
|
|
|
|
// =================================================================================================
|
|
@@ -674,7 +732,7 @@ public class HeatingV2PopupScreen extends WpadScreen {
|
|
|
Sound().Play(SND.effect.TOUCH_LATCHED);
|
|
|
|
|
|
if (OPERATION_MODE == Common.MODE_BUSINESS_SAMPLE) Sample_setPopupResult();
|
|
|
-
|
|
|
+ if (edit_state == EDIT_STATE.Normal) setPopupResult();
|
|
|
super.finish();
|
|
|
}
|
|
|
else if (TargetId == ID.heatingV2Popup.button.MANUAL)
|
|
@@ -687,6 +745,8 @@ public class HeatingV2PopupScreen extends WpadScreen {
|
|
|
else if (TargetId == ID.heatingV2Popup.button.ROOMSEL_LEFT) {
|
|
|
DebugLogOutput("onTouchEvent [ROOMSEL_LEFT] BUTTON !!!");
|
|
|
Sound().Play(SND.effect.TOUCH_LATCHED);
|
|
|
+ edit_state = EDIT_STATE.Normal;
|
|
|
+ setEditStatus();
|
|
|
|
|
|
if (OPERATION_MODE == Common.MODE_NOMAL) {
|
|
|
Device_NowTempSet();
|
|
@@ -711,6 +771,8 @@ public class HeatingV2PopupScreen extends WpadScreen {
|
|
|
else if (TargetId == ID.heatingV2Popup.button.ROOMSEL_RIGHT) {
|
|
|
DebugLogOutput("onTouchEvent [ROOMSEL_RIGHT] BUTTON !!!");
|
|
|
Sound().Play(SND.effect.TOUCH_LATCHED);
|
|
|
+ edit_state = EDIT_STATE.Normal;
|
|
|
+ setEditStatus();
|
|
|
|
|
|
if (OPERATION_MODE == Common.MODE_NOMAL) {
|
|
|
Device_NowTempSet();
|
|
@@ -732,6 +794,8 @@ public class HeatingV2PopupScreen extends WpadScreen {
|
|
|
} else if ((TargetId >= ID.heatingV2Popup.text.TAB_DEFAULT) && (TargetId <= ID.heatingV2Popup.text.TAB_SLEEP)) {
|
|
|
int index = TargetId - ID.heatingV2Popup.text.TAB_DEFAULT;
|
|
|
DebugLogOutput("onTouchEvent [TAB_" + (index + 1) + "] BUTTON !!!");
|
|
|
+ edit_state = EDIT_STATE.Normal;
|
|
|
+ setEditStatus();
|
|
|
|
|
|
if (mCurrentTabStatus != TargetId) {
|
|
|
Sound().Play(SND.effect.TOUCH_LATCHED);
|
|
@@ -749,6 +813,10 @@ public class HeatingV2PopupScreen extends WpadScreen {
|
|
|
Draw_TabChange(TargetId);
|
|
|
drawUpdate((byte) mCurrentRoomIndex);
|
|
|
}
|
|
|
+ } else if (TargetId == ID.heatingV2Popup.button.EDIT) {
|
|
|
+ Log.d(TAG, "[onTouchEvent] EDIT BUTTON");
|
|
|
+ Sound().Play(SND.effect.TOUCH_LATCHED);
|
|
|
+ editRoomName();
|
|
|
}
|
|
|
}
|
|
|
} else if ((TargetId >= ID.heatingV2Popup.tabDefault.BASE) && (TargetId < ID.heatingV2Popup.tabReserbation.BASE)) {
|
|
@@ -977,8 +1045,7 @@ public class HeatingV2PopupScreen extends WpadScreen {
|
|
|
Log.i(TAG, "[drawUpdate] (index != Common.INDEX_ALL) && (index != (byte) mCurrentRoomIndex)");
|
|
|
return;
|
|
|
}
|
|
|
- //int pos = ROOM_POS[index];
|
|
|
- //HeatingV2.RoomData roomData = mData.heatingV2.Device.Room[pos];
|
|
|
+
|
|
|
HeatingV2.RoomData roomData = mData.heatingV2.Device.Room[mCurrentRoomIndex];
|
|
|
|
|
|
// 운전모드 , 밸브상태 갱신
|
|
@@ -1343,6 +1410,65 @@ public class HeatingV2PopupScreen extends WpadScreen {
|
|
|
else TimeBtnArray[index].setButtonDefaultImageID();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 룸 명칭을 편집한다.
|
|
|
+ */
|
|
|
+ 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_HEATING))
|
|
|
+ wallpadStatusData.SetRoomNameChangeByUser(1, define.ROOM_NAME_HEATING); // 사용자에 의해 방명칭 수정시 1로 저장 (추후 방명칭 변경 여부 판단 기준)
|
|
|
+ }
|
|
|
+ mRoomNameList[mCurrentRoomIndex] = editNameRoom;
|
|
|
+ if (wallpadStatusData.SetDevRoomNameList(mRoomNameList, define.ROOM_NAME_HEATING) < 0) {
|
|
|
+ wallpadStatusData.GetDevRoomNameList(define.ROOM_NAME_HEATING);
|
|
|
+ int nRet = wallpadStatusData.SetDevRoomNameList(mRoomNameList, define.ROOM_NAME_HEATING);
|
|
|
+ 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
|
|
|
// =================================================================================================
|
|
@@ -1885,6 +2011,16 @@ public class HeatingV2PopupScreen extends WpadScreen {
|
|
|
Device_SetSleep((byte) mCurrentRoomIndex, SetTemp, SetTime);
|
|
|
}
|
|
|
|
|
|
+ private void setPopupResult() {
|
|
|
+ Intent data = new Intent();
|
|
|
+
|
|
|
+ // SCREEN
|
|
|
+ data.putExtra("SCREEN", ID.screen.HeatingV2PopupScreen);
|
|
|
+ data.putExtra("REFRESH", true);
|
|
|
+
|
|
|
+ super.setPopupResult(data);
|
|
|
+ }
|
|
|
+
|
|
|
// =================================================================================================
|
|
|
// [[ Sample ]] region
|
|
|
// =================================================================================================
|
|
@@ -1983,6 +2119,7 @@ public class HeatingV2PopupScreen extends WpadScreen {
|
|
|
}
|
|
|
|
|
|
data.putExtra("SCREEN", ID.screen.HeatingV2PopupScreen);
|
|
|
+ data.putExtra("SAMPLE_CTRL", true);
|
|
|
data.putExtra("CURTEMP_ARRAY", CurTempArray);
|
|
|
data.putExtra("SETTEMP_ARRAY", SetTempArray);
|
|
|
data.putExtra("MODE_ARRAY", ModeArray);
|