Dismiss ZRTP SAS validation dialog when clicking outside
This commit is contained in:
parent
42846e6b45
commit
dd1ec48cbd
3 changed files with 16 additions and 0 deletions
|
@ -23,6 +23,7 @@ import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import org.linphone.R
|
import org.linphone.R
|
||||||
import org.linphone.utils.AppUtils
|
import org.linphone.utils.AppUtils
|
||||||
|
import org.linphone.utils.Event
|
||||||
|
|
||||||
class DialogViewModel(val message: String, val title: String = "") : ViewModel() {
|
class DialogViewModel(val message: String, val title: String = "") : ViewModel() {
|
||||||
var showDoNotAskAgain: Boolean = false
|
var showDoNotAskAgain: Boolean = false
|
||||||
|
@ -41,6 +42,8 @@ class DialogViewModel(val message: String, val title: String = "") : ViewModel()
|
||||||
|
|
||||||
val doNotAskAgain = MutableLiveData<Boolean>()
|
val doNotAskAgain = MutableLiveData<Boolean>()
|
||||||
|
|
||||||
|
val dismissEvent = MutableLiveData<Event<Boolean>>()
|
||||||
|
|
||||||
init {
|
init {
|
||||||
doNotAskAgain.value = false
|
doNotAskAgain.value = false
|
||||||
showTitle = title.isNotEmpty()
|
showTitle = title.isNotEmpty()
|
||||||
|
@ -92,4 +95,8 @@ class DialogViewModel(val message: String, val title: String = "") : ViewModel()
|
||||||
fun onOkClicked() {
|
fun onOkClicked() {
|
||||||
onOk(doNotAskAgain.value == true)
|
onOk(doNotAskAgain.value == true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun dismiss() {
|
||||||
|
dismissEvent.value = Event(true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,6 +140,12 @@ class StatusFragment : GenericFragment<VoipStatusFragmentBinding>() {
|
||||||
getString(R.string.zrtp_dialog_ok_button_label)
|
getString(R.string.zrtp_dialog_ok_button_label)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
viewModel.dismissEvent.observe(viewLifecycleOwner) {
|
||||||
|
it.consume {
|
||||||
|
dialog.dismiss()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
zrtpDialog = dialog
|
zrtpDialog = dialog
|
||||||
dialog.show()
|
dialog.show()
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:onClick="@{() -> viewModel.dismiss()}"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
|
@ -24,6 +25,8 @@
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:id="@+id/background"
|
android:id="@+id/background"
|
||||||
|
android:clickable="true"
|
||||||
|
android:focusable="true"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_marginStart="10dp"
|
android:layout_marginStart="10dp"
|
||||||
|
|
Loading…
Reference in a new issue