mirror of
https://github.com/SimpleMobileTools/Simple-Dialer.git
synced 2025-06-05 21:49:23 +02:00
ask for being the default Phone handler on startup
This commit is contained in:
@@ -36,6 +36,6 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.simplemobiletools:commons:5.27.20'
|
||||
implementation 'com.simplemobiletools:commons:5.27.22'
|
||||
implementation 'com.github.tibbi:IndicatorFastScroll:08f512858a'
|
||||
}
|
||||
|
@@ -25,9 +25,13 @@ class MainActivity : SimpleActivity() {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_main)
|
||||
appLaunched(BuildConfig.APPLICATION_ID)
|
||||
|
||||
setupTabColors()
|
||||
|
||||
if (isDefaultDialer()) {
|
||||
checkContactPermissions()
|
||||
} else {
|
||||
launchSetDefaultDialerIntent()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
@@ -59,6 +63,14 @@ class MainActivity : SimpleActivity() {
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, resultData: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, resultData)
|
||||
// we dont really care about the result, the app can work without being the default Dialer too
|
||||
if (requestCode == REQUEST_CODE_SET_DEFAULT_DIALER) {
|
||||
checkContactPermissions()
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkContactPermissions() {
|
||||
handlePermission(PERMISSION_READ_CONTACTS) {
|
||||
if (it) {
|
||||
|
Reference in New Issue
Block a user