Some small improvements

This commit is contained in:
Sylvain Berfini 2020-04-07 12:06:11 +02:00
parent 59b758e682
commit de389858ce
23 changed files with 119 additions and 132 deletions

View file

@ -60,7 +60,7 @@ class VideoZoomHelper(context: Context, private var videoDisplayView: View) : Ge
}
})
videoDisplayView.setOnTouchListener { v, event ->
videoDisplayView.setOnTouchListener { _, event ->
val currentZoomFactor = zoomFactor
scaleDetector.onTouchEvent(event)

View file

@ -128,7 +128,7 @@ class ChatRoomCreationViewModel : ErrorReportingViewModel() {
list.addAll(selectedAddresses.value.orEmpty())
val found = list.find {
if (address != null) it.weakEqual(address) else false
it.weakEqual(address)
}
if (found != null) {

View file

@ -34,6 +34,7 @@ import org.linphone.core.tools.Log
import org.linphone.utils.AppUtils
import org.linphone.utils.FileUtils
@Suppress("DEPRECATION")
@TargetApi(21)
class Api21Compatibility {
companion object {

View file

@ -29,6 +29,7 @@ import org.linphone.core.ChatRoom
import org.linphone.core.Content
import org.linphone.mediastream.Version
@Suppress("DEPRECATION")
class Compatibility {
companion object {
fun hasPermission(context: Context, permission: String): Boolean {

View file

@ -78,6 +78,7 @@ fun LinearLayout.setBackground(resource: Int) {
this.setBackgroundResource(resource)
}
@Suppress("DEPRECATION")
@BindingAdapter("style")
fun TextView.setStyle(resource: Int) {
this.setTextAppearance(context, resource)
@ -360,7 +361,7 @@ fun addEmailEditTextValidation(editText: EditText, enabled: Boolean) {
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) { }
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {
if (!Patterns.EMAIL_ADDRESS.matcher(s).matches()) {
editText.error = editText.context.getString(R.string.assistant_error_invalid_email_address)
}
@ -376,7 +377,7 @@ fun addUrlEditTextValidation(editText: EditText, enabled: Boolean) {
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) { }
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {
if (!Patterns.WEB_URL.matcher(s).matches()) {
editText.error = editText.context.getString(R.string.assistant_remote_provisioning_wrong_format)
}

View file

@ -201,8 +201,8 @@ class FileUtils {
return false
}
private fun createFile(fileName: String): File {
var fileName = fileName
private fun createFile(file: String): File {
var fileName = file
if (fileName.isEmpty()) fileName = getStartDate()
if (!fileName.contains(".")) {

View file

@ -34,6 +34,7 @@ class ImageUtils {
val roundBm: Bitmap?
if (fromPictureUri != null) {
bm = try {
@Suppress("DEPRECATION")
MediaStore.Images.Media.getBitmap(
context.contentResolver, fromPictureUri
)

View file

@ -105,6 +105,7 @@ private class RecyclerViewSwipeUtilsCallback(
top + icon.intrinsicHeight
)
@Suppress("DEPRECATION")
if (configuration.leftToRightAction.iconTint != 0) icon.setColorFilter(
configuration.leftToRightAction.iconTint,
PorterDuff.Mode.SRC_IN

View file

@ -157,8 +157,8 @@ class ShortcutsHelper(val context: Context) {
val localAddress = chatRoom.localAddress.asStringUriOnly()
val personsList = arrayListOf<Person>()
var subject = ""
var icon: IconCompat
val subject: String
val icon: IconCompat
if (chatRoom.hasCapability(ChatRoomCapabilities.Basic.toInt())) {
val contact =
coreContext.contactsManager.findContactByAddress(chatRoom.peerAddress)

View file

@ -83,7 +83,7 @@
android:adjustViewBounds="true"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:contentDescription="@string/content_description_app_logo"
android:contentDescription="@null"
android:src="@drawable/linphone_logo_tinted"/>
<ImageView
@ -91,7 +91,7 @@
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:layout_gravity="center"
android:contentDescription="@string/content_description_app_logo"
android:contentDescription="@null"
android:src="@drawable/linphone_app_name_logo" />
<TextView

View file

@ -142,6 +142,7 @@
android:layout_toRightOf="@id/tabs_fragment"
android:padding="30dp"
android:layout_centerHorizontal="true"
android:contentDescription="@null"
android:src="@drawable/dialer_background" />
</RelativeLayout>

View file

@ -86,7 +86,7 @@
android:adjustViewBounds="true"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:contentDescription="@string/content_description_app_logo"
android:contentDescription="@null"
android:src="@drawable/linphone_logo_tinted"/>
<ImageView
@ -94,7 +94,7 @@
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:layout_gravity="center"
android:contentDescription="@string/content_description_app_logo"
android:contentDescription="@null"
android:src="@drawable/linphone_app_name_logo" />
<TextView

View file

@ -41,7 +41,7 @@
android:src="@drawable/linphone_logo_tinted"
android:layout_width="150dp"
android:layout_height="150dp"
android:contentDescription="@string/content_description_app_logo"
android:contentDescription="@null"
android:layout_centerInParent="true"/>
<ProgressBar

View file

@ -110,43 +110,36 @@
android:layout_below="@id/phone_number_label"/>
<LinearLayout
android:orientation="vertical"
android:orientation="horizontal"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/select_country">
<LinearLayout
android:orientation="horizontal"
<EditText
assistantPhoneNumberPrefixValidation="@{true}"
android:background="@drawable/resizable_text_field"
android:textColor="@color/black_color"
android:inputType="phone"
android:text="@={viewModel.prefix}"
android:layout_marginRight="10dp"
android:gravity="center"
android:layout_width="65dp"
android:layout_height="wrap_content"
android:hint="@string/international_prefix"
android:maxLines="1"/>
<EditText
assistantPhoneNumberValidation="@{true}"
errorMessage="@={viewModel.phoneNumberError}"
android:text="@={viewModel.phoneNumber}"
android:background="@drawable/resizable_text_field"
android:textColor="@color/black_color"
android:inputType="phone"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
assistantPhoneNumberPrefixValidation="@{true}"
android:background="@drawable/resizable_text_field"
android:textColor="@color/black_color"
android:inputType="phone"
android:text="@={viewModel.prefix}"
android:layout_marginRight="10dp"
android:gravity="center"
android:layout_width="65dp"
android:layout_height="wrap_content"
android:hint="@string/international_prefix"
android:maxLines="1"/>
<EditText
assistantPhoneNumberValidation="@{true}"
errorMessage="@={viewModel.phoneNumberError}"
android:text="@={viewModel.phoneNumber}"
android:background="@drawable/resizable_text_field"
android:textColor="@color/black_color"
android:inputType="phone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/phone_number"
android:maxLines="1"/>
</LinearLayout>
android:layout_height="wrap_content"
android:hint="@string/phone_number"
android:maxLines="1"/>
</LinearLayout>

View file

@ -25,83 +25,77 @@
android:layout_alignParentTop="true"
tools:layout="@layout/assistant_top_bar_fragment" />
<RelativeLayout
<LinearLayout
android:layout_below="@id/top_bar_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="wrap_content"
android:gravity="center"
android:paddingLeft="30dp"
android:paddingRight="30dp"
android:orientation="vertical">
<LinearLayout
<TextView
style="@style/standard_text_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingLeft="30dp"
android:paddingRight="30dp"
android:orientation="vertical">
android:text="@string/assistant_remote_provisioning_title"
android:paddingTop="10dp"
android:textAllCaps="true" />
<TextView
style="@style/standard_text_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/assistant_remote_provisioning_title"
android:paddingTop="10dp"
android:textAllCaps="true" />
<TextView
style="@style/standard_small_text_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_gravity="top"
android:paddingTop="10dp"
android:text="@string/assistant_remote_provisioning_desc" />
<TextView
style="@style/standard_small_text_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_gravity="top"
android:paddingTop="10dp"
android:text="@string/assistant_remote_provisioning_desc" />
<TextView
android:text="@string/assistant_remote_provisioning_url"
style="@style/assistant_input_field_header_font"
android:textAllCaps="true"
android:paddingTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<TextView
android:text="@string/assistant_remote_provisioning_url"
style="@style/assistant_input_field_header_font"
android:textAllCaps="true"
android:paddingTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<EditText
errorMessage="@={viewModel.urlError}"
urlConfirmationValidation="@{true}"
android:text="@={viewModel.urlToFetch}"
android:background="@drawable/resizable_text_field"
android:textColor="@color/black_color"
android:inputType="textUri"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/assistant_remote_provisioning_url"
android:maxLines="1"/>
<EditText
errorMessage="@={viewModel.urlError}"
urlConfirmationValidation="@{true}"
android:text="@={viewModel.urlToFetch}"
android:background="@drawable/resizable_text_field"
android:textColor="@color/black_color"
android:inputType="textUri"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/assistant_remote_provisioning_url"
android:maxLines="1"/>
<TextView
android:onClick="@{() -> viewModel.fetchAndApply()}"
android:enabled="@{viewModel.fetchEnabled}"
android:text="@string/assistant_fetch_apply"
android:background="@drawable/assistant_button"
android:textColor="@drawable/assistant_button_text_color"
style="@style/button_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:layout_marginTop="20dp"/>
<TextView
android:onClick="@{() -> viewModel.fetchAndApply()}"
android:enabled="@{viewModel.fetchEnabled}"
android:text="@string/assistant_fetch_apply"
android:background="@drawable/assistant_button"
android:textColor="@drawable/assistant_button_text_color"
style="@style/button_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:layout_marginTop="20dp"/>
<TextView
android:onClick="@{qrCodeClickListener}"
android:text="@string/assistant_launch_qrcode"
android:background="@drawable/assistant_button"
android:textColor="@drawable/assistant_button_text_color"
style="@style/button_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:layout_marginTop="20dp"/>
<TextView
android:onClick="@{qrCodeClickListener}"
android:text="@string/assistant_launch_qrcode"
android:background="@drawable/assistant_button"
android:textColor="@drawable/assistant_button_text_color"
style="@style/button_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:layout_marginTop="20dp"/>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
<include
layout="@layout/wait_layout"

View file

@ -17,6 +17,7 @@
<LinearLayout
android:id="@+id/decline_button"
android:onClick="@{() -> viewModel.decline(!viewModel.screenLocked)}"
android:focusable="true"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
@ -49,14 +50,14 @@
<ImageView
android:src="@drawable/arrow_hangup"
android:contentDescription="@string/content_description_slide_right_hangup"
android:contentDescription="@null"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha="0.6"/>
<ImageView
android:src="@drawable/arrow_hangup"
android:contentDescription="@string/content_description_slide_right_hangup"
android:contentDescription="@null"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha="0.4"/>
@ -68,6 +69,7 @@
<LinearLayout
android:id="@+id/answer_button"
android:onClick="@{() -> viewModel.answer(!viewModel.screenLocked)}"
android:focusable="true"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
@ -87,14 +89,14 @@
<ImageView
android:src="@drawable/arrow_accept"
android:contentDescription="@string/content_description_slide_left_answer"
android:contentDescription="@null"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha="0.4"/>
<ImageView
android:src="@drawable/arrow_accept"
android:contentDescription="@string/content_description_slide_left_answer"
android:contentDescription="@null"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha="0.6"/>

View file

@ -32,7 +32,7 @@
<ImageView
android:id="@+id/caller_picture"
android:contentDescription="@string/content_description_contact_avatar"
android:contentDescription="@null"
android:layout_width="50dp"
android:layout_height="50dp"
android:adjustViewBounds="true"

View file

@ -77,7 +77,7 @@
android:adjustViewBounds="true"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp"
android:contentDescription="@string/content_description_ephemeral_message_logo"
android:contentDescription="@null"
android:src="@drawable/ephemeral_messages" />
<TextView

View file

@ -39,7 +39,7 @@
android:layout_height="35dp"
android:layout_alignParentLeft="true"
android:adjustViewBounds="true"
android:contentDescription="@string/content_description_group_chat_logo"
android:contentDescription="@null"
android:src="@{groupChatAvatarVisibility ? @drawable/chat_group_avatar : @drawable/avatar}"/>
<ImageView
@ -48,7 +48,7 @@
android:layout_height="35dp"
android:layout_alignParentLeft="true"
android:adjustViewBounds="true"
android:contentDescription="@string/content_description_contact_avatar"
android:contentDescription="@null"
android:src="@drawable/generated_avatar_bg" />
<TextView
@ -69,7 +69,7 @@
android:layout_height="35dp"
android:layout_alignParentLeft="true"
android:adjustViewBounds="true"
android:contentDescription="@string/content_description_contact_avatar"
android:contentDescription="@null"
app:glideAvatar="@{imagePath}" />
<ImageView

View file

@ -24,7 +24,7 @@
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:adjustViewBounds="true"
android:contentDescription="@string/content_description_contact_avatar"
android:contentDescription="@null"
android:src="@drawable/avatar"/>
<ImageView
@ -33,7 +33,7 @@
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:adjustViewBounds="true"
android:contentDescription="@string/content_description_contact_avatar"
android:contentDescription="@null"
android:src="@drawable/generated_avatar_bg" />
<TextView
@ -54,7 +54,7 @@
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:adjustViewBounds="true"
android:contentDescription="@string/content_description_contact_avatar"
android:contentDescription="@null"
app:glideAvatar="@{imagePath}" />
<ImageView
@ -62,6 +62,7 @@
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:adjustViewBounds="true"
android:contentDescription="@null"
android:src="@drawable/avatar_border" />
</RelativeLayout>

View file

@ -16,7 +16,7 @@
android:adjustViewBounds="true"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:contentDescription="@string/content_description_app_logo"
android:contentDescription="@null"
android:src="@drawable/linphone_logo_tinted"/>
<ImageView
@ -25,7 +25,7 @@
android:adjustViewBounds="true"
android:layout_marginBottom="50dp"
android:layout_gravity="center"
android:contentDescription="@string/content_description_app_logo"
android:contentDescription="@null"
android:src="@drawable/linphone_app_name_logo" />
<TextView

View file

@ -481,13 +481,9 @@
<string name="operation_in_progress_wait">Operation in progress, please wait</string>
<!-- Content description -->
<string name="content_description_app_logo">&appName; logo</string>
<string name="content_description_ephemeral_message_logo">Ephemeral message logo</string>
<string name="content_description_group_chat_logo">Group conversation logo</string>
<string name="content_description_add_sip_address_field">Add a SIP address field</string>
<string name="content_description_add_phone_number_field">Add a phone number field</string>
<string name="content_description_go_back">Go back</string>
<string name="content_description_contact_avatar">Contact avatar</string>
<string name="content_description_phone_number_use">Show what your phone number will be used for</string>
<string name="content_description_clear_field">Empty the text field next to it</string>
<string name="content_description_switch_camera">Switch from front camera to back and vice versa</string>

View file

@ -60,11 +60,6 @@
<!-- Assistant related -->
<style name="assistant_input_field_error_font" parent="@android:style/TextAppearance.Small">
<item name="android:textColor">@color/red_color</item>
<item name="android:textSize">14sp</item>
</style>
<style name="assistant_input_field_header_font" parent="@android:style/TextAppearance.Medium">
<item name="android:textColor">?attr/primarySubtextLightColor</item>
<item name="android:textSize">13sp</item>