Quellcode durchsuchen

[최진오]
디바이스 상세 변경

jinochoi vor 8 Jahren
Ursprung
Commit
8683aa2b3d

+ 4 - 0
onecable/src/main/java/com/ntels/onecable/common/Constants.java

@@ -845,6 +845,10 @@ public interface Constants {
    */
   public static final String KEY_NODE_ID = "node_id";
   public static final String KEY_CMDCLS_VALUE_LIST = "cmdcls_value_list";
+  /**
+   * 프로파일 업데이트 여부
+   */
+  public static final String KEY_PROFILE_UPDATE_YN = "profile_update_yn";
   /**
    * 노드 명
    */

+ 6 - 5
onecable/src/main/java/com/ntels/onecable/view/things/FragmentThingsAdapter.java

@@ -203,7 +203,8 @@ public class FragmentThingsAdapter extends RecyclerView.Adapter<RecyclerView.Vie
                 final ItemViewHolder itemViewHolerView = (ItemViewHolder) holder;
 
                 // (장치의) 접속 상태 (ON / OFF / none)
-                String onlineState = mUtil.null2string(hmItem.get(Constants.KEY_DEVICE_ONLINE));
+                String deviceId = mUtil.null2string(hmItem.get(Constants.KEY_DEVICE_ID));
+
                 // (default) 커맨드 클래스 값의 단위
                 String unit = mUtil.null2string(hmItem.get(Constants.KEY_UNIT));
                 // (default) 커맨드클래스 유형 ID
@@ -213,7 +214,7 @@ public class FragmentThingsAdapter extends RecyclerView.Adapter<RecyclerView.Vie
 
                 // 2016.08.03 노드 이미지 로컬에 있는 이미지를 사용하는걸로 변경.
                 itemViewHolerView.ivRowIcon.setImageResource(mUtil.getImageId(context, "img_" + deviceclassTypeId));
-
+//                40108.png
 //                itemViewHolerView.llRowOffline.setVisibility(View.GONE);
                 itemViewHolerView.btnRowControl.setBackgroundResource(0);
                 itemViewHolerView.btnRowControl.setVisibility(GONE);
@@ -545,7 +546,7 @@ public class FragmentThingsAdapter extends RecyclerView.Adapter<RecyclerView.Vie
                     itemViewHolerView.ivRowDelete.setVisibility(View.VISIBLE);
 //                    itemViewHolerView.llRowOffline.setVisibility(GONE);
                     itemViewHolerView.llLoading.setVisibility(GONE);
-                    if (onlineState.equals("OFF") || mAppConfig.getSelectHomegrpHomehubOnlineState().equals("OFF")) {
+                    if (mAppConfig.getSelectHomegrpHomehubOnlineState(deviceId).equals("OFF")) {
                         itemViewHolerView.ivRowIcon.setBackgroundResource(R.drawable.img_thing_icon_bg_default);
                     }
                 } else if (isMoveCheck) {
@@ -553,11 +554,11 @@ public class FragmentThingsAdapter extends RecyclerView.Adapter<RecyclerView.Vie
                     itemViewHolerView.ivRowMove.setVisibility(View.VISIBLE);
 //                    itemViewHolerView.llRowOffline.setVisibility(GONE);
                     itemViewHolerView.llLoading.setVisibility(GONE);
-                    if (onlineState.equals("OFF") || mAppConfig.getSelectHomegrpHomehubOnlineState().equals("OFF")) {
+                    if (mAppConfig.getSelectHomegrpHomehubOnlineState(deviceId).equals("OFF")) {
                         itemViewHolerView.ivRowIcon.setBackgroundResource(R.drawable.img_thing_icon_bg_default);
                     }
                 } else {
-                    if (onlineState.equals("OFF") || mAppConfig.getSelectHomegrpHomehubOnlineState().equals("OFF")) {
+                    if (mAppConfig.getSelectHomegrpHomehubOnlineState(deviceId).equals("OFF")) {
                         itemViewHolerView.ivRowIcon.setBackgroundResource(R.drawable.img_thing_icon_bg_default);
 //                        itemViewHolerView.llRowControl.setVisibility(GONE);
 //                        itemViewHolerView.llRowDelete.setVisibility(GONE);

+ 32 - 18
onecable/src/main/java/com/ntels/onecable/view/things/ThingsDetail.java

@@ -277,21 +277,25 @@ public class ThingsDetail extends CustomActivity implements View.OnClickListener
         } else {
             //홈그룹 있을경우
             if (!mAppConfig.getIsHomegrpHomehub()) {
-                //홈그룹은 있고 홈허브가 없는경우
-                mUtil.getView(mToolbar, R.id.llToolbar).setVisibility(View.GONE);
-                mUtil.getView(mToolbar, R.id.llToolbarHomeHub).setVisibility(View.VISIBLE);
-                mUtil.getTextView(mToolbar, R.id.tvToolbarHomeHub).setText(mUtil.getString(mActivity, R.string.layout_homehub_delete));
-                mUtil.getView(mToolbar, R.id.btnToolbarMore).setVisibility(View.GONE);
-                mUtil.getView(mToolbar, R.id.btnToolbarClose).setVisibility(View.GONE);
-                if (mDialogListBuilder != null) {
-                    mDialogListBuilder.create().dismiss();
-                }
+//                //홈그룹은 있고 홈허브가 없는경우
+//                mUtil.getView(mToolbar, R.id.llToolbar).setVisibility(View.GONE);
+//                mUtil.getView(mToolbar, R.id.llToolbarHomeHub).setVisibility(View.VISIBLE);
+//                mUtil.getTextView(mToolbar, R.id.tvToolbarHomeHub).setText(mUtil.getString(mActivity, R.string.layout_homehub_delete));
+//                mUtil.getView(mToolbar, R.id.btnToolbarMore).setVisibility(View.GONE);
+//                mUtil.getView(mToolbar, R.id.btnToolbarClose).setVisibility(View.GONE);
+//                if (mDialogListBuilder != null) {
+//                    mDialogListBuilder.create().dismiss();
+//                }
+                // 알람 발생
             } else {
-                if (mAppConfig.getSelectHomegrpHomehubOnlineState().equals("OFF")) {
+                if (mAppConfig.getSelectHomegrpHomehubOnlineState(mDeviceId).equals("OFF")) {
                     //홈그룹은 있고 홈허브가 오프라인인경우
-                    mUtil.getView(mToolbar, R.id.llToolbar).setVisibility(View.GONE);
-                    mUtil.getView(mToolbar, R.id.llToolbarHomeHub).setVisibility(View.VISIBLE);
-                    mUtil.getTextView(mToolbar, R.id.tvToolbarHomeHub).setText(mUtil.getString(mActivity, R.string.layout_homehub_offline));
+//                    mUtil.getView(mToolbar, R.id.llToolbar).setVisibility(View.GONE);
+//                    mUtil.getView(mToolbar, R.id.llToolbarHomeHub).setVisibility(View.VISIBLE);
+//                    mUtil.getTextView(mToolbar, R.id.tvToolbarHomeHub).setText(mUtil.getString(mActivity, R.string
+// .layout_homehub_offline));
+                    //에러 발생
+
                 } else {
                     //홈그룹은 있고 홈허브가 온라인인 경우
                     mUtil.getView(mToolbar, R.id.llToolbar).setVisibility(View.VISIBLE);
@@ -384,6 +388,9 @@ public class ThingsDetail extends CustomActivity implements View.OnClickListener
 
         mUtil.getView(mActivity, R.id.llBtn1).setOnClickListener(this);
 
+        mUtil.getTextView(mActivity, R.id.tvDeviceName).setText(mUtil.getString(mActivity, R.string.layout_things_detail_02)
+                + mAppConfig.getHomehubDeviceName(mDeviceId));
+
         mTotalList.clear();
 
         mSwipeRefreshLayout = (SwipeRefreshLayout) mActivity.findViewById(R.id.swiperefreshlayou);
@@ -405,7 +412,7 @@ public class ThingsDetail extends CustomActivity implements View.OnClickListener
         nodeMandatoryPager = (CustomViewPager) findViewById(R.id.vpNode_M);
         mMandatoryTotalList.clear();
         imageIndex = 0;
-        pageAdapter = new ThingsDetailVpAdapter(mActivity, mMandatoryTotalList, this);
+        pageAdapter = new ThingsDetailVpAdapter(mActivity, mDeviceId, mMandatoryTotalList, this);
         nodeMandatoryPager.setAdapter(pageAdapter);
         nodeMandatoryPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
             boolean first = true;
@@ -528,15 +535,22 @@ public class ThingsDetail extends CustomActivity implements View.OnClickListener
                     onlineState = mUtil.null2string(joResult.get(Constants.KEY_ONLINE_STATE));
                 }
 
-                String deviceclassTypeId = mUtil.null2string(joResult.get(Constants.KEY_DEVICECLASS_TYPE_ID));
-                mUtil.getImageView(mActivity, R.id.ivThingsIcon).setImageResource(mUtil.getImageId(mActivity, "img_" + deviceclassTypeId +
-                        "_rule"));
+                String profileUpdateYn = mUtil.null2string(joResult.get(Constants.KEY_PROFILE_UPDATE_YN));
+                if (profileUpdateYn.equals("Y")) {
+                    mUtil.getView(mActivity, R.id.tvUpdateAlram).setVisibility(View.VISIBLE);
+                } else {
+                    mUtil.getView(mActivity, R.id.tvUpdateAlram).setVisibility(View.INVISIBLE);
+                }
+//                String deviceclassTypeId = mUtil.null2string(joResult.get(Constants.KEY_DEVICECLASS_TYPE_ID));
+//                mUtil.getImageView(mActivity, R.id.ivThingsIcon).setImageResource(
+//                        mUtil.getImageId(mActivity, "img_" + deviceclassTypeId + "_rule"));
 
                 // 장치명
                 String prd_name = mUtil.null2string(joResult.get(Constants.KEY_PRD_USER_NAME));
                 String prdUserName = mUtil.null2string(joResult.get(Constants.KEY_PRD_USER_NAME));
                 deviceName = !prdUserName.equals("") ? prdUserName : prd_name;
-                mUtil.getTextView(mActivity, R.id.tvThingsName).setText(deviceName);
+                mUtil.getTextView(mToolbar, R.id.tvToolbarTitle1).setText(deviceName);
+                mUtil.getTextView(mActivity, R.id.tvNodeId).setText(mUtil.getString(mActivity, R.string.layout_things_detail_04) + nodeId);
 
                 String cmdclsList = mUtil.null2string(joResult.get(Constants.KEY_CMDCLS_LIST));
                 ArrayList<HashMap<String, Object>> alList = mUtil.jsonToArrayListMap(cmdclsList);

Datei-Diff unterdrückt, da er zu groß ist
+ 367 - 674
onecable/src/main/java/com/ntels/onecable/view/things/ThingsDetailVpAdapter.java


+ 50 - 60
onecable/src/main/res/layout/row_things_detail_list.xml

@@ -15,7 +15,7 @@
             android:id="@+id/llRowBody"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:background="@drawable/color_bg_01"
+            android:background="@drawable/color_body_01"
             android:orientation="vertical">
 
         <RelativeLayout
@@ -27,32 +27,18 @@
                     android:id="@+id/llRowBody1"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
-                    android:background="@drawable/color_body_01"
                     android:gravity="center_horizontal"
                     android:orientation="vertical">
 
-                <TextView
-                        android:id="@+id/tvRowBody1_Title"
-                        android:layout_width="match_parent"
-                        android:layout_height="wrap_content"
-                        android:layout_marginTop="5dp"
-                        android:gravity="center"
-                        android:includeFontPadding="false"
-                        android:maxLines="1"
-                        android:text="닫힘"
-                        android:textColor="@color/color_text_01"
-                        android:textSize="@dimen/size_font_08"
-                        android:textStyle="bold"/>
-
                 <RelativeLayout
-                        android:layout_width="190dp"
-                        android:layout_height="190dp"
-                        android:layout_marginTop="10dp">
+                        android:layout_width="175dp"
+                        android:layout_height="175dp"
+                        android:layout_marginTop="7dp">
 
                     <ImageView
                             android:id="@+id/ivRowBody1_Icon"
-                            android:layout_width="190dp"
-                            android:layout_height="190dp"
+                            android:layout_width="175dp"
+                            android:layout_height="175dp"
                             android:background="@drawable/img_things_detail_02_01_sensor_shock_normal"/>
 
                     <TextView
@@ -70,46 +56,49 @@
 
                 <LinearLayout
                         android:id="@+id/llRowBody1_Contents"
-                        android:layout_width="wrap_content"
+                        android:layout_width="match_parent"
                         android:layout_height="wrap_content"
-                        android:gravity="center_horizontal"
+                        android:layout_marginTop="24dp"
+                        android:paddingLeft="25dp"
+                        android:paddingRight="15dp"
+                        android:gravity="center"
                         android:orientation="horizontal">
 
-                    <Button
-                            android:id="@+id/btnRowBody1_Contents_On"
+                    <TextView
+                            android:id="@+id/tvRowBody1_Title"
                             android:layout_width="wrap_content"
-                            android:layout_height="65dp"
-                            android:layout_marginLeft="5dp"
-                            android:layout_marginRight="5dp"
-                            android:layout_marginTop="20dp"
-                            android:background="@drawable/d_img_things_detail_06_99_btn_on"
-                            android:minWidth="110dp"
-                            android:textColor="@color/color_text_04"
-                            android:textSize="@dimen/size_font_02"/>
+                            android:layout_height="wrap_content"
+                            android:gravity="left"
+                            android:includeFontPadding="false"
+                            android:maxLines="1"
+                            android:text="닫힘"
+                            android:textColor="@color/color_text_01"
+                            android:textSize="@dimen/size_font_07"
+                            android:textStyle="bold"/>
 
-                    <Button
-                            android:id="@+id/btnRowBody1_Contents_Off"
-                            android:layout_width="wrap_content"
-                            android:layout_height="65dp"
-                            android:layout_marginLeft="5dp"
-                            android:layout_marginRight="5dp"
-                            android:layout_marginTop="20dp"
-                            android:background="@drawable/d_img_things_detail_06_99_btn_off"
-                            android:minWidth="110dp"
-                            android:textColor="@color/color_text_04"
-                            android:textSize="@dimen/size_font_02"/>
+                    <LinearLayout
+                            android:id="@+id/llRowBody1_Control"
+                            android:layout_width="0dp"
+                            android:layout_height="wrap_content"
+                            android:gravity="right"
+                            android:layout_weight="1">
 
-                    <Button
-                            android:id="@+id/btnRowBody1_Contents_Lock"
-                            android:layout_width="wrap_content"
-                            android:layout_height="65dp"
-                            android:layout_marginLeft="5dp"
-                            android:layout_marginRight="5dp"
-                            android:layout_marginTop="20dp"
-                            android:background="@drawable/d_img_things_detail_05_99_btn_lock"
-                            android:minWidth="110dp"
-                            android:textColor="@color/color_text_04"
-                            android:textSize="@dimen/size_font_02"/>
+                        <Button
+                                android:id="@+id/btnRowBody1_Contents_On"
+                                android:layout_width="60dp"
+                                android:layout_height="60dp"
+                                android:background="@drawable/d_img_things_detail_06_99_btn_on"
+                                android:textColor="@color/color_text_04"
+                                android:textSize="@dimen/size_font_02"/>
+
+                        <Button
+                                android:id="@+id/btnRowBody1_Contents_Off"
+                                android:layout_width="60dp"
+                                android:layout_height="60dp"
+                                android:background="@drawable/d_img_things_detail_06_99_btn_off"
+                                android:textColor="@color/color_text_04"
+                                android:textSize="@dimen/size_font_02"/>
+                    </LinearLayout>
                 </LinearLayout>
 
                 <TextView
@@ -178,7 +167,7 @@
                 android:layout_height="wrap_content"
                 android:layout_marginLeft="10dp"
                 android:layout_marginRight="10dp"
-                android:background="@drawable/color_body_01"
+                android:background="@drawable/color_body_02"
                 android:gravity="center"
                 android:orientation="vertical">
 
@@ -200,8 +189,8 @@
                         android:paddingBottom="20dp"
                         android:paddingTop="20dp"
                         android:text="배터리"
-                        android:textColor="@color/color_text_01"
-                        android:textSize="@dimen/size_font_01"
+                        android:textColor="@color/color_text_03"
+                        android:textSize="@dimen/size_font_03"
                         android:textStyle="bold"/>
 
                 <View
@@ -231,8 +220,8 @@
                                 android:gravity="center"
                                 android:includeFontPadding="false"
                                 android:text="80%"
-                                android:textColor="@color/color_text_01"
-                                android:textSize="@dimen/size_font_01"
+                                android:textColor="@color/color_text_04"
+                                android:textSize="@dimen/size_font_03"
                                 android:textStyle="bold"/>
 
                         <Button
@@ -267,11 +256,12 @@
 
             <View
                     android:id="@+id/divider_last"
-                    style="@style/width_Divider_02"/>
+                    style="@style/width_Divider_01"/>
         </LinearLayout>
 
 
         <View
+                android:visibility="gone"
                 android:id="@+id/section_last"
                 style="@style/width_section"/>
     </LinearLayout>

+ 32 - 13
onecable/src/main/res/layout/things_detail.xml

@@ -45,11 +45,13 @@
           android:id="@+id/llSvbody"
           android:layout_width="match_parent"
           android:layout_height="wrap_content"
+          android:paddingBottom="30dp"
           android:orientation="vertical">
 
         <LinearLayout
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
+            android:orientation="vertical"
             android:background="@drawable/color_body_01"
             android:gravity="center_vertical"
             android:paddingBottom="15dp"
@@ -57,22 +59,27 @@
             android:paddingRight="15dp"
             android:paddingTop="20dp">
 
-          <ImageView
-              android:id="@+id/ivThingsIcon"
-              android:layout_width="55dp"
-              android:layout_height="55dp"
-              android:layout_marginRight="5dp"/>
+          <TextView
+              android:id="@+id/tvDeviceName"
+              android:layout_width="match_parent"
+              android:layout_height="wrap_content"
+              android:gravity="left"
+              android:includeFontPadding="false"
+              android:text="@string/layout_things_detail_02"
+              android:textColor="@color/color_text_03"
+              android:textSize="@dimen/size_font_03"
+              android:textStyle="bold"/>
 
           <TextView
-              android:id="@+id/tvThingsName"
-              android:layout_width="0dp"
+              android:id="@+id/tvUpdateAlram"
+              android:layout_width="match_parent"
               android:layout_height="wrap_content"
-              android:layout_weight="1"
+              android:layout_marginTop="7dp"
               android:gravity="left"
               android:includeFontPadding="false"
-              android:text=""
-              android:textColor="@color/color_text_01"
-              android:textSize="@dimen/size_font_02"
+              android:text="@string/layout_things_detail_03"
+              android:textColor="@color/color_text_04"
+              android:textSize="@dimen/size_font_06"
               android:textStyle="bold"/>
         </LinearLayout>
 
@@ -83,7 +90,7 @@
           <com.ntels.onecable.common.widget.CustomViewPager
               android:id="@+id/vpNode_M"
               android:layout_width="match_parent"
-              android:minHeight="100dp"
+              android:minHeight="279dp"
               android:layout_height="wrap_content">
           </com.ntels.onecable.common.widget.CustomViewPager>
 
@@ -91,7 +98,7 @@
               android:id="@+id/llvpNode_M_Icon"
               android:layout_width="match_parent"
               android:layout_height="match_parent"
-              android:layout_marginBottom="20dp"
+              android:layout_marginBottom="2dp"
               android:gravity="center_horizontal|bottom"
               android:orientation="horizontal">
           </LinearLayout>
@@ -105,6 +112,18 @@
             android:orientation="vertical">
         </LinearLayout>
 
+        <TextView
+                android:id="@+id/tvNodeId"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:gravity="right"
+                android:includeFontPadding="false"
+                android:layout_marginTop="10dp"
+                android:paddingRight="25dp"
+                android:text="@string/layout_things_detail_04"
+                android:textColor="@color/color_text_03"
+                android:textSize="@dimen/size_font_03"
+                android:textStyle="bold"/>
       </LinearLayout>
     </com.ntels.onecable.common.widget.CustomScrollView>
   </android.support.v4.widget.SwipeRefreshLayout>

+ 3 - 0
onecable/src/main/res/values/strings_layout.xml

@@ -396,6 +396,9 @@
     <string name="layout_things_device_del_03_02"><![CDATA["장치를 삭제했습니다"]]></string>
 
     <string name="layout_things_detail_01"><![CDATA["장치 상세"]]></string>
+    <string name="layout_things_detail_02"><![CDATA["홈 허브 "]]></string>
+    <string name="layout_things_detail_03"><![CDATA["장치를 최신버전으로 업데이트 하세요."]]></string>
+    <string name="layout_things_detail_04"><![CDATA["장치 ID "]]></string>
 
     <string name="layout_rules_01"><![CDATA["활성"]]></string>
     <string name="layout_rules_02"><![CDATA["비활성"]]></string>