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