mirror of
				https://github.com/SimpleMobileTools/Simple-Contacts.git
				synced 2025-06-05 21:59:27 +02:00 
			
		
		
		
	improve the handling of SIM picker at call start
This commit is contained in:
		| @@ -17,10 +17,14 @@ import android.view.WindowManager | |||||||
| import android.widget.RemoteViews | import android.widget.RemoteViews | ||||||
| import androidx.core.app.NotificationCompat | import androidx.core.app.NotificationCompat | ||||||
| import com.simplemobiletools.commons.extensions.* | import com.simplemobiletools.commons.extensions.* | ||||||
| import com.simplemobiletools.commons.helpers.* | import com.simplemobiletools.commons.helpers.MINUTE_SECONDS | ||||||
|  | import com.simplemobiletools.commons.helpers.isOreoMr1Plus | ||||||
|  | import com.simplemobiletools.commons.helpers.isOreoPlus | ||||||
|  | import com.simplemobiletools.commons.helpers.isQPlus | ||||||
| import com.simplemobiletools.contacts.pro.R | import com.simplemobiletools.contacts.pro.R | ||||||
| import com.simplemobiletools.contacts.pro.extensions.audioManager | import com.simplemobiletools.contacts.pro.extensions.audioManager | ||||||
| import com.simplemobiletools.contacts.pro.extensions.config | import com.simplemobiletools.contacts.pro.extensions.config | ||||||
|  | import com.simplemobiletools.contacts.pro.extensions.startCallIntent | ||||||
| import com.simplemobiletools.contacts.pro.helpers.ACCEPT_CALL | import com.simplemobiletools.contacts.pro.helpers.ACCEPT_CALL | ||||||
| import com.simplemobiletools.contacts.pro.helpers.CallManager | import com.simplemobiletools.contacts.pro.helpers.CallManager | ||||||
| import com.simplemobiletools.contacts.pro.helpers.DECLINE_CALL | import com.simplemobiletools.contacts.pro.helpers.DECLINE_CALL | ||||||
| @@ -201,8 +205,10 @@ class CallActivity : SimpleActivity() { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     private fun showPhoneAccountPicker() { |     private fun showPhoneAccountPicker() { | ||||||
|         if (!hasPermission(PERMISSION_READ_PHONE_STATE)) { |         if (callContact == null || callContact!!.number.isEmpty()) { | ||||||
|             return |             toast(R.string.unknown_error_occurred) | ||||||
|  |         } else { | ||||||
|  |             startCallIntent(callContact!!.number) | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -46,7 +46,7 @@ class CallManager { | |||||||
|         } |         } | ||||||
|  |  | ||||||
|         fun getCallContact(context: Context): CallContact? { |         fun getCallContact(context: Context): CallContact? { | ||||||
|             val callContact = CallContact("", "") |             val callContact = CallContact("", "", "") | ||||||
|             if (call == null) { |             if (call == null) { | ||||||
|                 return callContact |                 return callContact | ||||||
|             } |             } | ||||||
| @@ -54,6 +54,7 @@ class CallManager { | |||||||
|             val uri = Uri.decode(call!!.details.handle.toString()) |             val uri = Uri.decode(call!!.details.handle.toString()) | ||||||
|             if (uri.startsWith("tel:")) { |             if (uri.startsWith("tel:")) { | ||||||
|                 val number = uri.substringAfter("tel:") |                 val number = uri.substringAfter("tel:") | ||||||
|  |                 callContact.number = number | ||||||
|                 callContact.name = context.getNameFromPhoneNumber(number) |                 callContact.name = context.getNameFromPhoneNumber(number) | ||||||
|                 callContact.photoUri = context.getPhotoUriFromPhoneNumber(number) |                 callContact.photoUri = context.getPhotoUriFromPhoneNumber(number) | ||||||
|             } |             } | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| package com.simplemobiletools.contacts.pro.models | package com.simplemobiletools.contacts.pro.models | ||||||
|  |  | ||||||
| // a simpler Contact model containing just info needed at the call screen | // a simpler Contact model containing just info needed at the call screen | ||||||
| data class CallContact(var name: String, var photoUri: String) | data class CallContact(var name: String, var photoUri: String, var number: String) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user