Browse Source

[최진오]
장치리스트 순서변경
장치리스트 홈허브 상태 관련 변경

jinochoi 8 years ago
parent
commit
6dba56478a

+ 207 - 218
onecable/src/main/java/com/ntels/onecable/common/AppConfig.java

@@ -36,121 +36,16 @@ import java.util.Locale;
 public class AppConfig extends MultiDexApplication {
 
     private static final String TAG = AppConfig.class.getSimpleName();
-
-    private Util util = new Util();
     public static boolean DEBUG = false;
-
     private static volatile AppConfig instance = null;
-
-    @Override
-    protected void attachBaseContext(Context base) {
-
-        super.attachBaseContext(base);
-        MultiDex.install(this);
-    }
-
-    public static AppConfig getGlobalApplicationContext() {
-
-        if (instance == null)
-            throw new IllegalStateException("this application does not inherit com.kakao.GlobalApplication");
-        return instance;
-    }
-
-    public static AppConfig getInstance() {
-
-        return instance;
-    }
-
-    public enum TrackerName {
-        APP_TRACKER,
-        // 앱 별로 트래킹
-        GLOBAL_TRACKER,
-        // 모든 앱을 통틀어 트래킹
-        ECOMMERCE_TRACKER,     // 아마 유료 결재 트래킹 개념 같음
-    }
-
-    HashMap<TrackerName, Tracker> mTrackers = new HashMap<TrackerName, Tracker>();
-
-    public synchronized Tracker getTracker(TrackerName trackerId) {
-
-        if (!mTrackers.containsKey(trackerId)) {
-            GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
-            Tracker t = (trackerId == TrackerName.APP_TRACKER)
-                    ? analytics.newTracker(getString(R.string.google_analytics_property_id))
-                    : (trackerId == TrackerName.GLOBAL_TRACKER) ? analytics.newTracker(getString(R.string.google_analytics_property_id))
-                    : analytics.newTracker(getString(
-                    R.string.google_analytics_property_id));
-            mTrackers.put(trackerId, t);
-        }
-        return mTrackers.get(trackerId);
-    }
-
-    /**
-     * <PRE> 1. MethodName: onCreate 2. ClassName : 3. Comment   : onCreate 4. Developer : 최진오 5.
-     * Created   : 2015. 10. </PRE>
-     */
-    @Override
-    public void onCreate() {
-
-        super.onCreate();
-        this.DEBUG = isDebuggable(this);
-        instance = this;
-        Typekit.getInstance().addNormal(Typekit.createFromAsset(this, "fonts/NotoSans-Light.otf")).addBold(Typekit.createFromAsset(this,
-                "fonts/NotoSans-Regular.otf"));
-
-        patchEOFException();
-        CookieSyncManager.createInstance(this);
-    }
-
-    public boolean isDebuggable(Context context) {
-
-        boolean debuggable = false;
-
-        PackageManager pm = context.getPackageManager();
-        try {
-            ApplicationInfo appinfo = pm.getApplicationInfo(context.getPackageName(), 0);
-            debuggable = (0 != (appinfo.flags & ApplicationInfo.FLAG_DEBUGGABLE));
-        } catch (PackageManager.NameNotFoundException e) {
-            /* debuggable variable will remain false */
-        }
-
-        return debuggable;
-    }
-
-    @Override
-    public void onConfigurationChanged(Configuration newConfig) {
-
-        super.onConfigurationChanged(newConfig);
-    }
-
-    @Override
-    public void onLowMemory() {
-
-        super.onLowMemory();
-    }
-
-    @Override
-    public void onTerminate() {
-
-        super.onTerminate();
-        instance = null;
-    }
-
-    private void patchEOFException() {
-
-        System.setProperty("http.keepAlive", "false");
-    }
-
     public ArrayList<HashMap<String, Object>> authHomegrpListHM = new ArrayList<HashMap<String, Object>>();
     public ArrayList<HashMap<String, Object>> authInvitationList = new ArrayList<HashMap<String, Object>>();
-
     public Boolean bLogin = false;
     public Boolean isLogout = false;
     public Boolean bExit = false;
     public Boolean bManualNotView = false;
     public Boolean bPush = false;
     public Boolean bAutoLogin = false;
-    private Boolean mSaveId = false;
     public Boolean bGoErr = false;
     public Boolean bIntro = false;
     public Boolean bMain = false;
@@ -161,7 +56,6 @@ public class AppConfig extends MultiDexApplication {
     public String sLogin_Id = "";
     public String sLogin_TermId = "";
     public String sPush_Token = "";
-
     /**
      * 나의 사진 이미지 URL
      */
@@ -178,7 +72,6 @@ public class AppConfig extends MultiDexApplication {
      * 로그인 비밀번호
      */
     public String sLogin_Pass = "";
-
     public float fScale = 0f;
     public int iDisplayHeight = 0;
     public int iDisplayWidth = 0;
@@ -202,7 +95,6 @@ public class AppConfig extends MultiDexApplication {
     public int iTurnPort = 0;
     public String sVsaasDomain = "";
     public String sSipPassword = "";
-
     /**
      * 서비스 아이디
      */
@@ -228,7 +120,6 @@ public class AppConfig extends MultiDexApplication {
      * 초대 여부
      */
     public String sInvitations_Count = "";
-
     /**
      * (소속된) 홈그룹 명
      */
@@ -293,12 +184,13 @@ public class AppConfig extends MultiDexApplication {
      * (소속된 홈그룹내) 홈허브 디바이스 Key
      */
     public String sSelect_Homegrp_Homehub_Device_Key = "";
-
+    HashMap<TrackerName, Tracker> mTrackers = new HashMap<TrackerName, Tracker>();
+    private Util util = new Util();
+    private Boolean mSaveId = false;
     /**
      * (소속된 홈그룹내) 홈허브 디바이스 여부
      */
     private Boolean mIsHomegrpHomehub = false;
-
     /**
      * 고객 ID
      */
@@ -308,6 +200,102 @@ public class AppConfig extends MultiDexApplication {
      */
     private String mCtrtGroupId = "";
 
+    public static AppConfig getGlobalApplicationContext() {
+
+        if (instance == null)
+            throw new IllegalStateException("this application does not inherit com.kakao.GlobalApplication");
+        return instance;
+    }
+
+    public static AppConfig getInstance() {
+
+        return instance;
+    }
+
+    public static String getLanguageType() {
+        Locale locale = getGlobalApplicationContext().getResources().getConfiguration().locale;
+        Log.i("getLanguageType()", locale.getLanguage());
+        return locale.getLanguage();
+    }
+
+    @Override
+    protected void attachBaseContext(Context base) {
+
+        super.attachBaseContext(base);
+        MultiDex.install(this);
+    }
+
+    public synchronized Tracker getTracker(TrackerName trackerId) {
+
+        if (!mTrackers.containsKey(trackerId)) {
+            GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
+            Tracker t = (trackerId == TrackerName.APP_TRACKER)
+                    ? analytics.newTracker(getString(R.string.google_analytics_property_id))
+                    : (trackerId == TrackerName.GLOBAL_TRACKER) ? analytics.newTracker(getString(R.string.google_analytics_property_id))
+                    : analytics.newTracker(getString(
+                    R.string.google_analytics_property_id));
+            mTrackers.put(trackerId, t);
+        }
+        return mTrackers.get(trackerId);
+    }
+
+    /**
+     * <PRE> 1. MethodName: onCreate 2. ClassName : 3. Comment   : onCreate 4. Developer : 최진오 5.
+     * Created   : 2015. 10. </PRE>
+     */
+    @Override
+    public void onCreate() {
+
+        super.onCreate();
+        this.DEBUG = isDebuggable(this);
+        instance = this;
+        Typekit.getInstance().addNormal(Typekit.createFromAsset(this, "fonts/NotoSans-Light.otf"))
+                .addBold(Typekit.createFromAsset(this, "fonts/NotoSans-Regular.otf"));
+
+        patchEOFException();
+        CookieSyncManager.createInstance(this);
+
+    }
+
+    public boolean isDebuggable(Context context) {
+
+        boolean debuggable = false;
+
+        PackageManager pm = context.getPackageManager();
+        try {
+            ApplicationInfo appinfo = pm.getApplicationInfo(context.getPackageName(), 0);
+            debuggable = (0 != (appinfo.flags & ApplicationInfo.FLAG_DEBUGGABLE));
+        } catch (PackageManager.NameNotFoundException e) {
+            /* debuggable variable will remain false */
+        }
+
+        return debuggable;
+    }
+
+    @Override
+    public void onConfigurationChanged(Configuration newConfig) {
+
+        super.onConfigurationChanged(newConfig);
+    }
+
+    @Override
+    public void onLowMemory() {
+
+        super.onLowMemory();
+    }
+
+    @Override
+    public void onTerminate() {
+
+        super.onTerminate();
+        instance = null;
+    }
+
+    private void patchEOFException() {
+
+        System.setProperty("http.keepAlive", "false");
+    }
+
     public void Labinit() {
 
         authHomegrpListHM = new ArrayList<HashMap<String, Object>>();
@@ -519,19 +507,14 @@ public class AppConfig extends MultiDexApplication {
         mCtrtGroupId = outState.getString("ctrtGroupId");
     }
 
-    public void setInvitations_Count(String str) {
-
-        sInvitations_Count = str;
-    }
-
     public String getInvitations_Count() {
 
         return sInvitations_Count;
     }
 
-    public void setSelect_Homegrp_Homehub_Device_Id(String str) {
+    public void setInvitations_Count(String str) {
 
-        sSelect_Homegrp_Homehub_Device_Id = str;
+        sInvitations_Count = str;
     }
 
     public String getSelect_Homegrp_Homehub_Device_Id() {
@@ -539,9 +522,9 @@ public class AppConfig extends MultiDexApplication {
         return sSelect_Homegrp_Homehub_Device_Id;
     }
 
-    public void setSelect_Homegrp_Homehub_Online_State(String str) {
-        LogUtil.i(TAG, "setSelect_Homegrp_Homehub_Online_State : " + str);
-        sSelect_Homegrp_Homehub_Online_State = str;
+    public void setSelect_Homegrp_Homehub_Device_Id(String str) {
+
+        sSelect_Homegrp_Homehub_Device_Id = str;
     }
 
     public String getSelect_Homegrp_Homehub_Online_State() {
@@ -556,6 +539,11 @@ public class AppConfig extends MultiDexApplication {
         return onlineState;
     }
 
+    public void setSelect_Homegrp_Homehub_Online_State(String str) {
+        LogUtil.i(TAG, "setSelect_Homegrp_Homehub_Online_State : " + str);
+        sSelect_Homegrp_Homehub_Online_State = str;
+    }
+
     public String getsSelect_Homegrp_Homehub_Conn_State() {
         return sSelect_Homegrp_Homehub_Conn_State;
     }
@@ -591,19 +579,14 @@ public class AppConfig extends MultiDexApplication {
         this.sSelect_Homegrp_Homehub_Mqtt_Online_Last_Datetime = sSelect_Homegrp_Homehub_Mqtt_Online_Last_Datetime;
     }
 
-    public void setPush_Type_Mode_Chg_Yn(String str) {
-
-        sPush_Type_Mode_Chg_Yn = str;
-    }
-
     public String getPush_Type_Mode_Chg_Yn() {
 
         return sPush_Type_Mode_Chg_Yn;
     }
 
-    public void setPush_Type_Prsnc_Chg_Yn(String str) {
+    public void setPush_Type_Mode_Chg_Yn(String str) {
 
-        sPush_Type_Prsnc_Chg_Yn = str;
+        sPush_Type_Mode_Chg_Yn = str;
     }
 
     public String getPush_Type_Prsnc_Chg_Yn() {
@@ -611,9 +594,9 @@ public class AppConfig extends MultiDexApplication {
         return sPush_Type_Prsnc_Chg_Yn;
     }
 
-    public void setTemp_Password_Yn(String str) {
+    public void setPush_Type_Prsnc_Chg_Yn(String str) {
 
-        sTemp_Password_Yn = str;
+        sPush_Type_Prsnc_Chg_Yn = str;
     }
 
     public String getTemp_Password_Yn() {
@@ -621,9 +604,9 @@ public class AppConfig extends MultiDexApplication {
         return sTemp_Password_Yn;
     }
 
-    public void setSelect_Homegrp_Grade_Code(String str) {
+    public void setTemp_Password_Yn(String str) {
 
-        sSelect_Homegrp_Grade_Code = str;
+        sTemp_Password_Yn = str;
     }
 
     public String getSelect_Homegrp_Grade_Code() {
@@ -631,9 +614,9 @@ public class AppConfig extends MultiDexApplication {
         return sSelect_Homegrp_Grade_Code;
     }
 
-    public void setSelect_Homegrp_Device_Yn(String str) {
+    public void setSelect_Homegrp_Grade_Code(String str) {
 
-        sSelect_Homegrp_Device_Yn = str;
+        sSelect_Homegrp_Grade_Code = str;
     }
 
     public String getSelect_Homegrp_Device_Yn() {
@@ -641,10 +624,9 @@ public class AppConfig extends MultiDexApplication {
         return sSelect_Homegrp_Device_Yn;
     }
 
+    public void setSelect_Homegrp_Device_Yn(String str) {
 
-    public void setSelect_Homegrp_Name(String str) {
-
-        sSelect_Homegrp_Name = str;
+        sSelect_Homegrp_Device_Yn = str;
     }
 
     public String getSelect_Homegrp_Name() {
@@ -652,9 +634,9 @@ public class AppConfig extends MultiDexApplication {
         return sSelect_Homegrp_Name;
     }
 
-    public void setSelect_Homegrp_Icon(String str) {
+    public void setSelect_Homegrp_Name(String str) {
 
-        sSelect_Homegrp_Icon = str;
+        sSelect_Homegrp_Name = str;
     }
 
     public String getSelect_Homegrp_Icon() {
@@ -662,9 +644,9 @@ public class AppConfig extends MultiDexApplication {
         return sSelect_Homegrp_Icon;
     }
 
-    public void setSelect_Location_Addr(String str) {
+    public void setSelect_Homegrp_Icon(String str) {
 
-        sSelect_Location_Addr = str;
+        sSelect_Homegrp_Icon = str;
     }
 
     public String getSelect_Location_Addr() {
@@ -672,9 +654,9 @@ public class AppConfig extends MultiDexApplication {
         return sSelect_Location_Addr;
     }
 
-    public void setSelect_Location_Coordinate(String str) {
+    public void setSelect_Location_Addr(String str) {
 
-        sSelect_Location_Coordinate = str;
+        sSelect_Location_Addr = str;
     }
 
     public String getSelect_Location_Coordinate() {
@@ -682,9 +664,9 @@ public class AppConfig extends MultiDexApplication {
         return sSelect_Location_Coordinate;
     }
 
-    public void setSelect_Location_Radius(String str) {
+    public void setSelect_Location_Coordinate(String str) {
 
-        sSelect_Location_Radius = str;
+        sSelect_Location_Coordinate = str;
     }
 
     public String getSelect_Location_Radius() {
@@ -692,9 +674,9 @@ public class AppConfig extends MultiDexApplication {
         return sSelect_Location_Radius;
     }
 
-    public void setLogin_Member_Id(String str) {
+    public void setSelect_Location_Radius(String str) {
 
-        sLogin_Member_Id = str;
+        sSelect_Location_Radius = str;
     }
 
     public String getLogin_Member_Id() {
@@ -702,9 +684,9 @@ public class AppConfig extends MultiDexApplication {
         return sLogin_Member_Id;
     }
 
-    public void setCountry_Id(String str) {
+    public void setLogin_Member_Id(String str) {
 
-        sCountry_Id = str;
+        sLogin_Member_Id = str;
     }
 
     public String getCountry_Id() {
@@ -712,9 +694,9 @@ public class AppConfig extends MultiDexApplication {
         return sCountry_Id;
     }
 
-    public void setLanguage_Id(String str) {
+    public void setCountry_Id(String str) {
 
-        sLanguage_Id = str;
+        sCountry_Id = str;
     }
 
     public String getLanguage_Id() {
@@ -722,9 +704,9 @@ public class AppConfig extends MultiDexApplication {
         return sLanguage_Id;
     }
 
-    public void setService_Id(String str) {
+    public void setLanguage_Id(String str) {
 
-        sService_Id = str;
+        sLanguage_Id = str;
     }
 
     public String getService_Id() {
@@ -732,9 +714,9 @@ public class AppConfig extends MultiDexApplication {
         return sService_Id;
     }
 
-    public void setProject_Id(String str) {
+    public void setService_Id(String str) {
 
-        sProject_Id = str;
+        sService_Id = str;
     }
 
     public String getProject_Id() {
@@ -742,9 +724,9 @@ public class AppConfig extends MultiDexApplication {
         return sProject_Id;
     }
 
-    public void setAppstart_Id(String str) {
+    public void setProject_Id(String str) {
 
-        sAppstart_Id = str;
+        sProject_Id = str;
     }
 
     public String getAppstart_Id() {
@@ -752,9 +734,9 @@ public class AppConfig extends MultiDexApplication {
         return sAppstart_Id;
     }
 
-    public void setUrl(String str) {
+    public void setAppstart_Id(String str) {
 
-        sUrl = str;
+        sAppstart_Id = str;
     }
 
     public String getUrl() {
@@ -762,9 +744,9 @@ public class AppConfig extends MultiDexApplication {
         return sUrl;
     }
 
-    public void setSmartUrl(String str) {
+    public void setUrl(String str) {
 
-        sSmartUrl = str;
+        sUrl = str;
     }
 
     public String getSmartUrl() {
@@ -772,9 +754,9 @@ public class AppConfig extends MultiDexApplication {
         return sSmartUrl;
     }
 
-    public void setServicehubWebsocketUrl(String str) {
+    public void setSmartUrl(String str) {
 
-        sServicehubWebsocketUrl = str;
+        sSmartUrl = str;
     }
 
     public String getServicehubWebsocketUrl() {
@@ -782,6 +764,11 @@ public class AppConfig extends MultiDexApplication {
         return sServicehubWebsocketUrl;
     }
 
+    public void setServicehubWebsocketUrl(String str) {
+
+        sServicehubWebsocketUrl = str;
+    }
+
     public String getServicehubRestUrl() {
         return sServicehubRestUrl;
     }
@@ -838,14 +825,14 @@ public class AppConfig extends MultiDexApplication {
         this.sSipPassword = sSipPassword;
     }
 
-    public void setAuthToken(String str) {
+    public String getAuthToken() {
 
-        sAuth_Token = str;
+        return sAuth_Token;
     }
 
-    public String getAuthToken() {
+    public void setAuthToken(String str) {
 
-        return sAuth_Token;
+        sAuth_Token = str;
     }
 
     public String getAuthorization() {
@@ -857,19 +844,14 @@ public class AppConfig extends MultiDexApplication {
         return null;
     }
 
-    public void setScale(Float str) {
-
-        fScale = str;
-    }
-
     public Float getScale() {
 
         return fScale;
     }
 
-    public void setDisplayHeight(int str) {
+    public void setScale(Float str) {
 
-        iDisplayHeight = str;
+        fScale = str;
     }
 
     public int getDisplayHeight() {
@@ -877,9 +859,9 @@ public class AppConfig extends MultiDexApplication {
         return iDisplayHeight;
     }
 
-    public void setDisplayWidth(int str) {
+    public void setDisplayHeight(int str) {
 
-        iDisplayWidth = str;
+        iDisplayHeight = str;
     }
 
     public int getDisplayWidth() {
@@ -887,9 +869,9 @@ public class AppConfig extends MultiDexApplication {
         return iDisplayWidth;
     }
 
-    public void setLogin_Pass(String str) {
+    public void setDisplayWidth(int str) {
 
-        sLogin_Pass = str;
+        iDisplayWidth = str;
     }
 
     public String getLogin_Pass() {
@@ -897,9 +879,9 @@ public class AppConfig extends MultiDexApplication {
         return sLogin_Pass;
     }
 
-    public void setPush_Token(String str) {
+    public void setLogin_Pass(String str) {
 
-        sPush_Token = str;
+        sLogin_Pass = str;
     }
 
     public String getPush_Token() {
@@ -907,9 +889,9 @@ public class AppConfig extends MultiDexApplication {
         return sPush_Token;
     }
 
-    public void setMy_Image_Url(String str) {
+    public void setPush_Token(String str) {
 
-        sMy_Image_Url = str;
+        sPush_Token = str;
     }
 
     public String getMy_Image_Url() {
@@ -917,9 +899,9 @@ public class AppConfig extends MultiDexApplication {
         return sMy_Image_Url;
     }
 
-    public void setNickname(String str) {
+    public void setMy_Image_Url(String str) {
 
-        sNickname = str;
+        sMy_Image_Url = str;
     }
 
     public String getNickname() {
@@ -927,9 +909,9 @@ public class AppConfig extends MultiDexApplication {
         return sNickname;
     }
 
-    public void setTimezone_Id(String str) {
+    public void setNickname(String str) {
 
-        sTimezone_Id = str;
+        sNickname = str;
     }
 
     public String getTimezone_Id() {
@@ -937,9 +919,9 @@ public class AppConfig extends MultiDexApplication {
         return sTimezone_Id;
     }
 
-    public void setGoErr(Boolean sVal) {
+    public void setTimezone_Id(String str) {
 
-        bGoErr = sVal;
+        sTimezone_Id = str;
     }
 
     public Boolean getGoErr() {
@@ -947,9 +929,9 @@ public class AppConfig extends MultiDexApplication {
         return bGoErr;
     }
 
-    public void setVer(String str) {
+    public void setGoErr(Boolean sVal) {
 
-        sVer = str;
+        bGoErr = sVal;
     }
 
     public String getVer() {
@@ -957,9 +939,9 @@ public class AppConfig extends MultiDexApplication {
         return sVer;
     }
 
-    public void setUuid(String str) {
+    public void setVer(String str) {
 
-        sUuid = str;
+        sVer = str;
     }
 
     public String getUuid() {
@@ -967,9 +949,9 @@ public class AppConfig extends MultiDexApplication {
         return sUuid;
     }
 
-    public void setLogin(Boolean str) {
+    public void setUuid(String str) {
 
-        bLogin = str;
+        sUuid = str;
     }
 
     public Boolean getLogin() {
@@ -977,6 +959,11 @@ public class AppConfig extends MultiDexApplication {
         return bLogin;
     }
 
+    public void setLogin(Boolean str) {
+
+        bLogin = str;
+    }
+
     public Boolean getLogout() {
         return isLogout;
     }
@@ -985,19 +972,14 @@ public class AppConfig extends MultiDexApplication {
         isLogout = logout;
     }
 
-    public void setIntro(Boolean str) {
-
-        bIntro = str;
-    }
-
     public Boolean getIntro() {
 
         return bIntro;
     }
 
-    public void setMain(Boolean str) {
+    public void setIntro(Boolean str) {
 
-        bMain = str;
+        bIntro = str;
     }
 
     public Boolean getMain() {
@@ -1005,6 +987,11 @@ public class AppConfig extends MultiDexApplication {
         return bMain;
     }
 
+    public void setMain(Boolean str) {
+
+        bMain = str;
+    }
+
     public Boolean getbWebSocketAuth() {
         return bWebSocketAuth;
     }
@@ -1021,14 +1008,14 @@ public class AppConfig extends MultiDexApplication {
         this.bWebSocketConn = bWebSocketConn;
     }
 
-    public void setAutoLogin(Boolean str) {
+    public Boolean getAutoLogin() {
 
-        bAutoLogin = str;
+        return bAutoLogin;
     }
 
-    public Boolean getAutoLogin() {
+    public void setAutoLogin(Boolean str) {
 
-        return bAutoLogin;
+        bAutoLogin = str;
     }
 
     public Boolean getSaveId() {
@@ -1039,19 +1026,14 @@ public class AppConfig extends MultiDexApplication {
         this.mSaveId = saveId;
     }
 
-    public void setManualNotView(Boolean str) {
-
-        bManualNotView = str;
-    }
-
     public Boolean getManualNotView() {
 
         return bManualNotView;
     }
 
-    public void setPush(Boolean str) {
+    public void setManualNotView(Boolean str) {
 
-        bPush = str;
+        bManualNotView = str;
     }
 
     public Boolean getPush() {
@@ -1059,9 +1041,9 @@ public class AppConfig extends MultiDexApplication {
         return bPush;
     }
 
-    public void setLogin_Id(String str) {
+    public void setPush(Boolean str) {
 
-        sLogin_Id = str;
+        bPush = str;
     }
 
     public String getLogin_Id() {
@@ -1073,6 +1055,11 @@ public class AppConfig extends MultiDexApplication {
         }
     }
 
+    public void setLogin_Id(String str) {
+
+        sLogin_Id = str;
+    }
+
     public String getLogin_TermId() {
 
         return sLogin_TermId;
@@ -1155,9 +1142,11 @@ public class AppConfig extends MultiDexApplication {
     }
 
 
-    public static String getLanguageType() {
-        Locale locale = getGlobalApplicationContext().getResources().getConfiguration().locale;
-        Log.i("getLanguageType()", locale.getLanguage());
-        return locale.getLanguage();
+    public enum TrackerName {
+        APP_TRACKER,
+        // 앱 별로 트래킹
+        GLOBAL_TRACKER,
+        // 모든 앱을 통틀어 트래킹
+        ECOMMERCE_TRACKER,     // 아마 유료 결재 트래킹 개념 같음
     }
 }

+ 5 - 0
onecable/src/main/java/com/ntels/onecable/common/util/Util.java

@@ -363,6 +363,11 @@ public class Util {
                 hmTemp.put(Constants.KEY_TITLE, getString(AppConfig.getGlobalApplicationContext(), R.string.layout_context_menu_21));
                 hmTemp.put(Constants.KEY_SELECT_TYPE, iType);
                 break;
+            case 22:
+                hmTemp.put(Constants.KEY_IMAGE_FILE_NAME, "d_img_bg_morepopup_icon_masterchange");
+                hmTemp.put(Constants.KEY_TITLE, getString(AppConfig.getGlobalApplicationContext(), R.string.layout_context_menu_22));
+                hmTemp.put(Constants.KEY_SELECT_TYPE, iType);
+                break;
             default:
                 break;
         }

+ 58 - 0
onecable/src/main/java/com/ntels/onecable/common/util/recyclerview/ItemTouchHelperAdapter.java

@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2015 Paul Burke
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.ntels.onecable.common.util.recyclerview;
+
+import android.support.v7.widget.RecyclerView;
+import android.support.v7.widget.helper.ItemTouchHelper;
+
+/**
+ * Interface to listen for a move or dismissal event from a {@link ItemTouchHelper.Callback}.
+ *
+ * @author Paul Burke (ipaulpro)
+ */
+public interface ItemTouchHelperAdapter {
+
+    /**
+     * Called when an item has been dragged far enough to trigger a move. This is called every time
+     * an item is shifted, and <strong>not</strong> at the end of a "drop" event.<br/>
+     * <br/>
+     * Implementations should call {@link RecyclerView.Adapter#notifyItemMoved(int, int)} after
+     * adjusting the underlying data to reflect this move.
+     *
+     * @param fromPosition The start position of the moved item.
+     * @param toPosition   Then resolved position of the moved item.
+     * @return True if the item was moved to the new adapter position.
+     *
+     * @see RecyclerView#getAdapterPositionFor(RecyclerView.ViewHolder)
+     * @see RecyclerView.ViewHolder#getAdapterPosition()
+     */
+    boolean onItemMove(int fromPosition, int toPosition);
+
+
+    /**
+     * Called when an item has been dismissed by a swipe.<br/>
+     * <br/>
+     * Implementations should call {@link RecyclerView.Adapter#notifyItemRemoved(int)} after
+     * adjusting the underlying data to reflect this removal.
+     *
+     * @param position The position of the item dismissed.
+     *
+     * @see RecyclerView#getAdapterPositionFor(RecyclerView.ViewHolder)
+     * @see RecyclerView.ViewHolder#getAdapterPosition()
+     */
+    void onItemDismiss(int position);
+}

+ 41 - 0
onecable/src/main/java/com/ntels/onecable/common/util/recyclerview/ItemTouchHelperViewHolder.java

@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2015 Paul Burke
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.ntels.onecable.common.util.recyclerview;
+
+import android.support.v7.widget.helper.ItemTouchHelper;
+
+/**
+ * Interface to notify an item ViewHolder of relevant callbacks from {@link
+ * android.support.v7.widget.helper.ItemTouchHelper.Callback}.
+ *
+ * @author Paul Burke (ipaulpro)
+ */
+public interface ItemTouchHelperViewHolder {
+
+    /**
+     * Called when the {@link ItemTouchHelper} first registers an item as being moved or swiped.
+     * Implementations should update the item view to indicate it's active state.
+     */
+    void onItemSelected();
+
+
+    /**
+     * Called when the {@link ItemTouchHelper} has completed the move or swipe, and the active item
+     * state should be cleared.
+     */
+    void onItemClear();
+}

+ 33 - 0
onecable/src/main/java/com/ntels/onecable/common/util/recyclerview/OnStartDragListener.java

@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2015 Paul Burke
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.ntels.onecable.common.util.recyclerview;
+
+import android.support.v7.widget.RecyclerView;
+
+/**
+ * Listener for manual initiation of a drag.
+ */
+public interface OnStartDragListener {
+
+    /**
+     * Called when a view is requesting a start of a drag.
+     *
+     * @param viewHolder The holder of the view to drag.
+     */
+    void onStartDrag(RecyclerView.ViewHolder viewHolder);
+
+}

+ 124 - 0
onecable/src/main/java/com/ntels/onecable/common/util/recyclerview/SimpleItemTouchHelperCallback.java

@@ -0,0 +1,124 @@
+/*
+ * Copyright (C) 2015 Paul Burke
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.ntels.onecable.common.util.recyclerview;
+
+import android.graphics.Canvas;
+import android.support.v7.widget.GridLayoutManager;
+import android.support.v7.widget.RecyclerView;
+import android.support.v7.widget.helper.ItemTouchHelper;
+
+/**
+ * An implementation of {@link ItemTouchHelper.Callback} that enables basic drag & drop and
+ * swipe-to-dismiss. Drag events are automatically started by an item long-press.<br/>
+ * </br/>
+ * Expects the <code>RecyclerView.Adapter</code> to listen for {@link
+ * ItemTouchHelperAdapter} callbacks and the <code>RecyclerView.ViewHolder</code> to implement
+ * {@link ItemTouchHelperViewHolder}.
+ *
+ * @author Paul Burke (ipaulpro)
+ */
+public class SimpleItemTouchHelperCallback extends ItemTouchHelper.Callback {
+
+    public static final float ALPHA_FULL = 1.0f;
+
+    private final ItemTouchHelperAdapter mAdapter;
+
+    public SimpleItemTouchHelperCallback(ItemTouchHelperAdapter adapter) {
+        mAdapter = adapter;
+    }
+
+    @Override
+    public boolean isLongPressDragEnabled() {
+        return false;
+    }
+
+    @Override
+    public boolean isItemViewSwipeEnabled() {
+        return true;
+    }
+
+    @Override
+    public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
+        // Set movement flags based on the layout manager
+        if (recyclerView.getLayoutManager() instanceof GridLayoutManager) {
+            final int dragFlags = ItemTouchHelper.UP | ItemTouchHelper.DOWN | ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT;
+            final int swipeFlags = 0;
+            return makeMovementFlags(dragFlags, swipeFlags);
+        } else {
+            final int dragFlags = ItemTouchHelper.UP | ItemTouchHelper.DOWN;
+//            final int swipeFlags = ItemTouchHelper.START | ItemTouchHelper.END;
+            final int swipeFlags = 0;
+            return makeMovementFlags(dragFlags, swipeFlags);
+        }
+    }
+
+    @Override
+    public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder source, RecyclerView.ViewHolder target) {
+        if (source.getItemViewType() != target.getItemViewType()) {
+            return false;
+        }
+
+        // Notify the adapter of the move
+        mAdapter.onItemMove(source.getAdapterPosition(), target.getAdapterPosition());
+        return true;
+    }
+
+    @Override
+    public void onSwiped(RecyclerView.ViewHolder viewHolder, int i) {
+        // Notify the adapter of the dismissal
+        mAdapter.onItemDismiss(viewHolder.getAdapterPosition());
+    }
+
+    @Override
+    public void onChildDraw(Canvas c, RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, float dX, float dY, int actionState, boolean isCurrentlyActive) {
+        if (actionState == ItemTouchHelper.ACTION_STATE_SWIPE) {
+            // Fade out the view as it is swiped out of the parent's bounds
+            final float alpha = ALPHA_FULL - Math.abs(dX) / (float) viewHolder.itemView.getWidth();
+            viewHolder.itemView.setAlpha(alpha);
+            viewHolder.itemView.setTranslationX(dX);
+        } else {
+            super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive);
+        }
+    }
+
+    @Override
+    public void onSelectedChanged(RecyclerView.ViewHolder viewHolder, int actionState) {
+        // We only want the active item to change
+        if (actionState != ItemTouchHelper.ACTION_STATE_IDLE) {
+            if (viewHolder instanceof ItemTouchHelperViewHolder) {
+                // Let the view holder know that this item is being moved or dragged
+                ItemTouchHelperViewHolder itemViewHolder = (ItemTouchHelperViewHolder) viewHolder;
+                itemViewHolder.onItemSelected();
+            }
+        }
+
+        super.onSelectedChanged(viewHolder, actionState);
+    }
+
+    @Override
+    public void clearView(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
+        super.clearView(recyclerView, viewHolder);
+
+        viewHolder.itemView.setAlpha(ALPHA_FULL);
+
+        if (viewHolder instanceof ItemTouchHelperViewHolder) {
+            // Tell the view holder it's time to restore the idle state
+            ItemTouchHelperViewHolder itemViewHolder = (ItemTouchHelperViewHolder) viewHolder;
+            itemViewHolder.onItemClear();
+        }
+    }
+}

+ 2 - 4
onecable/src/main/java/com/ntels/onecable/common/websocket/WebSocketService.java

@@ -46,9 +46,7 @@ import javax.net.ssl.X509TrustManager;
 public class WebSocketService extends Service {
     public static final int WEBSOCKET_CONNECT_TIMEOUT = 0;
     public static final int WEBSOCKET_CLIENT_CONNECT_AUTH = 1;
-
     private static final String TAG = WebSocketService.class.getSimpleName();
-
     private static final int TIMEOUT = 20;
     private final IBinder binder = new WebSocketBinder();
     private AppConfig mAppConfig;
@@ -137,7 +135,7 @@ public class WebSocketService extends Service {
         URI uri;
         try {
 //            String url = mAppConfig.getServicehubWebsocketUrl() + "/" + sServicehubAppId + "/" + sHomeGrpId;
-            String url = mAppConfig.getServicehubWebsocketUrl()+ util.getString(getApplicationContext(), R.string.API_VERSION);
+            String url = mAppConfig.getServicehubWebsocketUrl() + util.getString(getApplicationContext(), R.string.API_VERSION);
             uri = new URI(url);
         } catch (URISyntaxException e) {
             e.printStackTrace();
@@ -249,7 +247,7 @@ public class WebSocketService extends Service {
         }
         try {
 //        webSocket.connectBlocking();
-        webSocket.connect();
+            webSocket.connect();
 
         } catch (Exception e) {
             e.printStackTrace();

File diff suppressed because it is too large
+ 289 - 247
onecable/src/main/java/com/ntels/onecable/view/things/FragmentThings.java


+ 127 - 52
onecable/src/main/java/com/ntels/onecable/view/things/FragmentThingsAdapter.java

@@ -9,11 +9,15 @@ import com.ntels.onecable.common.AppConfig;
 import com.ntels.onecable.common.Constants;
 import com.ntels.onecable.common.c_interface.ListInterface;
 import com.ntels.onecable.common.util.Util;
+import com.ntels.onecable.common.util.recyclerview.ItemTouchHelperAdapter;
+import com.ntels.onecable.common.util.recyclerview.OnStartDragListener;
 
 import android.content.Context;
 import android.content.Intent;
+import android.support.v4.view.MotionEventCompat;
 import android.support.v7.widget.RecyclerView;
 import android.view.LayoutInflater;
+import android.view.MotionEvent;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.Button;
@@ -23,8 +27,11 @@ import android.widget.RelativeLayout;
 import android.widget.TextView;
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashMap;
 
+import static android.view.View.GONE;
+
 /**
  * <pre>
  * 1. ClassName :   FragmentThingsAdapter
@@ -35,7 +42,7 @@ import java.util.HashMap;
  * 6. Comment   :   Initialize
  * </pre>
  */
-public class FragmentThingsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
+public class FragmentThingsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> implements ItemTouchHelperAdapter {
 
     public static final int TYPE_HEADER = 0;
     public static final int TYPE_ITEM = 1;
@@ -50,9 +57,13 @@ public class FragmentThingsAdapter extends RecyclerView.Adapter<RecyclerView.Vie
     private int listLayoutFooter;
     private String httpValue = "";
     private Boolean isListCheck = false;
+    private Boolean isDeleteCheck = false;
+    private Boolean isMoveCheck = false;
     private Boolean isHeaderCheck = false;
     private Boolean isFooterCheck = false;
     private Boolean isFooterVisible = false;
+    private final OnStartDragListener mDragStartListener;
+
 
     /**
      * 생성자.
@@ -66,7 +77,7 @@ public class FragmentThingsAdapter extends RecyclerView.Adapter<RecyclerView.Vie
      */
     public FragmentThingsAdapter(Context context, int listLayoutHead, int listLayoutItem,
                                  int listLayoutFooter, ArrayList<HashMap<String, Object>> alTmp,
-                                 ListInterface adapterCallback) {
+                                 ListInterface adapterCallback, OnStartDragListener dragStartListener) {
 
         this.context = context;
         alTotalList = alTmp;
@@ -74,6 +85,7 @@ public class FragmentThingsAdapter extends RecyclerView.Adapter<RecyclerView.Vie
         this.listLayoutItem = listLayoutItem;
         this.listLayoutFooter = listLayoutFooter;
         appConfig = (AppConfig) this.context.getApplicationContext();
+        mDragStartListener = dragStartListener;
 
         try {
             this.adapterCallback = adapterCallback;
@@ -102,6 +114,26 @@ public class FragmentThingsAdapter extends RecyclerView.Adapter<RecyclerView.Vie
         isListCheck = isCheck;
     }
 
+    public boolean getMoveCheck() {
+
+        return isMoveCheck;
+    }
+
+    public void setMoveCheck(boolean isCheck) {
+
+        isMoveCheck = isCheck;
+    }
+
+    public boolean getDeleteCheck() {
+
+        return isDeleteCheck;
+    }
+
+    public void setDeleteCheck(boolean isCheck) {
+
+        isDeleteCheck = isCheck;
+    }
+
     public boolean getHeaderCheck() {
 
         return isHeaderCheck;
@@ -163,7 +195,7 @@ public class FragmentThingsAdapter extends RecyclerView.Adapter<RecyclerView.Vie
             HashMap<String, Object> hmItem = new HashMap<String, Object>();
             hmItem = alTotalList.get(position);
             if (holder instanceof ItemViewHolder) {
-                ItemViewHolder itemViewHolerView = (ItemViewHolder) holder;
+                final ItemViewHolder itemViewHolerView = (ItemViewHolder) holder;
 
                 // (장치의) 접속 상태 (ON / OFF / none)
                 String onlineState = util.null2string(hmItem.get(Constants.KEY_DEVICE_ONLINE));
@@ -177,12 +209,17 @@ public class FragmentThingsAdapter extends RecyclerView.Adapter<RecyclerView.Vie
                 // 2016.08.03 노드 이미지 로컬에 있는 이미지를 사용하는걸로 변경.
                 itemViewHolerView.ivRowIcon.setImageResource(util.getImageId(context, "img_" + deviceclassTypeId));
 
-                itemViewHolerView.llRowOffline.setVisibility(View.GONE);
-                itemViewHolerView.llRowControl.setVisibility(View.GONE);
-                itemViewHolerView.llRowDelete.setVisibility(View.GONE);
+//                itemViewHolerView.llRowOffline.setVisibility(View.GONE);
+                itemViewHolerView.btnRowControl.setBackgroundResource(0);
+                itemViewHolerView.btnRowControl.setVisibility(GONE);
+                itemViewHolerView.ivRowDelete.setVisibility(GONE);
+                itemViewHolerView.ivRowMove.setVisibility(GONE);
 
                 // 장치명
                 String deviceName = util.null2string(hmItem.get(Constants.KEY_PRD_USER_NAME));
+                if ("".equals(deviceName)) {
+                    deviceName = util.null2string(hmItem.get(Constants.KEY_PRD_NAME));
+                }
                 itemViewHolerView.tvRowTitle.setText(deviceName);
 
                 // (default) 커맨드클래스 유형 ID number
@@ -203,11 +240,10 @@ public class FragmentThingsAdapter extends RecyclerView.Adapter<RecyclerView.Vie
                 if (!requestTime.equals("")) {
                     itemViewHolerView.llLoading.setVisibility(View.VISIBLE);
                 } else {
-                    itemViewHolerView.llLoading.setVisibility(View.GONE);
+                    itemViewHolerView.llLoading.setVisibility(GONE);
                 }
 
                 itemViewHolerView.btnRowControl.setTag(position);
-                itemViewHolerView.llRowControlBtn.setVisibility(View.GONE);
                 switch (cmdclsTypeIdNum) {
                     //SENSOR_BINARY
                     case Constants.CMDCLS_TYPE_ID_11001:
@@ -246,7 +282,7 @@ public class FragmentThingsAdapter extends RecyclerView.Adapter<RecyclerView.Vie
                     case Constants.CMDCLS_TYPE_ID_17005:
                     case Constants.CMDCLS_TYPE_ID_17006:
                         itemViewHolerView.tvRowControl.setText(tempValue);
-                        itemViewHolerView.llRowControlBtn.setVisibility(View.VISIBLE);
+                        itemViewHolerView.btnRowControl.setVisibility(View.VISIBLE);
 
                         if (contentValue.equals(select)) {
                             itemViewHolerView.ivRowIcon.setBackgroundResource(R.drawable.img_thing_icon_bg_default);
@@ -284,7 +320,7 @@ public class FragmentThingsAdapter extends RecyclerView.Adapter<RecyclerView.Vie
                         break;
                     case Constants.CMDCLS_TYPE_ID_36002:
                         itemViewHolerView.tvRowControl.setText(tempValue);
-                        itemViewHolerView.llRowControlBtn.setVisibility(View.VISIBLE);
+                        itemViewHolerView.btnRowControl.setVisibility(View.VISIBLE);
 
                         if (contentValue.equals(select)) {
                             itemViewHolerView.ivRowIcon.setBackgroundResource(R.drawable.img_thing_icon_bg_default);
@@ -498,32 +534,43 @@ public class FragmentThingsAdapter extends RecyclerView.Adapter<RecyclerView.Vie
                         break;
                 }
 
-                if (isListCheck) {
-                    itemViewHolerView.llRowControl.setVisibility(View.GONE);
-                    itemViewHolerView.llRowDelete.setVisibility(View.VISIBLE);
-                    itemViewHolerView.llRowOffline.setVisibility(View.GONE);
-                    itemViewHolerView.llLoading.setVisibility(View.GONE);
-                    if (onlineState.equals("OFF")
-                            || appConfig.getSelect_Homegrp_Homehub_Online_State().equals("OFF")) {
+                if (isDeleteCheck) {
+                    itemViewHolerView.btnRowControl.setVisibility(GONE);
+                    itemViewHolerView.ivRowDelete.setVisibility(View.VISIBLE);
+//                    itemViewHolerView.llRowOffline.setVisibility(GONE);
+                    itemViewHolerView.llLoading.setVisibility(GONE);
+                    if (onlineState.equals("OFF") || appConfig.getSelect_Homegrp_Homehub_Online_State().equals("OFF")) {
+                        itemViewHolerView.ivRowIcon.setBackgroundResource(R.drawable.img_thing_icon_bg_default);
+                    }
+                } else if (isMoveCheck) {
+                    itemViewHolerView.btnRowControl.setVisibility(GONE);
+                    itemViewHolerView.ivRowMove.setVisibility(View.VISIBLE);
+//                    itemViewHolerView.llRowOffline.setVisibility(GONE);
+                    itemViewHolerView.llLoading.setVisibility(GONE);
+                    if (onlineState.equals("OFF") || appConfig.getSelect_Homegrp_Homehub_Online_State().equals("OFF")) {
                         itemViewHolerView.ivRowIcon.setBackgroundResource(R.drawable.img_thing_icon_bg_default);
                     }
                 } else {
-                    if (onlineState.equals("OFF")
-                            || appConfig.getSelect_Homegrp_Homehub_Online_State().equals("OFF")) {
+                    if (onlineState.equals("OFF") || appConfig.getSelect_Homegrp_Homehub_Online_State().equals("OFF")) {
                         itemViewHolerView.ivRowIcon.setBackgroundResource(R.drawable.img_thing_icon_bg_default);
-                        itemViewHolerView.llRowControl.setVisibility(View.GONE);
-                        itemViewHolerView.llRowDelete.setVisibility(View.GONE);
-                        itemViewHolerView.llRowOffline.setVisibility(View.VISIBLE);
-                        itemViewHolerView.llLoading.setVisibility(View.GONE);
+//                        itemViewHolerView.llRowControl.setVisibility(GONE);
+//                        itemViewHolerView.llRowDelete.setVisibility(GONE);
+//                        itemViewHolerView.llRowOffline.setVisibility(View.VISIBLE);
+
+                        itemViewHolerView.tvRowControl.setText(util.getString(context, R.string.layout_offline));
+                        itemViewHolerView.tvRowControl.setTextColor(util.getColor(context, R.color.color_text_01));
+                        itemViewHolerView.llLoading.setVisibility(GONE);
+
                     } else {
-                        itemViewHolerView.llRowControl.setVisibility(View.VISIBLE);
-                        itemViewHolerView.llRowDelete.setVisibility(View.GONE);
-                        itemViewHolerView.llRowOffline.setVisibility(View.GONE);
+                        itemViewHolerView.btnRowControl.setVisibility(View.VISIBLE);
+//                        itemViewHolerView.llRowDelete.setVisibility(GONE);
+//                        itemViewHolerView.llRowOffline.setVisibility(GONE);
+
                     }
                 }
 
-                itemViewHolerView.llRowBody.setTag(position);
-                itemViewHolerView.llRowBody.setOnClickListener(new View.OnClickListener() {
+                itemViewHolerView.rlRowBody.setTag(position);
+                itemViewHolerView.rlRowBody.setOnClickListener(new View.OnClickListener() {
                     int tag = 0;
                     private Intent intent;
 
@@ -538,8 +585,8 @@ public class FragmentThingsAdapter extends RecyclerView.Adapter<RecyclerView.Vie
                         }
                     }
                 });
-                itemViewHolerView.llRowDelete.setTag(position);
-                itemViewHolerView.llRowDelete.setOnClickListener(new View.OnClickListener() {
+                itemViewHolerView.ivRowDelete.setTag(position);
+                itemViewHolerView.ivRowDelete.setOnClickListener(new View.OnClickListener() {
                     int tag = 0;
                     private Intent intent;
 
@@ -547,12 +594,22 @@ public class FragmentThingsAdapter extends RecyclerView.Adapter<RecyclerView.Vie
                     public void onClick(View view) {
 
                         tag = (int) view.getTag();
-                        if (isListCheck) {
-                            ;
+                        if (isDeleteCheck) {
                             adapterCallback.onCallAction(2, tag);
                         }
                     }
                 });
+
+                // Start a drag whenever the handle view it touched
+                itemViewHolerView.ivRowMove.setOnTouchListener(new View.OnTouchListener() {
+                    @Override
+                    public boolean onTouch(View v, MotionEvent event) {
+                        if (MotionEventCompat.getActionMasked(event) == MotionEvent.ACTION_DOWN) {
+                            mDragStartListener.onStartDrag(itemViewHolerView);
+                        }
+                        return false;
+                    }
+                });
             } else if (holder instanceof FooterViewHolder) {
 
                 FooterViewHolder vhItemView = (FooterViewHolder) holder;
@@ -560,14 +617,14 @@ public class FragmentThingsAdapter extends RecyclerView.Adapter<RecyclerView.Vie
                 if (moreYn.equals("Y")) {
                     vhItemView.llFooterProgress.setVisibility(View.VISIBLE);
                 } else {
-                    vhItemView.llFooterProgress.setVisibility(View.GONE);
-                    if (isListCheck) {
-                        vhItemView.llFooterBody.setVisibility(View.GONE);
+                    vhItemView.llFooterProgress.setVisibility(GONE);
+                    if (isDeleteCheck||isMoveCheck) {
+                        vhItemView.llFooterBody.setVisibility(GONE);
                     } else {
                         if (isFooterVisible) {
                             vhItemView.llFooterBody.setVisibility(View.VISIBLE);
                         } else {
-                            vhItemView.llFooterBody.setVisibility(View.GONE);
+                            vhItemView.llFooterBody.setVisibility(GONE);
                         }
 
                         vhItemView.llFooterBody.setOnClickListener(new View.OnClickListener() {
@@ -610,20 +667,23 @@ public class FragmentThingsAdapter extends RecyclerView.Adapter<RecyclerView.Vie
     public static class ItemViewHolder extends RecyclerView.ViewHolder {
 
         public LinearLayout llRowRoot;
-        public LinearLayout llRowBody;
-        public LinearLayout llRowControl;
-        public LinearLayout llRowControlBtn;
-        public LinearLayout llRowDelete;
-        public LinearLayout llRowOffline;
-        public LinearLayout llLoading;
         public RelativeLayout rlRowBody;
         public ImageView ivRowIcon;
         public TextView tvRowTitle;
         public TextView tvRowControl;
-        public TextView tvRowBody;
-        public TextView tvRowOffline;
         public Button btnRowControl;
+        public ImageView ivRowMove;
         public ImageView ivRowDelete;
+        public LinearLayout llLoading;
+
+
+//        public LinearLayout llRowBody;
+//        public LinearLayout llRowControl;
+//        public LinearLayout llRowControlBtn;
+//        public LinearLayout llRowDelete;
+//        public LinearLayout llRowOffline;
+//        public TextView tvRowBody;
+//        public TextView tvRowOffline;
 
         /**
          * 생성자.
@@ -634,20 +694,22 @@ public class FragmentThingsAdapter extends RecyclerView.Adapter<RecyclerView.Vie
 
             super(itemView);
             llRowRoot = (LinearLayout) itemView.findViewById(R.id.llRowRoot);
-            llRowBody = (LinearLayout) itemView.findViewById(R.id.llRowBody);
-            llRowControl = (LinearLayout) itemView.findViewById(R.id.llRowControl);
-            llRowControlBtn = (LinearLayout) itemView.findViewById(R.id.llRowControlBtn);
-            llRowDelete = (LinearLayout) itemView.findViewById(R.id.llRowDelete);
-            llRowOffline = (LinearLayout) itemView.findViewById(R.id.llRowOffline);
-            llLoading = (LinearLayout) itemView.findViewById(R.id.llLoading);
             rlRowBody = (RelativeLayout) itemView.findViewById(R.id.rlRowBody);
             ivRowIcon = (ImageView) itemView.findViewById(R.id.ivRowIcon);
             tvRowTitle = (TextView) itemView.findViewById(R.id.tvRowTitle);
-            tvRowBody = (TextView) itemView.findViewById(R.id.tvRowBody);
             tvRowControl = (TextView) itemView.findViewById(R.id.tvRowControl);
-            tvRowOffline = (TextView) itemView.findViewById(R.id.tvRowOffline);
             btnRowControl = (Button) itemView.findViewById(R.id.btnRowControl);
+            ivRowMove = (ImageView) itemView.findViewById(R.id.ivRowMove);
             ivRowDelete = (ImageView) itemView.findViewById(R.id.ivRowDelete);
+            llLoading = (LinearLayout) itemView.findViewById(R.id.llLoading);
+
+//            llRowBody = (LinearLayout) itemView.findViewById(R.id.llRowBody);
+//            llRowControl = (LinearLayout) itemView.findViewById(R.id.llRowControl);
+//            llRowControlBtn = (LinearLayout) itemView.findViewById(R.id.llRowControlBtn);
+//            llRowDelete = (LinearLayout) itemView.findViewById(R.id.llRowDelete);
+//            llRowOffline = (LinearLayout) itemView.findViewById(R.id.llRowOffline);
+//            tvRowBody = (TextView) itemView.findViewById(R.id.tvRowBody);
+//            tvRowOffline = (TextView) itemView.findViewById(R.id.tvRowOffline);
         }
     }
 
@@ -705,4 +767,17 @@ public class FragmentThingsAdapter extends RecyclerView.Adapter<RecyclerView.Vie
             ivFooterAdd = (ImageView) itemView.findViewById(R.id.ivFooterAdd);
         }
     }
+
+    @Override
+    public void onItemDismiss(int position) {
+        alTotalList.remove(position);
+        notifyItemRemoved(position);
+    }
+
+    @Override
+    public boolean onItemMove(int fromPosition, int toPosition) {
+        Collections.swap(alTotalList, fromPosition, toPosition);
+        notifyItemMoved(fromPosition, toPosition);
+        return true;
+    }
 }

+ 11 - 0
onecable/src/main/res/drawable/d_common_list_btn_changeorder.xml

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright (c) 2015. Ncomz. All Rights Reserved
+  -->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <item android:drawable="@drawable/common_list_btn_changeorder_press" android:state_pressed="true"/>
+    <item android:drawable="@drawable/common_list_btn_changeorder" />
+
+</selector>

+ 1 - 0
onecable/src/main/res/layout/app_toolbar.xml

@@ -139,6 +139,7 @@
                         android:textSize="@dimen/size_font_03"
                         android:textStyle="bold"/>
             </LinearLayout>
+
             <View
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"

+ 19 - 0
onecable/src/main/res/layout/fragment_things.xml

@@ -14,6 +14,25 @@
 
     <include layout="@layout/app_toolbar"/>
 
+    <LinearLayout
+            android:id="@+id/llHomeHubState"
+            android:layout_width="match_parent"
+            android:background="@drawable/img_head_bg"
+            android:orientation="horizontal"
+            android:gravity="center"
+            android:visibility="gone"
+            android:layout_height="@dimen/MyActionBar_Height">
+        <TextView
+                android:id="@+id/tvHomeHubState"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:includeFontPadding="false"
+                android:text="@string/layout_homehub_offline"
+                android:textColor="@color/color_text_02"
+                android:textSize="@dimen/size_font_03"
+                android:textStyle="bold"/>
+    </LinearLayout>
+
     <RelativeLayout
             android:layout_width="match_parent"
             android:layout_height="0dp"

+ 73 - 145
onecable/src/main/res/layout/row_things_list.xml

@@ -15,164 +15,92 @@
             android:id="@+id/rlRowBody"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:padding="2dp">
-
-        <LinearLayout
-                android:id="@+id/llRowBody"
-                android:layout_width="match_parent"
+            android:minHeight="202dp"
+            android:background="@drawable/d_list_bg"
+            android:layout_margin="2dp">
+
+
+        <com.ntels.onecable.common.widget.CircleImageView
+                android:id="@+id/ivRowIcon"
+                android:layout_width="75dp"
+                android:layout_height="75dp"
+                android:layout_centerHorizontal="true"
+                android:layout_marginTop="24dp"
+                app:civ_border_color="@color/Translucent"
+                app:civ_border_width="0dp"/>
+
+        <TextView
+                android:id="@+id/tvRowTitle"
+                android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
+                android:layout_below="@+id/ivRowIcon"
+                android:layout_marginTop="27dp"
+                android:layout_marginLeft="15dp"
+                android:ellipsize="end"
+                android:layout_alignParentLeft="true"
+                android:includeFontPadding="false"
+                android:singleLine="true"
+                android:text="스마트 플러그"
+                android:textColor="@color/color_text_01"
+                android:textSize="@dimen/size_font_04"/>
+
+        <TextView
+                android:id="@+id/tvRowControl"
+                android:layout_below="@+id/tvRowTitle"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginTop="6dp"
+                android:layout_marginLeft="15dp"
+                android:layout_marginRight="55dp"
+                android:layout_marginBottom="22dp"
+                android:ellipsize="end"
                 android:gravity="center_horizontal"
-                android:orientation="vertical"
-                android:minHeight="202dp"
-                android:background="@drawable/d_list_bg"
-                android:paddingBottom="10dp"
-                android:paddingLeft="10dp"
-                android:paddingRight="10dp"
-                android:paddingTop="24dp"
-                android:layout_centerVertical="true"
-                android:layout_centerHorizontal="true">
-
-
-            <com.ntels.onecable.common.widget.CircleImageView
-                    android:id="@+id/ivRowIcon"
-                    android:layout_width="75dp"
-                    android:layout_height="75dp"
-                    android:layout_marginLeft="5dp"
-                    app:civ_border_color="@color/Translucent"
-                    app:civ_border_width="0dp"/>
-
-
-            <RelativeLayout
-                    android:layout_width="match_parent"
-                    android:layout_marginLeft="5dp"
-                    android:layout_height="wrap_content">
-
-                <TextView
-                        android:id="@+id/tvRowTitle"
-                        android:layout_width="wrap_content"
-                        android:layout_height="wrap_content"
-                        android:layout_marginTop="27dp"
-                        android:ellipsize="end"
-                        android:layout_alignParentLeft="true"
-                        android:includeFontPadding="false"
-                        android:singleLine="true"
-                        android:text="스마트 플러그"
-                        android:textColor="@color/color_text_01"
-                        android:textSize="@dimen/size_font_04"/>
+                android:includeFontPadding="false"
+                android:singleLine="true"
+                android:text="닫힘"
+                android:textColor="@color/color_text_01"
+                android:textSize="@dimen/size_font_05"
+                android:textStyle="bold"/>
 
-                <LinearLayout
-                        android:id="@+id/llRowControl"
-                        android:layout_width="match_parent"
-                        android:layout_height="wrap_content"
-                        android:layout_alignBottom="@+id/tvRowTitle"
-                        android:layout_alignParentBottom="true"
-                        android:layout_marginTop="6dp"
-                        android:layout_marginBottom="12dp"
-                        android:gravity="left"
-                        android:orientation="horizontal">
 
-                    <TextView
-                            android:id="@+id/tvRowControl"
-                            android:layout_width="wrap_content"
-                            android:layout_height="wrap_content"
-                            android:layout_marginLeft="8dp"
-                            android:layout_marginRight="8dp"
-                            android:ellipsize="end"
-                            android:gravity="center_horizontal"
-                            android:includeFontPadding="false"
-                            android:singleLine="true"
-                            android:text="닫힘"
-                            android:textColor="@color/color_text_01"
-                            android:textSize="@dimen/size_font_05"
-                            android:textStyle="bold"/>
-
-                </LinearLayout>
-
-                <LinearLayout
-                        android:id="@+id/llRowControlBtn"
-                        android:layout_width="wrap_content"
-                        android:layout_height="wrap_content"
-                        android:layout_alignParentBottom="true"
-                        android:visibility="visible">
-
-                    <View
-                            android:id="@+id/vEmp1"
-                            android:layout_width="0dp"
-                            android:layout_height="match_parent"
-                            android:layout_weight="1"
-                            android:gravity="center_horizontal"/>
-
-                    <Button
-                            android:id="@+id/btnRowControl"
-                            android:layout_width="45dp"
-                            android:layout_height="45dp"
-                            android:background="@drawable/img_things_list_btn_onoff_off"/>
-                </LinearLayout>
-            </RelativeLayout>
-
-            <LinearLayout
-                    android:id="@+id/llRowDelete"
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:layout_gravity="center_horizontal"
-                    android:layout_marginTop="20dp"
-                    android:gravity="center"
-                    android:minHeight="35dp"
-                    android:orientation="horizontal"
-                    android:visibility="gone">
-
-                <ImageView
-                        android:id="@+id/ivRowDelete"
-                        android:layout_width="45dp"
-                        android:layout_height="35dp"
-                        android:layout_marginRight="5dp"
-                        android:background="@drawable/d_img_things_list_btn_delete"
-                        android:duplicateParentState="true"/>
-            </LinearLayout>
-
-            <LinearLayout
-                    android:id="@+id/llRowOffline"
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:layout_gravity="center_horizontal"
-                    android:layout_marginTop="20dp"
-                    android:gravity="center"
-                    android:minHeight="35dp"
-                    android:orientation="horizontal"
-                    android:visibility="gone">
-
-                <TextView
-                        android:id="@+id/tvRowOffline"
-                        android:layout_width="wrap_content"
-                        android:layout_height="wrap_content"
-                        android:ellipsize="end"
-                        android:gravity="center_horizontal"
-                        android:includeFontPadding="false"
-                        android:singleLine="true"
-                        android:text="@string/layout_offline"
-                        android:textColor="@color/color_text_01"
-                        android:textSize="@dimen/size_font_03"
-                        android:textStyle="bold"/>
-            </LinearLayout>
+        <LinearLayout
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_alignParentBottom="true"
+                android:layout_alignParentRight="true">
+
+            <Button
+                    android:id="@+id/btnRowControl"
+                    android:layout_width="45dp"
+                    android:layout_height="45dp"
+                    android:layout_marginRight="10dp"
+                    android:layout_marginBottom="10dp"
+                    android:background="@drawable/img_things_list_btn_onoff_off"/>
+
+            <ImageView
+                    android:id="@+id/ivRowMove"
+                    android:layout_width="40dp"
+                    android:layout_height="40dp"
+                    android:layout_marginRight="4dp"
+                    android:layout_marginBottom="8dp"
+                    android:background="@drawable/d_common_list_btn_changeorder"
+                    android:visibility="gone"/>
         </LinearLayout>
 
         <ImageView
-                android:id="@+id/ivCheck"
-                android:layout_width="30dp"
-                android:layout_height="30dp"
-                android:layout_marginLeft="15dp"
-                android:layout_marginTop="15dp"
-                android:background="@drawable/d_common_checkbox"
+                android:id="@+id/ivRowDelete"
+                android:layout_width="40dp"
+                android:layout_height="40dp"
+                android:layout_alignParentRight="true"
+                android:layout_marginRight="5dp"
+                android:layout_marginTop="5dp"
+                android:background="@drawable/d_common_list_btn_delete"
                 android:visibility="gone"/>
 
         <LinearLayout
                 android:id="@+id/llLoading"
                 android:layout_width="match_parent"
                 android:layout_height="match_parent"
-                android:layout_alignBottom="@+id/llRowBody"
-                android:layout_alignLeft="@+id/llRowBody"
-                android:layout_alignRight="@+id/llRowBody"
-                android:layout_alignTop="@+id/llRowBody"
                 android:visibility="gone"
                 android:background="@drawable/common_bg_alpha_85_w"
                 android:gravity="center">

+ 188 - 0
onecable/src/main/res/layout/row_things_list1.xml

@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright (c) 2015. Ncomz. All Rights Reserved
+  -->
+
+<LinearLayout
+        xmlns:android="http://schemas.android.com/apk/res/android"
+        xmlns:app="http://schemas.android.com/apk/res-auto"
+        android:id="@+id/llRowRoot"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="vertical">
+
+    <RelativeLayout
+            android:id="@+id/rlRowBody"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:padding="2dp">
+
+        <LinearLayout
+                android:id="@+id/llRowBody"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:gravity="center_horizontal"
+                android:orientation="vertical"
+                android:minHeight="202dp"
+                android:background="@drawable/d_list_bg"
+                android:paddingBottom="10dp"
+                android:paddingLeft="10dp"
+                android:paddingRight="10dp"
+                android:paddingTop="24dp"
+                android:layout_centerVertical="true"
+                android:layout_centerHorizontal="true">
+
+
+            <com.ntels.onecable.common.widget.CircleImageView
+                    android:id="@+id/ivRowIcon"
+                    android:layout_width="75dp"
+                    android:layout_height="75dp"
+                    android:layout_marginLeft="5dp"
+                    app:civ_border_color="@color/Translucent"
+                    app:civ_border_width="0dp"/>
+
+
+            <RelativeLayout
+                    android:layout_width="match_parent"
+                    android:layout_marginLeft="5dp"
+                    android:layout_height="wrap_content">
+
+                <TextView
+                        android:id="@+id/tvRowTitle"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_marginTop="27dp"
+                        android:ellipsize="end"
+                        android:layout_alignParentLeft="true"
+                        android:includeFontPadding="false"
+                        android:singleLine="true"
+                        android:text="스마트 플러그"
+                        android:textColor="@color/color_text_01"
+                        android:textSize="@dimen/size_font_04"/>
+
+                <LinearLayout
+                        android:id="@+id/llRowControl"
+                        android:layout_width="match_parent"
+                        android:layout_height="wrap_content"
+                        android:layout_below="@+id/tvRowTitle"
+                        android:layout_alignParentBottom="true"
+                        android:layout_marginTop="6dp"
+                        android:layout_marginBottom="12dp"
+                        android:gravity="left"
+                        android:orientation="horizontal">
+
+                    <TextView
+                            android:id="@+id/tvRowControl"
+                            android:layout_width="wrap_content"
+                            android:layout_height="wrap_content"
+                            android:layout_marginLeft="8dp"
+                            android:layout_marginRight="8dp"
+                            android:ellipsize="end"
+                            android:gravity="center_horizontal"
+                            android:includeFontPadding="false"
+                            android:singleLine="true"
+                            android:text="닫힘"
+                            android:textColor="@color/color_text_01"
+                            android:textSize="@dimen/size_font_05"
+                            android:textStyle="bold"/>
+
+                </LinearLayout>
+
+                <LinearLayout
+                        android:id="@+id/llRowControlBtn"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_alignParentBottom="true"
+                        android:visibility="visible">
+
+                    <View
+                            android:id="@+id/vEmp1"
+                            android:layout_width="0dp"
+                            android:layout_height="match_parent"
+                            android:layout_weight="1"
+                            android:gravity="center_horizontal"/>
+
+                    <Button
+                            android:id="@+id/btnRowControl"
+                            android:layout_width="45dp"
+                            android:layout_height="45dp"
+                            android:background="@drawable/img_things_list_btn_onoff_off"/>
+                </LinearLayout>
+            </RelativeLayout>
+
+            <LinearLayout
+                    android:id="@+id/llRowDelete"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_gravity="center_horizontal"
+                    android:layout_marginTop="20dp"
+                    android:gravity="center"
+                    android:minHeight="35dp"
+                    android:orientation="horizontal"
+                    android:visibility="visible">
+
+                <ImageView
+                        android:id="@+id/ivRowDelete"
+                        android:layout_width="45dp"
+                        android:layout_height="35dp"
+                        android:layout_marginRight="5dp"
+                        android:background="@drawable/d_img_things_list_btn_delete"
+                        android:duplicateParentState="true"/>
+            </LinearLayout>
+
+            <LinearLayout
+                    android:id="@+id/llRowOffline"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_gravity="center_horizontal"
+                    android:layout_marginTop="20dp"
+                    android:gravity="center"
+                    android:minHeight="35dp"
+                    android:orientation="horizontal"
+                    android:visibility="visible">
+
+                <TextView
+                        android:id="@+id/tvRowOffline"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:ellipsize="end"
+                        android:gravity="center_horizontal"
+                        android:includeFontPadding="false"
+                        android:singleLine="true"
+                        android:text="@string/layout_offline"
+                        android:textColor="@color/color_text_01"
+                        android:textSize="@dimen/size_font_03"
+                        android:textStyle="bold"/>
+            </LinearLayout>
+        </LinearLayout>
+
+        <ImageView
+                android:id="@+id/ivCheck"
+                android:layout_width="30dp"
+                android:layout_height="30dp"
+                android:layout_marginLeft="15dp"
+                android:layout_marginTop="15dp"
+                android:background="@drawable/d_common_checkbox"
+                android:visibility="visible"/>
+
+        <LinearLayout
+                android:id="@+id/llLoading"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:layout_alignBottom="@+id/llRowBody"
+                android:layout_alignLeft="@+id/llRowBody"
+                android:layout_alignRight="@+id/llRowBody"
+                android:layout_alignTop="@+id/llRowBody"
+                android:visibility="gone"
+                android:background="@drawable/common_bg_alpha_85_w"
+                android:gravity="center">
+
+            <ProgressBar
+                    android:id="@+id/progressLoading"
+                    android:layout_width="60dp"
+                    android:layout_height="60dp"
+                    android:indeterminateDrawable="@drawable/d_things_run_loading"
+                    android:indeterminateDuration="100"/>
+        </LinearLayout>
+    </RelativeLayout>
+</LinearLayout>

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

@@ -467,6 +467,7 @@
   <string name="layout_context_menu_19"><![CDATA["규칙 편집"]]></string>
   <string name="layout_context_menu_20"><![CDATA["동기화"]]></string>
   <string name="layout_context_menu_21"><![CDATA["권한양도"]]></string>
+  <string name="layout_context_menu_22"><![CDATA["순서 변경"]]></string>
   <string name="layout_address_select"><![CDATA["주소선택"]]></string>
   <string name="layout_congratulations"><![CDATA["축하합니다."]]></string>
   <string name="layout_call_man"><![CDATA["초대자"]]></string>