mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-20 20:19:42 +01:00
Don't show toast when dismiss the recording stop dialog
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
869dc86757
commit
5cc2a6d531
@ -397,8 +397,10 @@ public class CallActivity extends CallBaseActivity {
|
||||
callRecordingViewModel.getViewState().observe(this, viewState -> {
|
||||
if (viewState instanceof CallRecordingViewModel.RecordingStartedState) {
|
||||
binding.callRecordingIndicator.setVisibility(View.VISIBLE);
|
||||
if (((CallRecordingViewModel.RecordingStartedState) viewState).getShowStartedInfo()) {
|
||||
VibrationUtils.INSTANCE.vibrateShort(context);
|
||||
Toast.makeText(context, context.getResources().getString(R.string.record_active_info), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
} else if (viewState instanceof CallRecordingViewModel.RecordingConfirmStopState) {
|
||||
MaterialAlertDialogBuilder dialogBuilder = new MaterialAlertDialogBuilder(this)
|
||||
.setTitle(R.string.record_stop_confirm_title)
|
||||
@ -2598,8 +2600,9 @@ public class CallActivity extends CallBaseActivity {
|
||||
}
|
||||
|
||||
/**
|
||||
* Temporary implementation of SignalingMessageReceiver until signaling related code is extracted from CallActivity.
|
||||
*
|
||||
* Temporary implementation of SignalingMessageReceiver until signaling related code is extracted from
|
||||
* CallActivity.
|
||||
* <p>
|
||||
* All listeners are called in the main thread.
|
||||
*/
|
||||
private static class InternalSignalingMessageReceiver extends SignalingMessageReceiver {
|
||||
@ -2794,7 +2797,7 @@ public class CallActivity extends CallBaseActivity {
|
||||
|
||||
/**
|
||||
* Adds the local participant nick to offers and answers.
|
||||
*
|
||||
* <p>
|
||||
* For legacy reasons the offers and answers sent when the internal signaling server is used are expected to
|
||||
* provide the nick of the local participant.
|
||||
*
|
||||
|
@ -42,7 +42,8 @@ class CallRecordingViewModel @Inject constructor(private val repository: CallRec
|
||||
lateinit var roomToken: String
|
||||
|
||||
sealed interface ViewState
|
||||
object RecordingStartedState : ViewState
|
||||
open class RecordingStartedState(val showStartedInfo: Boolean) : ViewState
|
||||
|
||||
object RecordingStoppedState : ViewState
|
||||
object RecordingStartLoadingState : ViewState
|
||||
object RecordingStopLoadingState : ViewState
|
||||
@ -57,7 +58,7 @@ class CallRecordingViewModel @Inject constructor(private val repository: CallRec
|
||||
|
||||
fun clickRecordButton() {
|
||||
when (viewState.value) {
|
||||
RecordingStartedState -> {
|
||||
is RecordingStartedState -> {
|
||||
_viewState.value = RecordingConfirmStopState
|
||||
}
|
||||
RecordingStoppedState -> {
|
||||
@ -92,7 +93,7 @@ class CallRecordingViewModel @Inject constructor(private val repository: CallRec
|
||||
}
|
||||
|
||||
fun dismissStopRecording() {
|
||||
_viewState.value = RecordingStartedState
|
||||
_viewState.value = RecordingStartedState(false)
|
||||
}
|
||||
|
||||
override fun onCleared() {
|
||||
@ -108,8 +109,8 @@ class CallRecordingViewModel @Inject constructor(private val repository: CallRec
|
||||
fun setRecordingState(state: Int) {
|
||||
when (state) {
|
||||
RECORDING_STOPPED_CODE -> _viewState.value = RecordingStoppedState
|
||||
RECORDING_STARTED_VIDEO_CODE -> _viewState.value = RecordingStartedState
|
||||
RECORDING_STARTED_AUDIO_CODE -> _viewState.value = RecordingStartedState
|
||||
RECORDING_STARTED_VIDEO_CODE -> _viewState.value = RecordingStartedState(true)
|
||||
RECORDING_STARTED_AUDIO_CODE -> _viewState.value = RecordingStartedState(true)
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,9 @@ class CallRecordingViewModelTest : AbstractViewModelTest() {
|
||||
val viewModel = CallRecordingViewModel(repository)
|
||||
viewModel.setData("foo")
|
||||
viewModel.setRecordingState(CallRecordingViewModel.RECORDING_STARTED_VIDEO_CODE)
|
||||
|
||||
Assert.equals(true, (viewModel.viewState.value as CallRecordingViewModel.RecordingStartedState).showStartedInfo)
|
||||
|
||||
viewModel.clickRecordButton()
|
||||
|
||||
Assert.equals(CallRecordingViewModel.RecordingConfirmStopState, viewModel.viewState.value)
|
||||
@ -43,6 +46,9 @@ class CallRecordingViewModelTest : AbstractViewModelTest() {
|
||||
val viewModel = CallRecordingViewModel(repository)
|
||||
viewModel.setData("foo")
|
||||
viewModel.setRecordingState(CallRecordingViewModel.RECORDING_STARTED_VIDEO_CODE)
|
||||
|
||||
Assert.equals(true, (viewModel.viewState.value as CallRecordingViewModel.RecordingStartedState).showStartedInfo)
|
||||
|
||||
viewModel.clickRecordButton()
|
||||
|
||||
Assert.equals(CallRecordingViewModel.RecordingConfirmStopState, viewModel.viewState.value)
|
||||
@ -63,6 +69,13 @@ class CallRecordingViewModelTest : AbstractViewModelTest() {
|
||||
|
||||
viewModel.dismissStopRecording()
|
||||
|
||||
Assert.equals(CallRecordingViewModel.RecordingStartedState, viewModel.viewState.value)
|
||||
Assert.equals(
|
||||
CallRecordingViewModel.RecordingStartedState(false).javaClass,
|
||||
viewModel.viewState.value?.javaClass
|
||||
)
|
||||
Assert.equals(
|
||||
false,
|
||||
(viewModel.viewState.value as CallRecordingViewModel.RecordingStartedState).showStartedInfo
|
||||
)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user