Merge pull request #215 from KryptKode/feat/open-dialer-settings

Add settings option to launch dialpad by default
This commit is contained in:
Tibor Kaputa 2021-08-15 22:46:22 +02:00 committed by GitHub
commit 7fb5248553
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 74 additions and 1 deletions

View File

@ -26,6 +26,7 @@ import com.simplemobiletools.dialer.R
import com.simplemobiletools.dialer.adapters.ViewPagerAdapter import com.simplemobiletools.dialer.adapters.ViewPagerAdapter
import com.simplemobiletools.dialer.extensions.config import com.simplemobiletools.dialer.extensions.config
import com.simplemobiletools.dialer.fragments.MyViewPagerFragment import com.simplemobiletools.dialer.fragments.MyViewPagerFragment
import com.simplemobiletools.dialer.helpers.OPEN_DIAL_PAD_AT_LAUNCH
import com.simplemobiletools.dialer.helpers.RecentsHelper import com.simplemobiletools.dialer.helpers.RecentsHelper
import com.simplemobiletools.dialer.helpers.tabsList import com.simplemobiletools.dialer.helpers.tabsList
import kotlinx.android.synthetic.main.activity_main.* import kotlinx.android.synthetic.main.activity_main.*
@ -36,6 +37,7 @@ import java.util.*
class MainActivity : SimpleActivity() { class MainActivity : SimpleActivity() {
private var isSearchOpen = false private var isSearchOpen = false
private var launchedDialer = false
private var searchMenuItem: MenuItem? = null private var searchMenuItem: MenuItem? = null
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
@ -44,6 +46,8 @@ class MainActivity : SimpleActivity() {
appLaunched(BuildConfig.APPLICATION_ID) appLaunched(BuildConfig.APPLICATION_ID)
setupTabColors() setupTabColors()
launchedDialer = savedInstanceState?.getBoolean(OPEN_DIAL_PAD_AT_LAUNCH) ?: false
if (isDefaultDialer()) { if (isDefaultDialer()) {
checkContactPermissions() checkContactPermissions()
} else { } else {
@ -51,6 +55,11 @@ class MainActivity : SimpleActivity() {
} }
} }
override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState)
outState.putBoolean(OPEN_DIAL_PAD_AT_LAUNCH, launchedDialer)
}
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
val adjustedPrimaryColor = getAdjustedPrimaryColor() val adjustedPrimaryColor = getAdjustedPrimaryColor()
@ -273,6 +282,11 @@ class MainActivity : SimpleActivity() {
main_dialpad_button.setOnClickListener { main_dialpad_button.setOnClickListener {
launchDialpad() launchDialpad()
} }
if (config.openDialPadAtLaunch && !launchedDialer) {
launchDialpad()
launchedDialer = true
}
} }
private fun getTabIcon(position: Int): Drawable { private fun getTabIcon(position: Int): Drawable {

View File

@ -33,6 +33,7 @@ class SettingsActivity : SimpleActivity() {
setupChangeDateTimeFormat() setupChangeDateTimeFormat()
setupFontSize() setupFontSize()
setupDefaultTab() setupDefaultTab()
setupDialPadOpen()
setupGroupSubsequentCalls() setupGroupSubsequentCalls()
setupStartNameWithSurname() setupStartNameWithSurname()
setupShowCallConfirmation() setupShowCallConfirmation()
@ -133,6 +134,14 @@ class SettingsActivity : SimpleActivity() {
else -> R.string.last_used_tab else -> R.string.last_used_tab
}) })
private fun setupDialPadOpen() {
settings_open_dialpad_at_launch.isChecked = config.openDialPadAtLaunch
settings_open_dialpad_at_launch_holder.setOnClickListener {
settings_open_dialpad_at_launch.toggle()
config.openDialPadAtLaunch = settings_open_dialpad_at_launch.isChecked
}
}
private fun setupGroupSubsequentCalls() { private fun setupGroupSubsequentCalls() {
settings_group_subsequent_calls.isChecked = config.groupSubsequentCalls settings_group_subsequent_calls.isChecked = config.groupSubsequentCalls
settings_group_subsequent_calls_holder.setOnClickListener { settings_group_subsequent_calls_holder.setOnClickListener {

View File

@ -43,4 +43,8 @@ class Config(context: Context) : BaseConfig(context) {
var groupSubsequentCalls: Boolean var groupSubsequentCalls: Boolean
get() = prefs.getBoolean(GROUP_SUBSEQUENT_CALLS, true) get() = prefs.getBoolean(GROUP_SUBSEQUENT_CALLS, true)
set(groupSubsequentCalls) = prefs.edit().putBoolean(GROUP_SUBSEQUENT_CALLS, groupSubsequentCalls).apply() set(groupSubsequentCalls) = prefs.edit().putBoolean(GROUP_SUBSEQUENT_CALLS, groupSubsequentCalls).apply()
var openDialPadAtLaunch: Boolean
get() = prefs.getBoolean(OPEN_DIAL_PAD_AT_LAUNCH, false)
set(openDialPad) = prefs.edit().putBoolean(OPEN_DIAL_PAD_AT_LAUNCH, openDialPad).apply()
} }

View File

@ -4,6 +4,7 @@ package com.simplemobiletools.dialer.helpers
const val SPEED_DIAL = "speed_dial" const val SPEED_DIAL = "speed_dial"
const val REMEMBER_SIM_PREFIX = "remember_sim_" const val REMEMBER_SIM_PREFIX = "remember_sim_"
const val GROUP_SUBSEQUENT_CALLS = "group_subsequent_calls" const val GROUP_SUBSEQUENT_CALLS = "group_subsequent_calls"
const val OPEN_DIAL_PAD_AT_LAUNCH = "open_dial_pad_at_launch"
const val CONTACTS_TAB_MASK = 1 const val CONTACTS_TAB_MASK = 1
const val FAVORITES_TAB_MASK = 2 const val FAVORITES_TAB_MASK = 2

View File

@ -203,6 +203,29 @@
</RelativeLayout> </RelativeLayout>
<RelativeLayout
android:id="@+id/settings_open_dialpad_at_launch_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/medium_margin"
android:background="?attr/selectableItemBackground"
android:paddingStart="@dimen/normal_margin"
android:paddingTop="@dimen/activity_margin"
android:paddingEnd="@dimen/normal_margin"
android:paddingBottom="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MySwitchCompat
android:id="@+id/settings_open_dialpad_at_launch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:clickable="false"
android:paddingStart="@dimen/medium_margin"
android:text="@string/open_dialpad_by_default"
app:switchPadding="@dimen/medium_margin" />
</RelativeLayout>
<RelativeLayout <RelativeLayout
android:id="@+id/settings_group_subsequent_calls_holder" android:id="@+id/settings_group_subsequent_calls_holder"
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -40,6 +40,7 @@
<!-- Settings --> <!-- Settings -->
<string name="group_subsequent_calls">Seskupte další hovory se stejným číslem v protokolu hovorů</string> <string name="group_subsequent_calls">Seskupte další hovory se stejným číslem v protokolu hovorů</string>
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it --> <!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it -->

View File

@ -40,6 +40,7 @@
<!-- Settings --> <!-- Settings -->
<string name="group_subsequent_calls">In der Anrufliste aufeinanderfolgende Anrufe mit derselben Nummer gruppieren</string> <string name="group_subsequent_calls">In der Anrufliste aufeinanderfolgende Anrufe mit derselben Nummer gruppieren</string>
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it --> <!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it -->

View File

@ -40,6 +40,7 @@
<!-- Settings --> <!-- Settings -->
<string name="group_subsequent_calls">Ομαδοποίηση των επόμενων κλήσεων του ίδιου αριθμού στο αρχείο καταγραφής κλήσεων</string> <string name="group_subsequent_calls">Ομαδοποίηση των επόμενων κλήσεων του ίδιου αριθμού στο αρχείο καταγραφής κλήσεων</string>
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it --> <!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it -->

View File

@ -40,6 +40,7 @@
<!-- Settings --> <!-- Settings -->
<string name="group_subsequent_calls">Agrupar llamadas subsecuentes con el mísmo número en el registro de llamadas</string> <string name="group_subsequent_calls">Agrupar llamadas subsecuentes con el mísmo número en el registro de llamadas</string>
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it --> <!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it -->

View File

@ -40,6 +40,7 @@
<!-- Settings --> <!-- Settings -->
<string name="group_subsequent_calls">Ryhmitä saman numeron peräkkäiset puhelut puheluhistoriassa</string> <string name="group_subsequent_calls">Ryhmitä saman numeron peräkkäiset puhelut puheluhistoriassa</string>
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it --> <!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it -->

View File

@ -40,6 +40,7 @@
<!-- Settings --> <!-- Settings -->
<string name="group_subsequent_calls">Regrouper les appels suivants avec le même numéro dans le journal des appels</string> <string name="group_subsequent_calls">Regrouper les appels suivants avec le même numéro dans le journal des appels</string>
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it --> <!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it -->

View File

@ -40,6 +40,7 @@
<!-- Settings --> <!-- Settings -->
<string name="group_subsequent_calls">Agrupar, no rexisto, as chamadas para o mesmo contacto</string> <string name="group_subsequent_calls">Agrupar, no rexisto, as chamadas para o mesmo contacto</string>
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it --> <!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it -->

View File

@ -40,6 +40,7 @@
<!-- Settings --> <!-- Settings -->
<string name="group_subsequent_calls">Kelompokkan panggilan berikutnya dengan nomor yang sama di log panggilan</string> <string name="group_subsequent_calls">Kelompokkan panggilan berikutnya dengan nomor yang sama di log panggilan</string>
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it --> <!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it -->

View File

@ -1,7 +1,7 @@
<resources> <resources>
<string name="app_name">Simple Dialer</string> <string name="app_name">Simple Dialer</string>
<string name="app_launcher_name">Telefono</string> <string name="app_launcher_name">Telefono</string>
<string name="default_phone_app_prompt">Per favore, rendi l'app la predefinita per le chiamate</string> <string name="default_phone_app_prompt">Per favore, rendi l\'app la predefinita per le chiamate</string>
<!-- Contacts --> <!-- Contacts -->
<string name="could_not_access_contacts">Impossibile accedere ai contatti</string> <string name="could_not_access_contacts">Impossibile accedere ai contatti</string>
@ -40,6 +40,7 @@
<!-- Settings --> <!-- Settings -->
<string name="group_subsequent_calls">Raggruppa chiamate successive con lo stesso numero nel registro delle chiamate</string> <string name="group_subsequent_calls">Raggruppa chiamate successive con lo stesso numero nel registro delle chiamate</string>
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it --> <!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it -->

View File

@ -40,6 +40,7 @@
<!-- Settings --> <!-- Settings -->
<string name="group_subsequent_calls">後続の通話をコールログの同じ番号でグループ化する</string> <string name="group_subsequent_calls">後続の通話をコールログの同じ番号でグループ化する</string>
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it --> <!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it -->

View File

@ -37,8 +37,10 @@
<string name="speed_dial">സ്പീഡ് ഡയൽ</string> <string name="speed_dial">സ്പീഡ് ഡയൽ</string>
<string name="manage_speed_dial">സ്പീഡ് ഡയൽ നിയന്ത്രിക്കുക</string> <string name="manage_speed_dial">സ്പീഡ് ഡയൽ നിയന്ത്രിക്കുക</string>
<string name="speed_dial_label">കോൺ‌ടാക്റ്റ് നൽകുന്നതിന് ഒരു നമ്പറിൽ ക്ലിക്കുചെയ്യുക. ഡയലറിൽ നൽകിയ നമ്പർ ദീർഘനേരം അമർത്തിയാൽ, നിങ്ങൾ നൽകിയ കോൺടാക്റ്റിനെ വേഗത്തിൽ വിളിക്കാം. </string> <string name="speed_dial_label">കോൺ‌ടാക്റ്റ് നൽകുന്നതിന് ഒരു നമ്പറിൽ ക്ലിക്കുചെയ്യുക. ഡയലറിൽ നൽകിയ നമ്പർ ദീർഘനേരം അമർത്തിയാൽ, നിങ്ങൾ നൽകിയ കോൺടാക്റ്റിനെ വേഗത്തിൽ വിളിക്കാം. </string>
<!-- Settings --> <!-- Settings -->
<string name="group_subsequent_calls">കോൾ ലോഗിൽ അതേ നമ്പറുള്ള കോളുകൾ ഗ്രൂപ്പുചെയ്യുക</string> <string name="group_subsequent_calls">കോൾ ലോഗിൽ അതേ നമ്പറുള്ള കോളുകൾ ഗ്രൂപ്പുചെയ്യുക</string>
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it --> <!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it -->

View File

@ -40,6 +40,7 @@
<!-- Settings --> <!-- Settings -->
<string name="group_subsequent_calls">Oproepgeschiedenis: opeenvolgende items van hetzelfde nummer groeperen</string> <string name="group_subsequent_calls">Oproepgeschiedenis: opeenvolgende items van hetzelfde nummer groeperen</string>
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it --> <!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it -->

View File

@ -40,6 +40,7 @@
<!-- Settings --> <!-- Settings -->
<string name="group_subsequent_calls">Grupuj kolejne połączenia z tym samym numerem w rejestrze połączeń</string> <string name="group_subsequent_calls">Grupuj kolejne połączenia z tym samym numerem w rejestrze połączeń</string>
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it --> <!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it -->

View File

@ -40,6 +40,7 @@
<!-- Settings --> <!-- Settings -->
<string name="group_subsequent_calls">Agrupar, no registo, as chamadas para o mesmo contacto</string> <string name="group_subsequent_calls">Agrupar, no registo, as chamadas para o mesmo contacto</string>
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it --> <!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it -->

View File

@ -40,6 +40,7 @@
<!-- Settings --> <!-- Settings -->
<string name="group_subsequent_calls">Группировать последующие вызовы с тем же номером в журнале вызовов</string> <string name="group_subsequent_calls">Группировать последующие вызовы с тем же номером в журнале вызовов</string>
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it --> <!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it -->

View File

@ -40,6 +40,7 @@
<!-- Settings --> <!-- Settings -->
<string name="group_subsequent_calls">Zoskupiť susedné volania s rovnakým číslom v histórií volaní</string> <string name="group_subsequent_calls">Zoskupiť susedné volania s rovnakým číslom v histórií volaní</string>
<string name="open_dialpad_by_default">Otvoriť číselník po spustení apky</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it --> <!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it -->

View File

@ -40,6 +40,7 @@
<!-- Settings --> <!-- Settings -->
<string name="group_subsequent_calls">Gruppera samtal till och från samma nummer i samtalshistoriken</string> <string name="group_subsequent_calls">Gruppera samtal till och från samma nummer i samtalshistoriken</string>
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it --> <!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it -->

View File

@ -40,6 +40,7 @@
<!-- Settings --> <!-- Settings -->
<string name="group_subsequent_calls">Arama kaydında aynı numaraya sahip sonraki aramaları gruplandır</string> <string name="group_subsequent_calls">Arama kaydında aynı numaraya sahip sonraki aramaları gruplandır</string>
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it --> <!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it -->

View File

@ -40,6 +40,7 @@
<!-- Settings --> <!-- Settings -->
<string name="group_subsequent_calls">Group subsequent calls with the same number at the call log</string> <string name="group_subsequent_calls">Group subsequent calls with the same number at the call log</string>
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it --> <!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it -->

View File

@ -40,6 +40,7 @@
<!-- Settings --> <!-- Settings -->
<string name="group_subsequent_calls">在通话记录中将同一号码的后续呼叫合并为一组</string> <string name="group_subsequent_calls">在通话记录中将同一号码的后续呼叫合并为一组</string>
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it --> <!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it -->

View File

@ -40,6 +40,7 @@
<!-- Settings --> <!-- Settings -->
<string name="group_subsequent_calls">Group subsequent calls with the same number at the call log</string> <string name="group_subsequent_calls">Group subsequent calls with the same number at the call log</string>
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have --> <!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it --> <!-- App title has to have less than 50 characters. If you cannot squeeze it, just remove a part of it -->