Fixed various issues

This commit is contained in:
Sylvain Berfini 2021-07-29 18:55:05 +02:00
parent 3452e641bd
commit b4696502aa
6 changed files with 25 additions and 8 deletions

View file

@ -62,7 +62,11 @@ class DialerViewModel : LogsUploadViewModel() {
val onKeyClick: NumpadDigitListener = object : NumpadDigitListener {
override fun handleClick(key: Char) {
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()
if (coreContext.core.callsNb == 0) {

View file

@ -55,7 +55,14 @@ class AccountSettingsFragment : GenericFragment<SettingsAccountFragmentBinding>(
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!")
findNavController().navigateUp()
return
}
binding.viewModel = viewModel
binding.setBackClickListener { findNavController().popBackStack() }

View file

@ -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)
}

View file

@ -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)
}

View file

@ -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)
}

View file

@ -71,11 +71,17 @@ class AppUtils {
for (i in split.indices) {
if (split[i].isNotEmpty()) {
if (emoji?.hasEmojiGlyph(split[i]) == true) {
initials += emoji.process(split[i])
} else {
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
}