From 918e4736db64101e8412b5c19f33ede144f24196 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E9=9C=9E?= <2968206994@qq.com> Date: Wed, 14 May 2025 19:14:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=BE=E4=B8=8D=E5=88=B0=E7=AC=A6=E5=8F=B7?= =?UTF-8?q?=E5=8F=8Aswitch=E8=AF=AD=E5=8F=A5=E6=8A=A5=E9=94=99(=E5=9C=A8gr?= =?UTF-8?q?adle.properties=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=E4=B8=8B?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=EF=BC=9Aandroid.nonFinalResIds=3Dfalse)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../notes/gtask/remote/GTaskASyncTask.java | 19 ++++++++++--------- xiaomi/gradle.properties | 3 ++- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/xiaomi/app/src/main/java/net/micode/notes/gtask/remote/GTaskASyncTask.java b/xiaomi/app/src/main/java/net/micode/notes/gtask/remote/GTaskASyncTask.java index b3b61e7..a1deb99 100644 --- a/xiaomi/app/src/main/java/net/micode/notes/gtask/remote/GTaskASyncTask.java +++ b/xiaomi/app/src/main/java/net/micode/notes/gtask/remote/GTaskASyncTask.java @@ -64,21 +64,22 @@ public class GTaskASyncTask extends AsyncTask { } private void showNotification(int tickerId, String content) { - Notification notification = new Notification(R.drawable.notification, mContext - .getString(tickerId), System.currentTimeMillis()); - notification.defaults = Notification.DEFAULT_LIGHTS; - notification.flags = Notification.FLAG_AUTO_CANCEL; PendingIntent pendingIntent; if (tickerId != R.string.ticker_success) { pendingIntent = PendingIntent.getActivity(mContext, 0, new Intent(mContext, - NotesPreferenceActivity.class), 0); - + NotesPreferenceActivity.class), PendingIntent.FLAG_IMMUTABLE); } else { pendingIntent = PendingIntent.getActivity(mContext, 0, new Intent(mContext, - NotesListActivity.class), 0); + NotesListActivity.class), PendingIntent.FLAG_IMMUTABLE); } - notification.setLatestEventInfo(mContext, mContext.getString(R.string.app_name), content, - pendingIntent); + Notification.Builder builder = new Notification.Builder(mContext) + .setAutoCancel(true) + .setContentTitle(mContext.getString(R.string.app_name)) + .setContentText(content) + .setContentIntent(pendingIntent) + .setWhen(System.currentTimeMillis()) + .setOngoing(true); + Notification notification=builder.getNotification(); mNotifiManager.notify(GTASK_SYNC_NOTIFICATION_ID, notification); } diff --git a/xiaomi/gradle.properties b/xiaomi/gradle.properties index 4387edc..fd5ffa1 100644 --- a/xiaomi/gradle.properties +++ b/xiaomi/gradle.properties @@ -18,4 +18,5 @@ android.useAndroidX=true # Enables namespacing of each library's R class so that its R class includes only the # resources declared in the library itself and none from the library's dependencies, # thereby reducing the size of the R class for that library -android.nonTransitiveRClass=true \ No newline at end of file +android.nonTransitiveRClass=true +android.nonFinalResIds=false