From c663035080549abe5ea130557b78457f2d4be428 Mon Sep 17 00:00:00 2001 From: Marcel Hibbe Date: Mon, 5 Dec 2022 13:59:30 +0100 Subject: [PATCH] add recording related buttons to call screen Signed-off-by: Marcel Hibbe --- .../talk/activities/CallActivity.java | 9 +++ .../talk/activities/CallBaseActivity.java | 19 +++++ .../talk/ui/dialog/MoreCallActionsDialog.kt | 73 +++++++++++++++++++ .../ic_baseline_fiber_manual_record_24.xml | 8 ++ .../res/drawable/ic_dots_horizontal_white.xml | 25 +++++++ app/src/main/res/drawable/record_circle.xml | 9 +++ app/src/main/res/drawable/stop_circle.xml | 9 +++ app/src/main/res/layout/call_activity.xml | 30 +++++++- .../main/res/layout/dialog_audio_output.xml | 1 - .../res/layout/dialog_more_call_actions.xml | 73 +++++++++++++++++++ app/src/main/res/values/strings.xml | 3 + 11 files changed, 257 insertions(+), 2 deletions(-) create mode 100644 app/src/main/java/com/nextcloud/talk/ui/dialog/MoreCallActionsDialog.kt create mode 100644 app/src/main/res/drawable/ic_baseline_fiber_manual_record_24.xml create mode 100644 app/src/main/res/drawable/ic_dots_horizontal_white.xml create mode 100644 app/src/main/res/drawable/record_circle.xml create mode 100644 app/src/main/res/drawable/stop_circle.xml create mode 100644 app/src/main/res/layout/dialog_more_call_actions.xml diff --git a/app/src/main/java/com/nextcloud/talk/activities/CallActivity.java b/app/src/main/java/com/nextcloud/talk/activities/CallActivity.java index a2b2d972d..a624b4d60 100644 --- a/app/src/main/java/com/nextcloud/talk/activities/CallActivity.java +++ b/app/src/main/java/com/nextcloud/talk/activities/CallActivity.java @@ -3,6 +3,8 @@ * * @author Mario Danic * @author Tim Krüger + * @author Marcel Hibbe + * Copyright (C) 2022 Marcel Hibbe * Copyright (C) 2022 Tim Krüger * Copyright (C) 2017-2018 Mario Danic * @@ -86,6 +88,7 @@ import com.nextcloud.talk.models.json.signaling.settings.SignalingSettingsOveral import com.nextcloud.talk.signaling.SignalingMessageReceiver; import com.nextcloud.talk.signaling.SignalingMessageSender; import com.nextcloud.talk.ui.dialog.AudioOutputDialog; +import com.nextcloud.talk.ui.dialog.MoreCallActionsDialog; import com.nextcloud.talk.users.UserManager; import com.nextcloud.talk.utils.ApiUtils; import com.nextcloud.talk.utils.DisplayUtils; @@ -317,6 +320,7 @@ public class CallActivity extends CallBaseActivity { private CallActivityBinding binding; private AudioOutputDialog audioOutputDialog; + private MoreCallActionsDialog moreCallActionsDialog; private final ActivityResultLauncher requestBluetoothPermissionLauncher = registerForActivityResult(new ActivityResultContracts.RequestPermission(), isGranted -> { @@ -425,6 +429,11 @@ public class CallActivity extends CallBaseActivity { audioOutputDialog.show(); }); + binding.moreCallActions.setOnClickListener(v -> { + moreCallActionsDialog = new MoreCallActionsDialog(this); + moreCallActionsDialog.show(); + }); + if (canPublishAudioStream) { binding.microphoneButton.setOnClickListener(l -> onMicrophoneClick()); binding.microphoneButton.setOnLongClickListener(l -> { diff --git a/app/src/main/java/com/nextcloud/talk/activities/CallBaseActivity.java b/app/src/main/java/com/nextcloud/talk/activities/CallBaseActivity.java index 6f13a2aae..ece059e6e 100644 --- a/app/src/main/java/com/nextcloud/talk/activities/CallBaseActivity.java +++ b/app/src/main/java/com/nextcloud/talk/activities/CallBaseActivity.java @@ -1,3 +1,22 @@ +/* + * Nextcloud Talk application + * + * @author Marcel Hibbe + * Copyright (C) 2022 Marcel Hibbe + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ package com.nextcloud.talk.activities; import android.annotation.SuppressLint; diff --git a/app/src/main/java/com/nextcloud/talk/ui/dialog/MoreCallActionsDialog.kt b/app/src/main/java/com/nextcloud/talk/ui/dialog/MoreCallActionsDialog.kt new file mode 100644 index 000000000..f119be722 --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/ui/dialog/MoreCallActionsDialog.kt @@ -0,0 +1,73 @@ +/* + * Nextcloud Talk application + * + * @author Marcel Hibbe + * Copyright (C) 2022 Marcel Hibbe + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.nextcloud.talk.ui.dialog + +import android.os.Bundle +import android.view.View +import android.view.ViewGroup +import autodagger.AutoInjector +import com.google.android.material.bottomsheet.BottomSheetBehavior +import com.google.android.material.bottomsheet.BottomSheetDialog +import com.nextcloud.talk.R +import com.nextcloud.talk.activities.CallActivity +import com.nextcloud.talk.application.NextcloudTalkApplication +import com.nextcloud.talk.databinding.DialogMoreCallActionsBinding +import com.nextcloud.talk.ui.theme.ViewThemeUtils +import javax.inject.Inject + +@AutoInjector(NextcloudTalkApplication::class) +class MoreCallActionsDialog(val callActivity: CallActivity) : BottomSheetDialog(callActivity) { + + @Inject + lateinit var viewThemeUtils: ViewThemeUtils + + private lateinit var binding: DialogMoreCallActionsBinding + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + NextcloudTalkApplication.sharedApplication?.componentApplication?.inject(this) + + binding = DialogMoreCallActionsBinding.inflate(layoutInflater) + setContentView(binding.root) + window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) + + viewThemeUtils.platform.themeDialogDark(binding.root) + initClickListeners() + } + + private fun initClickListeners() { + binding.recordCall.setOnClickListener { + // callActivity.setAudioOutputChannel(WebRtcAudioManager.AudioDevice.BLUETOOTH) + dismiss() + } + } + + override fun onStart() { + super.onStart() + val bottomSheet = findViewById(R.id.design_bottom_sheet) + val behavior = BottomSheetBehavior.from(bottomSheet as View) + behavior.state = BottomSheetBehavior.STATE_COLLAPSED + } + + companion object { + private const val TAG = "MoreCallActionsDialog" + } +} diff --git a/app/src/main/res/drawable/ic_baseline_fiber_manual_record_24.xml b/app/src/main/res/drawable/ic_baseline_fiber_manual_record_24.xml new file mode 100644 index 000000000..397bcd32e --- /dev/null +++ b/app/src/main/res/drawable/ic_baseline_fiber_manual_record_24.xml @@ -0,0 +1,8 @@ + + + diff --git a/app/src/main/res/drawable/ic_dots_horizontal_white.xml b/app/src/main/res/drawable/ic_dots_horizontal_white.xml new file mode 100644 index 000000000..27bdc148d --- /dev/null +++ b/app/src/main/res/drawable/ic_dots_horizontal_white.xml @@ -0,0 +1,25 @@ + + + + diff --git a/app/src/main/res/drawable/record_circle.xml b/app/src/main/res/drawable/record_circle.xml new file mode 100644 index 000000000..15f19b81e --- /dev/null +++ b/app/src/main/res/drawable/record_circle.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/stop_circle.xml b/app/src/main/res/drawable/stop_circle.xml new file mode 100644 index 000000000..47795ee1c --- /dev/null +++ b/app/src/main/res/drawable/stop_circle.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/layout/call_activity.xml b/app/src/main/res/layout/call_activity.xml index 2a3f3b71b..e91187651 100644 --- a/app/src/main/res/layout/call_activity.xml +++ b/app/src/main/res/layout/call_activity.xml @@ -89,6 +89,23 @@ android:visibility="gone" /> + + + + + + android:weightSum="6"> + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 40ec2036e..1ccf3a82f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -557,6 +557,9 @@ Audio output Wired headset + Advanced call options + Record call + Media File