Small improvements reported by Android Studio code inspector

This commit is contained in:
Sylvain Berfini 2024-12-18 15:30:25 +01:00
parent ea92ca2220
commit 8e93fefda3
14 changed files with 20 additions and 24 deletions

View file

@ -291,7 +291,7 @@ class ContactLoader : LoaderManager.LoaderCallbacks<Cursor> {
if (core.globalState == GlobalState.Shutdown || core.globalState == GlobalState.Off) {
Log.w("$TAG Core is being stopped or already destroyed, abort")
} else if (friends.isEmpty()) {
} else if (friends.isEmpty) {
Log.w("$TAG No friend created!")
} else {
Log.i("$TAG ${friends.size} friends fetched")

View file

@ -1276,7 +1276,7 @@ open class ConversationFragment : SlidingPaneChildFragment() {
val model = MessageReactionsModel(chatMessageModel.chatMessage) { reactionsModel ->
coreContext.postOnMainThread {
if (reactionsModel.allReactions.isEmpty()) {
if (reactionsModel.allReactions.isEmpty) {
Log.i("$TAG No reaction to display, closing bottom sheet")
val bottomSheetBehavior = BottomSheetBehavior.from(
binding.messageBottomSheet.root

View file

@ -288,7 +288,7 @@ class ConversationViewModel
list.remove(found)
eventsList = list
updateEvents.postValue(Event(true))
isEmpty.postValue(eventsList.isEmpty())
isEmpty.postValue(eventsList.isEmpty)
} else {
Log.e("$TAG Failed to find matching message in conversation events list")
}
@ -428,7 +428,7 @@ class ConversationViewModel
list.remove(found)
eventsList = list
updateEvents.postValue(Event(true))
isEmpty.postValue(eventsList.isEmpty())
isEmpty.postValue(eventsList.isEmpty)
} else {
Log.e(
"$TAG Failed to find chat message id [${chatMessageModel.id}] in events list!"
@ -524,7 +524,7 @@ class ConversationViewModel
list.addAll(eventsList)
eventsList = list
updateEvents.postValue(Event(true))
isEmpty.postValue(eventsList.isEmpty())
isEmpty.postValue(eventsList.isEmpty)
}
}
}
@ -647,7 +647,7 @@ class ConversationViewModel
Log.i("$TAG Extracted [${list.size}] events from conversation history in database")
eventsList = list
updateEvents.postValue(Event(true))
isEmpty.postValue(eventsList.isEmpty())
isEmpty.postValue(eventsList.isEmpty)
}
@WorkerThread
@ -694,7 +694,7 @@ class ConversationViewModel
list.addAll(newList)
eventsList = list
updateEvents.postValue(Event(true))
isEmpty.postValue(eventsList.isEmpty())
isEmpty.postValue(eventsList.isEmpty)
}
@WorkerThread
@ -726,7 +726,7 @@ class ConversationViewModel
list.addAll(eventsList)
eventsList = list
updateEvents.postValue(Event(true))
isEmpty.postValue(eventsList.isEmpty())
isEmpty.postValue(eventsList.isEmpty)
}
@WorkerThread
@ -784,7 +784,7 @@ class ConversationViewModel
eventsList.addAll(processGroupedEvents(arrayListOf(event)))
} else {
for (event in history) {
if (groupedEventLogs.isEmpty()) {
if (groupedEventLogs.isEmpty) {
groupedEventLogs.add(event)
continue
}

View file

@ -409,7 +409,7 @@ class SendMessageInConversationViewModel
attachments.value = list
maxNumberOfAttachmentsReached.value = list.size >= MAX_FILES_TO_ATTACH
if (list.isEmpty()) {
if (list.isEmpty) {
isFileAttachmentsListOpen.value = false
}
}

View file

@ -177,7 +177,7 @@ class MeetingsListViewModel
val organizerCheck = info.organizer?.asStringUriOnly()?.contains(
filter,
ignoreCase = true
) ?: false
) == true
val subjectCheck = info.subject?.contains(filter, ignoreCase = true) == true
val descriptionCheck = info.description?.contains(filter, ignoreCase = true) == true
val participantsCheck = info.participantInfos.find {

View file

@ -328,7 +328,7 @@ abstract class AddressSelectionViewModel
list.addAll(contactsList)
list.addAll(suggestionsList)
modelsList.postValue(list)
isEmpty.postValue(list.isEmpty())
isEmpty.postValue(list.isEmpty)
Log.i(
"$TAG Processed [${results.size}] results: [${conversationsList.size}] conversations, [${favoritesList.size}] favorites, [${contactsList.size}] contacts and [${suggestionsList.size}] suggestions"
)

View file

@ -104,6 +104,7 @@
android:layout_marginEnd="16dp"
android:src="@drawable/voicemail"
android:visibility="@{model.showMwi ? View.VISIBLE : View.GONE, default=gone}"
android:contentDescription="@string/content_description_voicemail_available"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/voicemail_count"
app:layout_constraintEnd_toStartOf="@id/notifications_count"/>

View file

@ -106,6 +106,7 @@
android:layout_marginTop="3dp"
android:src="@drawable/forward"
android:visibility="@{model.isLastMessageForwarded ? View.VISIBLE : View.GONE, default=gone}"
android:contentDescription="@null"
app:layout_constraintStart_toEndOf="@id/last_message_sender"
app:layout_constraintEnd_toStartOf="@id/last_message_or_composing"
app:layout_constraintTop_toTopOf="@id/last_message_or_composing"

View file

@ -193,6 +193,7 @@
android:layout_marginStart="5dp"
android:layout_marginEnd="16dp"
android:src="@drawable/copy"
android:contentDescription="@string/content_description_copy_text_to_clipboard"
app:tint="?attr/color_main2_600"
app:layout_constraintTop_toTopOf="@id/app_version_subtitle"
app:layout_constraintBottom_toBottomOf="@id/app_version_subtitle"
@ -250,6 +251,7 @@
android:layout_marginStart="5dp"
android:layout_marginEnd="16dp"
android:src="@drawable/copy"
android:contentDescription="@string/content_description_copy_text_to_clipboard"
app:tint="?attr/color_main2_600"
app:layout_constraintTop_toTopOf="@id/sdk_version_subtitle"
app:layout_constraintBottom_toBottomOf="@id/sdk_version_subtitle"

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android">
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
<import type="android.view.View" />

View file

@ -748,7 +748,7 @@
<string name="generic_address_picker_favorites_list_title">Favoris</string>
<string name="generic_address_picker_suggestions_list_title">Suggestions</string>
<string name="post_notifications_permission_not_granted">La permission de poster des notifications n\'est pas donnée !</string>
<plurals name="mwi_messages_are_waiting">
<plurals name="mwi_messages_are_waiting" tools:ignore="MissingQuantity">
<item quantity="one">%s message vocal en attente</item>
<item quantity="other">%s messages vocaux en attente</item>
</plurals>

View file

@ -14,7 +14,6 @@
<color name="orange_main_300">#FFB266</color>
<color name="orange_main_500">#FF5E00</color>
<color name="orange_main_700">#B72D00</color>
<color name="orange_main_900">#7F2F00</color>
<color name="gray_main2_100">#EEF6F8</color>
<color name="gray_main2_200">#DFECF2</color>
@ -64,40 +63,34 @@
<color name="yellow_main_300">#FFE799</color>
<color name="yellow_main_500">#F5BC00</color>
<color name="yellow_main_700">#A37D00</color>
<color name="yellow_main_900">#806200</color>
<color name="green_main_100">#DCF9E7</color>
<color name="green_main_100_alpha_50">#80DCF9E7</color>
<color name="green_main_300">#A8F0C2</color>
<color name="green_main_500">#25D366</color>
<color name="green_main_700">#1C9C4B</color>
<color name="green_main_900">#136c34</color>
<color name="blue_main_100">#D6F4FF</color>
<color name="blue_main_100_alpha_50">#80D6F4FF</color>
<color name="blue_main_300">#99E4FF</color>
<color name="blue_main_500">#00aff0</color>
<color name="blue_main_700">#0078A3</color>
<color name="blue_main_900">#005d80</color>
<color name="red_main_100">#FBE1DA</color>
<color name="red_main_100_alpha_50">#80FBE1DA</color>
<color name="red_main_300">#F5B53A</color>
<color name="red_main_500">#E14318</color>
<color name="red_main_700">#A63211</color>
<color name="red_main_900">#73220c</color>
<color name="pink_main_100">#FFD6F1</color>
<color name="pink_main_100_alpha_50">#80FFD6F1</color>
<color name="pink_main_300">#FF99DD</color>
<color name="pink_main_500">#FF00A9</color>
<color name="pink_main_700">#B8007A</color>
<color name="pink_main_900">#800055</color>
<color name="purple_main_100">#FFD6FF</color>
<color name="purple_main_100_alpha_50">#80FFD6FF</color>
<color name="purple_main_300">#FF99FF</color>
<color name="purple_main_500">#800080</color>
<color name="purple_main_700">#520052</color>
<color name="purple_main_900">#80007f</color>
</resources>

View file

@ -57,7 +57,6 @@
<dimen name="popup_menu_padding">15dp</dimen>
<dimen name="popup_menu_item_top_margin">20dp</dimen>
<dimen name="call_top_bar_text_height">28dp</dimen>
<dimen name="call_remote_video_top_margin">70dp</dimen> <!-- Size of top text + top & bottom margins -->
<dimen name="call_main_actions_menu_height">110dp</dimen>
<dimen name="call_all_actions_menu_height">345dp</dimen> <!-- sum of above two -->

View file

@ -863,7 +863,6 @@
<string name="content_description_chat_cancel_reply">Message will no longer be a reply to a previous message</string>
<string name="content_description_chat_open_emoji_picker">Opens emoji picker</string>
<string name="content_description_chat_open_attach_file">Opens file picker</string>
<string name="content_description_chat_take_picture">Opens camera to take a picture</string>
<string name="content_description_chat_edit_conversation_subject">Click to edit the subject of this conversation</string>
<string name="content_description_chat_toggle_mute">Silences on/off this conversation</string>
<string name="content_description_chat_removal_in_progress">Conversation is being removed</string>
@ -889,6 +888,8 @@
<string name="content_description_ldap_save">Save LDAP configuration</string>
<string name="content_description_play_call_recording">Plays the call recording</string>
<string name="content_description_go_to_conversation">Go to conversation</string>
<string name="content_description_copy_text_to_clipboard">Copy text to clipboard</string>
<string name="content_description_voicemail_available">Voice message are available</string>
<!-- Copy of private hosts_allowlist_sample in androidx.car.app:app:1.7.0-beta01, as they recommend it -->
<string-array name="hosts_allowlist_sample_copy" translatable="false">