adjust notification issues.
authorTrillGates <williamtrillgates@gmail.com>
Fri, 3 Sep 2021 10:48:39 +0000 (18:48 +0800)
committerTrillGates <williamtrillgates@gmail.com>
Fri, 3 Sep 2021 10:48:39 +0000 (18:48 +0800)
app/release/ICLoopPageLauncher_V42_202109031730_release.apk [moved from app/release/ICLoopPageLauncher_V41_202109031043_release.apk with 57% similarity]
app/release/output-metadata.json
app/src/main/java/com/ic/launcher/NotificationActivity.java
app/src/main/java/com/ic/launcher/data/NotificationItem.java
app/src/main/java/com/ic/launcher/presenter/NotificationPresenter.java
app/src/main/res/layout/item_notification.xml
app/version_code.properties

similarity index 57%
rename from app/release/ICLoopPageLauncher_V41_202109031043_release.apk
rename to app/release/ICLoopPageLauncher_V42_202109031730_release.apk
index 517c64c..cc96928 100644 (file)
Binary files a/app/release/ICLoopPageLauncher_V41_202109031043_release.apk and b/app/release/ICLoopPageLauncher_V42_202109031730_release.apk differ
index 4733003..1493ee3 100644 (file)
@@ -12,7 +12,7 @@
       "filters": [],
       "versionCode": 1,
       "versionName": "1.0",
-      "outputFile": "ICLoopPageLauncher_V41_202109031043_release.apk"
+      "outputFile": "ICLoopPageLauncher_V42_202109031730_release.apk"
     }
   ]
 }
\ No newline at end of file
index c025ae0..17a2b47 100644 (file)
@@ -128,9 +128,10 @@ public class NotificationActivity extends AppCompatActivity {
         String title = notificationItem.getTitle();
         switch (category) {
             case CATEGORY_SMS:
+                ICLogger.d("notificationItem.getPhone() ==> " + notificationItem.getPhone());
                 //跳转到短信详情界面
                 intent.setAction("com.ic.sms.action.DETAIL");
-                intent.putExtra("detailNum", notificationItem.getTitle());
+                intent.putExtra("detailNum", notificationItem.getPhone());
                 break;
             case CATEGORY_TEMPERATURE:
             case CATEGORY_BLOOD:
index 762673c..97b8c47 100644 (file)
@@ -7,6 +7,15 @@ public class NotificationItem {
     private String category;
     private String type;
     private int order;
+    private String phone;
+
+    public String getPhone() {
+        return phone;
+    }
+
+    public void setPhone(String phone) {
+        this.phone = phone;
+    }
 
     public int getId() {
         return id;
index f08a3ce..d86449c 100644 (file)
@@ -77,8 +77,10 @@ public class NotificationPresenter extends BasePresenter {
                     String category = query.getString(3);
                     notificationItem.setCategory(category);
                     int order = query.getInt(4);
+                    String phoneNum = query.getString(5);
+                    notificationItem.setPhone(phoneNum);
                     notificationItem.setOrder(order);
-                    long date = query.getLong(5);
+                    long date = query.getLong(6);
                     notificationItem.setDate(date);
                     ICLogger.d("notificationItem == > " +
                             notificationItem.toString());
@@ -90,27 +92,19 @@ public class NotificationPresenter extends BasePresenter {
                 //如果数量大于1,就显示通知界面
                 query.close();
             }
+            handleTopIcons();
         });
     }
 
-    public void removeNotificationByCategory(String category, String title) {
-        executorService.execute(() -> {
-            int delete;
-            if (TextUtils.isEmpty(title)) {
-                delete = contentResolver.delete(Uri.parse(Constants.NOTIFICATIONS),
-                        "category=?",
-                        new String[]{category});
-            } else {
-                delete = contentResolver.delete(Uri.parse(Constants.NOTIFICATIONS),
-                        "category=? and title=?",
-                        new String[]{category, title});
-            }
-            ICLogger.d("deleted == > " + delete);
-        });
+    private void handleTopIcons() {
+
         //根据类型修改顶部的值
         //如果是短信
-        Map<String, Integer> tempMap = new HashMap<>();
         List<NotificationItem> value = notificationListValue.getValue();
+        if (value == null) {
+            return;
+        }
+        Map<String, Integer> tempMap = new HashMap<>();
         for (int i = 0; i < value.size(); i++) {
             NotificationItem notificationItem = value.get(i);
             String itemCategory = notificationItem.getCategory();
@@ -144,4 +138,21 @@ public class NotificationPresenter extends BasePresenter {
             contentResolver.insert(Uri.parse(Constants.SETTINGS), contentValues);
         }
     }
+
+    public void removeNotificationByCategory(String category, String title) {
+        executorService.execute(() -> {
+            int delete;
+            if (TextUtils.isEmpty(title)) {
+                delete = contentResolver.delete(Uri.parse(Constants.NOTIFICATIONS),
+                        "category=?",
+                        new String[]{category});
+            } else {
+                delete = contentResolver.delete(Uri.parse(Constants.NOTIFICATIONS),
+                        "category=? and title=?",
+                        new String[]{category, title});
+            }
+            ICLogger.d("deleted == > " + delete);
+        });
+        updateData();
+    }
 }
index 37ca727..40d7b9e 100644 (file)
@@ -21,6 +21,8 @@
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_marginLeft="10dp"
+        android:ellipsize="marquee"
+        android:singleLine="true"
         android:text="通知标题"
         android:textColor="@color/black"
         android:textSize="22sp"
index 03a514b..48d8d17 100644 (file)
@@ -1,2 +1,2 @@
-#Fri Sep 03 10:43:20 CST 2021
-VERSION_CODE=41
+#Fri Sep 03 17:30:04 CST 2021
+VERSION_CODE=42