浏览代码

[수정사항]
1. Led Bulb 주석 추가.

aaron 9 年之前
父节点
当前提交
e51b88cf0e

+ 3 - 1
color_picker/src/main/java/com/flask/colorpicker/ColorPickerView.java

@@ -36,6 +36,7 @@ public class ColorPickerView extends View {
 	private float lightness = 1;
 	private float alpha = 1;
 	private int backgroundColor = 0x00000000;
+	private int offlineColor = 0xffebebeb;
 
 	private Integer initialColors[] = new Integer[]{null, null, null, null, null};
 	private int colorSelection = 0;
@@ -255,7 +256,8 @@ public class ColorPickerView extends View {
 				canvas.drawCircle(currentColorCircle.getX(), currentColorCircle.getY(), size * STROKE_RATIO, selectorStroke2);
 				canvas.drawCircle(currentColorCircle.getX(), currentColorCircle.getY(), size * (1 + (STROKE_RATIO - 1) / 2), selectorStroke1);
 			} else {
-				color = 15461355;
+				// view disable 시 그레이 컬러 처리.
+				color = offlineColor;
 			}
 			colorWheelFill.setColor(color);
 			colorWheelFill.setAlpha((int) (alpha * 0xff));

+ 3 - 2
color_picker/src/main/java/com/flask/colorpicker/renderer/FlowerColorWheelRenderer.java

@@ -31,7 +31,8 @@ public class FlowerColorWheelRenderer extends AbsColorWheelRenderer {
 			float radius = maxRadius * p;
 			float size = Math.max(1.5f + strokeWidth, cSize + (i == 0 ? 0 : cSize * sizeJitter * jitter));
 			int total = Math.min(calcTotalCount(radius, size), density * 2);
-			int color = 15461355;
+			// default gray color (for offline)
+			int color = 0xffebebeb;
 
 			for (int j = 0; j < total; j++) {
 				double angle = Math.PI * 2 * j / total + (Math.PI / total) * ((i + 1) % 2);
@@ -40,7 +41,7 @@ public class FlowerColorWheelRenderer extends AbsColorWheelRenderer {
 				hsv[0] = (float) (angle * 180 / Math.PI);
 				hsv[1] = radius / maxRadius;
 				hsv[2] = colorWheelRenderOption.lightness;
-				// TODO : 비활성화시 컬러 변경
+
 				if (mIsEnable) {
 					hsv[0] = (float) (angle * 180 / Math.PI);
 					hsv[1] = radius / maxRadius;

+ 5 - 1
color_picker/src/main/java/com/flask/colorpicker/renderer/SimpleColorWheelRenderer.java

@@ -21,23 +21,27 @@ public class SimpleColorWheelRenderer extends AbsColorWheelRenderer {
 		float half = colorWheelRenderOption.targetCanvas.getWidth() / 2f;
 		int density = colorWheelRenderOption.density;
 		float maxRadius = colorWheelRenderOption.maxRadius;
-		int color = 15461355;
 
 		for (int i = 0; i < density; i++) {
 			float p = (float) i / (density - 1); // 0~1
 			float radius = maxRadius * p;
 			float size = colorWheelRenderOption.cSize;
 			int total = calcTotalCount(radius, size);
+			// default gray color (for offline)
+			int color = 0xffebebeb;
 
 			for (int j = 0; j < total; j++) {
 				double angle = Math.PI * 2 * j / total + (Math.PI / total) * ((i + 1) % 2);
 				float x = half + (float) (radius * Math.cos(angle));
 				float y = half + (float) (radius * Math.sin(angle));
+
 				if (mIsEnable) {
 					hsv[0] = (float) (angle * 180 / Math.PI);
 					hsv[1] = radius / maxRadius;
 					hsv[2] = colorWheelRenderOption.lightness;
 					color = Color.HSVToColor(hsv);
+				} else {
+					Color.colorToHSV(color, hsv);
 				}
 				selectorFill.setColor(color);
 				selectorFill.setAlpha(getAlphaValueAsInt());

+ 116 - 101
kneet_v3/src/main/java/com/ntels/kneet/v3/view/things/ThingsDeviceLedBulbDetail.java

@@ -10,7 +10,6 @@ import com.flask.colorpicker.OnColorSelectedListener;
 import com.ntels.kneet.v3.R;
 import com.ntels.kneet.v3.common.AppConfig;
 import com.ntels.kneet.v3.common.Constants;
-import com.ntels.kneet.v3.common.c_interface.ListInterface;
 import com.ntels.kneet.v3.common.c_interface.OnDataSendToReslut;
 import com.ntels.kneet.v3.common.http.HttpSend;
 import com.ntels.kneet.v3.common.http.Response;
@@ -33,7 +32,6 @@ import android.content.Context;
 import android.content.DialogInterface;
 import android.content.Intent;
 import android.content.ServiceConnection;
-import android.graphics.Color;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.IBinder;
@@ -223,6 +221,97 @@ public class ThingsDeviceLedBulbDetail extends CustomActionBarActivity implement
         displayListView();
     }
 
+    @Override
+    public void onBackPressed() {
+
+        intent = new Intent();
+        intent.putExtra(Constants.EXTRA_RELOAD_FLAG, mIsReloadFinish);
+        mActivity.setResult(RESULT_CANCELED, intent);
+        finish();
+    }
+
+    @Override
+    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+
+        super.onActivityResult(requestCode, resultCode, data);
+        if (resultCode == RESULT_OK) {
+            switch (requestCode) {
+                case Constants.ACT_THINGS_NAME_CHANGE:
+                    mIsReloadFinish = true;
+                    comHandler.sendMessageDelayed(comHandler.obtainMessage(MSG_COM_G_DEVICES_DEVICE_ID), 10);
+                    break;
+                default:
+                    break;
+            }
+        } else {
+            if (mAppConfig.getGoErr()) {
+                mActivity.setResult(RESULT_CANCELED, new Intent());
+                finish();
+            }
+        }
+    }
+
+    @Override
+    public void onClick(View view) {
+
+        switch (view.getId()) {
+            case R.id.llBtn1:
+                onBackPressed();
+                break;
+            case R.id.btnRowBody1_Contents_On:
+                setPower("ON");
+                break;
+            case R.id.btnRowBody1_Contents_Off:
+                setPower("OFF");
+                break;
+            default:
+                break;
+        }
+    }
+
+    @Override
+    public void resultCustomDialogResponse(int msgId, int btnResult) {
+
+        switch (msgId) {
+
+            case Constants.MSG998:
+                mUtil.callApp_Start(mActivity, "LOGOUT");
+                break;
+            case Constants.MSG997:
+                mUtil.callApp_Start(mActivity, "HOME_RELOAD");
+                break;
+            case Constants.MSG807:
+                if (btnResult == 1) {
+                    comHandler.sendMessageDelayed(comHandler.obtainMessage(mType), 10);
+                }
+                break;
+            default:
+                break;
+        }
+    }
+
+    Handler comHandler = new Handler(new IncomingHandlerCallBack());
+
+    class IncomingHandlerCallBack implements Handler.Callback {
+
+        @Override
+        public boolean handleMessage(Message msg) {
+
+            mType = msg.what;
+            switch (msg.what) {
+                case MSG_COM_G_DEVICES_DEVICE_ID:
+                    sendGetDevicesDetail();
+                    break;
+                case MSG_COM_WS_NODE_COMMAND:
+                    sendWsNodeCommand();
+                    break;
+                default:
+                    break;
+            }
+            return true;
+        }
+    }
+
     /**
      * 툴바 셋팅.
      */
@@ -261,7 +350,7 @@ public class ThingsDeviceLedBulbDetail extends CustomActionBarActivity implement
     /**
      * 현재 홈허브 상태(온라인, 오프라인 등)에 따라 타이틀과 리스트를 보여준다.
      */
-    public void setHomeHubStateAll() {
+    private void setHomeHubStateAll() {
 
         setHomeHubStateTitle();
         setHomeHubStateList();
@@ -270,7 +359,7 @@ public class ThingsDeviceLedBulbDetail extends CustomActionBarActivity implement
     /**
      * 현재 홈허브 상태(온라인, 오프라인 등)에 따라 다른 타이틀을 보여준다.
      */
-    public void setHomeHubStateTitle() {
+    private void setHomeHubStateTitle() {
 
         if (mAppConfig.getSelect_Homegrp_Id().equals("")) {
             //홈그룹 없을경우
@@ -428,6 +517,11 @@ public class ThingsDeviceLedBulbDetail extends CustomActionBarActivity implement
         }
     }
 
+    /**
+     * Led Bulb 컬러 변경.
+     *
+     * @param selectedColor 선택된 컬러
+     */
     private void setBulbColor(int selectedColor) {
         float[] hsb = mUtil.rgbToHsb(selectedColor);
         mCmdclsId = CMDCLS_ID_HSB_COLOR;
@@ -445,46 +539,6 @@ public class ThingsDeviceLedBulbDetail extends CustomActionBarActivity implement
         mSwipeRefreshLayout.setEnabled(false);
     }
 
-    @Override
-    public void onClick(View view) {
-
-        switch (view.getId()) {
-            case R.id.llBtn1:
-                onBackPressed();
-                break;
-            case R.id.btnRowBody1_Contents_On:
-                setPower("ON");
-                break;
-            case R.id.btnRowBody1_Contents_Off:
-                setPower("OFF");
-                break;
-            default:
-                break;
-        }
-    }
-
-    Handler comHandler = new Handler(new IncomingHandlerCallBack());
-
-    class IncomingHandlerCallBack implements Handler.Callback {
-
-        @Override
-        public boolean handleMessage(Message msg) {
-
-            mType = msg.what;
-            switch (msg.what) {
-                case MSG_COM_G_DEVICES_DEVICE_ID:
-                    sendGetDevicesDetail();
-                    break;
-                case MSG_COM_WS_NODE_COMMAND:
-                    sendWsNodeCommand();
-                    break;
-                default:
-                    break;
-            }
-            return true;
-        }
-    }
-
     /**
      * 장치 상세조회(해당 장치의 상세 정보를 조회한다. (장치가 보유한 모든 커맨드 클래스 리스트를 보여준다)) 요청.
      */
@@ -588,27 +642,6 @@ public class ThingsDeviceLedBulbDetail extends CustomActionBarActivity implement
         }
     }
 
-    @Override
-    public void resultCustomDialogResponse(int msgId, int btnResult) {
-
-        switch (msgId) {
-
-            case Constants.MSG998:
-                mUtil.callApp_Start(mActivity, "LOGOUT");
-                break;
-            case Constants.MSG997:
-                mUtil.callApp_Start(mActivity, "HOME_RELOAD");
-                break;
-            case Constants.MSG807:
-                if (btnResult == 1) {
-                    comHandler.sendMessageDelayed(comHandler.obtainMessage(mType), 10);
-                }
-                break;
-            default:
-                break;
-        }
-    }
-
     /**
      * 메뉴 선택 시 처리.
      *
@@ -684,42 +717,6 @@ public class ThingsDeviceLedBulbDetail extends CustomActionBarActivity implement
         }
     }
 
-    @Override
-    protected void onSaveInstanceState(Bundle outState) {
-
-        super.onSaveInstanceState(outState);
-    }
-
-    @Override
-    public void onBackPressed() {
-
-        intent = new Intent();
-        intent.putExtra(Constants.EXTRA_RELOAD_FLAG, mIsReloadFinish);
-        mActivity.setResult(RESULT_CANCELED, intent);
-        finish();
-    }
-
-    @Override
-    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
-
-        super.onActivityResult(requestCode, resultCode, data);
-        if (resultCode == RESULT_OK) {
-            switch (requestCode) {
-                case Constants.ACT_THINGS_NAME_CHANGE:
-                    mIsReloadFinish = true;
-                    comHandler.sendMessageDelayed(comHandler.obtainMessage(MSG_COM_G_DEVICES_DEVICE_ID), 10);
-                    break;
-                default:
-                    break;
-            }
-        } else {
-            if (mAppConfig.getGoErr()) {
-                mActivity.setResult(RESULT_CANCELED, new Intent());
-                finish();
-            }
-        }
-    }
-
     /**
      * 서비스 허브에 노드 제어를 요청한다.
      */
@@ -835,18 +832,31 @@ public class ThingsDeviceLedBulbDetail extends CustomActionBarActivity implement
         setHomeHubStateList();
     }
 
+    /**
+     * Led Bulb 밝기 변경.
+     *
+     * @param progress 밝기 정도 (0 ~ 99)
+     */
     private void setDimming(int progress) {
         mCmdclsId = CMDCLS_ID_DIMMING;
         mRequestValue = String.valueOf(progress);
         comHandler.sendEmptyMessageDelayed(MSG_COM_WS_NODE_COMMAND, Constants.HANDLER_DELAY_MILLIS);
     }
 
+    /**
+     * Led Bulb 색온도 변경.
+     *
+     * @param progress 색온도 (0 ~ 100)
+     */
     private void setWhiteLevel(int progress) {
         mCmdclsId = CMDCLS_ID_WHITE_LEVEL;
         mRequestValue = String.valueOf(progress);
         comHandler.sendEmptyMessageDelayed(MSG_COM_WS_NODE_COMMAND, Constants.HANDLER_DELAY_MILLIS);
     }
 
+    /**
+     * 노드 데이터 셋팅.
+     */
     private void setNodeDisplay() {
         if (null != mTotalList) {
             for (HashMap hm : mTotalList) {
@@ -893,6 +903,11 @@ public class ThingsDeviceLedBulbDetail extends CustomActionBarActivity implement
         }
     }
 
+    /**
+     * Led Bulb power on/off.
+     *
+     * @param requestValue ON or OFF
+     */
     private void setPower(String requestValue) {
         String contentValue = mUtil.null2string(mTotalList.get(0)
                 .get(Constants.HTTP_content_value));