Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implements #114 #218

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions app/src/main/kotlin/org/fossify/phone/activities/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ class MainActivity : SimpleActivity() {
private var storedShowTabs = 0
private var storedFontSize = 0
private var storedStartNameWithSurname = false
private var storedShowContactThumbnails = false

var cachedContacts = ArrayList<Contact>()

override fun onCreate(savedInstanceState: Bundle?) {
Expand Down Expand Up @@ -127,6 +129,14 @@ class MainActivity : SimpleActivity() {
storedStartNameWithSurname = config.startNameWithSurname
}

val configShowContactThumbnails = config.showContactThumbnails
if (storedShowContactThumbnails != configShowContactThumbnails) {
getContactsFragment()?.showContactThumbnailsChanged(configShowContactThumbnails)
getFavoritesFragment()?.showContactThumbnailsChanged(configShowContactThumbnails)
getRecentsFragment()?.showContactThumbnailsChanged(configShowContactThumbnails)
storedShowContactThumbnails = config.showContactThumbnails
}

if (!binding.mainMenu.isSearchOpen) {
refreshItems(true)
}
Expand All @@ -148,6 +158,7 @@ class MainActivity : SimpleActivity() {
super.onPause()
storedShowTabs = config.showTabs
storedStartNameWithSurname = config.startNameWithSurname
storedShowContactThumbnails = config.showContactThumbnails
config.lastUsedViewPagerPage = binding.viewPager.currentItem
}

Expand Down Expand Up @@ -440,6 +451,7 @@ class MainActivity : SimpleActivity() {
binding.mainTabsHolder.beGoneIf(binding.mainTabsHolder.tabCount == 1)
storedShowTabs = config.showTabs
storedStartNameWithSurname = config.startNameWithSurname
storedShowContactThumbnails = config.showContactThumbnails
}

private fun getTabIcon(position: Int): Drawable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class SettingsActivity : SimpleActivity() {
setupDefaultTab()
setupDialPadOpen()
setupGroupSubsequentCalls()
setupShowContactThumbnails()
setupStartNameWithSurname()
setupFormatPhoneNumbers()
setupDialpadVibrations()
Expand Down Expand Up @@ -244,6 +245,16 @@ class SettingsActivity : SimpleActivity() {
}
}

private fun setupShowContactThumbnails() {
binding.apply {
settingsShowContactThumbnails.isChecked = config.showContactThumbnails
settingsShowContactThumbnailsHolder.setOnClickListener {
settingsShowContactThumbnails.toggle()
config.showContactThumbnails = settingsShowContactThumbnails.isChecked
}
}
}

private fun setupStartNameWithSurname() {
binding.apply {
settingsStartNameWithSurname.isChecked = config.startNameWithSurname
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ class ContactsAdapter(
}
}
}
itemContactImage.beVisibleIf(activity.config.showContactThumbnails)

if (enableDrag && textToHighlight.isEmpty()) {
dragHandleIcon.apply {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,8 @@ class RecentCallsAdapter(
nameToShow = SpannableString(nameToShow.toString().highlightTextPart(textToHighlight, properPrimaryColor))
}

itemRecentsImage.beVisibleIf(activity.config.showContactThumbnails)

itemRecentsName.apply {
text = nameToShow
setTextColor(textColor)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,20 @@ abstract class MyViewPagerFragment<BINDING : MyViewPagerFragment.InnerBinding>(c
}
}

fun showContactThumbnailsChanged(showContactThumbnails: Boolean) {
config.showContactThumbnails = showContactThumbnails

if (this is RecentsFragment) {
(innerBinding.recentsList.adapter as? RecentCallsAdapter)?.apply {
(this@MyViewPagerFragment.activity!! as MainActivity).refreshFragments()
}
} else {
(innerBinding.fragmentList?.adapter as? ContactsAdapter)?.apply {
(this@MyViewPagerFragment.activity!! as MainActivity).refreshFragments()
}
}
}

fun finishActMode() {
(innerBinding.fragmentList?.adapter as? MyRecyclerViewAdapter)?.finishActMode()
(innerBinding.recentsList?.adapter as? MyRecyclerViewAdapter)?.finishActMode()
Expand Down
47 changes: 44 additions & 3 deletions app/src/main/res/layout/activity_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -264,15 +264,45 @@
</RelativeLayout>

<include
android:id="@+id/settings_startup_divider"
android:id="@+id/settings_main_screen_divider"
layout="@layout/divider" />

<TextView
android:id="@+id/settings_calls_label"
android:id="@+id/settings_list_view_label"
style="@style/SettingsSectionLabelStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/calls" />
android:text="@string/list_view" />

<RelativeLayout
android:id="@+id/settings_show_contact_thumbnails_holder"
style="@style/SettingsHolderCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<org.fossify.commons.views.MyAppCompatCheckbox
android:id="@+id/settings_show_contact_thumbnails"
style="@style/SettingsCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/show_contact_thumbnails" />

</RelativeLayout>

<RelativeLayout
android:id="@+id/settings_start_name_with_surname_holder"
style="@style/SettingsHolderCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<org.fossify.commons.views.MyAppCompatCheckbox
android:id="@+id/settings_start_name_with_surname"
style="@style/SettingsCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/start_name_with_surname" />

</RelativeLayout>

<RelativeLayout
android:id="@+id/settings_group_subsequent_calls_holder"
Expand All @@ -289,6 +319,17 @@

</RelativeLayout>

<include
android:id="@+id/settings_startup_divider"
layout="@layout/divider" />

<TextView
android:id="@+id/settings_calls_label"
style="@style/SettingsSectionLabelStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/calls" />

<RelativeLayout
android:id="@+id/settings_show_call_confirmation_holder"
style="@style/SettingsHolderSwitchStyle"
Expand Down
13 changes: 7 additions & 6 deletions app/src/main/res/layout/item_recent_call.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@
android:layout_height="wrap_content"
android:clickable="true"
android:focusable="true"
android:paddingStart="@dimen/normal_margin"
android:paddingTop="@dimen/medium_margin"
android:paddingEnd="@dimen/normal_margin"
android:paddingBottom="@dimen/medium_margin">

<ImageView
android:id="@+id/item_recents_image"
android:layout_width="@dimen/normal_icon_size"
android:layout_height="@dimen/normal_icon_size"
android:layout_centerVertical="true"
android:layout_marginStart="@dimen/normal_margin"
android:layout_marginEnd="@dimen/small_margin"
android:padding="@dimen/small_margin"
android:layout_marginStart="@dimen/small_margin"
android:padding="@dimen/tiny_margin"
android:src="@drawable/ic_person_vector"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
Expand All @@ -27,13 +28,13 @@
android:id="@+id/item_recents_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/small_margin"
android:layout_marginEnd="@dimen/small_margin"
android:ellipsize="end"
android:maxLines="1"
android:paddingStart="@dimen/medium_margin"
android:paddingEnd="@dimen/activity_margin"
android:textAlignment="viewStart"
android:textDirection="locale"
android:textSize="@dimen/bigger_text_size"
android:textSize="@dimen/big_text_size"
app:layout_constraintBottom_toTopOf="@id/item_recents_date_time"
app:layout_constraintEnd_toStartOf="@+id/overflow_menu_icon"
app:layout_constraintStart_toEndOf="@+id/item_recents_image"
Expand Down
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 @@ -58,6 +58,7 @@
<string name="speed_dial">اتصال سريع</string>
<string name="manage_speed_dial">إدارة الاتصال السريع</string>
<string name="speed_dial_label">انقر فوق رقم لتعيين جهة اتصال له. يمكنك بعد ذلك الاتصال بجهة الاتصال المحددة بسرعة عن طريق الضغط لفترة طويلة على الرقم المحدد في الهاتف.</string>
<string name="show_contact_thumbnails">عرض صور مصغرة لجهات الإتصال</string>
<string name="group_subsequent_calls">تجميع المكالمات اللاحقة مع نفس الرقم في سجل المكالمات</string>
<string name="open_dialpad_by_default">افتح لوحة الاتصال افتراضيًا عند فتح التطبيق</string>
<string name="disable_proximity_sensor">تعطيل مستشعر القرب أثناء المكالمات</string>
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/values-az/strings.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="dialpad">Zəng paneli</string>
</resources>
<string name="show_contact_thumbnails">Kontakt görüntülərini göstər</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-be/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
<string name="speed_dial">Хуткі набор</string>
<string name="manage_speed_dial">Кіраванне хуткім наборам</string>
<string name="speed_dial_label">Націсніце на лічбу, каб прызначыць ёй кантакт. Затым вы можаце хутка патэлефанаваць дадзенаму кантакту доўгім націсканнем на абранай лічбе на панэлі набору нумароў.</string>
<string name="show_contact_thumbnails">Паказваць фота кантакту</string>
<string name="group_subsequent_calls">Групаваць наступныя выклікі з тым жа нумарам у журнале выклікаў</string>
<string name="open_dialpad_by_default">Адкрываць панэль набору нумароў пры запуску</string>
<string name="disable_proximity_sensor">Адключаць датчык набліжэння падчас выклікаў</string>
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/values-bg/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
<string name="speed_dial">Бързо набиране</string>
<string name="manage_speed_dial">Управление на бързото набиране</string>
<string name="speed_dial_label">Докоснете цифра, за да изберете контакт към нея. След това можете бързо да наберете така избрания контакт, чрез задържане върху цифрата в панела за набиране.</string>
<string name="show_contact_thumbnails">Показване на миниатюра на контакта</string>
<string name="group_subsequent_calls">Групиране на последователните обаждания от един номер в дневника на обажданията</string>
<string name="open_dialpad_by_default">При стартиране се отваря панела за набиране</string>
<string name="disable_proximity_sensor">Изключване на сензора за близост по време на обаждания</string>
Expand All @@ -69,4 +70,4 @@
<string name="faq_1_text">Такива проблеми могат да имат много специфични за устройството и системата причини, трудно е да се каже като цяло. Трябва да се огледате в настройките на устройството и да се уверите, че приложението има разрешение да се показва, когато е във фонов режим и може да се показва върху други приложения.</string>
<string name="app_launcher_name">Телефон</string>
<string name="audio_route_bluetooth">Bluetooth</string>
</resources>
</resources>
3 changes: 2 additions & 1 deletion app/src/main/res/values-ca/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
<string name="speed_dial">Marcatge ràpid</string>
<string name="manage_speed_dial">Gestiona el marcatge ràpid</string>
<string name="speed_dial_label">Feu clic en un número per a assignar-li un contacte. A continuació, podeu trucar ràpidament al contacte indicat prement prolongadament el número assignat al marcador.</string>
<string name="show_contact_thumbnails">Mostra les miniatures dels contactes</string>
<string name="group_subsequent_calls">Agrupa les trucades posteriors amb el mateix número al registre de trucades</string>
<string name="open_dialpad_by_default">Obre el teclat de marcatge de manera predeterminada quan s\'obri l\'aplicació</string>
<string name="disable_proximity_sensor">Desactiva el sensor de proximitat durant les trucades</string>
Expand All @@ -69,4 +70,4 @@
<string name="faq_1_text">Aquests problemes poden tenir moltes raons específiques del dispositiu i del sistema, difícils de dir en general. Hauríeu de mirar per la configuració del dispositiu i assegurar-vos que l\'aplicació pugui aparèixer en segon pla i permetre que es mostri sobre altres aplicacions.</string>
<string name="app_launcher_name">Telèfon</string>
<string name="audio_route_bluetooth">Bluetooth</string>
</resources>
</resources>
3 changes: 2 additions & 1 deletion app/src/main/res/values-cs/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
<string name="speed_dial">Rychlé vytáčení</string>
<string name="manage_speed_dial">Spravovat rychlá vytáčení</string>
<string name="speed_dial_label">Kliknutím na číslo mu přiřadíte kontakt. Potom můžete rychle zavolat danému kontaktu dlouhým stisknutím daného čísla na číselníku.</string>
<string name="show_contact_thumbnails">Zobrazit obrázky kontaktů</string>
<string name="group_subsequent_calls">Seskupit v protokolu hovorů další hovory se stejným číslem</string>
<string name="open_dialpad_by_default">Otevřít číselník vždy po spuštění aplikace</string>
<string name="disable_proximity_sensor">Vypnout senzor přiblížení během hovoru</string>
Expand All @@ -69,4 +70,4 @@
<string name="faq_1_text">Takové problémy mohou mít mnoho důvodů specifických pro zařízení a systém, takže je těžké říci něco obecně. Měli byste zkontrolovat nastavení zařízení a ujistit se, že se aplikace může otevřít, když běží na pozadí, a umožnit zobrazení přes jiné aplikace.</string>
<string name="audio_route_bluetooth">Bluetooth</string>
<string name="app_launcher_name">Telefon</string>
</resources>
</resources>
5 changes: 4 additions & 1 deletion app/src/main/res/values-da/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<<<<<<< HEAD
<string name="app_launcher_name">Opkald</string>
<string name="default_phone_app_prompt">Vælg venligst denne app som standard til opkald</string>
<string name="allow_displaying_over_other_apps">Tillad venligst visning over andre apps for pålidelig adfærd</string>
Expand Down Expand Up @@ -69,8 +70,10 @@
<string name="speed_dial">Hurtigopkald</string>
<string name="manage_speed_dial">Administrer hurtigopkald</string>
<string name="speed_dial_label">Klik på et nummer for at tilknytte en kontakt til det. Derefter kan du hurtigt ringe op til den givne kontkakt ved at holde nede på det givne nummer via det numeriske tastatur.</string>
<string name="show_contact_thumbnails">Vis kontakt miniature-billede</string>

<!-- Settings -->
<string name="show_contact_thumbnails">Vis kontakt miniature-billede</string>
<string name="group_subsequent_calls">Gruppér efterfølgende opkald med samme nummer i opkaldsloggen</string>
<string name="open_dialpad_by_default">Åbn det numeriske tastatur som standard når appen åbner</string>
<string name="disable_proximity_sensor">Deaktivér nærhedssensor under opkald</string>
Expand All @@ -84,4 +87,4 @@
<string name="faq_1_title">Jeg hører indgående opkald, men skærmen tænder ikke. Hvad kan jeg gøre?</string>
<string name="faq_1_text">Sådanne problemer kan have mange enheds- og systemspecifikke årsager, så det er svært at sige noget generelt. Du bør se dig omkring i dine enhedsindstillinger og sikre dig, at appen får lov til at poppe op, når den er i baggrunden, og tillade visning over andre apps.</string>

</resources>
</resources>
5 changes: 3 additions & 2 deletions app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@
<string name="speed_dial">Kurzwahl</string>
<string name="manage_speed_dial">Kurzwahlnummern verwalten</string>
<string name="speed_dial_label">Auf eine Zahl klicken, um einen Kontakt zuzuweisen. Danach kann der Kontakt durch langes Drücken der entsprechenden Zahl schnell angerufen werden.</string>
<string name="group_subsequent_calls">In der Anrufliste aufeinanderfolgende Anrufe mit derselben Nummer gruppieren</string>
<string name="show_contact_thumbnails">Vorschaubilder der Kontakte zeigen</string>
<string name="group_subsequent_calls">Aufeinanderfolgende Anrufe mit derselben Nummer gruppieren</string>
<string name="open_dialpad_by_default">Beim Öffnen der App immer das Wähltastenfeld öffnen</string>
<string name="disable_proximity_sensor">Näherungssensor bei Anrufen deaktivieren</string>
<string name="disable_swipe_to_answer">Anrufe durch Klicken statt durch Streichen annehmen</string>
Expand All @@ -69,4 +70,4 @@
<string name="faq_1_text">Eine allgemeine Antwort auf die Frage ist schwer, denn solche Probleme können viele geräte- und systemspezifische Gründe haben. Du solltest dich in den Einstellungen des Geräts umsehen und sicherstellen, dass die App im Hintergrund angezeigt werden darf und die Einblendung über anderen Apps erlaubt ist.</string>
<string name="audio_route_bluetooth">Bluetooth</string>
<string name="app_launcher_name">Telefon</string>
</resources>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-el/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
<string name="speed_dial">Ταχεία κλήση</string>
<string name="manage_speed_dial">Διαχείριση ταχείας κλήσης</string>
<string name="speed_dial_label">Κάντε κλικ σε έναν αριθμό για να αντιστοιχίσετε μια επαφή σε αυτόν. Στη συνέχεια, μπορείτε να καλέσετε γρήγορα τη δεδομένη επαφή πατώντας τον αριθμό αυτόν.</string>
<string name="show_contact_thumbnails">Εμφάνιση μικρογραφιών επαφής</string>
<string name="group_subsequent_calls">Ομαδοποίηση των επόμενων κλήσεων του ίδιου αριθμού στο αρχείο καταγραφής κλήσεων</string>
<string name="open_dialpad_by_default">Άνοιγμα του πληκτρολογίου από προεπιλογή όταν ανοίγει η εφαρμογή</string>
<string name="disable_proximity_sensor">Απενεργοποίηση του αισθητήρα εγγύτητας κατά τη διάρκεια κλήσεων</string>
Expand Down
Loading