From 62139047b3cd600f5d5943486b0952f1befb66d5 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Mon, 18 Sep 2023 15:45:10 +0200 Subject: [PATCH] Various UI changes --- .../viewmodel/AccountCreationViewModel.kt | 3 -- .../ui/main/help/viewmodel/HelpViewModel.kt | 2 +- .../settings/viewmodel/SettingsViewModel.kt | 4 +- .../main/viewmodel/AbstractTopBarViewModel.kt | 34 ++++++++++++++++- .../main/java/org/linphone/utils/AppUtils.kt | 6 +-- app/src/main/res/color/switch_track_color.xml | 5 +++ app/src/main/res/drawable/incoming_call.xml | 20 ++++------ .../res/drawable/incoming_call_missed.xml | 20 ++++------ app/src/main/res/drawable/outgoing_call.xml | 20 ++++------ .../res/drawable/outgoing_call_missed.xml | 20 ++++------ .../shape_circle_white_background.xml | 2 +- .../shape_circle_white_pressed_background.xml | 2 +- ...shadow.xml => shape_dialog_background.xml} | 6 +-- .../shape_squircle_primary_background.xml | 5 --- .../drawable/shape_toast_blue_background.xml | 6 +++ .../drawable/shape_toast_green_background.xml | 6 +++ .../res/drawable/shape_toast_green_shadow.xml | 17 --------- .../drawable/shape_toast_red_background.xml | 6 +++ .../res/drawable/shape_toast_red_shadow.xml | 17 --------- .../res/layout/account_profile_fragment.xml | 1 + ...third_party_sip_account_login_fragment.xml | 15 +++++++- .../res/layout/call_history_list_cell.xml | 6 +-- app/src/main/res/layout/call_start_numpad.xml | 17 +++++---- .../dialog_account_modes_explanation.xml | 12 +----- ...assistant_accept_conditions_and_policy.xml | 12 +----- ...nt_create_account_confirm_phone_number.xml | 12 +----- .../layout/dialog_cancel_contact_changes.xml | 12 +----- .../res/layout/dialog_confirm_zrtp_sas.xml | 12 +----- .../dialog_contact_confirm_trust_call.xml | 12 +----- .../layout/dialog_contact_trust_process.xml | 12 +----- .../layout/dialog_pick_number_or_address.xml | 12 +----- .../main/res/layout/dialog_remove_account.xml | 12 +----- .../layout/dialog_remove_all_call_logs.xml | 12 +----- .../main/res/layout/help_debug_fragment.xml | 1 + .../main/res/layout/operation_in_progress.xml | 38 ++++++++++++++++--- app/src/main/res/layout/settings_fragment.xml | 10 +++++ app/src/main/res/layout/toast.xml | 2 +- .../res/layout/voip_active_call_fragment.xml | 4 +- .../layout/voip_incoming_call_fragment.xml | 4 +- .../layout/voip_outgoing_call_fragment.xml | 4 +- app/src/main/res/values/strings.xml | 6 +++ app/src/main/res/values/styles.xml | 5 +++ 42 files changed, 196 insertions(+), 238 deletions(-) create mode 100644 app/src/main/res/color/switch_track_color.xml rename app/src/main/res/drawable/{shape_toast_blue_shadow.xml => shape_dialog_background.xml} (69%) delete mode 100644 app/src/main/res/drawable/shape_squircle_primary_background.xml create mode 100644 app/src/main/res/drawable/shape_toast_blue_background.xml create mode 100644 app/src/main/res/drawable/shape_toast_green_background.xml delete mode 100644 app/src/main/res/drawable/shape_toast_green_shadow.xml create mode 100644 app/src/main/res/drawable/shape_toast_red_background.xml delete mode 100644 app/src/main/res/drawable/shape_toast_red_shadow.xml diff --git a/app/src/main/java/org/linphone/ui/assistant/viewmodel/AccountCreationViewModel.kt b/app/src/main/java/org/linphone/ui/assistant/viewmodel/AccountCreationViewModel.kt index f040822cc..741687c8e 100644 --- a/app/src/main/java/org/linphone/ui/assistant/viewmodel/AccountCreationViewModel.kt +++ b/app/src/main/java/org/linphone/ui/assistant/viewmodel/AccountCreationViewModel.kt @@ -312,7 +312,6 @@ class AccountCreationViewModel @UiThread constructor() : ViewModel(), CountryPic @UiThread fun confirmPhoneNumber() { - operationInProgress.value = true coreContext.postOnCoreThread { if (::accountCreator.isInitialized) { val prefix = internationalPrefix.value.orEmpty().trim() @@ -343,7 +342,6 @@ class AccountCreationViewModel @UiThread constructor() : ViewModel(), CountryPic Log.e( "$TAG Failed to compute phone number using international prefix [$digitsPrefix] and number [$number]" ) - operationInProgress.postValue(false) val error = AppUtils.getString( R.string.assistant_account_register_invalid_phone_number_error @@ -382,7 +380,6 @@ class AccountCreationViewModel @UiThread constructor() : ViewModel(), CountryPic } } phoneNumberError.postValue(error) - operationInProgress.postValue(false) } } else { Log.e("$TAG Account creator hasn't been initialized!") diff --git a/app/src/main/java/org/linphone/ui/main/help/viewmodel/HelpViewModel.kt b/app/src/main/java/org/linphone/ui/main/help/viewmodel/HelpViewModel.kt index a0586da94..3800fc4ca 100644 --- a/app/src/main/java/org/linphone/ui/main/help/viewmodel/HelpViewModel.kt +++ b/app/src/main/java/org/linphone/ui/main/help/viewmodel/HelpViewModel.kt @@ -165,7 +165,7 @@ class HelpViewModel @UiThread constructor() : ViewModel() { fun checkForUpdate() { val currentVersion = version.value.orEmpty() coreContext.postOnCoreThread { core -> - Log.i("[$TAG] Checking for update using current version [$currentVersion]") + Log.i("$TAG Checking for update using current version [$currentVersion]") core.checkForUpdate(currentVersion) } } diff --git a/app/src/main/java/org/linphone/ui/main/settings/viewmodel/SettingsViewModel.kt b/app/src/main/java/org/linphone/ui/main/settings/viewmodel/SettingsViewModel.kt index a544b0c98..54b7ca6d2 100644 --- a/app/src/main/java/org/linphone/ui/main/settings/viewmodel/SettingsViewModel.kt +++ b/app/src/main/java/org/linphone/ui/main/settings/viewmodel/SettingsViewModel.kt @@ -54,8 +54,8 @@ class SettingsViewModel @UiThread constructor() : ViewModel() { val isVibrationAvailable = MutableLiveData() init { - expandCalls.value = true - expandNetwork.value = true + expandCalls.value = false + expandNetwork.value = false expandUserInterface.value = false val vibrator = coreContext.context.getSystemService(Vibrator::class.java) diff --git a/app/src/main/java/org/linphone/ui/main/viewmodel/AbstractTopBarViewModel.kt b/app/src/main/java/org/linphone/ui/main/viewmodel/AbstractTopBarViewModel.kt index 4ea83961b..5ec42bc6a 100644 --- a/app/src/main/java/org/linphone/ui/main/viewmodel/AbstractTopBarViewModel.kt +++ b/app/src/main/java/org/linphone/ui/main/viewmodel/AbstractTopBarViewModel.kt @@ -24,11 +24,13 @@ import androidx.annotation.WorkerThread import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel import org.linphone.LinphoneApplication.Companion.coreContext +import org.linphone.R import org.linphone.core.Call import org.linphone.core.Core import org.linphone.core.CoreListenerStub import org.linphone.core.tools.Log import org.linphone.ui.main.model.AccountModel +import org.linphone.utils.AppUtils import org.linphone.utils.Event import org.linphone.utils.LinphoneUtils @@ -167,7 +169,7 @@ open class AbstractTopBarViewModel @UiThread constructor() : ViewModel() { callDisplayName.postValue( contact?.name ?: LinphoneUtils.getDisplayName(currentCall.remoteAddress) ) - callStatus.postValue(currentCall.state.name) // TODO: improve text + callStatus.postValue(callStateToString(currentCall.state)) } else { val firstCall = core.calls.firstOrNull() if (firstCall != null) { @@ -177,10 +179,38 @@ open class AbstractTopBarViewModel @UiThread constructor() : ViewModel() { callDisplayName.postValue( contact?.name ?: LinphoneUtils.getDisplayName(firstCall.remoteAddress) ) - callStatus.postValue(firstCall.state.name) // TODO: improve text + callStatus.postValue(callStateToString(firstCall.state)) } } Log.i("$TAG At least a call, asking fragment to change status bar color") changeSystemTopBarColorToInCallEvent.postValue(Event(true)) } + + @WorkerThread + private fun callStateToString(state: Call.State): String { + return when (state) { + Call.State.IncomingEarlyMedia, Call.State.IncomingReceived -> { + AppUtils.getString(R.string.voip_call_state_incoming_received) + } + Call.State.OutgoingInit, Call.State.OutgoingProgress -> { + AppUtils.getString(R.string.voip_call_state_outgoing_progress) + } + Call.State.OutgoingRinging, Call.State.OutgoingEarlyMedia -> { + AppUtils.getString(R.string.voip_call_state_outgoing_ringing) + } + Call.State.Connected, Call.State.StreamsRunning, Call.State.Updating, Call.State.UpdatedByRemote -> { + AppUtils.getString(R.string.voip_call_state_connected) + } + Call.State.Pausing, Call.State.Paused, Call.State.PausedByRemote -> { + AppUtils.getString(R.string.voip_call_state_paused) + } + Call.State.End, Call.State.Released, Call.State.Error -> { + AppUtils.getString(R.string.voip_call_state_ended) + } + else -> { + // TODO: handle other states + "" + } + } + } } diff --git a/app/src/main/java/org/linphone/utils/AppUtils.kt b/app/src/main/java/org/linphone/utils/AppUtils.kt index 2f3d1bfed..a4bc15bee 100644 --- a/app/src/main/java/org/linphone/utils/AppUtils.kt +++ b/app/src/main/java/org/linphone/utils/AppUtils.kt @@ -107,7 +107,7 @@ class AppUtils { ) redToast.message = message redToast.icon = icon - redToast.shadowColor = R.drawable.shape_toast_red_shadow + redToast.shadowColor = R.drawable.shape_toast_red_background redToast.textColor = R.color.red_danger redToast.root.visibility = View.GONE return redToast @@ -128,7 +128,7 @@ class AppUtils { ) greenToast.message = message greenToast.icon = icon - greenToast.shadowColor = R.drawable.shape_toast_green_shadow + greenToast.shadowColor = R.drawable.shape_toast_green_background greenToast.textColor = R.color.green_online greenToast.root.visibility = View.GONE return greenToast @@ -149,7 +149,7 @@ class AppUtils { ) blueToast.message = message blueToast.icon = icon - blueToast.shadowColor = R.drawable.shape_toast_blue_shadow + blueToast.shadowColor = R.drawable.shape_toast_blue_background blueToast.textColor = R.color.blue_trusted blueToast.root.visibility = View.GONE return blueToast diff --git a/app/src/main/res/color/switch_track_color.xml b/app/src/main/res/color/switch_track_color.xml new file mode 100644 index 000000000..bb693d14d --- /dev/null +++ b/app/src/main/res/color/switch_track_color.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/app/src/main/res/drawable/incoming_call.xml b/app/src/main/res/drawable/incoming_call.xml index 180b3616d..bfee4317d 100644 --- a/app/src/main/res/drawable/incoming_call.xml +++ b/app/src/main/res/drawable/incoming_call.xml @@ -1,13 +1,9 @@ - - + + diff --git a/app/src/main/res/drawable/incoming_call_missed.xml b/app/src/main/res/drawable/incoming_call_missed.xml index e9a9720e7..f825127ef 100644 --- a/app/src/main/res/drawable/incoming_call_missed.xml +++ b/app/src/main/res/drawable/incoming_call_missed.xml @@ -1,13 +1,9 @@ - - + + diff --git a/app/src/main/res/drawable/outgoing_call.xml b/app/src/main/res/drawable/outgoing_call.xml index 5f9b587a3..ee3e22fb3 100644 --- a/app/src/main/res/drawable/outgoing_call.xml +++ b/app/src/main/res/drawable/outgoing_call.xml @@ -1,13 +1,9 @@ - - + + diff --git a/app/src/main/res/drawable/outgoing_call_missed.xml b/app/src/main/res/drawable/outgoing_call_missed.xml index b1be1cfed..033723cf2 100644 --- a/app/src/main/res/drawable/outgoing_call_missed.xml +++ b/app/src/main/res/drawable/outgoing_call_missed.xml @@ -1,13 +1,9 @@ - - + + diff --git a/app/src/main/res/drawable/shape_circle_white_background.xml b/app/src/main/res/drawable/shape_circle_white_background.xml index b8f2da426..07f066002 100644 --- a/app/src/main/res/drawable/shape_circle_white_background.xml +++ b/app/src/main/res/drawable/shape_circle_white_background.xml @@ -1,5 +1,5 @@ - + \ No newline at end of file diff --git a/app/src/main/res/drawable/shape_circle_white_pressed_background.xml b/app/src/main/res/drawable/shape_circle_white_pressed_background.xml index f396103cd..032b95cad 100644 --- a/app/src/main/res/drawable/shape_circle_white_pressed_background.xml +++ b/app/src/main/res/drawable/shape_circle_white_pressed_background.xml @@ -1,5 +1,5 @@ - + \ No newline at end of file diff --git a/app/src/main/res/drawable/shape_toast_blue_shadow.xml b/app/src/main/res/drawable/shape_dialog_background.xml similarity index 69% rename from app/src/main/res/drawable/shape_toast_blue_shadow.xml rename to app/src/main/res/drawable/shape_dialog_background.xml index 3b7aeac5f..a9e6c9e4f 100644 --- a/app/src/main/res/drawable/shape_toast_blue_shadow.xml +++ b/app/src/main/res/drawable/shape_dialog_background.xml @@ -3,13 +3,13 @@ xmlns:android="http://schemas.android.com/apk/res/android"> - - + + - + diff --git a/app/src/main/res/drawable/shape_squircle_primary_background.xml b/app/src/main/res/drawable/shape_squircle_primary_background.xml deleted file mode 100644 index 823494dba..000000000 --- a/app/src/main/res/drawable/shape_squircle_primary_background.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/shape_toast_blue_background.xml b/app/src/main/res/drawable/shape_toast_blue_background.xml new file mode 100644 index 000000000..bd2efcbb7 --- /dev/null +++ b/app/src/main/res/drawable/shape_toast_blue_background.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/shape_toast_green_background.xml b/app/src/main/res/drawable/shape_toast_green_background.xml new file mode 100644 index 000000000..a4f85efa0 --- /dev/null +++ b/app/src/main/res/drawable/shape_toast_green_background.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/shape_toast_green_shadow.xml b/app/src/main/res/drawable/shape_toast_green_shadow.xml deleted file mode 100644 index 7fd80a5e1..000000000 --- a/app/src/main/res/drawable/shape_toast_green_shadow.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/shape_toast_red_background.xml b/app/src/main/res/drawable/shape_toast_red_background.xml new file mode 100644 index 000000000..04951e349 --- /dev/null +++ b/app/src/main/res/drawable/shape_toast_red_background.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/shape_toast_red_shadow.xml b/app/src/main/res/drawable/shape_toast_red_shadow.xml deleted file mode 100644 index 49899cc01..000000000 --- a/app/src/main/res/drawable/shape_toast_red_shadow.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/account_profile_fragment.xml b/app/src/main/res/layout/account_profile_fragment.xml index 2a3979531..4f26666c7 100644 --- a/app/src/main/res/layout/account_profile_fragment.xml +++ b/app/src/main/res/layout/account_profile_fragment.xml @@ -244,6 +244,7 @@ app:layout_constraintBottom_toBottomOf="@id/connection_bottom_anchor"/> + + diff --git a/app/src/main/res/layout/call_history_list_cell.xml b/app/src/main/res/layout/call_history_list_cell.xml index 4cd484af9..e1af9e6f6 100644 --- a/app/src/main/res/layout/call_history_list_cell.xml +++ b/app/src/main/res/layout/call_history_list_cell.xml @@ -19,8 +19,8 @@ diff --git a/app/src/main/res/layout/call_start_numpad.xml b/app/src/main/res/layout/call_start_numpad.xml index e8394dac8..37d2c4403 100644 --- a/app/src/main/res/layout/call_start_numpad.xml +++ b/app/src/main/res/layout/call_start_numpad.xml @@ -43,7 +43,7 @@ app:layout_constraintTop_toBottomOf="@id/handle" app:flow_horizontalStyle="spread" app:flow_wrapMode="aligned" - app:flow_verticalGap="16dp" + app:flow_verticalGap="10dp" app:flow_maxElementsWrap="3" app:constraint_referenced_ids="digit_1, digit_2, digit_3, digit_4, digit_5, digit_6, digit_7, digit_8, digit_9, digit_star, digit_0, digit_sharp" /> @@ -172,13 +172,14 @@ android:id="@+id/call" android:onClick="@{() -> model.onCallClicked()}" android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginTop="16dp" - android:layout_marginBottom="21dp" + android:layout_height="@dimen/voip_button_size" + android:paddingStart="30dp" + android:paddingTop="15dp" + android:paddingEnd="30dp" + android:paddingBottom="15dp" android:src="@drawable/phone" - android:padding="15dp" android:elevation="3dp" - android:background="@drawable/circle_green_button_background" + android:background="@drawable/squircle_green_button_background" app:tint="@color/white" app:layout_constraintTop_toBottomOf="@id/flow" app:layout_constraintStart_toStartOf="parent" @@ -196,8 +197,8 @@ android:padding="20dp" android:elevation="3dp" app:layout_constraintTop_toBottomOf="@id/flow" - app:layout_constraintStart_toEndOf="@id/call" - app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="@id/digit_sharp" + app:layout_constraintEnd_toEndOf="@id/digit_sharp" app:layout_constraintBottom_toBottomOf="parent"/> diff --git a/app/src/main/res/layout/dialog_account_modes_explanation.xml b/app/src/main/res/layout/dialog_account_modes_explanation.xml index 554ba71de..dd135bf74 100644 --- a/app/src/main/res/layout/dialog_account_modes_explanation.xml +++ b/app/src/main/res/layout/dialog_account_modes_explanation.xml @@ -18,16 +18,6 @@ android:layout_width="match_parent" android:layout_height="match_parent"> - - - - - - - - - - - - - - - - - - - - - + android:background="@color/dialog_background" + android:visibility="@{visibility ? View.VISIBLE : View.GONE, default=gone}"> + + + android:indeterminate="true" + app:layout_constraintVertical_chainStyle="packed" + app:layout_constraintTop_toTopOf="@id/dialog_background" + app:layout_constraintStart_toStartOf="@id/dialog_background" + app:layout_constraintEnd_toEndOf="@id/dialog_background" + app:layout_constraintBottom_toTopOf="@id/title"/> + android:layout_centerHorizontal="true" + app:layout_constraintTop_toBottomOf="@id/progress" + app:layout_constraintStart_toStartOf="@id/dialog_background" + app:layout_constraintEnd_toEndOf="@id/dialog_background" + app:layout_constraintBottom_toBottomOf="@id/dialog_background"/> - + \ No newline at end of file diff --git a/app/src/main/res/layout/settings_fragment.xml b/app/src/main/res/layout/settings_fragment.xml index 16e13c125..bb38dbaff 100644 --- a/app/src/main/res/layout/settings_fragment.xml +++ b/app/src/main/res/layout/settings_fragment.xml @@ -121,6 +121,7 @@ app:layout_constraintEnd_toStartOf="@id/echo_canceller_switch"/> Pause Pause Record + In progress + Ringing + Incoming + Active + Paused + Ended %s has reacted by %s to: %s diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index b1cd97adf..445f6632e 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -127,4 +127,9 @@ 1 end +