Merge pull request #8 from SimpleMobileTools/master

upd
This commit is contained in:
solokot 2018-03-11 13:52:28 +03:00 committed by GitHub
commit 4e4f8273ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 166 additions and 75 deletions

View File

@ -1,6 +1,11 @@
Changelog
==========
Version 3.3.3 *(2018-03-04)*
----------------------------
* Make sure Search searches address and Notes too
Version 3.3.2 *(2018-03-04)*
----------------------------

View File

@ -10,8 +10,8 @@ android {
applicationId "com.simplemobiletools.contacts"
minSdkVersion 16
targetSdkVersion 27
versionCode 13
versionName "3.3.2"
versionCode 14
versionName "3.3.3"
setProperty("archivesBaseName", "contacts")
}

View File

@ -361,7 +361,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
FilePickerDialog(this, pickFile = false, showFAB = true) {
ExportContactsDialog(this, it) { file, contactSources ->
Thread {
ContactsHelper(this).getContacts(true) {
ContactsHelper(this).getContacts {
val contacts = it.filter { contactSources.contains(it.source) }
if (contacts.isEmpty()) {
toast(R.string.no_entries_for_exporting)

View File

@ -75,7 +75,7 @@ class SelectContactActivity : SimpleActivity() {
}
private fun initContacts() {
ContactsHelper(this).getContacts(true) {
ContactsHelper(this).getContacts {
if (isActivityDestroyed()) {
return@getContacts
}

View File

@ -168,7 +168,7 @@ class ContactsAdapter(activity: SimpleActivity, var contactItems: ArrayList<Cont
contactsIDs.add(contactItems[it].id)
}
ContactsHelper(activity).getContacts(true) {
ContactsHelper(activity).getContacts {
val filtered = it.filter { contactsIDs.contains(it.id) } as ArrayList<Contact>
activity.shareContacts(filtered)
}

View File

@ -171,7 +171,9 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
val filtered = contactsIgnoringSearch.filter {
it.getFullName(startNameWithSurname).contains(text, true) ||
it.phoneNumbers.any { it.value.contains(text, true) } ||
it.emails.any { it.value.contains(text, true) }
it.emails.any { it.value.contains(text, true) } ||
it.addresses.any { it.value.contains(text, true) } ||
it.notes.contains(text, true)
} as ArrayList
Contact.sorting = config.sorting
@ -188,7 +190,7 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
}
fun onSearchOpened() {
contactsIgnoringSearch = (fragment_list?.adapter as? ContactsAdapter)?.contactItems as? ArrayList ?: ArrayList()
contactsIgnoringSearch = (fragment_list?.adapter as? ContactsAdapter)?.contactItems ?: ArrayList()
}
fun onSearchClosed() {

View File

@ -29,7 +29,7 @@ import com.simplemobiletools.contacts.extensions.getPhotoThumbnailSize
import com.simplemobiletools.contacts.models.*
class ContactsHelper(val activity: BaseSimpleActivity) {
fun getContacts(addOptionalFields: Boolean = false, callback: (ArrayList<Contact>) -> Unit) {
fun getContacts(callback: (ArrayList<Contact>) -> Unit) {
val contacts = SparseArray<Contact>()
Thread {
val uri = ContactsContract.Data.CONTENT_URI
@ -75,34 +75,32 @@ class ContactsHelper(val activity: BaseSimpleActivity) {
contacts[key]?.phoneNumbers = phoneNumbers.valueAt(i)
}
if (addOptionalFields) {
val emails = getEmails()
size = emails.size()
for (i in 0 until size) {
val key = emails.keyAt(i)
contacts[key]?.emails = emails.valueAt(i)
}
val emails = getEmails()
size = emails.size()
for (i in 0 until size) {
val key = emails.keyAt(i)
contacts[key]?.emails = emails.valueAt(i)
}
val addresses = getAddresses()
size = addresses.size()
for (i in 0 until size) {
val key = addresses.keyAt(i)
contacts[key]?.addresses = addresses.valueAt(i)
}
val addresses = getAddresses()
size = addresses.size()
for (i in 0 until size) {
val key = addresses.keyAt(i)
contacts[key]?.addresses = addresses.valueAt(i)
}
val events = getEvents()
size = events.size()
for (i in 0 until size) {
val key = events.keyAt(i)
contacts[key]?.events = events.valueAt(i)
}
val events = getEvents()
size = events.size()
for (i in 0 until size) {
val key = events.keyAt(i)
contacts[key]?.events = events.valueAt(i)
}
val notes = getNotes()
size = notes.size()
for (i in 0 until size) {
val key = notes.keyAt(i)
contacts[key]?.notes = notes.valueAt(i)
}
val notes = getNotes()
size = notes.size()
for (i in 0 until size) {
val key = notes.keyAt(i)
contacts[key]?.notes = notes.valueAt(i)
}
activity.dbHelper.getContacts().forEach {

View File

@ -1,70 +1,70 @@
<resources>
<string name="app_name">Simple Contacts</string>
<string name="app_launcher_name">Contactos</string>
<string name="address">Address</string>
<string name="inserting">Inserting</string>
<string name="updating">Updating</string>
<string name="phone_storage">Phone storage</string>
<string name="phone_storage_hidden">Phone storage (not visible by other apps)</string>
<string name="address">Enederço</string>
<string name="inserting">A inserir</string>
<string name="updating">A atualizar</string>
<string name="phone_storage">Armazenamento do telefone</string>
<string name="phone_storage_hidden">Armazenamento do telefone (não visível por outras alicações)</string>
<string name="new_contact">Novo contacto</string>
<string name="edit_contact">Editar contacto</string>
<string name="select_contact">Select contact</string>
<string name="select_contacts">Select contacts</string>
<string name="first_name">First name</string>
<string name="middle_name">Middle name</string>
<string name="surname">Surname</string>
<string name="select_contact">Selecionar contacto</string>
<string name="select_contacts">Selecionar contactos</string>
<string name="first_name">Primeiro nome</string>
<string name="middle_name">Segundo nome</string>
<string name="surname">Apelido</string>
<!-- Photo -->
<string name="take_photo">Take photo</string>
<string name="choose_photo">Choose photo</string>
<string name="remove_photo">Remove photo</string>
<string name="take_photo">Tirar foto</string>
<string name="choose_photo">Escolher foto</string>
<string name="remove_photo">Remover foto</string>
<!-- Settings -->
<string name="start_name_with_surname">Start name with surname</string>
<string name="show_phone_numbers">Show phone numbers on the main screen</string>
<string name="show_contact_thumbnails">Show contact thumbnails</string>
<string name="on_contact_click">On contact click</string>
<string name="call_contact">Call contact</string>
<string name="view_contact">View contact details</string>
<string name="start_name_with_surname">Ordenar por apelido</string>
<string name="show_phone_numbers">Mostrar número de telefone no ecrã principal</string>
<string name="show_contact_thumbnails">Mostrar miniatura do contacto</string>
<string name="on_contact_click">Ao clicar no contacto</string>
<string name="call_contact">Ligar</string>
<string name="view_contact">Ver detalhes</string>
<!-- Emails -->
<string name="email">E-mail</string>
<string name="home">Home</string>
<string name="work">Work</string>
<string name="other">Other</string>
<string name="home">Pessoal</string>
<string name="work">Profissional</string>
<string name="other">Outro</string>
<!-- Phone numbers -->
<string name="number">Número</string>
<string name="mobile">Mobile</string>
<string name="main_number">Main</string>
<string name="work_fax">Work Fax</string>
<string name="home_fax">Home Fax</string>
<string name="mobile">Telemóvel</string>
<string name="main_number">Principal</string>
<string name="work_fax">Fax profissional</string>
<string name="home_fax">Fax pessoal</string>
<string name="pager">Pager</string>
<string name="no_phone_number_found">No phone number has been found</string>
<string name="no_phone_number_found">Número de telefone não encontrado</string>
<!-- Events -->
<string name="birthday">Birthday</string>
<string name="anniversary">Anniversary</string>
<string name="birthday">Data de nascimento</string>
<string name="anniversary">Aniversário</string>
<!-- Favorites -->
<string name="no_favorites">Seems like you haven\'t added any favorite contacts yet.</string>
<string name="add_favorites">Add favorites</string>
<string name="add_to_favorites">Add to favorites</string>
<string name="remove_from_favorites">Remove from favorites</string>
<string name="no_favorites">Parece que ainda não adicionou contactos como favoritos.</string>
<string name="add_favorites">Adicionar favoritos</string>
<string name="add_to_favorites">Adicionar aos favoritos</string>
<string name="remove_from_favorites">Remover dos favoritos</string>
<!-- Search -->
<string name="search_contacts">Search contacts</string>
<string name="search_favorites">Search favorites</string>
<string name="search_contacts">Pesquisar contactos</string>
<string name="search_favorites">Pesquisar favoritos</string>
<!-- Export / Import -->
<string name="import_contacts">Import contacts</string>
<string name="export_contacts">Export contacts</string>
<string name="import_contacts_from_vcf">Import contacts from a .vcf file</string>
<string name="export_contacts_to_vcf">Export contacts to a .vcf file</string>
<string name="target_contact_source">Target contact source</string>
<string name="include_contact_sources">Include contact sources</string>
<string name="filename_without_vcf">Filename (without .vcf)</string>
<string name="import_contacts">Importar contactos</string>
<string name="export_contacts">Exportar contactos</string>
<string name="import_contacts_from_vcf">Importar contactos de um ficheiro .vcf</string>
<string name="export_contacts_to_vcf">Exportar contactos para um ficheiro .vcf</string>
<string name="target_contact_source">Destino da fonte do contacto</string>
<string name="include_contact_sources">Incluir fontes dos contactos</string>
<string name="filename_without_vcf">Nome do ficheiro (sem .vcf)</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View File

@ -0,0 +1,86 @@
<resources>
<string name="app_name">簡易通訊錄</string>
<string name="app_launcher_name">簡易通訊錄</string>
<string name="address">地址</string>
<string name="inserting">添加中…</string>
<string name="updating">更新中…</string>
<string name="phone_storage">手機空間</string>
<string name="phone_storage_hidden">手機空間 (其他程式不可見)</string>
<string name="new_contact">新聯絡人</string>
<string name="edit_contact">編輯聯絡人</string>
<string name="select_contact">選擇聯絡人</string>
<string name="select_contacts">選擇聯絡人</string>
<string name="first_name">名字</string>
<string name="middle_name">中間名</string>
<string name="surname">姓氏</string>
<!-- Photo -->
<string name="take_photo">拍照</string>
<string name="choose_photo">選擇相片</string>
<string name="remove_photo">移除相片</string>
<!-- Settings -->
<string name="start_name_with_surname">姓氏在前</string>
<string name="show_phone_numbers">主畫面顯示電話號碼</string>
<string name="show_contact_thumbnails">顯示聯絡人縮圖</string>
<string name="on_contact_click">點擊聯絡人</string>
<string name="call_contact">打電話給聯絡人</string>
<string name="view_contact">顯示聯絡人資料</string>
<!-- Emails -->
<string name="email">信箱</string>
<string name="home">住家</string>
<string name="work">工作</string>
<string name="other">其它</string>
<!-- Phone numbers -->
<string name="number">號碼</string>
<string name="mobile">手機</string>
<string name="main_number">主用</string>
<string name="work_fax">工作傳真</string>
<string name="home_fax">住家傳真</string>
<string name="pager">呼叫器</string>
<string name="no_phone_number_found">未發現電話號碼</string>
<!-- Events -->
<string name="birthday">生日</string>
<string name="anniversary">紀念日</string>
<!-- Favorites -->
<string name="no_favorites">你似乎還沒加入任何我的最愛聯絡人。</string>
<string name="add_favorites">添加我的最愛</string>
<string name="add_to_favorites">加入我的最愛</string>
<string name="remove_from_favorites">從我的最愛移除</string>
<!-- Search -->
<string name="search_contacts">搜尋聯絡人</string>
<string name="search_favorites">搜尋我的最愛</string>
<!-- Export / Import -->
<string name="import_contacts">匯入聯絡人</string>
<string name="export_contacts">匯出聯絡人</string>
<string name="import_contacts_from_vcf">從.vcf檔案匯入聯絡人</string>
<string name="export_contacts_to_vcf">匯出聯絡人成.vcf檔案</string>
<string name="target_contact_source">聯絡人來源</string>
<string name="include_contact_sources">包含聯絡人來源</string>
<string name="filename_without_vcf">檔案名稱 (不含.vcf)</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->
<string name="app_short_description">一個用來管理聯絡人,且沒有廣告的通訊錄應用程式。</string>
<string name="app_long_description">
一個用來從任何來源建立或管理聯絡人的簡易應用程式。聯絡人只能儲存於你的裝置上不過也能透過Google或其他帳號來同步。你能將我的最愛聯絡人顯示在獨立名單上。
你也能用來管理使用者信箱和活動。它能夠以多項參數來排序/篩選,以及選擇將姓氏顯示在名字前面。
不包含廣告及非必要的權限,而且完全開放原始碼,並提供自訂顏色。
這程式只是一系列眾多應用程式的其中一項,你可以在這發現更多 http://www.simplemobiletools.com
</string>
<!--
Haven't found some strings? There's more at
https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res
-->
</resources>