use of androidx.core.content.LocusIdCompat in project Signal-Android by WhisperSystems.
the class ConversationUtil method buildShortcutInfo.
/**
* Builds the shortcut info object for a given Recipient.
*
* @param context The Context under which we are operating
* @param recipient The Recipient to generate a ShortcutInfo for
* @param rank The rank that should be assigned to this recipient
* @return The new ShortcutInfo
*/
@WorkerThread
@NonNull
private static ShortcutInfoCompat buildShortcutInfo(@NonNull Context context, @NonNull Recipient recipient, int rank) {
Recipient resolved = recipient.resolve();
Person[] persons = buildPersons(context, resolved);
Long threadId = SignalDatabase.threads().getThreadIdFor(resolved.getId());
String shortName = resolved.isSelf() ? context.getString(R.string.note_to_self) : resolved.getShortDisplayName(context);
String longName = resolved.isSelf() ? context.getString(R.string.note_to_self) : resolved.getDisplayName(context);
String shortcutId = getShortcutId(resolved);
return new ShortcutInfoCompat.Builder(context, shortcutId).setLongLived(true).setIntent(ConversationIntents.createBuilder(context, resolved.getId(), threadId != null ? threadId : -1).build()).setShortLabel(shortName).setLongLabel(longName).setIcon(AvatarUtil.getIconCompatForShortcut(context, resolved)).setPersons(persons).setCategories(Collections.singleton(CATEGORY_SHARE_TARGET)).setActivity(new ComponentName(context, "org.thoughtcrime.securesms.RoutingActivity")).setRank(rank).setLocusId(new LocusIdCompat(shortcutId)).build();
}
Aggregations