diff --git a/app/ui/src/main/java/de/mm20/launcher2/ui/icons/Icons.kt b/app/ui/src/main/java/de/mm20/launcher2/ui/icons/Icons.kt index 502821eb..5f35cf52 100644 --- a/app/ui/src/main/java/de/mm20/launcher2/ui/icons/Icons.kt +++ b/app/ui/src/main/java/de/mm20/launcher2/ui/icons/Icons.kt @@ -701,6 +701,107 @@ val Icons.Rounded.Telegram } } +val Icons.Rounded.Signal + get() = materialIcon("Icons.Rounded.Signal") { + materialPath { + moveTo(11.355945f, 1.9820878f) + curveTo(10.0436f, 2.0655696f, 8.7649581f, 2.4055267f, 7.586184f, 2.9832267f) + lineTo(8.2563273f, 4.1457871f) + curveTo(9.2280638f, 3.6816254f, 10.280688f, 3.4041485f, 11.355945f, 3.3240053f) + close() + moveToRelative(1.338656f, 0.00326f) + verticalLineToRelative(1.3419206f) + curveToRelative(1.068577f, 0.083487f, 2.116547f, 0.3673228f, 3.084943f, 0.8348259f) + lineTo(16.451317f, 3.0011655f) + curveTo(15.275885f, 2.4201272f, 13.996929f, 2.075513f, 12.694601f, 1.985352f) + close() + moveTo(6.4236234f, 3.6517428f) + curveTo(5.3316725f, 4.3797082f, 4.3928304f, 5.3186302f, 3.6615236f, 6.4105816f) + lineTo(4.824084f, 7.080725f) + curveTo(5.4318345f, 6.1891319f, 6.2021737f, 5.4220536f, 7.0937673f, 4.8143031f) + close() + moveToRelative(11.1869936f, 0.022829f) + lineToRelative(-0.671774f, 1.1625603f) + curveToRelative(0.768041f, 0.5276096f, 1.446087f, 1.1791914f, 2.010431f, 1.9305341f) + curveToRelative(0.08349f, 0.1068682f, 0.162887f, 0.2207222f, 0.239686f, 0.3342566f) + lineTo(20.35152f, 6.4301481f) + curveTo(20.244661f, 6.2698614f, 20.134061f, 6.1125345f, 20.020525f, 5.9589279f) + curveTo(19.345984f, 5.0673347f, 18.532265f, 4.29568f, 17.610617f, 3.6745718f) + close() + moveToRelative(-5.613878f, 0.9783103f) + curveToRelative(-1.312345f, 0f, -2.6018667f, 0.3544746f, -3.7338895f, 1.0223357f) + curveTo(7.1341648f, 6.3397372f, 6.2036973f, 7.2983832f, 5.5692314f, 8.4471004f) + curveTo(4.934759f, 9.5991592f, 4.6194134f, 10.894733f, 4.6561405f, 12.207079f) + curveToRelative(0.036733f, 1.312344f, 0.4255131f, 2.590922f, 1.1234279f, 3.702908f) + lineToRelative(-0.7060149f, 3.0132f) + lineToRelative(3.0131998f, -0.706014f) + curveToRelative(0.96506f, 0.604412f, 2.0572737f, 0.982235f, 3.1892957f, 1.092448f) + curveToRelative(1.132023f, 0.113534f, 2.277329f, -0.03945f, 3.342565f, -0.443502f) + curveToRelative(1.061898f, -0.407396f, 2.016809f, -1.056501f, 2.788188f, -1.894666f) + curveToRelative(0.771379f, -0.838162f, 1.334481f, -1.842907f, 1.651716f, -2.938196f) + curveToRelative(0.313885f, -1.091951f, 0.371731f, -2.246725f, 0.164684f, -3.365392f) + curveTo(19.019505f, 9.5458598f, 18.554503f, 8.4896596f, 17.866609f, 7.5780306f) + curveTo(17.18205f, 6.6697396f, 16.29754f, 5.9316859f, 15.275713f, 5.4241143f) + curveTo(14.257226f, 4.9165459f, 13.135439f, 4.6528786f, 11.996739f, 4.6528786f) + close() + moveTo(2.9897496f, 7.5682475f) + curveTo(2.4087114f, 8.7503597f, 2.068921f, 10.033896f, 1.9820886f, 11.3429f) + horizontalLineTo(3.3240061f) + curveTo(3.4041494f, 10.267647f, 3.6848069f, 9.2150962f, 4.15231f, 8.2400215f) + close() + moveToRelative(18.0302834f, 0.024458f) + lineToRelative(-1.16256f, 0.6701438f) + curveToRelative(0.323915f, 0.6812174f, 0.560951f, 1.4091759f, 0.697863f, 2.1571767f) + curveToRelative(0.05676f, 0.307227f, 0.09728f, 0.615661f, 0.120659f, 0.922874f) + horizontalLineToRelative(1.341916f) + curveTo(21.991089f, 10.952202f, 21.944564f, 10.564438f, 21.874425f, 10.177078f) + curveTo(21.707451f, 9.2788057f, 21.42075f, 8.4074936f, 21.020033f, 7.5927055f) + close() + moveTo(1.9853497f, 12.681556f) + curveToRelative(0.076805f, 1.158739f, 0.35762f, 2.293786f, 0.8217818f, 3.352348f) + lineTo(4.2256834f, 15.909985f) + curveTo(3.72145f, 14.901518f, 3.4141515f, 13.8069f, 3.3240061f, 12.681556f) + close() + moveToRelative(18.6906443f, 0f) + curveToRelative(-0.04676f, 0.584377f, -0.154404f, 1.16238f, -0.31469f, 1.726721f) + curveToRelative(-0.133562f, 0.464165f, -0.306586f, 0.914331f, -0.513614f, 1.348439f) + lineToRelative(1.16256f, 0.671774f) + curveToRelative(0.260467f, -0.52761f, 0.473908f, -1.079066f, 0.637534f, -1.650086f) + curveToRelative(0.197013f, -0.684556f, 0.320115f, -1.388915f, 0.366866f, -2.096848f) + close() + moveToRelative(-1.500078f, 4.23446f) + curveToRelative(-0.23374f, 0.343946f, -0.490735f, 0.667833f, -0.771236f, 0.975049f) + curveToRelative(-0.444125f, 0.480859f, -0.937991f, 0.907665f, -1.475619f, 1.278328f) + lineToRelative(0.670143f, 1.16256f) + curveToRelative(0.651163f, -0.437449f, 1.252682f, -0.954911f, 1.790309f, -1.535949f) + curveToRelative(0.347287f, -0.380679f, 0.665124f, -0.782417f, 0.948963f, -1.209845f) + close() + moveTo(4.4930885f, 17.229075f) + lineTo(3.0875808f, 17.352994f) + lineTo(2.3701523f, 20.421631f) + curveToRelative(-0.1703202f, 0.721289f, 0.4803266f, 1.371997f, 1.2049538f, 1.201693f) + lineToRelative(3.1925571f, -0.746777f) + lineToRelative(0.3896942f, -1.465838f) + lineToRelative(-3.3621312f, 0.787542f) + close() + moveToRelative(11.2766725f, 2.612092f) + curveToRelative(-0.220395f, 0.103523f, -0.44307f, 0.20014f, -0.670144f, 0.286969f) + curveToRelative(-0.774716f, 0.297194f, -1.583548f, 0.477808f, -2.405016f, 0.544593f) + verticalLineToRelative(1.34192f) + curveToRelative(0.981754f, -0.07011f, 1.952802f, -0.280304f, 2.881128f, -0.634272f) + curveToRelative(0.293847f, -0.113525f, 0.581966f, -0.238027f, 0.865806f, -0.37828f) + close() + moveToRelative(-7.3634259f, 0.07989f) + lineToRelative(-0.3505616f, 1.309307f) + curveToRelative(0.9383444f, 0.400717f, 1.934383f, 0.658013f, 2.9528705f, 0.758191f) + curveToRelative(0.116892f, 0.01325f, 0.230431f, 0.01924f, 0.347301f, 0.02935f) + verticalLineToRelative(-1.341911f) + curveToRelative(-0.07345f, -0.0066f, -0.143489f, -0.01456f, -0.213599f, -0.02119f) + curveToRelative(-0.948358f, -0.0935f, -1.8711298f, -0.339697f, -2.7360109f, -0.733734f) + close() + } + } + val Icons.Rounded.Fdroid get() = materialIcon("Icons.Rounded.Fdroid") { materialPath { diff --git a/app/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/contacts/ContactItem.kt b/app/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/contacts/ContactItem.kt index c3fc142c..9826a5f7 100644 --- a/app/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/contacts/ContactItem.kt +++ b/app/ui/src/main/java/de/mm20/launcher2/ui/launcher/search/contacts/ContactItem.kt @@ -56,6 +56,7 @@ import de.mm20.launcher2.ui.component.DefaultToolbarAction import de.mm20.launcher2.ui.component.ShapedLauncherIcon import de.mm20.launcher2.ui.component.Toolbar import de.mm20.launcher2.ui.component.ToolbarAction +import de.mm20.launcher2.ui.icons.Signal import de.mm20.launcher2.ui.icons.Telegram import de.mm20.launcher2.ui.icons.WhatsApp import de.mm20.launcher2.ui.ktx.toPixels @@ -198,6 +199,33 @@ fun ContactItem( } } } + if (contact.signal.isNotEmpty()) { + Row( + modifier = Modifier.padding(horizontal = 16.dp), + verticalAlignment = Alignment.CenterVertically + ) { + Icon(Icons.Rounded.Signal, contentDescription = null) + LazyRow( + modifier = Modifier + .weight(1f) + .padding(start = 16.dp), + verticalAlignment = Alignment.CenterVertically + ) { + items(contact.signal.toList()) { + Chip( + modifier = Modifier.padding(end = 16.dp), + text = it.label, + onClick = { + context.tryStartActivity( + Intent(Intent.ACTION_VIEW).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK) + .setData(Uri.parse(it.data)) + ) + } + ) + } + } + } + } if (contact.telegram.isNotEmpty()) { Row( modifier = Modifier.padding(horizontal = 16.dp), diff --git a/data/contacts/src/main/java/de/mm20/launcher2/search/data/Contact.kt b/data/contacts/src/main/java/de/mm20/launcher2/search/data/Contact.kt index 8f6963e4..73506f44 100644 --- a/data/contacts/src/main/java/de/mm20/launcher2/search/data/Contact.kt +++ b/data/contacts/src/main/java/de/mm20/launcher2/search/data/Contact.kt @@ -27,6 +27,7 @@ data class Contact( val emails: Set, val telegram: Set, val whatsapp: Set, + val signal: Set, val postals: Set, override val labelOverride: String? = null ) : Searchable, SavableSearchable { @@ -101,6 +102,7 @@ data class Contact( " OR ${ContactsContract.Data.MIMETYPE} = \"${ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE}\"" + " OR ${ContactsContract.Data.MIMETYPE} = \"vnd.android.cursor.item/vnd.org.telegram.messenger.android.profile\"" + " OR ${ContactsContract.Data.MIMETYPE} = \"vnd.android.cursor.item/vnd.com.whatsapp.profile\"" + + " OR ${ContactsContract.Data.MIMETYPE} = \"vnd.android.cursor.item/vnd.org.thoughtcrime.securesms.contact\"" + ")" val dataCursor = context.contentResolver.query( ContactsContract.Data.CONTENT_URI, @@ -110,6 +112,7 @@ data class Contact( val emails = mutableSetOf() val telegram = mutableSetOf() val whatsapp = mutableSetOf() + val signal = mutableSetOf() val postals = mutableSetOf() var firstName = "" var lastName = "" @@ -186,6 +189,20 @@ data class Contact( ) ) } + "vnd.android.cursor.item/vnd.org.thoughtcrime.securesms.contact" -> { + val data1 = dataCursor.getStringOrNull(data1Column) + ?: continue@loop + val dataId = dataCursor.getLong(idColumn) + signal.add( + ContactInfo( + data1, + Uri.withAppendedPath( + ContactsContract.Data.CONTENT_URI, + dataId.toString() + ).toString(), + ) + ) + } } } dataCursor.close() @@ -213,6 +230,7 @@ data class Contact( postals = postals, telegram = telegram, whatsapp = whatsapp, + signal = signal, lookupKey = lookUpKey ) }