Fixed various issues
This commit is contained in:
parent
e486993654
commit
d590d59bb8
7 changed files with 29 additions and 12 deletions
|
@ -62,7 +62,11 @@ class DialerViewModel : LogsUploadViewModel() {
|
||||||
val onKeyClick: NumpadDigitListener = object : NumpadDigitListener {
|
val onKeyClick: NumpadDigitListener = object : NumpadDigitListener {
|
||||||
override fun handleClick(key: Char) {
|
override fun handleClick(key: Char) {
|
||||||
val sb: StringBuilder = StringBuilder(enteredUri.value)
|
val sb: StringBuilder = StringBuilder(enteredUri.value)
|
||||||
sb.insert(enteredUriCursorPosition, key.toString())
|
try {
|
||||||
|
sb.insert(enteredUriCursorPosition, key.toString())
|
||||||
|
} catch (ioobe: IndexOutOfBoundsException) {
|
||||||
|
sb.insert(sb.length, key.toString())
|
||||||
|
}
|
||||||
enteredUri.value = sb.toString()
|
enteredUri.value = sb.toString()
|
||||||
|
|
||||||
if (coreContext.core.callsNb == 0) {
|
if (coreContext.core.callsNb == 0) {
|
||||||
|
|
|
@ -22,7 +22,6 @@ package org.linphone.activities.main.settings.fragments
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import androidx.navigation.fragment.findNavController
|
|
||||||
import org.linphone.R
|
import org.linphone.R
|
||||||
import org.linphone.activities.GenericFragment
|
import org.linphone.activities.GenericFragment
|
||||||
import org.linphone.activities.main.settings.viewmodels.AccountSettingsViewModel
|
import org.linphone.activities.main.settings.viewmodels.AccountSettingsViewModel
|
||||||
|
@ -53,11 +52,18 @@ class AccountSettingsFragment : GenericFragment<SettingsAccountFragmentBinding>(
|
||||||
if (identity == null) {
|
if (identity == null) {
|
||||||
Log.e("[Account Settings] Identity is null, aborting!")
|
Log.e("[Account Settings] Identity is null, aborting!")
|
||||||
// (activity as MainActivity).showSnackBar(R.string.error)
|
// (activity as MainActivity).showSnackBar(R.string.error)
|
||||||
findNavController().navigateUp()
|
goBack()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
viewModel = ViewModelProvider(this, AccountSettingsViewModelFactory(identity)).get(AccountSettingsViewModel::class.java)
|
try {
|
||||||
|
viewModel = ViewModelProvider(this, AccountSettingsViewModelFactory(identity)).get(
|
||||||
|
AccountSettingsViewModel::class.java)
|
||||||
|
} catch (nsee: NoSuchElementException) {
|
||||||
|
Log.e("[Account Settings] Failed to find Account object, aborting!")
|
||||||
|
goBack()
|
||||||
|
return
|
||||||
|
}
|
||||||
binding.viewModel = viewModel
|
binding.viewModel = viewModel
|
||||||
|
|
||||||
binding.setBackClickListener { goBack() }
|
binding.setBackClickListener { goBack() }
|
||||||
|
@ -80,7 +86,7 @@ class AccountSettingsFragment : GenericFragment<SettingsAccountFragmentBinding>(
|
||||||
viewModel.accountRemovedEvent.observe(viewLifecycleOwner, {
|
viewModel.accountRemovedEvent.observe(viewLifecycleOwner, {
|
||||||
it.consume {
|
it.consume {
|
||||||
sharedViewModel.accountRemoved.value = true
|
sharedViewModel.accountRemoved.value = true
|
||||||
findNavController().navigateUp()
|
goBack()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,7 +151,7 @@ open class Contact : Comparable<Contact> {
|
||||||
if (bm == null) IconCompat.createWithResource(
|
if (bm == null) IconCompat.createWithResource(
|
||||||
coreContext.context,
|
coreContext.context,
|
||||||
R.drawable.avatar
|
R.drawable.avatar
|
||||||
) else IconCompat.createWithAdaptiveBitmap(bm)
|
) else IconCompat.createWithBitmap(bm)
|
||||||
if (icon != null) {
|
if (icon != null) {
|
||||||
personBuilder.setIcon(icon)
|
personBuilder.setIcon(icon)
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ class NativeContact(val nativeId: String, private val lookupKey: String? = null)
|
||||||
if (bm == null) IconCompat.createWithResource(
|
if (bm == null) IconCompat.createWithResource(
|
||||||
coreContext.context,
|
coreContext.context,
|
||||||
R.drawable.avatar
|
R.drawable.avatar
|
||||||
) else IconCompat.createWithAdaptiveBitmap(bm)
|
) else IconCompat.createWithBitmap(bm)
|
||||||
if (icon != null) {
|
if (icon != null) {
|
||||||
personBuilder.setIcon(icon)
|
personBuilder.setIcon(icon)
|
||||||
}
|
}
|
||||||
|
|
|
@ -362,7 +362,7 @@ class NotificationsManager(private val context: Context) {
|
||||||
val builder = Person.Builder().setName(displayName)
|
val builder = Person.Builder().setName(displayName)
|
||||||
val userIcon =
|
val userIcon =
|
||||||
if (picture != null) {
|
if (picture != null) {
|
||||||
IconCompat.createWithAdaptiveBitmap(picture)
|
IconCompat.createWithBitmap(picture)
|
||||||
} else {
|
} else {
|
||||||
IconCompat.createWithResource(context, R.drawable.avatar)
|
IconCompat.createWithResource(context, R.drawable.avatar)
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,11 +77,17 @@ class AppUtils {
|
||||||
|
|
||||||
for (i in split.indices) {
|
for (i in split.indices) {
|
||||||
if (split[i].isNotEmpty()) {
|
if (split[i].isNotEmpty()) {
|
||||||
if (emoji?.hasEmojiGlyph(split[i]) == true) {
|
try {
|
||||||
initials += emoji.process(split[i])
|
if (emoji?.hasEmojiGlyph(split[i]) == true) {
|
||||||
} else {
|
initials += emoji.process(split[i])
|
||||||
|
} else {
|
||||||
|
initials += split[i][0]
|
||||||
|
}
|
||||||
|
} catch (ise: IllegalStateException) {
|
||||||
|
Log.e("[App Utils] Can't call hasEmojiGlyph: $ise")
|
||||||
initials += split[i][0]
|
initials += split[i][0]
|
||||||
}
|
}
|
||||||
|
|
||||||
characters += 1
|
characters += 1
|
||||||
if (characters >= limit) break
|
if (characters >= limit) break
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,8 @@ class ImageUtils {
|
||||||
var bm: Bitmap? = null
|
var bm: Bitmap? = null
|
||||||
if (fromPictureUri != null) {
|
if (fromPictureUri != null) {
|
||||||
bm = try {
|
bm = try {
|
||||||
Compatibility.getBitmapFromUri(context, fromPictureUri)
|
// We make a copy to ensure Bitmap will be Software and not Hardware, required for shortcuts
|
||||||
|
Compatibility.getBitmapFromUri(context, fromPictureUri).copy(Bitmap.Config.ARGB_8888, true)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Log.e("[Image Utils] Failed to get bitmap from URI [$fromPictureUri]: $e")
|
Log.e("[Image Utils] Failed to get bitmap from URI [$fromPictureUri]: $e")
|
||||||
return null
|
return null
|
||||||
|
|
Loading…
Reference in a new issue