Merge pull request #730 from Aga-C/prevent-adding-empty-contact

Prevented adding empty contact (#728)
This commit is contained in:
Tibor Kaputa 2021-11-18 10:36:21 +01:00 committed by GitHub
commit 146d3733c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
33 changed files with 63 additions and 6 deletions

View File

@ -907,6 +907,31 @@ class EditContactActivity : ContactActivity() {
return
}
val filledPhoneNumbers = getFilledPhoneNumbers()
val filledEmails = getFilledEmails()
val filledAddresses = getFilledAddresses()
val filledIMs = getFilledIMs()
val filledEvents = getFilledEvents()
val filledWebsites = getFilledWebsites()
val contactFields = arrayListOf(
contact_prefix, contact_first_name, contact_middle_name, contact_surname, contact_suffix, contact_nickname,
contact_notes, contact_organization_company, contact_organization_job_position
)
if (contactFields.all { it.value.isEmpty() } &&
currentContactPhotoPath.isEmpty() &&
filledPhoneNumbers.isEmpty() &&
filledEmails.isEmpty() &&
filledAddresses.isEmpty() &&
filledIMs.isEmpty() &&
filledEvents.isEmpty() &&
filledWebsites.isEmpty()
) {
toast(R.string.fields_empty)
return
}
contact?.apply {
val oldPhotoUri = photoUri
@ -917,14 +942,14 @@ class EditContactActivity : ContactActivity() {
suffix = contact_suffix.value
nickname = contact_nickname.value
photoUri = currentContactPhotoPath
phoneNumbers = getFilledPhoneNumbers()
emails = getFilledEmails()
addresses = getFilledAddresses()
IMs = getFilledIMs()
events = getFilledEvents()
phoneNumbers = filledPhoneNumbers
emails = filledEmails
addresses = filledAddresses
IMs = filledIMs
events = filledEvents
starred = if (isContactStarred()) 1 else 0
notes = contact_notes.value
websites = getFilledWebsites()
websites = filledWebsites
val company = contact_organization_company.value
val jobPosition = contact_organization_job_position.value

View File

@ -14,6 +14,7 @@
<string name="send_email_to_group">ارسال بريد الكتروني الى مجموعة</string>
<string name="create_new_contact">إنشاء جهة إتصال</string>
<string name="add_to_existing_contact">إضافة إلى جهة موجودة</string>
<string name="fields_empty">At least 1 field has to be filled out</string>
<!-- Placeholders -->
<string name="no_contacts_with_emails">لا توجد جهات اتصال بهذا البريد الالكتروني</string>

View File

@ -14,6 +14,7 @@
<string name="send_email_to_group">Grupa e-poçt göndər</string>
<string name="create_new_contact">Create new contact</string>
<string name="add_to_existing_contact">Add to an existing contact</string>
<string name="fields_empty">At least 1 field has to be filled out</string>
<!-- Placeholders -->
<string name="no_contacts_with_emails">No contacts with emails have been found</string>

View File

@ -14,6 +14,7 @@
<string name="send_email_to_group">Poslat skupině e-mail</string>
<string name="create_new_contact">Vytvořit nový kontakt</string>
<string name="add_to_existing_contact">Přidat k existujícímu kontaktu</string>
<string name="fields_empty">At least 1 field has to be filled out</string>
<!-- Placeholders -->
<string name="no_contacts_with_emails">Nenalezeny žádné kontakty s e-maily</string>

View File

@ -14,6 +14,7 @@
<string name="send_email_to_group">Anfon ebost at grŵp</string>
<string name="create_new_contact">Creu cyswllt newydd</string>
<string name="add_to_existing_contact">Ychwanegu at gyswllt sy\'n bodoli</string>
<string name="fields_empty">At least 1 field has to be filled out</string>
<!-- Placeholders -->
<string name="no_contacts_with_emails">Ni chanfuwyd unrhyw gysylltiadau gydag ebost</string>

View File

@ -15,6 +15,7 @@
<string name="send_email_to_group">Send e-mail til gruppe</string>
<string name="create_new_contact">Opret ny kontakt</string>
<string name="add_to_existing_contact">Tilføj til en eksisterende kontakt</string>
<string name="fields_empty">At least 1 field has to be filled out</string>
<!-- Placeholders -->
<string name="no_contacts_with_emails">Ingen kontakter med e-mails fundet</string>
<string name="no_contacts_with_phone_numbers">Ingen kontakter med telefonnumre fundet</string>

View File

@ -15,6 +15,7 @@
<string name="send_email_to_group">E-Mail an Gruppe senden</string>
<string name="create_new_contact">Neuen Kontakt erstellen</string>
<string name="add_to_existing_contact">Zu einem existierenden Kontakt hinzufügen</string>
<string name="fields_empty">At least 1 field has to be filled out</string>
<!-- Placeholders -->
<string name="no_contacts_with_emails">Keine Kontakte mit E-Mailadressen gefunden</string>
<string name="no_contacts_with_phone_numbers">Keine Kontakte mit Telefonnummern gefunden</string>

View File

@ -14,6 +14,7 @@
<string name="send_email_to_group">Αποστολή email σε ομάδες</string>
<string name="create_new_contact">Δημιουργία νέας Επαφής</string>
<string name="add_to_existing_contact">Προσθήκη σε μια υπάρχουσα Επαφή</string>
<string name="fields_empty">At least 1 field has to be filled out</string>
<!-- Placeholders -->
<string name="no_contacts_with_emails">Δεν βρέθηκαν Επαφές με emails</string>

View File

@ -14,6 +14,7 @@
<string name="send_email_to_group">Enviar correo electrónico a grupo</string>
<string name="create_new_contact">Crear nuevo contacto</string>
<string name="add_to_existing_contact">Añadir a un contacto existente</string>
<string name="fields_empty">At least 1 field has to be filled out</string>
<!-- Placeholders -->
<string name="no_contacts_with_emails">No se encontraron contactos con correo electrónico</string>

View File

@ -14,6 +14,7 @@
<string name="send_email_to_group">Bidali emaila taldeari</string>
<string name="create_new_contact">Create new contact</string>
<string name="add_to_existing_contact">Add to an existing contact</string>
<string name="fields_empty">At least 1 field has to be filled out</string>
<!-- Placeholders -->
<string name="no_contacts_with_emails">No contacts with emails have been found</string>

View File

@ -14,6 +14,7 @@
<string name="send_email_to_group">Lähetä sähköposti ryhmälle</string>
<string name="create_new_contact">Luo uusi yhteystieto</string>
<string name="add_to_existing_contact">Lisää olemassa olevaan yhteystietoon</string>
<string name="fields_empty">At least 1 field has to be filled out</string>
<!-- Placeholders -->
<string name="no_contacts_with_emails">Sähköpostillisia yhteystietoja ei löytynyt</string>

View File

@ -15,6 +15,7 @@
<string name="send_email_to_group">Envoyer un courriel au groupe</string>
<string name="create_new_contact">Créer un nouveau contact</string>
<string name="add_to_existing_contact">Ajouter à un contact existant</string>
<string name="fields_empty">At least 1 field has to be filled out</string>
<!-- Placeholders -->
<string name="no_contacts_with_emails">Aucun contact avec des adresses courriel n\a été trouvé</string>
<string name="no_contacts_with_phone_numbers">Aucun contact avec des numéros de téléphone n\a été trouvé</string>

View File

@ -14,6 +14,7 @@
<string name="send_email_to_group">Send email to group</string>
<string name="create_new_contact">Create new contact</string>
<string name="add_to_existing_contact">Add to an existing contact</string>
<string name="fields_empty">At least 1 field has to be filled out</string>
<!-- Placeholders -->
<string name="no_contacts_with_emails">No contacts with emails have been found</string>

View File

@ -14,6 +14,7 @@
<string name="send_email_to_group">Pošalji e-poštu grupi</string>
<string name="create_new_contact">Stvori novi kontakt</string>
<string name="add_to_existing_contact">Dodaj postojećem kontaktu</string>
<string name="fields_empty">At least 1 field has to be filled out</string>
<!-- Placeholders -->
<string name="no_contacts_with_emails">Nije pronađen nijedan kontakt s e-poštom</string>

View File

@ -14,6 +14,7 @@
<string name="send_email_to_group">Email küldése csoportnak</string>
<string name="create_new_contact">Új névjegy hozzáadása</string>
<string name="add_to_existing_contact">Hozzáadás meglévő névjegyhez</string>
<string name="fields_empty">At least 1 field has to be filled out</string>
<!-- Placeholders -->
<string name="no_contacts_with_emails">Nincs emailt tartalmazó névjegy.</string>

View File

@ -14,6 +14,7 @@
<string name="send_email_to_group">Kirim surel ke grup</string>
<string name="create_new_contact">Buat kontak baru</string>
<string name="add_to_existing_contact">Tambah ke kontak yang ada</string>
<string name="fields_empty">At least 1 field has to be filled out</string>
<!-- Placeholders -->
<string name="no_contacts_with_emails">Tidak ada kontak dengan alamat surel yang ditemukan</string>

View File

@ -15,6 +15,7 @@
<string name="send_email_to_group">Invia un\'email al gruppo</string>
<string name="create_new_contact">Crea un nuovo contatto</string>
<string name="add_to_existing_contact">Aggiungi a un contatto esistente</string>
<string name="fields_empty">At least 1 field has to be filled out</string>
<!-- Placeholders -->
<string name="no_contacts_with_emails">Nessun contatto trovato con un\'email</string>
<string name="no_contacts_with_phone_numbers">Nessun contatto trovato con un numero di telefono</string>

View File

@ -14,6 +14,7 @@
<string name="send_email_to_group">グループにメールを送信</string>
<string name="create_new_contact">新しい連絡先を作成</string>
<string name="add_to_existing_contact">既存の連絡先に追加</string>
<string name="fields_empty">At least 1 field has to be filled out</string>
<!-- Placeholders -->
<string name="no_contacts_with_emails">メールアドレスが登録された連絡先が見つかりません</string>

View File

@ -14,6 +14,7 @@
<string name="send_email_to_group">Send email to group</string>
<string name="create_new_contact">Create new contact</string>
<string name="add_to_existing_contact">Add to an existing contact</string>
<string name="fields_empty">At least 1 field has to be filled out</string>
<!-- Placeholders -->
<string name="no_contacts_with_emails">No contacts with emails have been found</string>

View File

@ -14,6 +14,7 @@
<string name="send_email_to_group">Send email to group</string>
<string name="create_new_contact">Create new contact</string>
<string name="add_to_existing_contact">Add to an existing contact</string>
<string name="fields_empty">At least 1 field has to be filled out</string>
<!-- Placeholders -->
<string name="no_contacts_with_emails">No contacts with emails have been found</string>

View File

@ -14,6 +14,7 @@
<string name="send_email_to_group">ഗ്രൂപ്പിലേക്ക് ഇമെയിൽ അയയ്ക്കുക</string>
<string name="create_new_contact">പുതിയ കോൺ‌ടാക്റ്റ് സൃഷ്‌ടിക്കുക</string>
<string name="add_to_existing_contact">നിലവിലുള്ള കോൺ‌ടാക്റ്റിലേക്ക് ചേർക്കുക</string>
<string name="fields_empty">At least 1 field has to be filled out</string>
<!-- Placeholders -->
<string name="no_contacts_with_emails">ഇമെയിലുകളില്ലാത്ത കോൺടാക്റ്റുകൾ കണ്ടെത്തിയില്ല</string>

View File

@ -14,6 +14,7 @@
<string name="send_email_to_group">E-mail naar groep sturen</string>
<string name="create_new_contact">Nieuw contact</string>
<string name="add_to_existing_contact">Aan bestaand contact toevoegen</string>
<string name="fields_empty">At least 1 field has to be filled out</string>
<!-- Placeholders -->
<string name="no_contacts_with_emails">Geen contacten met e-mailadressen gevonden</string>

View File

@ -15,6 +15,7 @@
<string name="send_email_to_group">Wyślij e-mail do grupy</string>
<string name="create_new_contact">Utwórz nowy kontakt</string>
<string name="add_to_existing_contact">Dodaj do istniejącego kontaktu</string>
<string name="fields_empty">Należy wypełnić co najmniej 1 pole</string>
<!-- Placeholders -->
<string name="no_contacts_with_emails">Nie znaleziono kontaktów z adresami e-mail</string>
<string name="no_contacts_with_phone_numbers">Nie znaleziono kontaktów z numerami telefonów</string>

View File

@ -14,6 +14,7 @@
<string name="send_email_to_group">Enviar e-mail ao grupo</string>
<string name="create_new_contact">Criar novo contato</string>
<string name="add_to_existing_contact">Adicionar um contato existente</string>
<string name="fields_empty">At least 1 field has to be filled out</string>
<!-- Placeholders -->
<string name="no_contacts_with_emails">Não foram encontrados contatos com e-mails</string>

View File

@ -14,6 +14,7 @@
<string name="send_email_to_group">Enviar e-mail para o grupo</string>
<string name="create_new_contact">Criar novo contacto</string>
<string name="add_to_existing_contact">Adicionar a um contacto existente</string>
<string name="fields_empty">At least 1 field has to be filled out</string>
<!-- Placeholders -->
<string name="no_contacts_with_emails">Não existem contactos com endereço de e-mail</string>

View File

@ -15,6 +15,7 @@
<string name="send_email_to_group">Отправить письмо группе</string>
<string name="create_new_contact">Создать новый контакт</string>
<string name="add_to_existing_contact">Добавить к существующему контакту</string>
<string name="fields_empty">At least 1 field has to be filled out</string>
<!-- Placeholders -->
<string name="no_contacts_with_emails">Контакты с адресами электронной почты не найдены</string>
<string name="no_contacts_with_phone_numbers">Контакты с номерами телефонов не найдены</string>

View File

@ -14,6 +14,7 @@
<string name="send_email_to_group">Poslať skupine email</string>
<string name="create_new_contact">Vytvoriť nový kontakt</string>
<string name="add_to_existing_contact">Pridať k existujúcemu kontaktu</string>
<string name="fields_empty">Musí byť vyplnené aspoň 1 pole</string>
<!-- Placeholders -->
<string name="no_contacts_with_emails">Nenašli sa žiadne kontakty s emailami</string>

View File

@ -15,6 +15,7 @@
<string name="send_email_to_group">Skicka e-post till grupp</string>
<string name="create_new_contact">Skapa ny kontakt</string>
<string name="add_to_existing_contact">Lägg till i en befintlig kontakt</string>
<string name="fields_empty">At least 1 field has to be filled out</string>
<!-- Placeholders -->
<string name="no_contacts_with_emails">Inga kontakter med e-postadresser hittades</string>
<string name="no_contacts_with_phone_numbers">Inga kontakter med telefonnummer hittades</string>

View File

@ -15,6 +15,7 @@
<string name="send_email_to_group">Gruba e-posta gönder</string>
<string name="create_new_contact">Yeni kişi oluştur</string>
<string name="add_to_existing_contact">Mevcut bir kişiye ekle</string>
<string name="fields_empty">At least 1 field has to be filled out</string>
<!-- Placeholders -->
<string name="no_contacts_with_emails">E-posta ile hiç bağlantı bulunamadı</string>
<string name="no_contacts_with_phone_numbers">Telefon numaralarını içeren kişi bulunamadı</string>

View File

@ -14,6 +14,7 @@
<string name="send_email_to_group">Надіслати електронний лист групі контактів</string>
<string name="create_new_contact">Створити новий контакт</string>
<string name="add_to_existing_contact">Додати до існуючого контакту</string>
<string name="fields_empty">At least 1 field has to be filled out</string>
<!-- Placeholders -->
<string name="no_contacts_with_emails">Не знайдено контактів з електронною поштою</string>

View File

@ -15,6 +15,7 @@
<string name="send_email_to_group">发送电子邮件给群组</string>
<string name="create_new_contact">建立新联系人</string>
<string name="add_to_existing_contact">添加至已存在的联系人</string>
<string name="fields_empty">At least 1 field has to be filled out</string>
<!-- Placeholders -->
<string name="no_contacts_with_emails">未发现含有电子邮箱的联系人</string>
<string name="no_contacts_with_phone_numbers">未发现含有电话号码的联系人</string>

View File

@ -14,6 +14,7 @@
<string name="send_email_to_group">發送電子郵件給群組</string>
<string name="create_new_contact">建立新聯絡人</string>
<string name="add_to_existing_contact">添加至已存在的聯絡人</string>
<string name="fields_empty">At least 1 field has to be filled out</string>
<!-- Placeholders -->
<string name="no_contacts_with_emails">未發現含有電子信箱的聯絡人</string>

View File

@ -15,6 +15,7 @@
<string name="send_email_to_group">Send email to group</string>
<string name="create_new_contact">Create new contact</string>
<string name="add_to_existing_contact">Add to an existing contact</string>
<string name="fields_empty">At least 1 field has to be filled out</string>
<!-- Placeholders -->
<string name="no_contacts_with_emails">No contacts with emails have been found</string>