From ba89f3efba437d1921809e9b1ebff203f885fd0a Mon Sep 17 00:00:00 2001 From: tabzzz Date: Mon, 22 Apr 2024 19:07:01 +0800 Subject: [PATCH] =?UTF-8?q?[fix]=E4=BF=AE=E6=94=B9BUG=EF=BC=8C=E6=88=90?= =?UTF-8?q?=E5=8A=9F=E8=BF=90=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../notes/gtask/remote/GTaskASyncTask.java | 22 ++++++++++--------- .../micode/notes/ui/NotesListActivity.java | 2 ++ 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/net/micode/notes/gtask/remote/GTaskASyncTask.java b/src/net/micode/notes/gtask/remote/GTaskASyncTask.java index b3b61e7..9dc4ccd 100644 --- a/src/net/micode/notes/gtask/remote/GTaskASyncTask.java +++ b/src/net/micode/notes/gtask/remote/GTaskASyncTask.java @@ -17,6 +17,7 @@ package net.micode.notes.gtask.remote; +import android.annotation.SuppressLint; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; @@ -31,19 +32,20 @@ import net.micode.notes.ui.NotesPreferenceActivity; public class GTaskASyncTask extends AsyncTask { - private static int GTASK_SYNC_NOTIFICATION_ID = 5234235; + private static final int GTASK_SYNC_NOTIFICATION_ID = 5234235; public interface OnCompleteListener { void onComplete(); } - private Context mContext; + @SuppressLint("StaticFieldLeak") + private final Context mContext; - private NotificationManager mNotifiManager; + private final NotificationManager mNotifiManager; - private GTaskManager mTaskManager; + private final GTaskManager mTaskManager; - private OnCompleteListener mOnCompleteListener; + private final OnCompleteListener mOnCompleteListener; public GTaskASyncTask(Context context, OnCompleteListener listener) { mContext = context; @@ -58,11 +60,10 @@ public class GTaskASyncTask extends AsyncTask { } public void publishProgess(String message) { - publishProgress(new String[] { - message - }); + publishProgress(message); } + @SuppressLint("UnspecifiedImmutableFlag") private void showNotification(int tickerId, String content) { Notification notification = new Notification(R.drawable.notification, mContext .getString(tickerId), System.currentTimeMillis()); @@ -77,8 +78,9 @@ public class GTaskASyncTask extends AsyncTask { pendingIntent = PendingIntent.getActivity(mContext, 0, new Intent(mContext, NotesListActivity.class), 0); } - notification.setLatestEventInfo(mContext, mContext.getString(R.string.app_name), content, - pendingIntent); +// notification.setLatestEventInfo(mContext, mContext.getString(R.string.app_name), content, +// pendingIntent); + notification.contentIntent = pendingIntent; mNotifiManager.notify(GTASK_SYNC_NOTIFICATION_ID, notification); } diff --git a/src/net/micode/notes/ui/NotesListActivity.java b/src/net/micode/notes/ui/NotesListActivity.java index e843aec..1dea67b 100644 --- a/src/net/micode/notes/ui/NotesListActivity.java +++ b/src/net/micode/notes/ui/NotesListActivity.java @@ -135,6 +135,8 @@ public class NotesListActivity extends Activity implements OnClickListener, OnIt private final static int REQUEST_CODE_OPEN_NODE = 102; private final static int REQUEST_CODE_NEW_NODE = 103; + + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);