Code cleanup

This commit is contained in:
Sylvain Berfini 2023-11-18 16:30:22 +01:00
parent ff6d722e44
commit a092922145
32 changed files with 65 additions and 92 deletions

View file

@ -30,21 +30,11 @@ import org.linphone.R
import org.linphone.utils.AppUtils
class AvatarGenerator(private val context: Context) {
private var textSize: Float
private var textColor: Int
private var avatarSize: Int
private var textSize: Float = AppUtils.getDimension(R.dimen.avatar_initials_text_size)
private var textColor: Int = ContextCompat.getColor(context, R.color.gray_main2_600)
private var avatarSize: Int = AppUtils.getDimension(R.dimen.avatar_list_cell_size).toInt()
private var initials = " "
private var backgroundColor: Int
init {
backgroundColor = ContextCompat.getColor(context, R.color.gray_main2_200)
textColor = ContextCompat.getColor(context, R.color.gray_main2_600)
textSize = AppUtils.getDimension(R.dimen.avatar_initials_text_size)
avatarSize = AppUtils.getDimension(R.dimen.avatar_list_cell_size).toInt()
}
private var backgroundColor: Int = ContextCompat.getColor(context, R.color.gray_main2_200)
fun setTextSize(size: Float) = apply {
textSize = size

View file

@ -174,7 +174,7 @@ class RegisterFragment : Fragment() {
viewModel.dialPlansLabelList
) {
override fun getView(position: Int, convertView: View?, parent: ViewGroup): View {
val view = convertView ?: super.getView(position, convertView, parent)
val view = convertView ?: super.getView(position, null, parent)
val label = viewModel.dialPlansShortLabelList[position]
(view as? AppCompatTextView)?.text = label
return view

View file

@ -72,9 +72,6 @@ class MeetingViewModel @UiThread constructor() : ViewModel() {
private lateinit var conferenceInfo: ConferenceInfo
init {
}
override fun onCleared() {
super.onCleared()

View file

@ -125,9 +125,7 @@ class MeetingsListViewModel @UiThread constructor() : AbstractTopBarViewModel()
TimestampUtils.isAfterToday(it.timestamp)
}
Log.i("$TAG $firstMeetingAfterToday")
if (firstMeetingAfterToday != null) {
firstMeetingAfterToday.displayTodayIndicator.postValue(true)
}
firstMeetingAfterToday?.displayTodayIndicator?.postValue(true)
}
meetings.postValue(list)

View file

@ -34,9 +34,9 @@ class AccountSettingsFragment : GenericFragment() {
private val dropdownListener = object : AdapterView.OnItemSelectedListener {
override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
val transport = viewModel.availableTransports[position]
val transportType = when {
transport == TransportType.Tcp.name.uppercase(Locale.getDefault()) -> TransportType.Tcp
transport == TransportType.Tls.name.uppercase(Locale.getDefault()) -> TransportType.Tls
val transportType = when (transport) {
TransportType.Tcp.name.uppercase(Locale.getDefault()) -> TransportType.Tcp
TransportType.Tls.name.uppercase(Locale.getDefault()) -> TransportType.Tls
else -> TransportType.Udp
}
Log.i("$TAG Selected transport updated [$transport] -> [${transportType.name}]")

View file

@ -115,7 +115,7 @@ class AccountProfileViewModel @UiThread constructor() : ViewModel() {
val prefix = account.params.internationalPrefix
if (!prefix.isNullOrEmpty()) {
Log.i(
"$TAG Account [${account.params?.identityAddress?.asStringUriOnly()}] prefix is [$prefix]"
"$TAG Account [${account.params.identityAddress?.asStringUriOnly()}] prefix is [$prefix]"
)
val dialPlan = Factory.instance().dialPlans.find {
it.countryCallingCode == prefix

View file

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false"
android:color="@color/gray_main2_100" />
<item android:state_pressed="true"
android:color="@color/gray_main2_100" />
<item
android:color="@color/white"/>
</selector>

View file

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<corners android:topLeftRadius="20dp" android:bottomRightRadius="20dp"/>
<solid android:color="@color/gray_main2_600"/>
</shape>

View file

@ -41,7 +41,7 @@
android:layout_width="@dimen/landscape_nav_bar_width"
android:layout_height="match_parent"
layout="@layout/bottom_nav_bar"
viewModel="@{viewModel}"
bind:viewModel="@{viewModel}"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent" />

View file

@ -41,7 +41,7 @@
android:layout_width="@dimen/landscape_nav_bar_width"
android:layout_height="match_parent"
layout="@layout/bottom_nav_bar"
viewModel="@{viewModel}"
bind:viewModel="@{viewModel}"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent" />

View file

@ -47,7 +47,7 @@
android:layout_width="@dimen/landscape_nav_bar_width"
android:layout_height="match_parent"
layout="@layout/bottom_nav_bar"
viewModel="@{viewModel}"
bind:viewModel="@{viewModel}"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent" />

View file

@ -44,7 +44,7 @@
android:layout_width="@dimen/landscape_nav_bar_width"
android:layout_height="match_parent"
layout="@layout/bottom_nav_bar"
viewModel="@{viewModel}"
bind:viewModel="@{viewModel}"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent" />

View file

@ -1,11 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.AppCompatTextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
style="@style/default_text_style"
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="40dp"
android:text="🇫🇷 +33"
android:background="@color/white"
android:gravity="center_vertical"
android:paddingStart="20dp"
android:paddingEnd="20dp"/>
android:paddingEnd="20dp"
tools:ignore="HardcodedText" />

View file

@ -1,6 +1,7 @@
<?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:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<data>
<import type="android.view.View" />
@ -20,7 +21,8 @@
android:focusable="true"
app:behavior_hideable="true"
app:behavior_peekHeight="0dp"
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior"
tools:ignore="HardcodedText">
<com.google.android.material.bottomsheet.BottomSheetDragHandleView
android:id="@+id/handle"

View file

@ -1,7 +1,7 @@
<?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">
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:bind="http://schemas.android.com/tools">
<data>
<import type="android.view.View" />
@ -174,7 +174,7 @@
android:layout_height="wrap_content"
android:visibility="@{model.meetingFound ? View.VISIBLE : View.GONE, default=gone}"
android:layout="@layout/chat_bubble_meeting_invite_content"
model="@{model}"/>
bind:model="@{model}"/>
<ViewStub
android:id="@+id/voice_record"
@ -182,7 +182,7 @@
android:layout_height="wrap_content"
android:visibility="@{model.isVoiceRecord ? View.VISIBLE : View.GONE, default=gone}"
android:layout="@layout/chat_bubble_voice_record_content"
model="@{model}" />
bind:model="@{model}" />
<org.linphone.ui.main.chat.view.ChatBubbleTextView
style="@style/default_text_style"

View file

@ -1,6 +1,7 @@
<?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:app="http://schemas.android.com/apk/res-auto"
xmlns:bind="http://schemas.android.com/tools">
<data>
<import type="android.view.View" />
@ -164,7 +165,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/bottom_barrier"
model="@{model}"
bind:model="@{model}"
layout="@layout/chat_bubble_outgoing"/>
<include
@ -178,7 +179,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/bottom_barrier"
model="@{model}"
bind:model="@{model}"
layout="@layout/chat_bubble_incoming"/>
<View
@ -273,7 +274,7 @@
<include
android:id="@+id/emoji_picker_bottom_sheet"
layout="@layout/chat_bubble_emoji_picker_bottom_sheet"
model="@{model}"/>
bind:model="@{model}"/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View file

@ -1,7 +1,7 @@
<?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">
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:bind="http://schemas.android.com/tools">
<data>
<import type="android.view.View" />
@ -136,7 +136,7 @@
android:layout_height="wrap_content"
android:visibility="@{model.meetingFound ? View.VISIBLE : View.GONE, default=gone}"
android:layout="@layout/chat_bubble_meeting_invite_content"
model="@{model}"/>
bind:model="@{model}"/>
<ViewStub
android:id="@+id/voice_record"
@ -144,7 +144,7 @@
android:layout_height="wrap_content"
android:visibility="@{model.isVoiceRecord ? View.VISIBLE : View.GONE, default=gone}"
android:layout="@layout/chat_bubble_voice_record_content"
model="@{model}" />
bind:model="@{model}" />
<org.linphone.ui.main.chat.view.ChatBubbleTextView
style="@style/default_text_style"

View file

@ -1,6 +1,7 @@
<?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:app="http://schemas.android.com/apk/res-auto"
xmlns:bind="http://schemas.android.com/tools">
<data>
<import type="android.view.View" />
@ -233,8 +234,8 @@
<include
android:id="@+id/send_area"
openFilePickerClickListener="@{openFilePickerClickListener}"
viewModel="@{sendMessageViewModel}"
bind:openFilePickerClickListener="@{openFilePickerClickListener}"
bind:viewModel="@{sendMessageViewModel}"
android:visibility="@{viewModel.isReadOnly ? View.GONE : View.VISIBLE}"
layout="@layout/chat_conversation_send_area_bottom_sheet"/>

View file

@ -1,7 +1,7 @@
<?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:bind="http://schemas.android.com/tools">
<data>
<import type="android.view.View" />
@ -30,14 +30,14 @@
<include
android:id="@+id/reply_area"
layout="@layout/chat_conversation_reply_area"
viewModel="@{viewModel}"
bind:viewModel="@{viewModel}"
android:visibility="@{viewModel.isReplying ? View.VISIBLE : View.GONE, default=gone}"
app:layout_constraintTop_toTopOf="parent" />
<include
android:id="@+id/attachments"
layout="@layout/chat_conversation_attachments_area"
viewModel="@{viewModel}"
bind:viewModel="@{viewModel}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="@{viewModel.isFileAttachmentsListOpen ? View.VISIBLE : View.GONE, default=gone}"
@ -46,7 +46,7 @@
<include
android:id="@+id/participants"
layout="@layout/chat_conversation_participants_area"
viewModel="@{viewModel}"
bind:viewModel="@{viewModel}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="@{viewModel.isParticipantsListOpen ? View.VISIBLE : View.GONE, default=gone}"
@ -170,7 +170,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
layout="@layout/chat_conversation_record_voice_message_area"
viewModel="@{viewModel}"
bind:viewModel="@{viewModel}"
android:visibility="@{viewModel.voiceRecording ? View.VISIBLE : View.GONE, default=gone}"
app:layout_constraintTop_toTopOf="@id/message_area_background"
app:layout_constraintBottom_toBottomOf="@id/message_area_background"/>

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:android="http://schemas.android.com/apk/res/android">
<data>
<import type="android.view.View" />

View file

@ -94,7 +94,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
layout="@layout/bottom_nav_bar"
viewModel="@{viewModel}"
bind:viewModel="@{viewModel}"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent" />

View file

@ -148,7 +148,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
layout="@layout/bottom_nav_bar"
viewModel="@{viewModel}"
bind:viewModel="@{viewModel}"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent" />

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:bind="http://schemas.android.com/tools">
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<import type="android.view.View" />

View file

@ -1,11 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.AppCompatTextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
style="@style/default_text_style"
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="40dp"
android:text="UDP"
android:background="@color/white"
android:gravity="center_vertical"
android:paddingStart="20dp"
android:paddingEnd="20dp"/>
android:paddingEnd="20dp"
tools:ignore="HardcodedText" />

View file

@ -113,7 +113,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
layout="@layout/bottom_nav_bar"
viewModel="@{viewModel}"
bind:viewModel="@{viewModel}"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent" />

View file

@ -1,6 +1,7 @@
<?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:app="http://schemas.android.com/apk/res-auto"
xmlns:bind="http://schemas.android.com/tools">
<data>
<import type="android.view.View" />

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<layout
<layout xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android">
<data>
@ -15,9 +15,11 @@
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:text="October"
android:textSize="20sp"
android:textColor="@color/gray_main2_600"
android:gravity="center_vertical"/>
android:gravity="center_vertical"
tools:ignore="HardcodedText" />
</layout>

View file

@ -110,7 +110,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
layout="@layout/bottom_nav_bar"
viewModel="@{viewModel}"
bind:viewModel="@{viewModel}"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent" />

View file

@ -1,6 +1,7 @@
<?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:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<data>
<import type="android.view.View" />
@ -20,7 +21,8 @@
android:focusable="true"
app:behavior_hideable="true"
app:behavior_peekHeight="0dp"
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior"
tools:ignore="HardcodedText">
<com.google.android.material.bottomsheet.BottomSheetDragHandleView
android:id="@+id/handle"

View file

@ -3,6 +3,5 @@
<dimen name="sliding_pane_left_fragment_width">450dp</dimen>
<dimen name="call_main_actions_menu_height">110dp</dimen>
<dimen name="call_extra_actions_menu_height">125dp</dimen>
<dimen name="call_all_actions_menu_height">235dp</dimen> <!-- sum of above two -->
</resources>

View file

@ -43,7 +43,6 @@
<dimen name="call_top_bar_text_height">28dp</dimen>
<dimen name="call_top_bar_info_height">48dp</dimen> <!-- Size of top text + top & bottom margins -->
<dimen name="call_main_actions_menu_height">110dp</dimen>
<dimen name="call_extra_actions_menu_height">235dp</dimen>
<dimen name="call_all_actions_menu_height">345dp</dimen> <!-- sum of above two -->
<dimen name="call_main_actions_menu_margin">120dp</dimen>
<dimen name="call_round_corners_texture_view_radius">20dp</dimen>
@ -63,9 +62,6 @@
<dimen name="chat_bubble_grouped_top_margin">4dp</dimen>
<dimen name="chat_bubble_top_margin">16dp</dimen>
<dimen name="chat_bubble_long_press_menu_bubble_offset">110dp</dimen>
<dimen name="chat_bubble_text_padding_with_bubble">12dp</dimen>
<dimen name="chat_bubble_text_padding_with_status">5dp</dimen>
<dimen name="chat_bubble_long_press_emoji_reaction_size">30sp</dimen>
<dimen name="chat_bubble_grid_image_size">88dp</dimen>
<dimen name="chat_bubble_big_image_max_size">150dp</dimen>

View file

@ -39,7 +39,6 @@
<string name="sip_address">SIP address</string>
<string name="sip_address_display_name">Display name</string>
<string name="sip_address_domain">Domain</string>
<string name="cancel">Cancel</string>
<string name="username">Username</string>
<string name="password">Password</string>
<string name="phone_number">Phone number</string>
@ -139,8 +138,7 @@
<string name="assistant_account_login">Login</string>
<string name="assistant_scan_qr_code">Scan QR code</string>
<string name="assistant_qr_code_provisioning_done">Configuration successfully applied</string>
<string name="assistant_qr_code_provisioning_error">Remote configuration failed!</string>
<string name="assistant_qr_code_provisioning_done">Configuration successfully applied</string>+
<string name="assistant_login_third_party_sip_account">Use a third party SIP account</string>
<string name="assistant_login_using_single_sign_on">Single sign on</string>
<string name="assistant_no_account_yet">No account yet?</string>