Set locus ID

pull/204/head
M66B 3 years ago
parent c3d447ed80
commit d96e979731

@ -49,6 +49,7 @@ import androidx.annotation.Nullable;
import androidx.core.app.NotificationCompat; import androidx.core.app.NotificationCompat;
import androidx.core.app.Person; import androidx.core.app.Person;
import androidx.core.app.RemoteInput; import androidx.core.app.RemoteInput;
import androidx.core.content.LocusIdCompat;
import androidx.core.graphics.drawable.IconCompat; import androidx.core.graphics.drawable.IconCompat;
import androidx.localbroadcastmanager.content.LocalBroadcastManager; import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
@ -4561,6 +4562,10 @@ class Core {
.setOnlyAlertOnce(alert_once) .setOnlyAlertOnce(alert_once)
.setAllowSystemGeneratedContextualActions(false); .setAllowSystemGeneratedContextualActions(false);
// https://developer.android.com/reference/android/content/LocusId
if (message.thread != null)
mbuilder.setLocusId(new LocusIdCompat(message.thread));
if (message.ui_silent) { if (message.ui_silent) {
mbuilder.setSilent(true); mbuilder.setSilent(true);
Log.i("Notify silent=" + message.id); Log.i("Notify silent=" + message.id);

@ -41,6 +41,7 @@ import android.widget.Toast;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.core.app.Person; import androidx.core.app.Person;
import androidx.core.content.LocusIdCompat;
import androidx.core.content.pm.ShortcutInfoCompat; import androidx.core.content.pm.ShortcutInfoCompat;
import androidx.core.content.pm.ShortcutManagerCompat; import androidx.core.content.pm.ShortcutManagerCompat;
import androidx.core.graphics.drawable.IconCompat; import androidx.core.graphics.drawable.IconCompat;
@ -303,11 +304,16 @@ class Shortcuts {
IconCompat icon = IconCompat.createWithBitmap(bm); IconCompat icon = IconCompat.createWithBitmap(bm);
String id = "message:" + message.id; String id = "message:" + message.id;
return new ShortcutInfoCompat.Builder(context, id) ShortcutInfoCompat.Builder builder = new ShortcutInfoCompat.Builder(context, id)
.setIcon(icon) .setIcon(icon)
.setShortLabel(label) .setShortLabel(label)
.setLongLabel(label) .setLongLabel(label)
.setIntent(thread); .setIntent(thread);
if (message.thread != null)
builder.setLocusId(new LocusIdCompat(message.thread));
return builder;
} }
@NonNull @NonNull

Loading…
Cancel
Save