Improvements suggested by code inspector

This commit is contained in:
Sylvain Berfini 2022-04-08 17:47:11 +02:00
parent a04c09b748
commit 5fd69bcd4c
17 changed files with 84 additions and 79 deletions

View file

@ -204,7 +204,7 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'androidx.media:media:1.4.3'
implementation 'androidx.media:media:1.5.0'
implementation 'androidx.fragment:fragment-ktx:1.4.1'
implementation 'androidx.core:core-ktx:1.7.0'

View file

@ -58,7 +58,7 @@ class ChatRoomsListAdapter(
fun forwardPending(pending: Boolean) {
isForwardPending = pending
notifyDataSetChanged()
notifyItemRangeChanged(0, itemCount)
}
inner class ViewHolder(

View file

@ -57,7 +57,7 @@ class GroupInfoParticipantsAdapter(
fun showAdminControls(show: Boolean) {
showAdmin = show
notifyDataSetChanged()
notifyItemRangeChanged(0, itemCount)
}
inner class ViewHolder(

View file

@ -223,7 +223,7 @@ class MasterChatRoomsFragment : MasterFragment<ChatRoomMasterFragmentBinding, Ch
viewLifecycleOwner
) {
it.consume {
adapter.notifyDataSetChanged()
adapter.notifyItemRangeChanged(0, adapter.itemCount)
}
}

View file

@ -56,6 +56,6 @@ class PdfViewerFragment : GenericViewerFragment<FilePdfViewerFragmentBinding>()
adapter = PdfPagesListAdapter(viewModel)
binding.pdfViewPager.adapter = adapter
adapter.notifyDataSetChanged()
//adapter.notifyDataSetChanged()
}
}

View file

@ -202,7 +202,7 @@ class MasterCallLogsFragment : MasterFragment<HistoryMasterFragmentBinding, Call
viewLifecycleOwner
) {
it.consume {
adapter.notifyDataSetChanged()
adapter.notifyItemRangeChanged(0, adapter.itemCount)
}
}

View file

@ -19,6 +19,7 @@
*/
package org.linphone.compatibility
import android.annotation.SuppressLint
import android.annotation.TargetApi
import android.bluetooth.BluetoothAdapter
import android.content.Context
@ -29,6 +30,7 @@ import org.linphone.utils.ShortcutsHelper
@TargetApi(25)
class Api25Compatibility {
companion object {
@SuppressLint("MissingPermission")
fun getDeviceName(context: Context): String {
var name = Settings.Global.getString(
context.contentResolver, Settings.Global.DEVICE_NAME

View file

@ -19,42 +19,36 @@
type="Integer" />
</data>
<RelativeLayout
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="@{controlsViewModel.fullScreenMode || controlsViewModel.pipMode ? @dimen/voip_remote_margin_full_screen : @dimen/voip_remote_margin, default=@dimen/voip_remote_margin}"
android:visibility="@{inflatedVisibility}">
android:visibility="@{inflatedVisibility}"
android:gravity="center"
android:orientation="vertical">
<LinearLayout
<include
android:id="@+id/header"
layout="@layout/voip_conference_header"
android:visibility="@{controlsViewModel.fullScreenMode || controlsViewModel.pipMode ? View.GONE : View.VISIBLE}"
app:conferenceViewModel="@{conferenceViewModel}" />
<include
android:id="@+id/remote_recording"
layout="@layout/voip_remote_recording"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="@{conferenceViewModel.isRemotelyRecorded ? View.VISIBLE : View.GONE, default=gone}" />
<org.linphone.activities.voip.views.GridBoxLayout
centerContent="@{true}"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
android:layout_marginTop="10dp"
android:onClick="@{() -> controlsViewModel.toggleFullScreen()}"
app:entries="@{conferenceViewModel.conferenceParticipantDevices}"
app:layout="@{@layout/voip_conference_participant_remote_grid}" />
<include
android:id="@+id/header"
layout="@layout/voip_conference_header"
android:visibility="@{controlsViewModel.fullScreenMode || controlsViewModel.pipMode ? View.GONE : View.VISIBLE}"
app:conferenceViewModel="@{conferenceViewModel}" />
<include
android:id="@+id/remote_recording"
layout="@layout/voip_remote_recording"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="@{conferenceViewModel.isRemotelyRecorded ? View.VISIBLE : View.GONE, default=gone}" />
<org.linphone.activities.voip.views.GridBoxLayout
centerContent="@{true}"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:onClick="@{() -> controlsViewModel.toggleFullScreen()}"
app:entries="@{conferenceViewModel.conferenceParticipantDevices}"
app:layout="@{@layout/voip_conference_participant_remote_grid}" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</layout>

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
<layout xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
@ -117,6 +118,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:contentDescription="@string/content_description_toggle_conference_info_details"
android:src="@drawable/button_conference_info"/>
</LinearLayout>
@ -139,6 +141,7 @@
android:layout_marginEnd="10dp"
android:layout_marginBottom="10dp"
android:selected="@{true}"
android:contentDescription="@string/content_description_toggle_conference_info_details"
android:src="@drawable/button_conference_info" />
<ImageView
@ -147,6 +150,7 @@
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:contentDescription="@string/content_description_conference_participants"
android:src="@drawable/icon_schedule_participants"/>
<EditText
@ -161,7 +165,8 @@
android:drawablePadding="5dp"
android:enabled="false"
android:inputType="textMultiLine"
android:text="@{data.participantsExpanded}" />
android:text="@{data.participantsExpanded}"
tools:ignore="LabelFor" />
</RelativeLayout>

View file

@ -142,7 +142,8 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
android:orientation="horizontal"
android:baselineAligned="false">
<LinearLayout
android:layout_width="0dp"
@ -203,7 +204,8 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
android:orientation="horizontal"
android:baselineAligned="false">
<LinearLayout
android:layout_width="0dp"

View file

@ -110,7 +110,8 @@
android:layout_marginEnd="5dp"
style="@style/conference_scheduling_font"
android:background="?attr/voipFormDisabledFieldBackgroundColor"
android:text="@{viewModel.subject}" />
android:text="@{viewModel.subject}"
bind:ignore="LabelFor" />
</LinearLayout>
@ -124,7 +125,8 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
android:orientation="horizontal"
android:baselineAligned="false">
<LinearLayout
android:layout_width="0dp"
@ -179,7 +181,8 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
android:orientation="horizontal"
android:baselineAligned="false">
<LinearLayout
android:layout_width="0dp"

View file

@ -74,7 +74,8 @@
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:orientation="horizontal">
android:orientation="horizontal"
android:baselineAligned="false">
<LinearLayout
android:layout_width="0dp"

View file

@ -42,6 +42,7 @@
android:layout_height="45dp"
android:layout_marginLeft="40dp"
android:layout_centerVertical="true"
android:contentDescription="@null"
android:background="@drawable/generated_avatar_bg"
android:src="@drawable/icon_multiple_contacts_avatar" />

View file

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>

View file

@ -19,42 +19,36 @@
type="Integer" />
</data>
<RelativeLayout
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="@{controlsViewModel.fullScreenMode || controlsViewModel.pipMode ? @dimen/voip_remote_margin_full_screen : @dimen/voip_remote_margin, default=@dimen/voip_remote_margin}"
android:visibility="@{inflatedVisibility}">
android:visibility="@{inflatedVisibility}"
android:gravity="center"
android:orientation="vertical">
<LinearLayout
<include
android:id="@+id/header"
layout="@layout/voip_conference_header"
android:visibility="@{controlsViewModel.fullScreenMode || controlsViewModel.pipMode ? View.GONE : View.VISIBLE}"
app:conferenceViewModel="@{conferenceViewModel}" />
<include
android:id="@+id/remote_recording"
layout="@layout/voip_remote_recording"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="@{conferenceViewModel.isRemotelyRecorded ? View.VISIBLE : View.GONE, default=gone}" />
<org.linphone.activities.voip.views.GridBoxLayout
centerContent="@{true}"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
android:layout_marginTop="10dp"
android:onClick="@{() -> controlsViewModel.toggleFullScreen()}"
app:entries="@{conferenceViewModel.conferenceParticipantDevices}"
app:layout="@{@layout/voip_conference_participant_remote_grid}" />
<include
android:id="@+id/header"
layout="@layout/voip_conference_header"
android:visibility="@{controlsViewModel.fullScreenMode || controlsViewModel.pipMode ? View.GONE : View.VISIBLE}"
app:conferenceViewModel="@{conferenceViewModel}" />
<include
android:id="@+id/remote_recording"
layout="@layout/voip_remote_recording"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="@{conferenceViewModel.isRemotelyRecorded ? View.VISIBLE : View.GONE, default=gone}" />
<org.linphone.activities.voip.views.GridBoxLayout
centerContent="@{true}"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:onClick="@{() -> controlsViewModel.toggleFullScreen()}"
app:entries="@{conferenceViewModel.conferenceParticipantDevices}"
app:layout="@{@layout/voip_conference_participant_remote_grid}" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</layout>

View file

@ -470,7 +470,7 @@
<string name="assistant_validate_account_1">Votre compte a été créé. Nous vous avons envoyé un email de confirmation à l\'adresse :</string>
<plurals name="chat_room_remote_composing">
<item quantity="one">%s écrit…</item>
<item quantity="other">%s écrivent…</item>
<item quantity="many">%s écrivent…</item>
</plurals>
<string name="chat_event_participant_added">%s a rejoint le groupe</string>
<string name="contact_choose_existing_or_new_to_add_number">Sélectionnez un contact ou créez-en un</string>
@ -480,7 +480,7 @@
<string name="sip_addresses">Adresses SIP</string>
<plurals name="days">
<item quantity="one">%d jour</item>
<item quantity="other">%d jours</item>
<item quantity="many">%d jours</item>
</plurals>
<string name="contact_delete_one_dialog">Voulez-vous supprimer ce contact \?\nIl sera aussi retiré du carnet d\'adresses du téléphone.</string>
<string name="dialer_address_bar_hint">Entrez un numéro ou une adresse</string>
@ -578,7 +578,7 @@
<string name="call_settings_use_telecom_manager_summary">Nécessite des permissions supplémentaires</string>
<plurals name="chat_room_unread_messages_event">
<item quantity="one">%1$d message non lu</item>
<item quantity="other">%1$d messages non lus</item>
<item quantity="many">%1$d messages non lus</item>
</plurals>
<string name="content_descripton_scroll_to_bottom">Aller au dernier message reçu ou au premier message non lu</string>
<string name="audio_settings_prefer_bluetooth_devices_title">Acheminer l\'audio vers l\'appareil bluetooth, s\'il existe</string>
@ -719,4 +719,6 @@
<string name="conference_participant_paused">(en pause)</string>
<string name="content_description_take_screenshot">Prendre une capture de la vidéo reçue</string>
<string name="conference_low_bandwidth">Faible bande passante détectée, vidéo désactivée</string>
<string name="content_description_toggle_conference_info_details">Afficher/cacher les détails de la conférence</string>
<string name="content_description_conference_participants">Participants de la conférence</string>
</resources>

View file

@ -849,4 +849,6 @@
<string name="content_description_conference_participant_mic_muted">Participant has it\'s microphone muted</string>
<string name="content_description_toggle_layout_menu">Show or hide conference layout menu</string>
<string name="content_description_participant_is_paused">Participant has momentarily left the conference</string>
<string name="content_description_toggle_conference_info_details">Toggle conference information details visibility</string>
<string name="content_description_conference_participants">Conference participants</string>
</resources>