mirror of
https://github.com/SimpleMobileTools/Simple-SMS-Messenger.git
synced 2025-02-11 09:10:50 +01:00
Added calling contact in conversation (#230)
This commit is contained in:
parent
1c71cce6df
commit
41114e5f2c
@ -2,6 +2,7 @@ package com.simplemobiletools.smsmessenger.activities
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Activity
|
||||
import android.content.ActivityNotFoundException
|
||||
import android.content.Intent
|
||||
import android.graphics.BitmapFactory
|
||||
import android.graphics.drawable.Drawable
|
||||
@ -143,6 +144,7 @@ class ThreadActivity : SimpleActivity() {
|
||||
menu.apply {
|
||||
findItem(R.id.delete).isVisible = threadItems.isNotEmpty()
|
||||
findItem(R.id.block_number).isVisible = isNougatPlus()
|
||||
findItem(R.id.dial_number).isVisible = participants.size == 1
|
||||
}
|
||||
|
||||
updateMenuItemColors(menu)
|
||||
@ -157,6 +159,7 @@ class ThreadActivity : SimpleActivity() {
|
||||
when (item.itemId) {
|
||||
R.id.block_number -> blockNumber()
|
||||
R.id.delete -> askConfirmDelete()
|
||||
R.id.dial_number -> dialNumber()
|
||||
R.id.manage_people -> managePeople()
|
||||
R.id.mark_as_unread -> markAsUnread()
|
||||
else -> return super.onOptionsItemSelected(item)
|
||||
@ -488,6 +491,21 @@ class ThreadActivity : SimpleActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun dialNumber() {
|
||||
val phoneNumber = participants.first().phoneNumbers.first()
|
||||
Intent(Intent.ACTION_DIAL).apply {
|
||||
data = Uri.fromParts("tel", phoneNumber, null)
|
||||
|
||||
try {
|
||||
startActivity(this)
|
||||
} catch (e: ActivityNotFoundException) {
|
||||
toast(R.string.no_app_found)
|
||||
} catch (e: Exception) {
|
||||
showErrorToast(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun managePeople() {
|
||||
if (thread_add_contacts.isVisible()) {
|
||||
hideKeyboard()
|
||||
|
@ -11,6 +11,11 @@
|
||||
android:icon="@drawable/ic_add_person_vector"
|
||||
android:title="@string/add_person"
|
||||
app:showAsAction="ifRoom" />
|
||||
<item
|
||||
android:id="@+id/dial_number"
|
||||
android:icon="@drawable/ic_phone_vector"
|
||||
android:title="@string/dial_number"
|
||||
app:showAsAction="ifRoom" />
|
||||
<item
|
||||
android:id="@+id/block_number"
|
||||
android:title="@string/block_number"
|
||||
|
Loading…
x
Reference in New Issue
Block a user