mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-21 04:29:45 +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 -> {
|
callRecordingViewModel.getViewState().observe(this, viewState -> {
|
||||||
if (viewState instanceof CallRecordingViewModel.RecordingStartedState) {
|
if (viewState instanceof CallRecordingViewModel.RecordingStartedState) {
|
||||||
binding.callRecordingIndicator.setVisibility(View.VISIBLE);
|
binding.callRecordingIndicator.setVisibility(View.VISIBLE);
|
||||||
|
if (((CallRecordingViewModel.RecordingStartedState) viewState).getShowStartedInfo()) {
|
||||||
VibrationUtils.INSTANCE.vibrateShort(context);
|
VibrationUtils.INSTANCE.vibrateShort(context);
|
||||||
Toast.makeText(context, context.getResources().getString(R.string.record_active_info), Toast.LENGTH_LONG).show();
|
Toast.makeText(context, context.getResources().getString(R.string.record_active_info), Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
} else if (viewState instanceof CallRecordingViewModel.RecordingConfirmStopState) {
|
} else if (viewState instanceof CallRecordingViewModel.RecordingConfirmStopState) {
|
||||||
MaterialAlertDialogBuilder dialogBuilder = new MaterialAlertDialogBuilder(this)
|
MaterialAlertDialogBuilder dialogBuilder = new MaterialAlertDialogBuilder(this)
|
||||||
.setTitle(R.string.record_stop_confirm_title)
|
.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.
|
* All listeners are called in the main thread.
|
||||||
*/
|
*/
|
||||||
private static class InternalSignalingMessageReceiver extends SignalingMessageReceiver {
|
private static class InternalSignalingMessageReceiver extends SignalingMessageReceiver {
|
||||||
@ -2794,7 +2797,7 @@ public class CallActivity extends CallBaseActivity {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the local participant nick to offers and answers.
|
* 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
|
* 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.
|
* provide the nick of the local participant.
|
||||||
*
|
*
|
||||||
|
@ -42,7 +42,8 @@ class CallRecordingViewModel @Inject constructor(private val repository: CallRec
|
|||||||
lateinit var roomToken: String
|
lateinit var roomToken: String
|
||||||
|
|
||||||
sealed interface ViewState
|
sealed interface ViewState
|
||||||
object RecordingStartedState : ViewState
|
open class RecordingStartedState(val showStartedInfo: Boolean) : ViewState
|
||||||
|
|
||||||
object RecordingStoppedState : ViewState
|
object RecordingStoppedState : ViewState
|
||||||
object RecordingStartLoadingState : ViewState
|
object RecordingStartLoadingState : ViewState
|
||||||
object RecordingStopLoadingState : ViewState
|
object RecordingStopLoadingState : ViewState
|
||||||
@ -57,7 +58,7 @@ class CallRecordingViewModel @Inject constructor(private val repository: CallRec
|
|||||||
|
|
||||||
fun clickRecordButton() {
|
fun clickRecordButton() {
|
||||||
when (viewState.value) {
|
when (viewState.value) {
|
||||||
RecordingStartedState -> {
|
is RecordingStartedState -> {
|
||||||
_viewState.value = RecordingConfirmStopState
|
_viewState.value = RecordingConfirmStopState
|
||||||
}
|
}
|
||||||
RecordingStoppedState -> {
|
RecordingStoppedState -> {
|
||||||
@ -92,7 +93,7 @@ class CallRecordingViewModel @Inject constructor(private val repository: CallRec
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun dismissStopRecording() {
|
fun dismissStopRecording() {
|
||||||
_viewState.value = RecordingStartedState
|
_viewState.value = RecordingStartedState(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCleared() {
|
override fun onCleared() {
|
||||||
@ -108,8 +109,8 @@ class CallRecordingViewModel @Inject constructor(private val repository: CallRec
|
|||||||
fun setRecordingState(state: Int) {
|
fun setRecordingState(state: Int) {
|
||||||
when (state) {
|
when (state) {
|
||||||
RECORDING_STOPPED_CODE -> _viewState.value = RecordingStoppedState
|
RECORDING_STOPPED_CODE -> _viewState.value = RecordingStoppedState
|
||||||
RECORDING_STARTED_VIDEO_CODE -> _viewState.value = RecordingStartedState
|
RECORDING_STARTED_VIDEO_CODE -> _viewState.value = RecordingStartedState(true)
|
||||||
RECORDING_STARTED_AUDIO_CODE -> _viewState.value = RecordingStartedState
|
RECORDING_STARTED_AUDIO_CODE -> _viewState.value = RecordingStartedState(true)
|
||||||
else -> {}
|
else -> {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,9 @@ class CallRecordingViewModelTest : AbstractViewModelTest() {
|
|||||||
val viewModel = CallRecordingViewModel(repository)
|
val viewModel = CallRecordingViewModel(repository)
|
||||||
viewModel.setData("foo")
|
viewModel.setData("foo")
|
||||||
viewModel.setRecordingState(CallRecordingViewModel.RECORDING_STARTED_VIDEO_CODE)
|
viewModel.setRecordingState(CallRecordingViewModel.RECORDING_STARTED_VIDEO_CODE)
|
||||||
|
|
||||||
|
Assert.equals(true, (viewModel.viewState.value as CallRecordingViewModel.RecordingStartedState).showStartedInfo)
|
||||||
|
|
||||||
viewModel.clickRecordButton()
|
viewModel.clickRecordButton()
|
||||||
|
|
||||||
Assert.equals(CallRecordingViewModel.RecordingConfirmStopState, viewModel.viewState.value)
|
Assert.equals(CallRecordingViewModel.RecordingConfirmStopState, viewModel.viewState.value)
|
||||||
@ -43,6 +46,9 @@ class CallRecordingViewModelTest : AbstractViewModelTest() {
|
|||||||
val viewModel = CallRecordingViewModel(repository)
|
val viewModel = CallRecordingViewModel(repository)
|
||||||
viewModel.setData("foo")
|
viewModel.setData("foo")
|
||||||
viewModel.setRecordingState(CallRecordingViewModel.RECORDING_STARTED_VIDEO_CODE)
|
viewModel.setRecordingState(CallRecordingViewModel.RECORDING_STARTED_VIDEO_CODE)
|
||||||
|
|
||||||
|
Assert.equals(true, (viewModel.viewState.value as CallRecordingViewModel.RecordingStartedState).showStartedInfo)
|
||||||
|
|
||||||
viewModel.clickRecordButton()
|
viewModel.clickRecordButton()
|
||||||
|
|
||||||
Assert.equals(CallRecordingViewModel.RecordingConfirmStopState, viewModel.viewState.value)
|
Assert.equals(CallRecordingViewModel.RecordingConfirmStopState, viewModel.viewState.value)
|
||||||
@ -63,6 +69,13 @@ class CallRecordingViewModelTest : AbstractViewModelTest() {
|
|||||||
|
|
||||||
viewModel.dismissStopRecording()
|
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