mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 03:18:06 +00:00
Added voicemail icon below 1 in dialpad & voicemail URI setting in account params to be called when long pressing voicemail icon in dialpad
This commit is contained in:
parent
27b1cf90c6
commit
899a3ea374
8 changed files with 143 additions and 58 deletions
|
|
@ -539,6 +539,8 @@ class CurrentCallViewModel @UiThread constructor() : GenericViewModel() {
|
|||
}
|
||||
}
|
||||
},
|
||||
{ // onVoicemailClicked
|
||||
},
|
||||
{ // OnBackspaceClicked
|
||||
removedCharacterAtCurrentPositionEvent.value = Event(true)
|
||||
},
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import org.linphone.core.tools.Log
|
|||
open class NumpadModel @UiThread constructor(
|
||||
private val inCallNumpad: Boolean,
|
||||
private val onDigitClicked: (value: String) -> (Unit),
|
||||
private val onVoicemailClicked: () -> (Unit),
|
||||
private val onBackspaceClicked: () -> (Unit),
|
||||
private val onCallClicked: () -> (Unit),
|
||||
private val onClearClicked: () -> (Unit)
|
||||
|
|
@ -49,12 +50,20 @@ open class NumpadModel @UiThread constructor(
|
|||
}
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun onDigitLongClicked(value: String): Boolean {
|
||||
Log.i("$TAG Long clicked on digit [$value]")
|
||||
onDigitClicked.invoke(value)
|
||||
return true
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun onVoicemailLongClicked(): Boolean {
|
||||
Log.i("$TAG Long clicked on voicemail icon")
|
||||
onVoicemailClicked.invoke()
|
||||
return true
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun onBackspaceClicked() {
|
||||
Log.i("$TAG Clicked on backspace")
|
||||
|
|
|
|||
|
|
@ -126,14 +126,24 @@ class StartCallViewModel @UiThread constructor() : AddressSelectionViewModel() {
|
|||
isNumpadVisible.value = false
|
||||
numpadModel = NumpadModel(
|
||||
false,
|
||||
{ digit ->
|
||||
// onDigitClicked
|
||||
{ digit -> // onDigitClicked
|
||||
appendDigitToSearchBarEvent.value = Event(digit)
|
||||
// Don't do that, cursor will stay at start
|
||||
// searchFilter.value = "${searchFilter.value.orEmpty()}$digit"
|
||||
},
|
||||
{
|
||||
// OnBackspaceClicked
|
||||
{ // onVoicemailClicked
|
||||
coreContext.postOnCoreThread { core ->
|
||||
val account = LinphoneUtils.getDefaultAccount()
|
||||
val voicemailAddress = account?.params?.voicemailAddress
|
||||
if (voicemailAddress != null) {
|
||||
Log.i("$TAG Calling voicemail URI [${voicemailAddress.asStringUriOnly()}]")
|
||||
coreContext.startCall(voicemailAddress)
|
||||
} else {
|
||||
Log.w("$TAG No voicemail URI configured for current account, nothing to do")
|
||||
}
|
||||
}
|
||||
},
|
||||
{ // OnBackspaceClicked
|
||||
removedCharacterAtCurrentPositionEvent.value = Event(true)
|
||||
},
|
||||
{ // OnCallClicked
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ class AccountSettingsViewModel @UiThread constructor() : GenericViewModel() {
|
|||
|
||||
val bundleModeEnabled = MutableLiveData<Boolean>()
|
||||
|
||||
val mwiUri = MutableLiveData<String>()
|
||||
val voicemailUri = MutableLiveData<String>()
|
||||
|
||||
val cpimInBasicChatRooms = MutableLiveData<Boolean>()
|
||||
|
|
@ -130,7 +131,8 @@ class AccountSettingsViewModel @UiThread constructor() : GenericViewModel() {
|
|||
|
||||
cpimInBasicChatRooms.postValue(params.isCpimInBasicChatRoomEnabled)
|
||||
|
||||
voicemailUri.postValue(params.mwiServerAddress?.asStringUriOnly().orEmpty())
|
||||
mwiUri.postValue(params.mwiServerAddress?.asStringUriOnly().orEmpty())
|
||||
voicemailUri.postValue(params.voicemailAddress?.asStringUriOnly().orEmpty())
|
||||
|
||||
expire.postValue(params.expires.toString())
|
||||
|
||||
|
|
@ -185,14 +187,22 @@ class AccountSettingsViewModel @UiThread constructor() : GenericViewModel() {
|
|||
|
||||
newParams.isCpimInBasicChatRoomEnabled = cpimInBasicChatRooms.value == true
|
||||
|
||||
val mwiUri = voicemailUri.value.orEmpty()
|
||||
if (mwiUri.isNotEmpty()) {
|
||||
val mwiAddress = core.interpretUrl(mwiUri, false)
|
||||
val mwi = mwiUri.value.orEmpty()
|
||||
if (mwi.isNotEmpty()) {
|
||||
val mwiAddress = core.interpretUrl(mwi, false)
|
||||
newParams.mwiServerAddress = mwiAddress
|
||||
} else {
|
||||
newParams.mwiServerAddress = null
|
||||
}
|
||||
|
||||
val voicemail = voicemailUri.value.orEmpty()
|
||||
if (voicemail.isNotEmpty()) {
|
||||
val voicemailAddress = core.interpretUrl(voicemail, false)
|
||||
newParams.voicemailAddress = voicemailAddress
|
||||
} else {
|
||||
newParams.voicemailAddress = null
|
||||
}
|
||||
|
||||
val expire = expire.value.orEmpty()
|
||||
val expireInt = if (expire.isEmpty()) {
|
||||
31536000
|
||||
|
|
|
|||
|
|
@ -129,6 +129,39 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/im_encryption_mandatory_switch"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/settings_title_style"
|
||||
android:id="@+id/voicemail_uri_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:text="@string/account_settings_voicemail_uri_title"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"
|
||||
app:layout_constraintTop_toBottomOf="@id/im_encryption_mandatory_switch"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatEditText
|
||||
style="@style/default_text_style"
|
||||
android:id="@+id/voicemail_uri"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:background="@drawable/edit_text_background"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:text="@={viewModel.voicemailUri}"
|
||||
android:inputType="text|textUri"
|
||||
android:hint="@string/account_settings_voicemail_uri_title"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/voicemail_uri_title" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/settings_title_style"
|
||||
android:id="@+id/mwi_uri_title"
|
||||
|
|
@ -140,7 +173,7 @@
|
|||
android:text="@string/account_settings_mwi_uri_title"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"
|
||||
app:layout_constraintTop_toBottomOf="@id/im_encryption_mandatory_switch"
|
||||
app:layout_constraintTop_toBottomOf="@id/voicemail_uri"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
||||
|
|
@ -155,7 +188,7 @@
|
|||
android:background="@drawable/edit_text_background"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:text="@={viewModel.voicemailUri}"
|
||||
android:text="@={viewModel.mwiUri}"
|
||||
android:inputType="text|textUri"
|
||||
android:hint="@string/account_settings_mwi_uri_title"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
|
|
|||
|
|
@ -36,28 +36,21 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<androidx.constraintlayout.helper.widget.Flow
|
||||
android:id="@+id/flow"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="14dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/handle"
|
||||
app:flow_horizontalStyle="spread"
|
||||
app:flow_wrapMode="aligned"
|
||||
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" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:onClick="@{() -> model.onDigitClicked(`1`)}"
|
||||
android:onLongClick="@{() -> model.onVoicemailLongClicked()}"
|
||||
style="@style/call_start_numpad_digits_style"
|
||||
android:id="@+id/digit_1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:text="1"
|
||||
app:layout_constraintTop_toBottomOf="@id/handle"
|
||||
app:layout_constraintStart_toStartOf="parent"/>
|
||||
android:textSize="24sp"
|
||||
android:drawableBottom="@drawable/voicemail"
|
||||
android:paddingBottom="5dp"
|
||||
app:layout_constraintTop_toTopOf="@id/digit_2"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/digit_2"
|
||||
app:layout_constraintBottom_toBottomOf="@id/digit_2"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:onClick="@{() -> model.onDigitClicked(`2`)}"
|
||||
|
|
@ -65,9 +58,13 @@
|
|||
android:id="@+id/digit_2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="14dp"
|
||||
android:text="2"
|
||||
app:layout_constraintVertical_chainStyle="packed"
|
||||
app:layout_constraintTop_toBottomOf="@id/handle"
|
||||
app:layout_constraintStart_toStartOf="parent"/>
|
||||
app:layout_constraintStart_toEndOf="@id/digit_1"
|
||||
app:layout_constraintEnd_toStartOf="@id/digit_3"
|
||||
app:layout_constraintBottom_toTopOf="@id/digit_5"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:onClick="@{() -> model.onDigitClicked(`3`)}"
|
||||
|
|
@ -76,8 +73,10 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="3"
|
||||
app:layout_constraintTop_toBottomOf="@id/handle"
|
||||
app:layout_constraintStart_toStartOf="parent"/>
|
||||
app:layout_constraintTop_toTopOf="@id/digit_2"
|
||||
app:layout_constraintStart_toEndOf="@id/digit_2"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="@id/digit_2"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:onClick="@{() -> model.onDigitClicked(`4`)}"
|
||||
|
|
@ -86,8 +85,10 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="4"
|
||||
app:layout_constraintTop_toBottomOf="@id/handle"
|
||||
app:layout_constraintStart_toStartOf="parent"/>
|
||||
app:layout_constraintTop_toTopOf="@id/digit_5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/digit_5"
|
||||
app:layout_constraintBottom_toBottomOf="@id/digit_5"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:onClick="@{() -> model.onDigitClicked(`5`)}"
|
||||
|
|
@ -95,9 +96,12 @@
|
|||
android:id="@+id/digit_5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="5"
|
||||
app:layout_constraintTop_toBottomOf="@id/handle"
|
||||
app:layout_constraintStart_toStartOf="parent"/>
|
||||
app:layout_constraintTop_toBottomOf="@id/digit_2"
|
||||
app:layout_constraintStart_toEndOf="@id/digit_4"
|
||||
app:layout_constraintEnd_toStartOf="@id/digit_6"
|
||||
app:layout_constraintBottom_toTopOf="@id/digit_8"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:onClick="@{() -> model.onDigitClicked(`6`)}"
|
||||
|
|
@ -106,8 +110,10 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="6"
|
||||
app:layout_constraintTop_toBottomOf="@id/handle"
|
||||
app:layout_constraintStart_toStartOf="parent"/>
|
||||
app:layout_constraintTop_toTopOf="@id/digit_5"
|
||||
app:layout_constraintStart_toEndOf="@id/digit_5"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="@id/digit_5"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:onClick="@{() -> model.onDigitClicked(`7`)}"
|
||||
|
|
@ -116,8 +122,10 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="7"
|
||||
app:layout_constraintTop_toBottomOf="@id/handle"
|
||||
app:layout_constraintStart_toStartOf="parent"/>
|
||||
app:layout_constraintTop_toTopOf="@id/digit_8"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/digit_8"
|
||||
app:layout_constraintBottom_toBottomOf="@id/digit_8"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:onClick="@{() -> model.onDigitClicked(`8`)}"
|
||||
|
|
@ -125,9 +133,12 @@
|
|||
android:id="@+id/digit_8"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="8"
|
||||
app:layout_constraintTop_toBottomOf="@id/handle"
|
||||
app:layout_constraintStart_toStartOf="parent"/>
|
||||
app:layout_constraintTop_toBottomOf="@id/digit_5"
|
||||
app:layout_constraintStart_toEndOf="@id/digit_7"
|
||||
app:layout_constraintEnd_toStartOf="@id/digit_9"
|
||||
app:layout_constraintBottom_toTopOf="@id/digit_0"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:onClick="@{() -> model.onDigitClicked(`9`)}"
|
||||
|
|
@ -136,8 +147,10 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="9"
|
||||
app:layout_constraintTop_toBottomOf="@id/handle"
|
||||
app:layout_constraintStart_toStartOf="parent"/>
|
||||
app:layout_constraintTop_toTopOf="@id/digit_8"
|
||||
app:layout_constraintStart_toEndOf="@id/digit_8"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="@id/digit_8"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:onClick="@{() -> model.onDigitClicked(`*`)}"
|
||||
|
|
@ -146,8 +159,10 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="*"
|
||||
app:layout_constraintTop_toBottomOf="@id/handle"
|
||||
app:layout_constraintStart_toStartOf="parent"/>
|
||||
app:layout_constraintTop_toTopOf="@id/digit_0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/digit_0"
|
||||
app:layout_constraintBottom_toBottomOf="@id/digit_0"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:onClick="@{() -> model.onDigitClicked(`0`)}"
|
||||
|
|
@ -155,10 +170,14 @@
|
|||
style="@style/call_start_numpad_digits_style"
|
||||
android:id="@+id/digit_0"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:text="0"
|
||||
app:layout_constraintTop_toBottomOf="@id/handle"
|
||||
app:layout_constraintStart_toStartOf="parent"/>
|
||||
app:layout_constraintTop_toBottomOf="@id/digit_8"
|
||||
app:layout_constraintStart_toEndOf="@id/digit_star"
|
||||
app:layout_constraintEnd_toStartOf="@id/digit_sharp"
|
||||
app:layout_constraintBottom_toTopOf="@id/call"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:onClick="@{() -> model.onDigitClicked(`#`)}"
|
||||
|
|
@ -167,8 +186,10 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="#"
|
||||
app:layout_constraintTop_toBottomOf="@id/handle"
|
||||
app:layout_constraintStart_toStartOf="parent"/>
|
||||
app:layout_constraintTop_toTopOf="@id/digit_0"
|
||||
app:layout_constraintStart_toEndOf="@id/digit_0"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="@id/digit_0"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/call"
|
||||
|
|
@ -179,14 +200,15 @@
|
|||
android:paddingTop="15dp"
|
||||
android:paddingEnd="30dp"
|
||||
android:paddingBottom="15dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:src="@drawable/phone"
|
||||
android:contentDescription="@string/content_description_call_start"
|
||||
android:elevation="3dp"
|
||||
android:background="@drawable/squircle_green_button_background"
|
||||
app:tint="?attr/color_main2_000"
|
||||
app:layout_constraintTop_toBottomOf="@id/flow"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/digit_0"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
|
||||
<ImageView
|
||||
|
|
@ -194,17 +216,14 @@
|
|||
android:onClick="@{() -> model.onBackspaceClicked()}"
|
||||
android:onLongClick="@{() -> model.onBackspaceLongClicked()}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:layout_height="@dimen/call_button_size"
|
||||
android:src="@drawable/backspace_fill"
|
||||
android:contentDescription="@string/content_description_erase_last_input"
|
||||
android:padding="20dp"
|
||||
android:elevation="3dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/flow"
|
||||
android:padding="15dp"
|
||||
app:layout_constraintStart_toStartOf="@id/digit_sharp"
|
||||
app:layout_constraintEnd_toEndOf="@id/digit_sharp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
app:layout_constraintTop_toTopOf="@id/call"
|
||||
app:layout_constraintBottom_toBottomOf="@id/call"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
|
|
|||
|
|
@ -305,7 +305,8 @@
|
|||
<string name="account_settings_lime_server_url_title">URL du serveur d\'échange de clés de chiffrement</string>
|
||||
<string name="account_settings_bundle_mode_title">Mode "bundle"</string>
|
||||
<string name="account_settings_cpim_in_basic_conversations_title">Utiliser CPIM dans les conversations \"basiques\"</string>
|
||||
<string name="account_settings_mwi_uri_title">URI du serveur de messagerie vocale</string>
|
||||
<string name="account_settings_voicemail_uri_title">URI du serveur de messagerie vocale</string>
|
||||
<string name="account_settings_mwi_uri_title">URI du serveur MWI (Message Waiting Indicator)</string>
|
||||
<string name="account_settings_update_password_title">Mettre à jour le mot de passe</string>
|
||||
|
||||
<string name="account_settings_dialog_invalid_password_title">Autentification requise</string>
|
||||
|
|
|
|||
|
|
@ -342,7 +342,8 @@
|
|||
<string name="account_settings_lime_server_url_title">E2E encryption keys server URL</string>
|
||||
<string name="account_settings_bundle_mode_title">Bundle mode</string>
|
||||
<string name="account_settings_cpim_in_basic_conversations_title">Use CPIM in \"basic\" conversations</string>
|
||||
<string name="account_settings_mwi_uri_title">Voicemail URI</string>
|
||||
<string name="account_settings_voicemail_uri_title">Voicemail URI</string>
|
||||
<string name="account_settings_mwi_uri_title"> MWI server URI (Message Waiting Indicator)</string>
|
||||
<string name="account_settings_update_password_title">Update password</string>
|
||||
|
||||
<string name="account_settings_dialog_invalid_password_title">Authentication needed</string>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue