mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-06-05 21:59:27 +02:00
@ -42,6 +42,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
|
|||||||
private var storedTextColor = 0
|
private var storedTextColor = 0
|
||||||
private var storedBackgroundColor = 0
|
private var storedBackgroundColor = 0
|
||||||
private var storedPrimaryColor = 0
|
private var storedPrimaryColor = 0
|
||||||
|
private var storedShowContactThumbnails = false
|
||||||
private var storedShowPhoneNumbers = false
|
private var storedShowPhoneNumbers = false
|
||||||
private var storedStartNameWithSurname = false
|
private var storedStartNameWithSurname = false
|
||||||
|
|
||||||
@ -76,6 +77,11 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (storedShowContactThumbnails != config.showContactThumbnails) {
|
||||||
|
restartActivity()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (storedShowPhoneNumbers != config.showPhoneNumbers) {
|
if (storedShowPhoneNumbers != config.showPhoneNumbers) {
|
||||||
restartActivity()
|
restartActivity()
|
||||||
return
|
return
|
||||||
@ -154,6 +160,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
|
|||||||
storedTextColor = textColor
|
storedTextColor = textColor
|
||||||
storedBackgroundColor = backgroundColor
|
storedBackgroundColor = backgroundColor
|
||||||
storedPrimaryColor = primaryColor
|
storedPrimaryColor = primaryColor
|
||||||
|
storedShowContactThumbnails = showContactThumbnails
|
||||||
storedShowPhoneNumbers = showPhoneNumbers
|
storedShowPhoneNumbers = showPhoneNumbers
|
||||||
storedStartNameWithSurname = startNameWithSurname
|
storedStartNameWithSurname = startNameWithSurname
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ class SettingsActivity : SimpleActivity() {
|
|||||||
setupCustomizeColors()
|
setupCustomizeColors()
|
||||||
setupUseEnglish()
|
setupUseEnglish()
|
||||||
setupShowInfoBubble()
|
setupShowInfoBubble()
|
||||||
|
setupShowContactThumbnails()
|
||||||
setupShowPhoneNumbers()
|
setupShowPhoneNumbers()
|
||||||
setupCallContactOnClick()
|
setupCallContactOnClick()
|
||||||
setupStartNameWithSurname()
|
setupStartNameWithSurname()
|
||||||
@ -51,6 +52,14 @@ class SettingsActivity : SimpleActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun setupShowContactThumbnails() {
|
||||||
|
settings_show_contact_thumbnails.isChecked = config.showContactThumbnails
|
||||||
|
settings_show_contact_thumbnails_holder.setOnClickListener {
|
||||||
|
settings_show_contact_thumbnails.toggle()
|
||||||
|
config.showContactThumbnails = settings_show_contact_thumbnails.isChecked
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun setupShowPhoneNumbers() {
|
private fun setupShowPhoneNumbers() {
|
||||||
settings_show_phone_numbers.isChecked = config.showPhoneNumbers
|
settings_show_phone_numbers.isChecked = config.showPhoneNumbers
|
||||||
settings_show_phone_numbers_holder.setOnClickListener {
|
settings_show_phone_numbers_holder.setOnClickListener {
|
||||||
|
@ -11,6 +11,7 @@ import com.bumptech.glide.request.RequestOptions
|
|||||||
import com.bumptech.glide.signature.ObjectKey
|
import com.bumptech.glide.signature.ObjectKey
|
||||||
import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter
|
import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter
|
||||||
import com.simplemobiletools.commons.dialogs.ConfirmationDialog
|
import com.simplemobiletools.commons.dialogs.ConfirmationDialog
|
||||||
|
import com.simplemobiletools.commons.extensions.beVisibleIf
|
||||||
import com.simplemobiletools.commons.extensions.getColoredDrawableWithColor
|
import com.simplemobiletools.commons.extensions.getColoredDrawableWithColor
|
||||||
import com.simplemobiletools.commons.extensions.isActivityDestroyed
|
import com.simplemobiletools.commons.extensions.isActivityDestroyed
|
||||||
import com.simplemobiletools.commons.views.FastScroller
|
import com.simplemobiletools.commons.views.FastScroller
|
||||||
@ -33,10 +34,12 @@ class ContactsAdapter(activity: SimpleActivity, var contactItems: MutableList<Co
|
|||||||
lateinit private var contactDrawable: Drawable
|
lateinit private var contactDrawable: Drawable
|
||||||
var config = activity.config
|
var config = activity.config
|
||||||
var startNameWithSurname: Boolean
|
var startNameWithSurname: Boolean
|
||||||
|
var showContactThumbnails: Boolean
|
||||||
var showPhoneNumbers: Boolean
|
var showPhoneNumbers: Boolean
|
||||||
|
|
||||||
init {
|
init {
|
||||||
initDrawables()
|
initDrawables()
|
||||||
|
showContactThumbnails = config.showContactThumbnails
|
||||||
showPhoneNumbers = config.showPhoneNumbers
|
showPhoneNumbers = config.showPhoneNumbers
|
||||||
startNameWithSurname = config.startNameWithSurname
|
startNameWithSurname = config.startNameWithSurname
|
||||||
}
|
}
|
||||||
@ -189,17 +192,20 @@ class ContactsAdapter(activity: SimpleActivity, var contactItems: MutableList<Co
|
|||||||
contact_name.setTextColor(textColor)
|
contact_name.setTextColor(textColor)
|
||||||
contact_number?.text = contact.phoneNumbers.firstOrNull()?.value ?: ""
|
contact_number?.text = contact.phoneNumbers.firstOrNull()?.value ?: ""
|
||||||
contact_number?.setTextColor(textColor)
|
contact_number?.setTextColor(textColor)
|
||||||
|
contact_tmb.beVisibleIf(showContactThumbnails)
|
||||||
|
|
||||||
if (contact.photoUri.isNotEmpty()) {
|
if (showContactThumbnails) {
|
||||||
val options = RequestOptions()
|
if (contact.photoUri.isNotEmpty()) {
|
||||||
.signature(ObjectKey(contact.photoUri))
|
val options = RequestOptions()
|
||||||
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
|
.signature(ObjectKey(contact.photoUri))
|
||||||
.error(contactDrawable)
|
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
|
||||||
.centerCrop()
|
.error(contactDrawable)
|
||||||
|
.centerCrop()
|
||||||
|
|
||||||
Glide.with(activity).load(contact.photoUri).transition(DrawableTransitionOptions.withCrossFade()).apply(options).into(contact_tmb)
|
Glide.with(activity).load(contact.photoUri).transition(DrawableTransitionOptions.withCrossFade()).apply(options).into(contact_tmb)
|
||||||
} else {
|
} else {
|
||||||
contact_tmb.setImageDrawable(contactDrawable)
|
contact_tmb.setImageDrawable(contactDrawable)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,10 @@ class Config(context: Context) : BaseConfig(context) {
|
|||||||
|
|
||||||
fun showAllContacts() = displayContactSources.size == 1 && displayContactSources.first() == "-1"
|
fun showAllContacts() = displayContactSources.size == 1 && displayContactSources.first() == "-1"
|
||||||
|
|
||||||
|
var showContactThumbnails : Boolean
|
||||||
|
get() = prefs.getBoolean(SHOW_CONTACT_THUMBNAILS, true)
|
||||||
|
set(showContactThumbnails) = prefs.edit().putBoolean(SHOW_CONTACT_THUMBNAILS, showContactThumbnails).apply()
|
||||||
|
|
||||||
var showPhoneNumbers: Boolean
|
var showPhoneNumbers: Boolean
|
||||||
get() = prefs.getBoolean(SHOW_PHONE_NUMBERS, false)
|
get() = prefs.getBoolean(SHOW_PHONE_NUMBERS, false)
|
||||||
set(showPhoneNumbers) = prefs.edit().putBoolean(SHOW_PHONE_NUMBERS, showPhoneNumbers).apply()
|
set(showPhoneNumbers) = prefs.edit().putBoolean(SHOW_PHONE_NUMBERS, showPhoneNumbers).apply()
|
||||||
|
@ -4,6 +4,7 @@ import android.provider.ContactsContract.CommonDataKinds
|
|||||||
|
|
||||||
// shared prefs
|
// shared prefs
|
||||||
val CALL_CONTACT_ON_CLICK = "call_contact_on_click"
|
val CALL_CONTACT_ON_CLICK = "call_contact_on_click"
|
||||||
|
val SHOW_CONTACT_THUMBNAILS = "show_contact_thumbnails"
|
||||||
val SHOW_PHONE_NUMBERS = "show_phone_numbers"
|
val SHOW_PHONE_NUMBERS = "show_phone_numbers"
|
||||||
val DISPLAY_CONTACT_SOURCES = "display_contact_sources"
|
val DISPLAY_CONTACT_SOURCES = "display_contact_sources"
|
||||||
val START_NAME_WITH_SURNAME = "start_name_with_surname"
|
val START_NAME_WITH_SURNAME = "start_name_with_surname"
|
||||||
|
@ -70,6 +70,26 @@
|
|||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/settings_show_contact_thumbnails_holder"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/medium_margin"
|
||||||
|
android:background="?attr/selectableItemBackground"
|
||||||
|
android:padding="@dimen/activity_margin">
|
||||||
|
|
||||||
|
<com.simplemobiletools.commons.views.MySwitchCompat
|
||||||
|
android:id="@+id/settings_show_contact_thumbnails"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@null"
|
||||||
|
android:clickable="false"
|
||||||
|
android:paddingLeft="@dimen/medium_margin"
|
||||||
|
android:paddingStart="@dimen/medium_margin"
|
||||||
|
android:text="@string/show_contact_thumbnails"/>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/settings_show_phone_numbers_holder"
|
android:id="@+id/settings_show_phone_numbers_holder"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
<string name="call_contact_on_click">Kontakt bei Klick anrufen</string>
|
<string name="call_contact_on_click">Kontakt bei Klick anrufen</string>
|
||||||
<string name="start_name_with_surname">Namen mit Nachnamen beginnen</string>
|
<string name="start_name_with_surname">Namen mit Nachnamen beginnen</string>
|
||||||
<string name="show_phone_numbers">Zeige Telefonnummern im Hauptmenü</string>
|
<string name="show_phone_numbers">Zeige Telefonnummern im Hauptmenü</string>
|
||||||
<string name="show_contact_avatars">Show contact avatars</string>
|
<string name="show_contact_thumbnails">Show contact thumbnails</string>
|
||||||
|
|
||||||
<!-- Emails -->
|
<!-- Emails -->
|
||||||
<string name="email">Email</string>
|
<string name="email">Email</string>
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
<string name="call_contact_on_click">클릭으로 전화걸기</string>
|
<string name="call_contact_on_click">클릭으로 전화걸기</string>
|
||||||
<string name="start_name_with_surname">성을 먼저 표시</string>
|
<string name="start_name_with_surname">성을 먼저 표시</string>
|
||||||
<string name="show_phone_numbers">메인 스크린에 전화번호 표시</string>
|
<string name="show_phone_numbers">메인 스크린에 전화번호 표시</string>
|
||||||
<string name="show_contact_avatars">Show contact avatars</string>
|
<string name="show_contact_thumbnails">Show contact thumbnails</string>
|
||||||
|
|
||||||
<!-- Emails -->
|
<!-- Emails -->
|
||||||
<string name="email">이메일</string>
|
<string name="email">이메일</string>
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
<string name="call_contact_on_click">Call contact on click</string>
|
<string name="call_contact_on_click">Call contact on click</string>
|
||||||
<string name="start_name_with_surname">Start name with surname</string>
|
<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_phone_numbers">Show phone numbers on the main screen</string>
|
||||||
<string name="show_contact_avatars">Show contact avatars</string>
|
<string name="show_contact_thumbnails">Show contact thumbnails</string>
|
||||||
|
|
||||||
<!-- Emails -->
|
<!-- Emails -->
|
||||||
<string name="email">E-mail</string>
|
<string name="email">E-mail</string>
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
<string name="call_contact_on_click">Вызывать контакт при нажатии</string>
|
<string name="call_contact_on_click">Вызывать контакт при нажатии</string>
|
||||||
<string name="start_name_with_surname">Показывать сначала фамилию</string>
|
<string name="start_name_with_surname">Показывать сначала фамилию</string>
|
||||||
<string name="show_phone_numbers">Показывать номера телефонов на главном экране</string>
|
<string name="show_phone_numbers">Показывать номера телефонов на главном экране</string>
|
||||||
<string name="show_contact_avatars">Показывать фото контакта</string>
|
<string name="show_contact_thumbnails">Показывать фото контакта</string>
|
||||||
|
|
||||||
<!-- Emails -->
|
<!-- Emails -->
|
||||||
<string name="email">Эл. почта</string>
|
<string name="email">Эл. почта</string>
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
<string name="call_contact_on_click">Zavolať kontakt po kliknutí</string>
|
<string name="call_contact_on_click">Zavolať kontakt po kliknutí</string>
|
||||||
<string name="start_name_with_surname">Začať meno priezviskom</string>
|
<string name="start_name_with_surname">Začať meno priezviskom</string>
|
||||||
<string name="show_phone_numbers">Zobraziť telefónne čísla na hlavnej obrazovke</string>
|
<string name="show_phone_numbers">Zobraziť telefónne čísla na hlavnej obrazovke</string>
|
||||||
<string name="show_contact_avatars">Zobraziť obrázky kontaktov</string>
|
<string name="show_contact_thumbnails">Zobraziť obrázky kontaktov</string>
|
||||||
|
|
||||||
<!-- Emails -->
|
<!-- Emails -->
|
||||||
<string name="email">Email</string>
|
<string name="email">Email</string>
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
<string name="call_contact_on_click">Ring kontakter när jag trycker på dem</string>
|
<string name="call_contact_on_click">Ring kontakter när jag trycker på dem</string>
|
||||||
<string name="start_name_with_surname">Visa efternamn först</string>
|
<string name="start_name_with_surname">Visa efternamn först</string>
|
||||||
<string name="show_phone_numbers">Visa telefonnummer i huvudvyn</string>
|
<string name="show_phone_numbers">Visa telefonnummer i huvudvyn</string>
|
||||||
<string name="show_contact_avatars">Show contact avatars</string>
|
<string name="show_contact_thumbnails">Show contact thumbnails</string>
|
||||||
|
|
||||||
<!-- Emails -->
|
<!-- Emails -->
|
||||||
<string name="email">E-post</string>
|
<string name="email">E-post</string>
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
<string name="call_contact_on_click">Call contact on click</string>
|
<string name="call_contact_on_click">Call contact on click</string>
|
||||||
<string name="start_name_with_surname">Start name with surname</string>
|
<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_phone_numbers">Show phone numbers on the main screen</string>
|
||||||
<string name="show_contact_avatars">Show contact avatars</string>
|
<string name="show_contact_thumbnails">Show contact thumbnails</string>
|
||||||
|
|
||||||
<!-- Emails -->
|
<!-- Emails -->
|
||||||
<string name="email">Email</string>
|
<string name="email">Email</string>
|
||||||
|
Reference in New Issue
Block a user