From cd107228c555b72a6dcc75fa42b2d6ea6f7f6e37 Mon Sep 17 00:00:00 2001 From: tyhs38 <1520736971@qq.com> Date: Thu, 15 May 2025 09:04:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E6=89=BE=E4=B8=8D=E5=88=B0=E7=AC=A6=E5=8F=B7=E7=9A=84=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../notes/gtask/remote/GTaskASyncTask.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Note-masters/app/src/main/java/net/micode/notes/gtask/remote/GTaskASyncTask.java b/Note-masters/app/src/main/java/net/micode/notes/gtask/remote/GTaskASyncTask.java index b3b61e7..43cbee6 100644 --- a/Note-masters/app/src/main/java/net/micode/notes/gtask/remote/GTaskASyncTask.java +++ b/Note-masters/app/src/main/java/net/micode/notes/gtask/remote/GTaskASyncTask.java @@ -64,24 +64,24 @@ 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); } - @Override protected Integer doInBackground(Void... unused) { publishProgess(mContext.getString(R.string.sync_progress_login, NotesPreferenceActivity -- 2.34.1