mirror of
https://github.com/SimpleMobileTools/Simple-Dialer.git
synced 2025-06-05 21:49:23 +02:00
Add settings option to launch dialpad by default
- also account for process death of the MainActivity by persisting the state of whether the dialer had been launched by default
This commit is contained in:
@ -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 {
|
||||||
|
@ -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 {
|
||||||
|
@ -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()
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
|
@ -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"
|
||||||
|
@ -70,6 +70,7 @@
|
|||||||
<b>Reddit:</b>
|
<b>Reddit:</b>
|
||||||
https://www.reddit.com/r/SimpleMobileTools
|
https://www.reddit.com/r/SimpleMobileTools
|
||||||
</string>
|
</string>
|
||||||
|
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Haven't found some strings? There's more at
|
Haven't found some strings? There's more at
|
||||||
|
@ -70,6 +70,7 @@
|
|||||||
<b>Reddit:</b>
|
<b>Reddit:</b>
|
||||||
https://www.reddit.com/r/SimpleMobileTools
|
https://www.reddit.com/r/SimpleMobileTools
|
||||||
</string>
|
</string>
|
||||||
|
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Haven't found some strings? There's more at
|
Haven't found some strings? There's more at
|
||||||
|
@ -70,6 +70,7 @@
|
|||||||
<b>Reddit:</b>
|
<b>Reddit:</b>
|
||||||
https://www.reddit.com/r/SimpleMobileTools
|
https://www.reddit.com/r/SimpleMobileTools
|
||||||
</string>
|
</string>
|
||||||
|
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Haven't found some strings? There's more at
|
Haven't found some strings? There's more at
|
||||||
|
@ -70,6 +70,7 @@
|
|||||||
<b>Reddit:</b>
|
<b>Reddit:</b>
|
||||||
https://www.reddit.com/r/SimpleMobileTools
|
https://www.reddit.com/r/SimpleMobileTools
|
||||||
</string>
|
</string>
|
||||||
|
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Haven't found some strings? There's more at
|
Haven't found some strings? There's more at
|
||||||
|
@ -70,6 +70,7 @@
|
|||||||
<b>Reddit:</b>
|
<b>Reddit:</b>
|
||||||
https://www.reddit.com/r/SimpleMobileTools
|
https://www.reddit.com/r/SimpleMobileTools
|
||||||
</string>
|
</string>
|
||||||
|
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Haven't found some strings? There's more at
|
Haven't found some strings? There's more at
|
||||||
|
@ -70,6 +70,7 @@
|
|||||||
<b>Reddit :</b>
|
<b>Reddit :</b>
|
||||||
https://www.reddit.com/r/SimpleMobileTools
|
https://www.reddit.com/r/SimpleMobileTools
|
||||||
</string>
|
</string>
|
||||||
|
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Haven't found some strings? There's more at
|
Haven't found some strings? There's more at
|
||||||
|
@ -70,6 +70,7 @@
|
|||||||
<b>Reddit:</b>
|
<b>Reddit:</b>
|
||||||
https://www.reddit.com/r/SimpleMobileTools
|
https://www.reddit.com/r/SimpleMobileTools
|
||||||
</string>
|
</string>
|
||||||
|
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Haven't found some strings? There's more at
|
Haven't found some strings? There's more at
|
||||||
|
@ -70,6 +70,7 @@
|
|||||||
<b>Reddit:</b>
|
<b>Reddit:</b>
|
||||||
https://www.reddit.com/r/SimpleMobileTools
|
https://www.reddit.com/r/SimpleMobileTools
|
||||||
</string>
|
</string>
|
||||||
|
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Haven't found some strings? There's more at
|
Haven't found some strings? There's more at
|
||||||
|
@ -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>
|
||||||
@ -70,6 +70,7 @@
|
|||||||
<b>Reddit:</b>
|
<b>Reddit:</b>
|
||||||
https://www.reddit.com/r/SimpleMobileTools
|
https://www.reddit.com/r/SimpleMobileTools
|
||||||
</string>
|
</string>
|
||||||
|
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Haven't found some strings? There's more at
|
Haven't found some strings? There's more at
|
||||||
|
@ -67,6 +67,7 @@
|
|||||||
<b> Reddit:</b>
|
<b> Reddit:</b>
|
||||||
https://www.reddit.com/r/SimpleMobileTools
|
https://www.reddit.com/r/SimpleMobileTools
|
||||||
</string>
|
</string>
|
||||||
|
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Haven't found some strings? There's more at
|
Haven't found some strings? There's more at
|
||||||
|
@ -69,6 +69,7 @@
|
|||||||
<b>Reddit:</b>
|
<b>Reddit:</b>
|
||||||
https://www.reddit.com/r/SimpleMobileTools
|
https://www.reddit.com/r/SimpleMobileTools
|
||||||
</string>
|
</string>
|
||||||
|
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Haven't found some strings? There's more at
|
Haven't found some strings? There's more at
|
||||||
|
@ -70,6 +70,7 @@
|
|||||||
<b>Reddit:</b>
|
<b>Reddit:</b>
|
||||||
https://www.reddit.com/r/SimpleMobileTools
|
https://www.reddit.com/r/SimpleMobileTools
|
||||||
</string>
|
</string>
|
||||||
|
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Haven't found some strings? There's more at
|
Haven't found some strings? There's more at
|
||||||
|
@ -70,6 +70,7 @@
|
|||||||
<b>Reddit:</b>
|
<b>Reddit:</b>
|
||||||
https://www.reddit.com/r/SimpleMobileTools
|
https://www.reddit.com/r/SimpleMobileTools
|
||||||
</string>
|
</string>
|
||||||
|
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Haven't found some strings? There's more at
|
Haven't found some strings? There's more at
|
||||||
|
@ -70,6 +70,7 @@
|
|||||||
<b>Reddit:</b>
|
<b>Reddit:</b>
|
||||||
https://www.reddit.com/r/SimpleMobileTools
|
https://www.reddit.com/r/SimpleMobileTools
|
||||||
</string>
|
</string>
|
||||||
|
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Haven't found some strings? There's more at
|
Haven't found some strings? There's more at
|
||||||
|
@ -70,6 +70,7 @@
|
|||||||
<b>Reddit:</b>
|
<b>Reddit:</b>
|
||||||
https://www.reddit.com/r/SimpleMobileTools
|
https://www.reddit.com/r/SimpleMobileTools
|
||||||
</string>
|
</string>
|
||||||
|
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Haven't found some strings? There's more at
|
Haven't found some strings? There's more at
|
||||||
|
@ -70,6 +70,7 @@
|
|||||||
<b>Reddit:</b>
|
<b>Reddit:</b>
|
||||||
https://www.reddit.com/r/SimpleMobileTools
|
https://www.reddit.com/r/SimpleMobileTools
|
||||||
</string>
|
</string>
|
||||||
|
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Haven't found some strings? There's more at
|
Haven't found some strings? There's more at
|
||||||
|
@ -70,6 +70,7 @@
|
|||||||
<b>Reddit:</b>
|
<b>Reddit:</b>
|
||||||
https://www.reddit.com/r/SimpleMobileTools
|
https://www.reddit.com/r/SimpleMobileTools
|
||||||
</string>
|
</string>
|
||||||
|
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Haven't found some strings? There's more at
|
Haven't found some strings? There's more at
|
||||||
|
@ -70,6 +70,7 @@
|
|||||||
<b>Reddit:</b>
|
<b>Reddit:</b>
|
||||||
https://www.reddit.com/r/SimpleMobileTools
|
https://www.reddit.com/r/SimpleMobileTools
|
||||||
</string>
|
</string>
|
||||||
|
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Bazı dizeleri bulamadınız mı? Burada daha fazlası var:
|
Bazı dizeleri bulamadınız mı? Burada daha fazlası var:
|
||||||
|
@ -70,6 +70,7 @@
|
|||||||
<b>Reddit:</b>
|
<b>Reddit:</b>
|
||||||
https://www.reddit.com/r/SimpleMobileTools
|
https://www.reddit.com/r/SimpleMobileTools
|
||||||
</string>
|
</string>
|
||||||
|
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Haven't found some strings? There's more at
|
Haven't found some strings? There's more at
|
||||||
|
@ -70,6 +70,7 @@
|
|||||||
<b>Reddit:</b>
|
<b>Reddit:</b>
|
||||||
https://www.reddit.com/r/SimpleMobileTools
|
https://www.reddit.com/r/SimpleMobileTools
|
||||||
</string>
|
</string>
|
||||||
|
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Haven't found some strings? There's more at
|
Haven't found some strings? There's more at
|
||||||
|
@ -70,6 +70,7 @@
|
|||||||
<b>Reddit:</b>
|
<b>Reddit:</b>
|
||||||
https://www.reddit.com/r/SimpleMobileTools
|
https://www.reddit.com/r/SimpleMobileTools
|
||||||
</string>
|
</string>
|
||||||
|
<string name="open_dialpad_by_default">Open the dialpad by default when the app opens</string>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Haven't found some strings? There's more at
|
Haven't found some strings? There's more at
|
||||||
|
Reference in New Issue
Block a user