Minor changes to fix code inspector warnings
This commit is contained in:
parent
07b6d07b7f
commit
8a11fc9c4a
28 changed files with 230 additions and 155 deletions
|
@ -114,8 +114,8 @@ class StatusFragment : GenericFragment<CallStatusFragmentBinding>() {
|
||||||
|
|
||||||
val viewModel = DialogViewModel(getString(R.string.zrtp_dialog_message), getString(R.string.zrtp_dialog_title))
|
val viewModel = DialogViewModel(getString(R.string.zrtp_dialog_message), getString(R.string.zrtp_dialog_title))
|
||||||
viewModel.showZrtp = true
|
viewModel.showZrtp = true
|
||||||
viewModel.zrtpReadSas = toRead.toUpperCase(Locale.getDefault())
|
viewModel.zrtpReadSas = toRead.uppercase(Locale.getDefault())
|
||||||
viewModel.zrtpListenSas = toListen.toUpperCase(Locale.getDefault())
|
viewModel.zrtpListenSas = toListen.uppercase(Locale.getDefault())
|
||||||
viewModel.showIcon = true
|
viewModel.showIcon = true
|
||||||
viewModel.iconResource = R.drawable.security_2_indicator
|
viewModel.iconResource = R.drawable.security_2_indicator
|
||||||
|
|
||||||
|
|
|
@ -342,23 +342,27 @@ class ControlsViewModel : ViewModel() {
|
||||||
val currentCall = core.currentCall
|
val currentCall = core.currentCall
|
||||||
val conference = core.conference
|
val conference = core.conference
|
||||||
|
|
||||||
if (currentCall != null) {
|
when {
|
||||||
if (currentCall.isRecording) {
|
currentCall != null -> {
|
||||||
currentCall.stopRecording()
|
if (currentCall.isRecording) {
|
||||||
} else {
|
currentCall.stopRecording()
|
||||||
currentCall.startRecording()
|
} else {
|
||||||
|
currentCall.startRecording()
|
||||||
|
}
|
||||||
|
isRecording.value = currentCall.isRecording
|
||||||
}
|
}
|
||||||
isRecording.value = currentCall.isRecording
|
conference != null -> {
|
||||||
} else if (conference != null) {
|
val path = LinphoneUtils.getRecordingFilePathForConference()
|
||||||
val path = LinphoneUtils.getRecordingFilePathForConference()
|
if (conference.isRecording) {
|
||||||
if (conference.isRecording) {
|
conference.stopRecording()
|
||||||
conference.stopRecording()
|
} else {
|
||||||
} else {
|
conference.startRecording(path)
|
||||||
conference.startRecording(path)
|
}
|
||||||
|
isRecording.value = conference.isRecording
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
isRecording.value = false
|
||||||
}
|
}
|
||||||
isRecording.value = conference.isRecording
|
|
||||||
} else {
|
|
||||||
isRecording.value = false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (closeMenu) toggleOptionsMenu()
|
if (closeMenu) toggleOptionsMenu()
|
||||||
|
|
|
@ -29,7 +29,7 @@ internal abstract class ChatScrollListener(private val mLayoutManager: LinearLay
|
||||||
// True if we are still waiting for the last set of data to load.
|
// True if we are still waiting for the last set of data to load.
|
||||||
private var loading = true
|
private var loading = true
|
||||||
|
|
||||||
var userHasScrolledUp: Boolean = false
|
private var userHasScrolledUp: Boolean = false
|
||||||
|
|
||||||
// This happens many times a second during a scroll, so be wary of the code you place here.
|
// This happens many times a second during a scroll, so be wary of the code you place here.
|
||||||
// We are given a few useful parameters to help us work out if we need to load some more data,
|
// We are given a few useful parameters to help us work out if we need to load some more data,
|
||||||
|
|
|
@ -60,7 +60,6 @@ class ChatMessageContentData(
|
||||||
|
|
||||||
val fileName = MutableLiveData<String>()
|
val fileName = MutableLiveData<String>()
|
||||||
val filePath = MutableLiveData<String>()
|
val filePath = MutableLiveData<String>()
|
||||||
val fileSize = MutableLiveData<String>()
|
|
||||||
|
|
||||||
val downloadable = MutableLiveData<Boolean>()
|
val downloadable = MutableLiveData<Boolean>()
|
||||||
val downloadEnabled = MutableLiveData<Boolean>()
|
val downloadEnabled = MutableLiveData<Boolean>()
|
||||||
|
@ -72,7 +71,6 @@ class ChatMessageContentData(
|
||||||
val formattedDuration = MutableLiveData<String>()
|
val formattedDuration = MutableLiveData<String>()
|
||||||
val voiceRecordPlayingPosition = MutableLiveData<Int>()
|
val voiceRecordPlayingPosition = MutableLiveData<Int>()
|
||||||
val isVoiceRecordPlaying = MutableLiveData<Boolean>()
|
val isVoiceRecordPlaying = MutableLiveData<Boolean>()
|
||||||
var voiceRecordAudioFocusRequest: AudioFocusRequestCompat? = null
|
|
||||||
|
|
||||||
val isAlone: Boolean
|
val isAlone: Boolean
|
||||||
get() {
|
get() {
|
||||||
|
@ -86,7 +84,9 @@ class ChatMessageContentData(
|
||||||
return count == 1
|
return count == 1
|
||||||
}
|
}
|
||||||
|
|
||||||
var isFileEncrypted: Boolean = false
|
private var isFileEncrypted: Boolean = false
|
||||||
|
|
||||||
|
private var voiceRecordAudioFocusRequest: AudioFocusRequestCompat? = null
|
||||||
|
|
||||||
private lateinit var voiceRecordingPlayer: Player
|
private lateinit var voiceRecordingPlayer: Player
|
||||||
private val playerListener = PlayerListener {
|
private val playerListener = PlayerListener {
|
||||||
|
@ -193,8 +193,8 @@ class ChatMessageContentData(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display download size and underline text
|
// Display download size and underline text
|
||||||
fileSize.value = AppUtils.bytesToDisplayableSize(content.fileSize.toLong())
|
val fileSize = AppUtils.bytesToDisplayableSize(content.fileSize.toLong())
|
||||||
val spannable = SpannableString("${AppUtils.getString(R.string.chat_message_download_file)} (${fileSize.value})")
|
val spannable = SpannableString("${AppUtils.getString(R.string.chat_message_download_file)} ($fileSize)")
|
||||||
spannable.setSpan(UnderlineSpan(), 0, spannable.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
|
spannable.setSpan(UnderlineSpan(), 0, spannable.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||||
downloadLabel.value = spannable
|
downloadLabel.value = spannable
|
||||||
|
|
||||||
|
|
|
@ -165,7 +165,7 @@ class ChatMessageData(val chatMessage: ChatMessage) : GenericContactData(chatMes
|
||||||
val list = arrayListOf<ChatMessageContentData>()
|
val list = arrayListOf<ChatMessageContentData>()
|
||||||
|
|
||||||
val contentsList = chatMessage.contents
|
val contentsList = chatMessage.contents
|
||||||
for (index in 0 until contentsList.size) {
|
for (index in contentsList.indices) {
|
||||||
val content = contentsList[index]
|
val content = contentsList[index]
|
||||||
if (content.isFileTransfer || content.isFile) {
|
if (content.isFileTransfer || content.isFile) {
|
||||||
val data = ChatMessageContentData(chatMessage, index)
|
val data = ChatMessageContentData(chatMessage, index)
|
||||||
|
|
|
@ -86,11 +86,11 @@ class ChatMessageSendingViewModel(private val chatRoom: ChatRoom) : ViewModel()
|
||||||
|
|
||||||
val isPlayingVoiceRecording = MutableLiveData<Boolean>()
|
val isPlayingVoiceRecording = MutableLiveData<Boolean>()
|
||||||
|
|
||||||
val recorder: Recorder
|
|
||||||
|
|
||||||
val voiceRecordPlayingPosition = MutableLiveData<Int>()
|
val voiceRecordPlayingPosition = MutableLiveData<Int>()
|
||||||
|
|
||||||
var voiceRecordAudioFocusRequest: AudioFocusRequestCompat? = null
|
private val recorder: Recorder
|
||||||
|
|
||||||
|
private var voiceRecordAudioFocusRequest: AudioFocusRequestCompat? = null
|
||||||
|
|
||||||
private lateinit var voiceRecordingPlayer: Player
|
private lateinit var voiceRecordingPlayer: Player
|
||||||
private val playerListener = PlayerListener {
|
private val playerListener = PlayerListener {
|
||||||
|
|
|
@ -90,12 +90,12 @@ class ChatRoomViewModel(val chatRoom: ChatRoom) : ViewModel(), ContactDataInterf
|
||||||
|
|
||||||
var oneParticipantOneDevice: Boolean = false
|
var oneParticipantOneDevice: Boolean = false
|
||||||
|
|
||||||
var addressToCall: Address? = null
|
|
||||||
|
|
||||||
var onlyParticipantOnlyDeviceAddress: Address? = null
|
var onlyParticipantOnlyDeviceAddress: Address? = null
|
||||||
|
|
||||||
val chatUnreadCountTranslateY = MutableLiveData<Float>()
|
val chatUnreadCountTranslateY = MutableLiveData<Float>()
|
||||||
|
|
||||||
|
private var addressToCall: Address? = null
|
||||||
|
|
||||||
private val bounceAnimator: ValueAnimator by lazy {
|
private val bounceAnimator: ValueAnimator by lazy {
|
||||||
ValueAnimator.ofFloat(AppUtils.getDimension(R.dimen.tabs_fragment_unread_count_bounce_offset), 0f).apply {
|
ValueAnimator.ofFloat(AppUtils.getDimension(R.dimen.tabs_fragment_unread_count_bounce_offset), 0f).apply {
|
||||||
addUpdateListener {
|
addUpdateListener {
|
||||||
|
|
|
@ -170,12 +170,10 @@ class ChatRoomsListViewModel : ErrorReportingViewModel() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun findChatRoomIndex(chatRoom: ChatRoom): Int {
|
private fun findChatRoomIndex(chatRoom: ChatRoom): Int {
|
||||||
var index = 0
|
for ((index, chatRoomViewModel) in chatRooms.value.orEmpty().withIndex()) {
|
||||||
for (chatRoomViewModel in chatRooms.value.orEmpty()) {
|
|
||||||
if (chatRoomViewModel.chatRoom == chatRoom) {
|
if (chatRoomViewModel.chatRoom == chatRoom) {
|
||||||
return index
|
return index
|
||||||
}
|
}
|
||||||
index++
|
|
||||||
}
|
}
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,8 +32,8 @@ import org.linphone.mediastream.Version
|
||||||
import org.linphone.utils.Event
|
import org.linphone.utils.Event
|
||||||
|
|
||||||
class AdvancedSettingsViewModel : LogsUploadViewModel() {
|
class AdvancedSettingsViewModel : LogsUploadViewModel() {
|
||||||
protected val prefs = corePreferences
|
private val prefs = corePreferences
|
||||||
protected val core = coreContext.core
|
private val core = coreContext.core
|
||||||
|
|
||||||
val debugModeListener = object : SettingListenerStub() {
|
val debugModeListener = object : SettingListenerStub() {
|
||||||
override fun onBoolValueChanged(newValue: Boolean) {
|
override fun onBoolValueChanged(newValue: Boolean) {
|
||||||
|
|
|
@ -57,7 +57,7 @@ open class StatusViewModel : ViewModel() {
|
||||||
body: Content
|
body: Content
|
||||||
) {
|
) {
|
||||||
if (body.type == "application" && body.subtype == "simple-message-summary" && body.size > 0) {
|
if (body.type == "application" && body.subtype == "simple-message-summary" && body.size > 0) {
|
||||||
val data = body.utf8Text?.toLowerCase(Locale.getDefault())
|
val data = body.utf8Text?.lowercase(Locale.getDefault())
|
||||||
val voiceMail = data?.split("voice-message: ")
|
val voiceMail = data?.split("voice-message: ")
|
||||||
if (voiceMail?.size ?: 0 >= 2) {
|
if (voiceMail?.size ?: 0 >= 2) {
|
||||||
val toParse = voiceMail!![1].split("/", limit = 0)
|
val toParse = voiceMail!![1].split("/", limit = 0)
|
||||||
|
|
|
@ -22,6 +22,7 @@ package org.linphone.compatibility
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.annotation.TargetApi
|
import android.annotation.TargetApi
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
|
import android.app.PendingIntent
|
||||||
import android.bluetooth.BluetoothAdapter
|
import android.bluetooth.BluetoothAdapter
|
||||||
import android.content.ContentValues
|
import android.content.ContentValues
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
@ -207,5 +208,9 @@ class Api21Compatibility {
|
||||||
fun requestDismissKeyguard(activity: Activity) {
|
fun requestDismissKeyguard(activity: Activity) {
|
||||||
activity.window.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD)
|
activity.window.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getUpdateCurrentPendingIntentFlag(): Int {
|
||||||
|
return PendingIntent.FLAG_UPDATE_CURRENT
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2010-2021 Belledonne Communications SARL.
|
||||||
|
*
|
||||||
|
* This file is part of linphone-android
|
||||||
|
* (see https://www.linphone.org).
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.linphone.compatibility
|
||||||
|
|
||||||
|
import android.annotation.TargetApi
|
||||||
|
import android.app.PendingIntent
|
||||||
|
|
||||||
|
@TargetApi(31)
|
||||||
|
class Api31Compatibility {
|
||||||
|
companion object {
|
||||||
|
fun getUpdateCurrentPendingIntentFlag(): Int {
|
||||||
|
return PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_MUTABLE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -252,5 +252,12 @@ class Compatibility {
|
||||||
}
|
}
|
||||||
return Api21Compatibility.addAudioToMediaStore(context, content)
|
return Api21Compatibility.addAudioToMediaStore(context, content)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getUpdateCurrentPendingIntentFlag(): Int {
|
||||||
|
if (Version.sdkAboveOrEqual(Version.API31_ANDROID_12)) {
|
||||||
|
return Api31Compatibility.getUpdateCurrentPendingIntentFlag()
|
||||||
|
}
|
||||||
|
return Api21Compatibility.getUpdateCurrentPendingIntentFlag()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,10 +129,10 @@ class AsyncContactsLoader(private val context: Context) :
|
||||||
|
|
||||||
try {
|
try {
|
||||||
val id: String =
|
val id: String =
|
||||||
cursor.getString(cursor.getColumnIndex(ContactsContract.Data.CONTACT_ID))
|
cursor.getString(cursor.getColumnIndexOrThrow(ContactsContract.Data.CONTACT_ID))
|
||||||
val starred =
|
val starred =
|
||||||
cursor.getInt(cursor.getColumnIndex(ContactsContract.Contacts.STARRED)) == 1
|
cursor.getInt(cursor.getColumnIndexOrThrow(ContactsContract.Contacts.STARRED)) == 1
|
||||||
val lookupKey = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.LOOKUP_KEY))
|
val lookupKey = cursor.getString(cursor.getColumnIndexOrThrow(ContactsContract.Contacts.LOOKUP_KEY))
|
||||||
var contact: Contact? = androidContactsCache[id]
|
var contact: Contact? = androidContactsCache[id]
|
||||||
if (contact == null) {
|
if (contact == null) {
|
||||||
Log.d(
|
Log.d(
|
||||||
|
@ -148,6 +148,10 @@ class AsyncContactsLoader(private val context: Context) :
|
||||||
Log.e(
|
Log.e(
|
||||||
"[Contacts Loader] Couldn't get values from cursor, exception: $ise"
|
"[Contacts Loader] Couldn't get values from cursor, exception: $ise"
|
||||||
)
|
)
|
||||||
|
} catch (iae: IllegalArgumentException) {
|
||||||
|
Log.e(
|
||||||
|
"[Contacts Loader] Couldn't get values from cursor, exception: $iae"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cursor.close()
|
cursor.close()
|
||||||
|
|
|
@ -51,10 +51,10 @@ open class Contact : Comparable<Contact> {
|
||||||
// Raw SIP addresses are only used for contact edition
|
// Raw SIP addresses are only used for contact edition
|
||||||
var rawSipAddresses = arrayListOf<String>()
|
var rawSipAddresses = arrayListOf<String>()
|
||||||
|
|
||||||
var thumbnailUri: Uri? = null
|
|
||||||
|
|
||||||
var friend: Friend? = null
|
var friend: Friend? = null
|
||||||
|
|
||||||
|
private var thumbnailUri: Uri? = null
|
||||||
|
|
||||||
override fun compareTo(other: Contact): Int {
|
override fun compareTo(other: Contact): Int {
|
||||||
val fn = fullName ?: ""
|
val fn = fullName ?: ""
|
||||||
val otherFn = other.fullName ?: ""
|
val otherFn = other.fullName ?: ""
|
||||||
|
|
|
@ -79,12 +79,6 @@ class ContactsManager(private val context: Context) {
|
||||||
@Synchronized
|
@Synchronized
|
||||||
private set
|
private set
|
||||||
|
|
||||||
var localAccountsContacts = ArrayList<Contact>()
|
|
||||||
@Synchronized
|
|
||||||
get
|
|
||||||
@Synchronized
|
|
||||||
private set
|
|
||||||
|
|
||||||
val magicSearch: MagicSearch by lazy {
|
val magicSearch: MagicSearch by lazy {
|
||||||
val magicSearch = coreContext.core.createMagicSearch()
|
val magicSearch = coreContext.core.createMagicSearch()
|
||||||
magicSearch.limitedSearch = false
|
magicSearch.limitedSearch = false
|
||||||
|
@ -93,6 +87,12 @@ class ContactsManager(private val context: Context) {
|
||||||
|
|
||||||
var latestContactFetch: String = ""
|
var latestContactFetch: String = ""
|
||||||
|
|
||||||
|
private var localAccountsContacts = ArrayList<Contact>()
|
||||||
|
@Synchronized
|
||||||
|
get
|
||||||
|
@Synchronized
|
||||||
|
private set
|
||||||
|
|
||||||
private val friendsMap: HashMap<String, Friend> = HashMap()
|
private val friendsMap: HashMap<String, Friend> = HashMap()
|
||||||
|
|
||||||
private val contactsUpdatedListeners = ArrayList<ContactsUpdatedListener>()
|
private val contactsUpdatedListeners = ArrayList<ContactsUpdatedListener>()
|
||||||
|
|
|
@ -86,97 +86,104 @@ class NativeContact(val nativeId: String, private val lookupKey: String? = null)
|
||||||
|
|
||||||
@Synchronized
|
@Synchronized
|
||||||
override fun syncValuesFromAndroidCursor(cursor: Cursor) {
|
override fun syncValuesFromAndroidCursor(cursor: Cursor) {
|
||||||
val displayName: String? =
|
try {
|
||||||
cursor.getString(cursor.getColumnIndex(ContactsContract.Data.DISPLAY_NAME_PRIMARY))
|
val displayName: String? =
|
||||||
|
cursor.getString(cursor.getColumnIndexOrThrow(ContactsContract.Data.DISPLAY_NAME_PRIMARY))
|
||||||
|
|
||||||
val mime: String? = cursor.getString(cursor.getColumnIndex(ContactsContract.Data.MIMETYPE))
|
val mime: String? =
|
||||||
val data1: String? = cursor.getString(cursor.getColumnIndex("data1"))
|
cursor.getString(cursor.getColumnIndexOrThrow(ContactsContract.Data.MIMETYPE))
|
||||||
val data2: String? = cursor.getString(cursor.getColumnIndex("data2"))
|
val data1: String? = cursor.getString(cursor.getColumnIndexOrThrow("data1"))
|
||||||
val data3: String? = cursor.getString(cursor.getColumnIndex("data3"))
|
val data2: String? = cursor.getString(cursor.getColumnIndexOrThrow("data2"))
|
||||||
val data4: String? = cursor.getString(cursor.getColumnIndex("data4"))
|
val data3: String? = cursor.getString(cursor.getColumnIndexOrThrow("data3"))
|
||||||
|
val data4: String? = cursor.getString(cursor.getColumnIndexOrThrow("data4"))
|
||||||
|
|
||||||
if (fullName == null || fullName != displayName) {
|
if (fullName == null || fullName != displayName) {
|
||||||
Log.d("[Native Contact] Setting display name $displayName")
|
Log.d("[Native Contact] Setting display name $displayName")
|
||||||
fullName = displayName
|
fullName = displayName
|
||||||
}
|
}
|
||||||
|
|
||||||
val linphoneMime = AppUtils.getString(R.string.linphone_address_mime_type)
|
val linphoneMime = AppUtils.getString(R.string.linphone_address_mime_type)
|
||||||
when (mime) {
|
when (mime) {
|
||||||
ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE -> {
|
ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE -> {
|
||||||
if (data1 == null && data4 == null) {
|
if (data1 == null && data4 == null) {
|
||||||
Log.d("[Native Contact] Phone number data is empty")
|
Log.d("[Native Contact] Phone number data is empty")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
val labelColumnIndex = cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.LABEL)
|
val labelColumnIndex =
|
||||||
val label: String? = cursor.getString(labelColumnIndex)
|
cursor.getColumnIndexOrThrow(ContactsContract.CommonDataKinds.Phone.LABEL)
|
||||||
val typeColumnIndex = cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.TYPE)
|
val label: String? = cursor.getString(labelColumnIndex)
|
||||||
val type: Int = cursor.getInt(typeColumnIndex)
|
val typeColumnIndex =
|
||||||
val typeLabel = ContactsContract.CommonDataKinds.Phone.getTypeLabel(
|
cursor.getColumnIndexOrThrow(ContactsContract.CommonDataKinds.Phone.TYPE)
|
||||||
coreContext.context.resources,
|
val type: Int = cursor.getInt(typeColumnIndex)
|
||||||
type,
|
val typeLabel = ContactsContract.CommonDataKinds.Phone.getTypeLabel(
|
||||||
label
|
coreContext.context.resources,
|
||||||
).toString()
|
type,
|
||||||
|
label
|
||||||
|
).toString()
|
||||||
|
|
||||||
// data4 = ContactsContract.CommonDataKinds.Phone.NORMALIZED_NUMBER
|
// data4 = ContactsContract.CommonDataKinds.Phone.NORMALIZED_NUMBER
|
||||||
// data1 = ContactsContract.CommonDataKinds.Phone.NUMBER
|
// data1 = ContactsContract.CommonDataKinds.Phone.NUMBER
|
||||||
val number = if (corePreferences.preferNormalizedPhoneNumbersFromAddressBook) {
|
val number = if (corePreferences.preferNormalizedPhoneNumbersFromAddressBook) {
|
||||||
data4 ?: data1
|
data4 ?: data1
|
||||||
} else {
|
} else {
|
||||||
data1 ?: data4
|
data1 ?: data4
|
||||||
}
|
}
|
||||||
if (number != null && number.isNotEmpty()) {
|
if (number != null && number.isNotEmpty()) {
|
||||||
Log.d("[Native Contact] Found phone number $data1 ($data4), type label is $typeLabel")
|
Log.d("[Native Contact] Found phone number $data1 ($data4), type label is $typeLabel")
|
||||||
if (!rawPhoneNumbers.contains(number)) {
|
if (!rawPhoneNumbers.contains(number)) {
|
||||||
phoneNumbers.add(PhoneNumber(number, typeLabel))
|
phoneNumbers.add(PhoneNumber(number, typeLabel))
|
||||||
rawPhoneNumbers.add(number)
|
rawPhoneNumbers.add(number)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
linphoneMime, ContactsContract.CommonDataKinds.SipAddress.CONTENT_ITEM_TYPE -> {
|
||||||
linphoneMime, ContactsContract.CommonDataKinds.SipAddress.CONTENT_ITEM_TYPE -> {
|
if (data1 == null) {
|
||||||
if (data1 == null) {
|
Log.d("[Native Contact] SIP address is null")
|
||||||
Log.d("[Native Contact] SIP address is null")
|
return
|
||||||
return
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Log.d("[Native Contact] Found SIP address $data1")
|
Log.d("[Native Contact] Found SIP address $data1")
|
||||||
if (rawPhoneNumbers.contains(data1)) {
|
if (rawPhoneNumbers.contains(data1)) {
|
||||||
Log.d("[Native Contact] SIP address value already exists in phone numbers list, skipping")
|
Log.d("[Native Contact] SIP address value already exists in phone numbers list, skipping")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
val address: Address? = coreContext.core.interpretUrl(data1)
|
val address: Address? = coreContext.core.interpretUrl(data1)
|
||||||
if (address == null) {
|
if (address == null) {
|
||||||
Log.e("[Native Contact] Couldn't parse address $data1 !")
|
Log.e("[Native Contact] Couldn't parse address $data1 !")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
val stringAddress = address.asStringUriOnly()
|
val stringAddress = address.asStringUriOnly()
|
||||||
Log.d("[Native Contact] Found SIP address $stringAddress")
|
Log.d("[Native Contact] Found SIP address $stringAddress")
|
||||||
if (!rawSipAddresses.contains(data1)) {
|
if (!rawSipAddresses.contains(data1)) {
|
||||||
sipAddresses.add(address)
|
sipAddresses.add(address)
|
||||||
rawSipAddresses.add(data1)
|
rawSipAddresses.add(data1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ContactsContract.CommonDataKinds.Organization.CONTENT_ITEM_TYPE -> {
|
||||||
|
if (data1 == null) {
|
||||||
|
Log.d("[Native Contact] Organization is null")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
Log.d("[Native Contact] Found organization $data1")
|
||||||
|
organization = data1
|
||||||
|
}
|
||||||
|
ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE -> {
|
||||||
|
if (data2 == null && data3 == null) {
|
||||||
|
Log.d("[Native Contact] First name and last name are both null")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
Log.d("[Native Contact] Found first name $data2 and last name $data3")
|
||||||
|
firstName = data2
|
||||||
|
lastName = data3
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ContactsContract.CommonDataKinds.Organization.CONTENT_ITEM_TYPE -> {
|
} catch (iae: IllegalArgumentException) {
|
||||||
if (data1 == null) {
|
Log.e("[Native Contact] Exception: $iae")
|
||||||
Log.d("[Native Contact] Organization is null")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
Log.d("[Native Contact] Found organization $data1")
|
|
||||||
organization = data1
|
|
||||||
}
|
|
||||||
ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE -> {
|
|
||||||
if (data2 == null && data3 == null) {
|
|
||||||
Log.d("[Native Contact] First name and last name are both null")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
Log.d("[Native Contact] Found first name $data2 and last name $data3")
|
|
||||||
firstName = data2
|
|
||||||
lastName = data3
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,8 +96,12 @@ class NativeContactEditor(val contact: NativeContact) {
|
||||||
if (cursor?.moveToFirst() == true) {
|
if (cursor?.moveToFirst() == true) {
|
||||||
do {
|
do {
|
||||||
if (rawId == null) {
|
if (rawId == null) {
|
||||||
rawId = cursor.getString(cursor.getColumnIndex(RawContacts._ID))
|
try {
|
||||||
Log.i("[Native Contact Editor] Found raw id $rawId for native contact with id ${contact.nativeId}")
|
rawId = cursor.getString(cursor.getColumnIndexOrThrow(RawContacts._ID))
|
||||||
|
Log.i("[Native Contact Editor] Found raw id $rawId for native contact with id ${contact.nativeId}")
|
||||||
|
} catch (iae: IllegalArgumentException) {
|
||||||
|
Log.e("[Native Contact Editor] Exception: $iae")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} while (cursor.moveToNext() && rawId == null)
|
} while (cursor.moveToNext() && rawId == null)
|
||||||
}
|
}
|
||||||
|
@ -258,11 +262,16 @@ class NativeContactEditor(val contact: NativeContact) {
|
||||||
)
|
)
|
||||||
if (cursor?.moveToFirst() == true) {
|
if (cursor?.moveToFirst() == true) {
|
||||||
do {
|
do {
|
||||||
val accountType =
|
try {
|
||||||
cursor.getString(cursor.getColumnIndex(RawContacts.ACCOUNT_TYPE))
|
val accountType =
|
||||||
if (accountType == AppUtils.getString(R.string.sync_account_type) && syncAccountRawId == null) {
|
cursor.getString(cursor.getColumnIndexOrThrow(RawContacts.ACCOUNT_TYPE))
|
||||||
syncAccountRawId = cursor.getString(cursor.getColumnIndex(RawContacts._ID))
|
if (accountType == AppUtils.getString(R.string.sync_account_type) && syncAccountRawId == null) {
|
||||||
Log.d("[Native Contact Editor] Found linphone raw id $syncAccountRawId for native contact with id ${contact.nativeId}")
|
syncAccountRawId =
|
||||||
|
cursor.getString(cursor.getColumnIndexOrThrow(RawContacts._ID))
|
||||||
|
Log.d("[Native Contact Editor] Found linphone raw id $syncAccountRawId for native contact with id ${contact.nativeId}")
|
||||||
|
}
|
||||||
|
} catch (iae: IllegalArgumentException) {
|
||||||
|
Log.e("[Native Contact Editor] Exception: $iae")
|
||||||
}
|
}
|
||||||
} while (cursor.moveToNext() && syncAccountRawId == null)
|
} while (cursor.moveToNext() && syncAccountRawId == null)
|
||||||
}
|
}
|
||||||
|
@ -461,7 +470,11 @@ class NativeContactEditor(val contact: NativeContact) {
|
||||||
val count = cursor?.count ?: 0
|
val count = cursor?.count ?: 0
|
||||||
val data1 = if (count > 0) {
|
val data1 = if (count > 0) {
|
||||||
if (cursor?.moveToFirst() == true) {
|
if (cursor?.moveToFirst() == true) {
|
||||||
cursor.getString(cursor.getColumnIndex("data1"))
|
try {
|
||||||
|
cursor.getString(cursor.getColumnIndexOrThrow("data1"))
|
||||||
|
} catch (iae: IllegalArgumentException) {
|
||||||
|
Log.e("[Native Contact Editor] Exception: $iae")
|
||||||
|
}
|
||||||
} else null
|
} else null
|
||||||
} else null
|
} else null
|
||||||
cursor?.close()
|
cursor?.close()
|
||||||
|
|
|
@ -87,7 +87,7 @@ class CoreContext(val context: Context, coreConfig: Config) {
|
||||||
"$sdkVersion ($sdkBranch, $sdkBuildType)"
|
"$sdkVersion ($sdkBranch, $sdkBuildType)"
|
||||||
}
|
}
|
||||||
|
|
||||||
val collator = Collator.getInstance()
|
val collator: Collator = Collator.getInstance()
|
||||||
val contactsManager: ContactsManager by lazy {
|
val contactsManager: ContactsManager by lazy {
|
||||||
ContactsManager(context)
|
ContactsManager(context)
|
||||||
}
|
}
|
||||||
|
|
|
@ -633,7 +633,7 @@ class NotificationsManager(private val context: Context) {
|
||||||
context,
|
context,
|
||||||
notifiable.notificationId,
|
notifiable.notificationId,
|
||||||
target,
|
target,
|
||||||
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_MUTABLE
|
Compatibility.getUpdateCurrentPendingIntentFlag()
|
||||||
)
|
)
|
||||||
|
|
||||||
val id = LinphoneUtils.getChatRoomId(room.localAddress, room.peerAddress)
|
val id = LinphoneUtils.getChatRoomId(room.localAddress, room.peerAddress)
|
||||||
|
@ -888,7 +888,7 @@ class NotificationsManager(private val context: Context) {
|
||||||
context,
|
context,
|
||||||
notifiable.notificationId,
|
notifiable.notificationId,
|
||||||
replyIntent,
|
replyIntent,
|
||||||
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_MUTABLE
|
Compatibility.getUpdateCurrentPendingIntentFlag()
|
||||||
)
|
)
|
||||||
return NotificationCompat.Action.Builder(
|
return NotificationCompat.Action.Builder(
|
||||||
R.drawable.chat_send_over,
|
R.drawable.chat_send_over,
|
||||||
|
|
|
@ -70,31 +70,31 @@ class FileUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun isPlainTextFile(path: String): Boolean {
|
fun isPlainTextFile(path: String): Boolean {
|
||||||
val extension = getExtensionFromFileName(path).toLowerCase(Locale.getDefault())
|
val extension = getExtensionFromFileName(path).lowercase(Locale.getDefault())
|
||||||
val type = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension)
|
val type = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension)
|
||||||
return type?.startsWith("text/plain") ?: false
|
return type?.startsWith("text/plain") ?: false
|
||||||
}
|
}
|
||||||
|
|
||||||
fun isExtensionPdf(path: String): Boolean {
|
fun isExtensionPdf(path: String): Boolean {
|
||||||
val extension = getExtensionFromFileName(path).toLowerCase(Locale.getDefault())
|
val extension = getExtensionFromFileName(path).lowercase(Locale.getDefault())
|
||||||
val type = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension)
|
val type = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension)
|
||||||
return type?.startsWith("application/pdf") ?: false
|
return type?.startsWith("application/pdf") ?: false
|
||||||
}
|
}
|
||||||
|
|
||||||
fun isExtensionImage(path: String): Boolean {
|
fun isExtensionImage(path: String): Boolean {
|
||||||
val extension = getExtensionFromFileName(path).toLowerCase(Locale.getDefault())
|
val extension = getExtensionFromFileName(path).lowercase(Locale.getDefault())
|
||||||
val type = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension)
|
val type = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension)
|
||||||
return type?.startsWith("image/") ?: false
|
return type?.startsWith("image/") ?: false
|
||||||
}
|
}
|
||||||
|
|
||||||
fun isExtensionVideo(path: String): Boolean {
|
fun isExtensionVideo(path: String): Boolean {
|
||||||
val extension = getExtensionFromFileName(path).toLowerCase(Locale.getDefault())
|
val extension = getExtensionFromFileName(path).lowercase(Locale.getDefault())
|
||||||
val type = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension)
|
val type = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension)
|
||||||
return type?.startsWith("video/") ?: false
|
return type?.startsWith("video/") ?: false
|
||||||
}
|
}
|
||||||
|
|
||||||
fun isExtensionAudio(path: String): Boolean {
|
fun isExtensionAudio(path: String): Boolean {
|
||||||
val extension = getExtensionFromFileName(path).toLowerCase(Locale.getDefault())
|
val extension = getExtensionFromFileName(path).lowercase(Locale.getDefault())
|
||||||
val type = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension)
|
val type = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension)
|
||||||
return type?.startsWith("audio/") ?: false
|
return type?.startsWith("audio/") ?: false
|
||||||
}
|
}
|
||||||
|
|
|
@ -205,7 +205,17 @@ class VoiceRecordProgressBar : View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setProgressDrawable(drawable: Drawable) {
|
fun setSecondaryProgressTint(color: Int) {
|
||||||
|
val drawable = progressDrawable
|
||||||
|
if (drawable != null) {
|
||||||
|
if (drawable is LayerDrawable) {
|
||||||
|
val secondaryProgressDrawable = drawable.findDrawableByLayerId(android.R.id.secondaryProgress)
|
||||||
|
secondaryProgressDrawable?.setTint(color)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setProgressDrawable(drawable: Drawable) {
|
||||||
val needUpdate: Boolean = if (progressDrawable != null && drawable !== progressDrawable) {
|
val needUpdate: Boolean = if (progressDrawable != null && drawable !== progressDrawable) {
|
||||||
progressDrawable?.callback = null
|
progressDrawable?.callback = null
|
||||||
true
|
true
|
||||||
|
@ -233,16 +243,6 @@ class VoiceRecordProgressBar : View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setSecondaryProgressTint(color: Int) {
|
|
||||||
val drawable = progressDrawable
|
|
||||||
if (drawable != null) {
|
|
||||||
if (drawable is LayerDrawable) {
|
|
||||||
val secondaryProgressDrawable = drawable.findDrawableByLayerId(android.R.id.secondaryProgress)
|
|
||||||
secondaryProgressDrawable?.setTint(color)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun refreshProgress(id: Int, progress: Int) {
|
private fun refreshProgress(id: Int, progress: Int) {
|
||||||
var scale: Float = if (max > 0) (progress.toFloat() / max) else 0f
|
var scale: Float = if (max > 0) (progress.toFloat() / max) else 0f
|
||||||
|
|
||||||
|
|
|
@ -97,6 +97,7 @@
|
||||||
android:id="@+id/message"
|
android:id="@+id/message"
|
||||||
android:enabled="@{!chatSendingViewModel.isReadOnly}"
|
android:enabled="@{!chatSendingViewModel.isReadOnly}"
|
||||||
android:text="@={chatSendingViewModel.textToSend}"
|
android:text="@={chatSendingViewModel.textToSend}"
|
||||||
|
android:hint="@string/chat_room_sending_message_hint"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
|
|
|
@ -328,6 +328,7 @@
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:background="@drawable/round_button_background"
|
android:background="@drawable/round_button_background"
|
||||||
android:padding="13dp"
|
android:padding="13dp"
|
||||||
|
android:contentDescription="@string/content_descripton_scroll_to_bottom"
|
||||||
android:src="@drawable/scroll_to_bottom" />
|
android:src="@drawable/scroll_to_bottom" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:linphone="http://schemas.android.com/apk/res-auto">
|
xmlns:linphone="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:bind="http://schemas.android.com/tools">
|
||||||
|
|
||||||
<data>
|
<data>
|
||||||
<import type="android.view.View"/>
|
<import type="android.view.View"/>
|
||||||
|
|
|
@ -192,7 +192,7 @@
|
||||||
<string name="content_description_menu_contacts">Contactos</string>
|
<string name="content_description_menu_contacts">Contactos</string>
|
||||||
<string name="content_description_menu_dialer">Marcador telefónico</string>
|
<string name="content_description_menu_dialer">Marcador telefónico</string>
|
||||||
<string name="content_description_menu_chat">Conversaciones</string>
|
<string name="content_description_menu_chat">Conversaciones</string>
|
||||||
<string name="content_description_dialer_erase">Eliminar el último caracter</string>
|
<string name="content_description_dialer_erase">Eliminar el último carácter</string>
|
||||||
<string name="content_description_add_contact">Crear contacto</string>
|
<string name="content_description_add_contact">Crear contacto</string>
|
||||||
<string name="content_description_show_all_calls">Mostrar todas las llamadas</string>
|
<string name="content_description_show_all_calls">Mostrar todas las llamadas</string>
|
||||||
<string name="content_description_show_missed_calls">Mostrar solo llamadas perdidad</string>
|
<string name="content_description_show_missed_calls">Mostrar solo llamadas perdidad</string>
|
||||||
|
|
|
@ -481,7 +481,7 @@
|
||||||
<string name="content_description_show_all_calls">Tous les appels</string>
|
<string name="content_description_show_all_calls">Tous les appels</string>
|
||||||
<string name="content_description_incoming_call">Appel entrant</string>
|
<string name="content_description_incoming_call">Appel entrant</string>
|
||||||
<string name="content_description_outgoing_call">Appel sortant</string>
|
<string name="content_description_outgoing_call">Appel sortant</string>
|
||||||
<string name="content_description_create_one_to_one_chat_room">Créer une conversation 1-1</string>
|
<string name="content_description_create_one_to_one_chat_room">Créer une conversation 1–1</string>
|
||||||
<string name="content_description_create_group_chat_room">Créer une conversation de groupe</string>
|
<string name="content_description_create_group_chat_room">Créer une conversation de groupe</string>
|
||||||
<string name="content_description_security_level_unsafe">Non sécurisé</string>
|
<string name="content_description_security_level_unsafe">Non sécurisé</string>
|
||||||
<string name="content_description_security_level_safe">Sécurisé</string>
|
<string name="content_description_security_level_safe">Sécurisé</string>
|
||||||
|
@ -626,4 +626,5 @@
|
||||||
<string name="call_settings_use_telecom_manager_summary">Nécessite des permissions supplémentaires</string>
|
<string name="call_settings_use_telecom_manager_summary">Nécessite des permissions supplémentaires</string>
|
||||||
<string name="chat_room_unread_messages">%1$d messages non lus</string>
|
<string name="chat_room_unread_messages">%1$d messages non lus</string>
|
||||||
<string name="chat_room_unread_message">%1$d message non lu</string>
|
<string name="chat_room_unread_message">%1$d message non lu</string>
|
||||||
|
<string name="content_descripton_scroll_to_bottom">Aller au dernier message reçu ou au premier message non lu</string>
|
||||||
</resources>
|
</resources>
|
|
@ -737,4 +737,5 @@
|
||||||
<string name="content_description_cancel_voice_recording">Cancel voice recording</string>
|
<string name="content_description_cancel_voice_recording">Cancel voice recording</string>
|
||||||
<string name="content_description_pause_voice_recording_playback">Pause voice recording</string>
|
<string name="content_description_pause_voice_recording_playback">Pause voice recording</string>
|
||||||
<string name="content_description_play_voice_recording">Play voice recording</string>
|
<string name="content_description_play_voice_recording">Play voice recording</string>
|
||||||
|
<string name="content_descripton_scroll_to_bottom">Scroll to bottom or first unread message</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in a new issue