diff --git a/jami-android/app/src/main/java/cx/ring/tv/call/TVCallFragment.kt b/jami-android/app/src/main/java/cx/ring/tv/call/TVCallFragment.kt index a2188ebab38cc03c4f8186a0e72efa4fc87659fb..216d8ebd1e89f50cbd90f0fd96bb7c0d9aee2a24 100644 --- a/jami-android/app/src/main/java/cx/ring/tv/call/TVCallFragment.kt +++ b/jami-android/app/src/main/java/cx/ring/tv/call/TVCallFragment.kt @@ -94,6 +94,7 @@ class TVCallFragment : BaseSupportFragment<CallPresenter, CallView>(), CallView repeatMode = Animation.REVERSE }} private var mSession: MediaSessionCompat? = null + private var muted = false @Inject lateinit var mDeviceRuntimeService: DeviceRuntimeService @@ -109,15 +110,15 @@ class TVCallFragment : BaseSupportFragment<CallPresenter, CallView>(), CallView } override fun handleCallWakelock(isAudioOnly: Boolean) {} - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { - return TvFragCallBinding.inflate(inflater, container, false).also { b -> + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View = + TvFragCallBinding.inflate(inflater, container, false).also { b -> binding = b b.callAcceptBtn.setOnClickListener { acceptClicked() } b.callRefuseBtn.setOnClickListener { refuseClicked() } b.callHangupBtn.setOnClickListener { hangUpClicked() } b.callAddBtn.setOnClickListener { addParticipant() } + b.callMuteBtn.setOnClickListener { muteClicked() } }.root - } private val listener: SurfaceTextureListener = object : SurfaceTextureListener { override fun onSurfaceTextureAvailable(surface: SurfaceTexture, width: Int, height: Int) { @@ -247,11 +248,13 @@ class TVCallFragment : BaseSupportFragment<CallPresenter, CallView>(), CallView if (display) { callHangupBtn.visibility = View.VISIBLE callAddBtn.visibility = View.VISIBLE + callMuteBtn.visibility = View.VISIBLE } else { callHangupBtn.startAnimation(fadeOutAnimation) callAddBtn.startAnimation(fadeOutAnimation) callHangupBtn.visibility = View.GONE callAddBtn.visibility = View.GONE + callMuteBtn.visibility = View.GONE } } } @@ -543,6 +546,12 @@ class TVCallFragment : BaseSupportFragment<CallPresenter, CallView>(), CallView prepareCall(true) } + fun muteClicked() { + presenter.muteMicrophoneToggled(!muted) + binding?.callMuteBtn?.setImageResource(if (muted) R.drawable.baseline_mic_on_24 else R.drawable.baseline_mic_off_24) + muted = !muted + } + override fun finish(hangupReason: CallPresenter.HangupReason) { mSession?.isActive = false activity?.let { activity -> @@ -562,7 +571,7 @@ class TVCallFragment : BaseSupportFragment<CallPresenter, CallView>(), CallView override fun enterPipMode(accountId: String, callId: String?) { val context = requireContext() - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N || !context.packageManager.hasSystemFeature(PackageManager.FEATURE_PICTURE_IN_PICTURE)) + if (!context.packageManager.hasSystemFeature(PackageManager.FEATURE_PICTURE_IN_PICTURE)) return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { val paramBuilder = PictureInPictureParams.Builder() diff --git a/jami-android/app/src/main/res/layout-w720dp-land/tv_frag_call.xml b/jami-android/app/src/main/res/layout-w720dp-land/tv_frag_call.xml index fd436a33eb8b194d7c4b69a3993dc37e6489dd45..bc09d0a1931d592aea5b55fffc8cab80c10d7f4b 100644 --- a/jami-android/app/src/main/res/layout-w720dp-land/tv_frag_call.xml +++ b/jami-android/app/src/main/res/layout-w720dp-land/tv_frag_call.xml @@ -157,24 +157,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. </LinearLayout> </LinearLayout> - <com.google.android.material.floatingactionbutton.FloatingActionButton - android:id="@+id/call_hangup_btn" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignParentBottom="true" - android:layout_centerHorizontal="true" - android:layout_marginStart="16dp" - android:layout_marginTop="16dp" - android:layout_marginEnd="16dp" - android:layout_marginBottom="48dp" - android:tint="@color/white" - android:visibility="gone" - app:backgroundTint="@color/colorError" - app:rippleColor="@android:color/white" - app:srcCompat="@drawable/baseline_call_end_24" - app:useCompatPadding="true" - tools:visibility="visible" /> - <LinearLayout android:id="@+id/record_layout" android:layout_width="wrap_content" @@ -182,7 +164,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. android:orientation="horizontal" android:layout_margin="16dp" android:gravity="center_vertical" - android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" android:visibility="invisible" tools:visibility="visible"> @@ -202,20 +184,58 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. tools:text="Thomas"/> </LinearLayout> - <com.google.android.material.floatingactionbutton.FloatingActionButton - android:id="@+id/call_add_btn" - android:layout_width="wrap_content" + + <LinearLayout + android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_toRightOf="@+id/call_hangup_btn" - android:layout_toEndOf="@+id/call_hangup_btn" android:layout_alignParentBottom="true" - android:layout_marginStart="16dp" - android:layout_marginTop="16dp" - android:layout_marginEnd="16dp" - android:layout_marginBottom="48dp" - android:visibility="gone" - app:srcCompat="@drawable/baseline_person_add_24" - app:useCompatPadding="true" - tools:visibility="visible" /> + android:layout_centerHorizontal="true" + android:animateLayoutChanges="true" + android:gravity="center_horizontal"> + + <com.google.android.material.floatingactionbutton.FloatingActionButton + android:id="@+id/call_hangup_btn" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="16dp" + android:layout_marginTop="16dp" + android:layout_marginEnd="16dp" + android:layout_marginBottom="48dp" + android:contentDescription="@string/action_call_hangup" + android:tint="@android:color/white" + android:visibility="gone" + app:backgroundTint="@color/colorError" + app:rippleColor="@android:color/white" + app:srcCompat="@drawable/baseline_call_end_24" + tools:visibility="visible" /> + + <com.google.android.material.floatingactionbutton.FloatingActionButton + android:id="@+id/call_mute_btn" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="16dp" + android:layout_marginTop="16dp" + android:layout_marginEnd="16dp" + android:layout_marginBottom="48dp" + android:contentDescription="@string/action_call_mute" + android:tint="@android:color/white" + android:visibility="gone" + app:rippleColor="@android:color/white" + app:srcCompat="@drawable/baseline_mic_on_24" + tools:visibility="visible" /> + + <com.google.android.material.floatingactionbutton.FloatingActionButton + android:id="@+id/call_add_btn" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="16dp" + android:layout_marginTop="16dp" + android:layout_marginEnd="16dp" + android:layout_marginBottom="48dp" + android:contentDescription="@string/bottomSheet_add_participants_btn" + android:visibility="gone" + app:srcCompat="@drawable/baseline_person_add_24" + tools:visibility="visible" /> + </LinearLayout> </RelativeLayout> diff --git a/jami-android/app/src/main/res/layout/tv_frag_call.xml b/jami-android/app/src/main/res/layout/tv_frag_call.xml index 11c1b54f10ae75c1eb63c2c7fb25e2b0c3b0b65c..9173390d03eb6e39f722765ed47aadd6c43dfe56 100644 --- a/jami-android/app/src/main/res/layout/tv_frag_call.xml +++ b/jami-android/app/src/main/res/layout/tv_frag_call.xml @@ -14,24 +14,23 @@ 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/>. --> -<RelativeLayout - xmlns:android="http://schemas.android.com/apk/res/android" +<RelativeLayout 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" - tools:context=".tv.call.TVCallActivity" android:layout_width="match_parent" android:layout_height="match_parent" android:clipChildren="false" android:clipToPadding="false" android:keepScreenOn="true" - tools:background="@color/cardview_dark_background"> + tools:background="@color/cardview_dark_background" + tools:context=".tv.call.TVCallActivity"> <cx.ring.views.ParticipantsContainerView android:id="@+id/participant_overlay_container" android:layout_width="match_parent" android:layout_height="match_parent" - android:visibility="gone" - android:animateLayoutChanges="false"/> + android:animateLayoutChanges="false" + android:visibility="gone" /> <androidx.cardview.widget.CardView android:id="@+id/preview_container" @@ -57,6 +56,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginBottom="16dp" + android:baselineAligned="false" android:orientation="horizontal" android:weightSum="100"> @@ -129,7 +129,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. android:layout_height="wrap_content" android:layout_margin="16dp" android:contentDescription="@string/action_call_decline" - android:tint="@color/white" + android:tint="@android:color/white" android:visibility="gone" app:backgroundTint="@color/colorError" app:elevation="6dp" @@ -157,32 +157,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. </LinearLayout> </LinearLayout> - <com.google.android.material.floatingactionbutton.FloatingActionButton - android:id="@+id/call_hangup_btn" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignParentBottom="true" - android:layout_centerHorizontal="true" - android:layout_marginStart="16dp" - android:layout_marginTop="16dp" - android:layout_marginEnd="16dp" - android:layout_marginBottom="48dp" - android:tint="@color/white" - android:visibility="gone" - app:backgroundTint="@color/colorError" - app:rippleColor="@android:color/white" - app:srcCompat="@drawable/baseline_call_end_24" - app:useCompatPadding="true" - tools:visibility="visible" /> - <LinearLayout android:id="@+id/record_layout" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:orientation="horizontal" + android:layout_alignParentStart="true" android:layout_margin="16dp" android:gravity="center_vertical" - android:layout_alignParentLeft="true" + android:orientation="horizontal" android:visibility="invisible" tools:visibility="visible"> @@ -190,8 +172,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. android:id="@+id/record_indicator" android:layout_width="13dp" android:layout_height="13dp" - android:backgroundTint="#BF0046" - android:background="@drawable/item_color_background" /> + android:background="@drawable/item_color_background" + android:backgroundTint="#BF0046" /> <TextView android:id="@+id/record_name" @@ -199,24 +181,60 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. android:layout_height="wrap_content" android:layout_marginStart="8dp" android:textSize="12sp" - tools:text="Thomas"/> + tools:text="Thomas" /> </LinearLayout> - <com.google.android.material.floatingactionbutton.FloatingActionButton - android:id="@+id/call_add_btn" - android:layout_width="wrap_content" + <LinearLayout + android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_toRightOf="@+id/call_hangup_btn" - android:layout_toEndOf="@+id/call_hangup_btn" android:layout_alignParentBottom="true" - android:layout_marginStart="16dp" - android:layout_marginTop="16dp" - android:layout_marginEnd="16dp" - android:layout_marginBottom="48dp" - android:visibility="gone" - app:srcCompat="@drawable/baseline_person_add_24" - app:useCompatPadding="true" - tools:visibility="visible" /> + android:layout_centerHorizontal="true" + android:animateLayoutChanges="true" + android:gravity="center_horizontal"> + <com.google.android.material.floatingactionbutton.FloatingActionButton + android:id="@+id/call_hangup_btn" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="16dp" + android:layout_marginTop="16dp" + android:layout_marginEnd="16dp" + android:layout_marginBottom="48dp" + android:contentDescription="@string/action_call_hangup" + android:tint="@android:color/white" + android:visibility="gone" + app:backgroundTint="@color/colorError" + app:rippleColor="@android:color/white" + app:srcCompat="@drawable/baseline_call_end_24" + tools:visibility="visible" /> + + <com.google.android.material.floatingactionbutton.FloatingActionButton + android:id="@+id/call_mute_btn" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="16dp" + android:layout_marginTop="16dp" + android:layout_marginEnd="16dp" + android:layout_marginBottom="48dp" + android:contentDescription="@string/action_call_mute" + android:tint="@android:color/white" + android:visibility="gone" + app:rippleColor="@android:color/white" + app:srcCompat="@drawable/baseline_mic_on_24" + tools:visibility="visible" /> + + <com.google.android.material.floatingactionbutton.FloatingActionButton + android:id="@+id/call_add_btn" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="16dp" + android:layout_marginTop="16dp" + android:layout_marginEnd="16dp" + android:layout_marginBottom="48dp" + android:contentDescription="@string/bottomSheet_add_participants_btn" + android:visibility="gone" + app:srcCompat="@drawable/baseline_person_add_24" + tools:visibility="visible" /> + </LinearLayout> </RelativeLayout>