Skip to content

Commit

Permalink
Merge branch 'you-apps:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
dominik-masson authored Mar 29, 2024
2 parents b70ab4e + c3c5e16 commit d5e01b0
Show file tree
Hide file tree
Showing 25 changed files with 809 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@ package com.bnyro.contacts.ui.activities

import android.app.Activity
import android.content.ContentUris
import android.content.Context
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.provider.ContactsContract
import android.provider.ContactsContract.CommonDataKinds.Email
import android.provider.ContactsContract.CommonDataKinds.Phone
import android.provider.ContactsContract.Data
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
Expand Down Expand Up @@ -33,10 +38,18 @@ import com.bnyro.contacts.ui.theme.ConnectYouTheme

class PickContactActivity : BaseActivity() {

private var specialMimeType: String? = null

@OptIn(ExperimentalMaterial3Api::class)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

specialMimeType = when (intent.data) {
Email.CONTENT_URI -> Email.CONTENT_ITEM_TYPE
Phone.CONTENT_URI -> Phone.CONTENT_ITEM_TYPE
else -> null
}

setContent {
ConnectYouTheme(themeModel.themeMode) {
val scrollBehavior = TopAppBarDefaults.exitUntilCollapsedScrollBehavior()
Expand Down Expand Up @@ -94,14 +107,48 @@ class PickContactActivity : BaseActivity() {
if (contact == null) {
setResult(Activity.RESULT_CANCELED, Intent())
} else {
val intent = Intent().apply {
data = ContentUris.withAppendedId(
val uri = when {
specialMimeType != null -> {
val contactId = getContactMimeTypeId(
this,
contact.contactId.toString(),
specialMimeType!!
)
Uri.withAppendedPath(Data.CONTENT_URI, contactId)
}

else -> ContentUris.withAppendedId(
ContactsContract.Contacts.CONTENT_URI,
contact.contactId
)
}
val intent = Intent().apply {
data = uri
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
}
setResult(Activity.RESULT_OK, intent)
}
finish()
}

private fun getContactMimeTypeId(
context: Context,
contactId: String,
mimeType: String
): String {
val uri = Data.CONTENT_URI
val projection = arrayOf(Data._ID, Data.RAW_CONTACT_ID, Data.MIMETYPE)
val selection = "${Data.MIMETYPE} = ? AND ${Data.RAW_CONTACT_ID} = ?"
val selectionArgs = arrayOf(mimeType, contactId)

val cursor = context.contentResolver.query(uri, projection, selection, selectionArgs, null)
cursor?.use {
if (it.moveToFirst()) {
val index = it.getColumnIndex(Data._ID)
return it.getString(index)
}
}
return ""
}

}
1 change: 1 addition & 0 deletions app/src/main/res/values-ar/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,5 @@
<string name="add_note">اضف ملاحظة</string>
<string name="add_event">أضف حدثًا</string>
<string name="date">‪التاريخ</string>
<string name="import_confirm">هل ترغب في استيراد ملف VCF المحدد؟</string>
</resources>
119 changes: 119 additions & 0 deletions app/src/main/res/values-ca/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<string name="backup_password">Contrasenya</string>
<string name="about">Quant a</string>
<string name="license">Llicència</string>
<string name="author">Autor</string>
<string name="version">Versió</string>
<string name="translation">Traducció</string>
<string name="add_website">Afegeix un lloc web</string>
<string name="add_phone_number">Afegeix un número de telèfon</string>
<string name="add_e_mail">Afegeix un correu electrònic</string>
<string name="add_address">Afegeix una adreça</string>
<string name="add_note">Afegeix una nota</string>
<string name="add_event">Afegeix un esdeveniment</string>
<string name="date">Data</string>
<string name="search" tools:ignore="PrivateResource">Cerca</string>
<string name="copied">S\'ha copiat al porta-retalls</string>
<string name="delete_contact">Suprimeix el contacte</string>
<string name="irreversible">Esteu segur? No es pot desfer.</string>
<string name="cancel">Cancel·la</string>
<string name="okay">D\'acord</string>
<string name="reset">Restableix</string>
<string name="create_contact">Crea un contacte</string>
<string name="retry">Reintenta</string>
<string name="share">Comparteix</string>
<string name="add_to_contact">Afegeix a un contacte</string>
<string name="new_contact">Nou contacte</string>
<string name="create_shortcut">Crea una drecera</string>
<string name="dial">Marca</string>
<string name="message">Missatge</string>
<string name="contact">Contacte</string>
<string name="contacts">Contactes</string>
<string name="edit">Edita</string>
<string name="filter">Filtre</string>
<string name="more">Més</string>
<string name="show_more_fields">Mostra més camps</string>
<string name="show_less">Mostra menys</string>
<string name="pick_contact">Escull un contacte</string>
<string name="save">Desa</string>
<string name="empty_name">El nom no pot estar buit.</string>
<string name="import_success">Importat.</string>
<string name="export_success">Exportat.</string>
<string name="nothing_here">No hi ha res aquí.</string>
<string name="phone">Telèfon</string>
<string name="email">Correu electrònic</string>
<string name="address">Adreça</string>
<string name="event">Esdeveniment</string>
<string name="website">Lloc web</string>
<string name="photo">Foto</string>
<string name="phone_number">Número de telèfon</string>
<string name="sort_order">Ordre de classificació</string>
<string name="account_type">Tipus de compte</string>
<string name="name">Nom</string>
<string name="first_name">Nom</string>
<string name="last_name">Cognom</string>
<string name="nick_name">Àlies</string>
<string name="organization">Organització</string>
<string name="type">Tipus</string>
<string name="home">Domicili</string>
<string name="work">Feina</string>
<string name="mobile">Mòbil</string>
<string name="other">Altres</string>
<string name="custom">Personalitzat</string>
<string name="car">Cotxe</string>
<string name="fax_home">Fax de casa</string>
<string name="fax_work">Fax de la feina</string>
<string name="assistant">Assistent</string>
<string name="birthday">Aniversari</string>
<string name="anniversary">Aniversari (de casament)</string>
<string name="note">Nota</string>
<string name="homepage">Pàgina principal</string>
<string name="ftp">FTP</string>
<string name="blog">Blog</string>
<string name="manage_groups">Gestiona els grups</string>
<string name="delete_group">Suprimeix el grup per a tothom</string>
<string name="title">Títol</string>
<string name="new_group">Nou</string>
<string name="group_already_exists">El grup ja existeix</string>
<string name="groups">Grups</string>
<string name="device">Dispositiu</string>
<string name="local">Local</string>
<string name="copy">Copia</string>
<string name="move">Mou</string>
<string name="delete">Suprimeix</string>
<string name="selected">%1$s seleccionats</string>
<string name="messages">Missatges</string>
<string name="send">Envia</string>
<string name="reply">Respon</string>
<string name="connection_error">No s\'ha pogut connectar. Assegureu-vos que el mode avió està desactivat.</string>
<string name="message_too_long">El missatge és massa llarg.</string>
<string name="send_message_as_multiple">Voleu enviar el missatge en múltiples missatges més petits?</string>
<string name="private_sms_database">Base de dades de SMS privada</string>
<string name="private_sms_database_desc">L\'SMS només s\'emmagatzemarà dins l\'aplicació i no serà accessible per altres aplicacions.</string>
<string name="delete_thread">Suprimeix el fil de conversa</string>
<string name="delete_message">Suprimeix el missatge</string>
<string name="import_vcf">Importa vCard</string>
<string name="export_vcf">Exporta vCard</string>
<string name="import_sim">Importa des de la SIM</string>
<string name="import_confirm">Voleu importar l\'arxiu VCF seleccionat?</string>
<string name="settings">Configuració</string>
<string name="start_tab">Pestanya d\'inici</string>
<string name="theme">Tema</string>
<string name="system">Sistema</string>
<string name="light">Clar</string>
<string name="dark">Fosc</string>
<string name="auto_backup">Còpia de seguretat automàtica</string>
<string name="backup_interval">Interval de còpia de seguretat</string>
<string name="max_backup_amount">Quantitat màxima de còpies de seguretat</string>
<string name="choose_dir">Directori</string>
<string name="both">Tots dos</string>
<string name="none">Cap</string>
<string name="misc">Miscel·lània</string>
<string name="collapse_bottom_bar">Redueix la barra inferior en desplaçar-se</string>
<string name="colorful_contact_icons">Icones de contacte acolorides</string>
<string name="behavior">Comportament</string>
<string name="appearance">Aspecte</string>
<string name="backup">Còpia de seguretat</string>
<string name="encrypt_backups">Xifra les còpies de seguretat amb zip</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-cs/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,5 @@
<string name="add_website">Přidat webové stránky</string>
<string name="add_phone_number">Přidat telefonní číslo</string>
<string name="date">Datum</string>
<string name="import_confirm">Chcete importovat vybraný soubor VCF?</string>
</resources>
117 changes: 117 additions & 0 deletions app/src/main/res/values-da/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<string name="copied">Kopieret til udklipsholder</string>
<string name="cancel">Annullér</string>
<string name="reset">Nulstil</string>
<string name="retry">Prøv igen</string>
<string name="new_contact">Ny kontakt</string>
<string name="create_shortcut">Opret genvej</string>
<string name="dial">Ring</string>
<string name="contact">Kontakt</string>
<string name="contacts">Kontakter</string>
<string name="filter">Filtrér</string>
<string name="more">Mere</string>
<string name="save">Gem</string>
<string name="empty_name">Navn kan ikke være tomt!</string>
<string name="import_success">Importeret.</string>
<string name="phone">Telefon</string>
<string name="phone_number">Telefonnummer</string>
<string name="first_name">Fornavn</string>
<string name="last_name">Efternavn</string>
<string name="organization">Organisation</string>
<string name="home">Hjem</string>
<string name="assistant">Assistent</string>
<string name="anniversary">Årsdag</string>
<string name="note">Note</string>
<string name="new_group">Ny</string>
<string name="group_already_exists">Gruppe eksisterer allerede</string>
<string name="groups">Grupper</string>
<string name="device">Enhed</string>
<string name="local">Lokal</string>
<string name="copy">Kopiér</string>
<string name="move">Flyt</string>
<string name="delete">Slet</string>
<string name="connection_error">Kunne ikke oprette forbindelse. Sørg for, at flytilstand er slået fra.</string>
<string name="private_sms_database">Privat SMS-database</string>
<string name="private_sms_database_desc">SMS\'en gemmes kun i appen og er ikke tilgængelig i andre apps.</string>
<string name="delete_thread">Slet tråd</string>
<string name="export_vcf">Eksportér vCard</string>
<string name="settings">Indstillinger</string>
<string name="backup_interval">Backup-interval</string>
<string name="collapse_bottom_bar">Skjul bundlinjen ved scroll</string>
<string name="search" tools:ignore="PrivateResource">Søg</string>
<string name="delete_contact">Slet kontakt</string>
<string name="irreversible">Er du sikker? Dette kan ikke fortrydes!</string>
<string name="share">Del</string>
<string name="okay">Okay</string>
<string name="create_contact">Opret kontakt</string>
<string name="add_to_contact">Føj til kontakt</string>
<string name="show_more_fields">Vis flere felter</string>
<string name="message">Besked</string>
<string name="edit">Redigér</string>
<string name="max_backup_amount">Maks. antal backups</string>
<string name="author">Autor</string>
<string name="choose_dir">Mappe</string>
<string name="misc">Diverse</string>
<string name="both">Begge</string>
<string name="none">Ingen</string>
<string name="behavior">Adfærd</string>
<string name="colorful_contact_icons">Farverige kontakt-ikoner</string>
<string name="backup">Backup</string>
<string name="appearance">Udseende</string>
<string name="license">Licens</string>
<string name="encrypt_backups">Kryptér backups som ZIP</string>
<string name="backup_password">Adgangskode</string>
<string name="about">Om</string>
<string name="version">Version</string>
<string name="add_phone_number">Tilføj Telefonnummer</string>
<string name="translation">Oversættelse</string>
<string name="add_e_mail">Tilføj E-mail</string>
<string name="add_address">Tilføj Adresse</string>
<string name="add_website">Tilføj Hjemmeside</string>
<string name="add_note">Tilføj Note</string>
<string name="add_event">Tilføj Begivenhed</string>
<string name="date">Dato</string>
<string name="show_less">Vis mindre</string>
<string name="pick_contact">Vælg kontakt</string>
<string name="export_success">Eksporteret.</string>
<string name="nothing_here">Intet her.</string>
<string name="email">E-mail</string>
<string name="address">Adresse</string>
<string name="website">Hjemmeside</string>
<string name="event">Begivenhed</string>
<string name="photo">Foto</string>
<string name="sort_order">Sortér efter</string>
<string name="account_type">Kontotype</string>
<string name="name">Navn</string>
<string name="nick_name">Kaldenavn</string>
<string name="other">Andet</string>
<string name="type">Type</string>
<string name="work">Arbejde</string>
<string name="mobile">Mobil</string>
<string name="birthday">Fødselsdag</string>
<string name="car">Bil</string>
<string name="custom">Brugerdefineret</string>
<string name="homepage">Startside</string>
<string name="ftp">FTP</string>
<string name="manage_groups">Administrér grupper</string>
<string name="blog">Blog</string>
<string name="delete_group">Slet gruppe for alle</string>
<string name="title">Titel</string>
<string name="messages">Beskeder</string>
<string name="selected">%1$s valgt</string>
<string name="send">Send besked</string>
<string name="reply">Svar</string>
<string name="message_too_long">Besked er for lang!</string>
<string name="send_message_as_multiple">Vil du sende beskeden som flere mindre?</string>
<string name="delete_message">Slet besked</string>
<string name="import_vcf">Importér vCard</string>
<string name="import_sim">Importér fra SIM</string>
<string name="import_confirm">Vil du importere den valgte VCF-fil?</string>
<string name="theme">Tema</string>
<string name="system">System</string>
<string name="light">Lys</string>
<string name="dark">Mørk</string>
<string name="auto_backup">Automatisk backup</string>
<string name="start_tab">Start-fane</string>
</resources>
5 changes: 5 additions & 0 deletions app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,9 @@
<string name="send">Nachricht senden</string>
<string name="messages">Nachrichten</string>
<string name="connection_error">Verbindungsfehler! Stellen sie sicher, dass der Flugmodus ausgeschaltet ist!</string>
<string name="phone_number">Telefonnummer</string>
<string name="delete_thread">Unterhaltung löschen</string>
<string name="delete_message">Nachricht löschen</string>
<string name="private_sms_database">Private SMS Datenbank</string>
<string name="save">Speichern</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,5 @@
<string name="add_event">Añadir evento</string>
<string name="add_note">Añadir nota</string>
<string name="date">Fecha</string>
<string name="import_confirm">¿Desea importar el archivo VCF seleccionado?</string>
</resources>
Loading

0 comments on commit d5e01b0

Please sign in to comment.