Quellcode durchsuchen

[WallPadMain]
1. 즐겨찾기 이슈 수정
- 즐겨찾기에는 있지만, 사용안함되어 있는경우 실제 즐겨찾기에 있는 아이콘만 DB에 반영하도록 수정

jglee vor 2 Jahren
Ursprung
Commit
26cbeb4dd3

+ 53 - 0
WallPadMain/src/main/java/kr/co/icontrols/wallpadmain/screen/MAIN.java

@@ -28,6 +28,7 @@ import com.artncore.wallpadapi.Sdb_LivingRoomLightAPI;
 import com.artncore.wallpadapi.WallPadAPI;
 import com.util.LogUtil;
 
+import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.List;
 
@@ -449,6 +450,9 @@ public class MAIN extends WpadScreen {
 
 //            mIconInfoTable.printValue();
 
+            //jglee - 즐겨찾기 이슈 수정을 위해(실제 올라가있는 아이콘과 DB를 비교하기 위하여 생선된 변수
+            ArrayList<WallpadStatusData.WidgetItem> listDelShortIcon = null;
+
             MainActivity.nShortcutCnt = MainActivity.MainScreenShortcutList.size();
             for (int i = 0; i < MainActivity.nShortcutCnt && i < MainActivity.nShortcutMax; i++) {
                 Log.d(TAG, "[registerShortcutIcon] MainScreenShortcutList.get(" + i + ").idx() : " + MainActivity.MainScreenShortcutList.get(i).idx + ", MainScreenShortcutList.get(" + i + ").widgetID() : " + MainActivity.MainScreenShortcutList.get(i).widgetID);
@@ -473,9 +477,58 @@ public class MAIN extends WpadScreen {
                     TXT_SHORTCUT_NAME[i].setText(mIconInfo.getIconName());
                 }
                 else {
+                    //여기서 이슈 발생 해당 아이콘 Table 에서 정보가 없음
+                    //여기서 다시 List 정리해서 해당 적용 필요
+                    if(listDelShortIcon == null)
+                        listDelShortIcon = new ArrayList<WallpadStatusData.WidgetItem>();
+                    Log.w(TAG, "Del Add Icon ID : " + MainActivity.MainScreenShortcutList.get(i).widgetID);
+                    listDelShortIcon.add(MainActivity.MainScreenShortcutList.get(i));
+
                     Log.w(TAG, "[registerShortcutIcon] mIconInfo is null!!");
                 }
             }
+
+
+            //여기서 List에 갯수가 남아 있으면 해당 아이콘 삭제를 진행
+            if(listDelShortIcon!=null && listDelShortIcon.size() != 0)
+            {
+                for(int del_index = 0; del_index < listDelShortIcon.size() ; del_index++)
+                {
+                    int del_widget_id = listDelShortIcon.get(del_index).widgetID;
+                    try {
+                        if (MainActivity.MainScreenShortcutList != null) {
+                            for (int i = 0; i < MainActivity.MainScreenShortcutList.size(); i++) {
+                                if (MainActivity.MainScreenShortcutList.get(i).widgetID == del_widget_id) {
+                                    //데이터 수집 앱 이름
+                                    IconInfoTable.IconInfo mIconInfo = mIconInfoTable.getIconInfoByID(MainActivity.MainScreenShortcutList.get(i).widgetID);
+
+                                    if (!deleteShortcutDB(MainActivity.MainScreenShortcutList.get(i).idx)) {
+                                        Log.w(TAG, "[procDeleteShortcutPopupResult] deleteShortcutDB = false!!");
+                                    }
+                                }
+                            }
+                        }
+                    } catch (RuntimeException re) {
+                        LogUtil.errorLogInfo("", TAG, re);
+                    }
+                    catch (Exception e) {
+                        Log.e(TAG, "[Exception] procDeleteShortcutPopupResult(boolean bDelete, int nShortcutID)");
+                        //e.printStackTrace();
+                        LogUtil.errorLogInfo("", TAG, e);
+                    }
+                }
+                
+                //아이콘 재정렬
+                unRegisterWidgetIcon(getLayout());
+                reOrderingShortcut();
+                registerShortcutIcon(getLayout());
+            }
+
+            if(listDelShortIcon!=null)
+                listDelShortIcon.clear();
+
+            listDelShortIcon = null;
+
         } catch (RuntimeException re) {
             LogUtil.errorLogInfo("", TAG, re);
         }