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 {
|
||||
override fun handleClick(key: Char) {
|
||||
val sb: StringBuilder = StringBuilder(enteredUri.value)
|
||||
try {
|
||||
sb.insert(enteredUriCursorPosition, key.toString())
|
||||
} catch (ioobe: IndexOutOfBoundsException) {
|
||||
sb.insert(sb.length, key.toString())
|
||||
}
|
||||
enteredUri.value = sb.toString()
|
||||
|
||||
if (coreContext.core.callsNb == 0) {
|
||||
|
|
|
@ -22,7 +22,6 @@ package org.linphone.activities.main.settings.fragments
|
|||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import org.linphone.R
|
||||
import org.linphone.activities.GenericFragment
|
||||
import org.linphone.activities.main.settings.viewmodels.AccountSettingsViewModel
|
||||
|
@ -53,11 +52,18 @@ class AccountSettingsFragment : GenericFragment<SettingsAccountFragmentBinding>(
|
|||
if (identity == null) {
|
||||
Log.e("[Account Settings] Identity is null, aborting!")
|
||||
// (activity as MainActivity).showSnackBar(R.string.error)
|
||||
findNavController().navigateUp()
|
||||
goBack()
|
||||
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.setBackClickListener { goBack() }
|
||||
|
@ -80,7 +86,7 @@ class AccountSettingsFragment : GenericFragment<SettingsAccountFragmentBinding>(
|
|||
viewModel.accountRemovedEvent.observe(viewLifecycleOwner, {
|
||||
it.consume {
|
||||
sharedViewModel.accountRemoved.value = true
|
||||
findNavController().navigateUp()
|
||||
goBack()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -151,7 +151,7 @@ open class Contact : Comparable<Contact> {
|
|||
if (bm == null) IconCompat.createWithResource(
|
||||
coreContext.context,
|
||||
R.drawable.avatar
|
||||
) else IconCompat.createWithAdaptiveBitmap(bm)
|
||||
) else IconCompat.createWithBitmap(bm)
|
||||
if (icon != null) {
|
||||
personBuilder.setIcon(icon)
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ class NativeContact(val nativeId: String, private val lookupKey: String? = null)
|
|||
if (bm == null) IconCompat.createWithResource(
|
||||
coreContext.context,
|
||||
R.drawable.avatar
|
||||
) else IconCompat.createWithAdaptiveBitmap(bm)
|
||||
) else IconCompat.createWithBitmap(bm)
|
||||
if (icon != null) {
|
||||
personBuilder.setIcon(icon)
|
||||
}
|
||||
|
|
|
@ -362,7 +362,7 @@ class NotificationsManager(private val context: Context) {
|
|||
val builder = Person.Builder().setName(displayName)
|
||||
val userIcon =
|
||||
if (picture != null) {
|
||||
IconCompat.createWithAdaptiveBitmap(picture)
|
||||
IconCompat.createWithBitmap(picture)
|
||||
} else {
|
||||
IconCompat.createWithResource(context, R.drawable.avatar)
|
||||
}
|
||||
|
|
|
@ -77,11 +77,17 @@ class AppUtils {
|
|||
|
||||
for (i in split.indices) {
|
||||
if (split[i].isNotEmpty()) {
|
||||
try {
|
||||
if (emoji?.hasEmojiGlyph(split[i]) == true) {
|
||||
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]
|
||||
}
|
||||
|
||||
characters += 1
|
||||
if (characters >= limit) break
|
||||
}
|
||||
|
|
|
@ -39,7 +39,8 @@ class ImageUtils {
|
|||
var bm: Bitmap? = null
|
||||
if (fromPictureUri != null) {
|
||||
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) {
|
||||
Log.e("[Image Utils] Failed to get bitmap from URI [$fromPictureUri]: $e")
|
||||
return null
|
||||
|
|
Loading…
Reference in a new issue