Przeglądaj źródła

add recording related buttons to call screen

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
Marcel Hibbe 2 lat temu
rodzic
commit
c663035080

+ 9 - 0
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 <dev@mhibbe.de>
  * Copyright (C) 2022 Tim Krüger <t@timkrueger.me>
  * Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
  *
@@ -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<String> 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 -> {

+ 19 - 0
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 <dev@mhibbe.de>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
 package com.nextcloud.talk.activities;
 
 import android.annotation.SuppressLint;

+ 73 - 0
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 <dev@mhibbe.de>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+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<View>(R.id.design_bottom_sheet)
+        val behavior = BottomSheetBehavior.from(bottomSheet as View)
+        behavior.state = BottomSheetBehavior.STATE_COLLAPSED
+    }
+
+    companion object {
+        private const val TAG = "MoreCallActionsDialog"
+    }
+}

+ 8 - 0
app/src/main/res/drawable/ic_baseline_fiber_manual_record_24.xml

@@ -0,0 +1,8 @@
+<vector
+    android:height="24dp"
+    android:viewportHeight="24"
+    android:viewportWidth="24"
+    android:width="24dp"
+    xmlns:android="http://schemas.android.com/apk/res/android">
+    <path android:fillColor="@color/nc_darkRed" android:pathData="M12,12m-8,0a8,8 0,1 1,16 0a8,8 0,1 1,-16 0"/>
+</vector>

+ 25 - 0
app/src/main/res/drawable/ic_dots_horizontal_white.xml

@@ -0,0 +1,25 @@
+<!--
+    @author Google LLC
+    Copyright (C) 2021 Google LLC
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="24dp"
+    android:height="24dp"
+    android:viewportWidth="24"
+    android:viewportHeight="24">
+    <path
+        android:fillColor="#FFFFFF"
+        android:pathData="M16,12A2,2 0 0,1 18,10A2,2 0 0,1 20,12A2,2 0 0,1 18,14A2,2 0 0,1 16,12M10,12A2,2 0 0,1 12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12M4,12A2,2 0 0,1 6,10A2,2 0 0,1 8,12A2,2 0 0,1 6,14A2,2 0 0,1 4,12Z" />
+</vector>

+ 9 - 0
app/src/main/res/drawable/record_circle.xml

@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="24dp"
+    android:height="24dp"
+    android:viewportWidth="24"
+    android:viewportHeight="24">
+  <path
+      android:fillColor="@color/nc_darkRed"
+      android:pathData="M12,2A10,10 0,0 0,2 12A10,10 0,0 0,12 22A10,10 0,0 0,22 12A10,10 0,0 0,12 2M12,9A3,3 0,0 1,15 12A3,3 0,0 1,12 15A3,3 0,0 1,9 12A3,3 0,0 1,12 9Z"/>
+</vector>

+ 9 - 0
app/src/main/res/drawable/stop_circle.xml

@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="24dp"
+    android:height="24dp"
+    android:viewportWidth="24"
+    android:viewportHeight="24">
+  <path
+      android:fillColor="@color/nc_darkRed"
+      android:pathData="M12,2A10,10 0,0 0,2 12A10,10 0,0 0,12 22A10,10 0,0 0,22 12A10,10 0,0 0,12 2M9,9H15V15H9"/>
+</vector>

+ 29 - 1
app/src/main/res/layout/call_activity.xml

@@ -89,6 +89,23 @@
                     android:visibility="gone" />
             </FrameLayout>
 
+            <LinearLayout
+                android:id="@+id/call_indicator_controls"
+                android:layout_width="match_parent"
+                android:layout_height="20dp"
+                android:layout_margin="20dp"
+                android:animateLayoutChanges="true"
+                android:background="@android:color/transparent"
+                android:orientation="horizontal"
+                android:weightSum="1">
+                <ImageView
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:src="@drawable/record_circle"
+                    android:contentDescription="@null">
+                </ImageView>
+            </LinearLayout>
+
             <LinearLayout
                 android:id="@+id/callInfosLinearLayout"
                 android:layout_width="match_parent"
@@ -152,7 +169,7 @@
         android:background="@android:color/transparent"
         android:gravity="center"
         android:orientation="horizontal"
-        android:weightSum="5">
+        android:weightSum="6">
 
         <ImageButton
             android:id="@+id/pictureInPictureButton"
@@ -204,6 +221,17 @@
             app:srcCompat="@drawable/ic_mic_off_white_24px"
             android:contentDescription="@string/nc_call_button_content_description_microphone" />
 
+        <ImageButton
+            android:id="@+id/more_call_actions"
+            android:layout_width="0dp"
+            android:layout_height="match_parent"
+            android:layout_marginHorizontal="@dimen/call_controls_margin_horizontal"
+            android:alpha="0.7"
+            app:backgroundImage="@color/call_buttons_background"
+            app:placeholderImage="@drawable/ic_dots_horizontal_white"
+            app:roundAsCircle="true"
+            android:layout_weight="1"/>
+
         <ImageButton
             android:id="@+id/hangupButton"
             android:layout_width="0dp"

+ 0 - 1
app/src/main/res/layout/dialog_audio_output.xml

@@ -28,7 +28,6 @@
     android:paddingBottom="@dimen/standard_half_padding">
 
     <TextView
-        android:id="@+id/upload"
         android:layout_width="wrap_content"
         android:layout_height="@dimen/bottom_sheet_item_height"
         android:gravity="start|center_vertical"

+ 73 - 0
app/src/main/res/layout/dialog_more_call_actions.xml

@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="utf-8"?><!--
+  ~ Nextcloud Talk application
+  ~
+  ~ @author Marcel Hibbe
+  ~ Copyright (C) 2022 Marcel Hibbe <marcel.hibbe@nextcloud.com>
+  ~
+  ~ 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 <http://www.gnu.org/licenses/>.
+  -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:background="@color/bg_call_screen_dialog"
+    android:orientation="vertical"
+    android:paddingBottom="@dimen/standard_half_padding">
+
+    <TextView
+        android:layout_width="wrap_content"
+        android:layout_height="@dimen/bottom_sheet_item_height"
+        android:gravity="start|center_vertical"
+        android:paddingStart="@dimen/standard_padding"
+        android:paddingEnd="@dimen/standard_padding"
+        android:text="@string/call_more_actions_dialog_headline"
+        android:textColor="@color/medium_emphasis_text_dark_background"
+        android:textSize="@dimen/bottom_sheet_text_size" />
+
+    <LinearLayout
+        android:id="@+id/record_call"
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/bottom_sheet_item_height"
+        android:background="?android:attr/selectableItemBackground"
+        android:gravity="center_vertical"
+        android:orientation="horizontal"
+        android:paddingStart="@dimen/standard_padding"
+        android:paddingEnd="@dimen/standard_padding"
+        tools:ignore="UseCompoundDrawables">
+
+        <ImageView
+            android:id="@+id/record_call_icon"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:contentDescription="@null"
+            android:src="@drawable/record_circle"
+            app:tint="@color/high_emphasis_menu_icon_inverse" />
+
+        <androidx.appcompat.widget.AppCompatTextView
+            android:id="@+id/record_call_text"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_gravity="start|center_vertical"
+            android:paddingStart="@dimen/standard_double_padding"
+            android:paddingEnd="@dimen/zero"
+            android:text="@string/call_record_description"
+            android:textAlignment="viewStart"
+            android:textColor="@color/high_emphasis_text_dark_background"
+            android:textSize="@dimen/bottom_sheet_text_size" />
+
+    </LinearLayout>
+
+</LinearLayout>

+ 3 - 0
app/src/main/res/values/strings.xml

@@ -557,6 +557,9 @@
     <string name="audio_output_dialog_headline">Audio output</string>
     <string name="audio_output_wired_headset">Wired headset</string>
 
+    <string name="call_more_actions_dialog_headline">Advanced call options</string>
+    <string name="call_record_description">Record call</string>
+
     <!-- Shared items -->
     <string name="shared_items_media">Media</string>
     <string name="shared_items_file">File</string>