Эх сурвалжийг харах

add floating lower hand button

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
Marcel Hibbe 2 жил өмнө
parent
commit
f2b312a118

+ 12 - 0
app/src/main/java/com/nextcloud/talk/activities/CallActivity.java

@@ -415,6 +415,14 @@ public class CallActivity extends CallBaseActivity {
         raiseHandViewModel = new ViewModelProvider(this, viewModelFactory).get((RaiseHandViewModel.class));
         raiseHandViewModel.setData(roomToken, isBreakoutRoom);
 
+        raiseHandViewModel.getViewState().observe(this, viewState -> {
+            if (viewState instanceof RaiseHandViewModel.RaisedHandState) {
+                binding.lowerHandButton.setVisibility(View.VISIBLE);
+            } else if (viewState instanceof RaiseHandViewModel.LoweredHandState) {
+                binding.lowerHandButton.setVisibility(View.GONE);
+            }
+        });
+
         callRecordingViewModel = new ViewModelProvider(this, viewModelFactory).get((CallRecordingViewModel.class));
         callRecordingViewModel.setData(roomToken);
         callRecordingViewModel.setRecordingState(extras.getInt(KEY_RECORDING_STATE));
@@ -584,6 +592,10 @@ public class CallActivity extends CallBaseActivity {
                 Toast.makeText(context, context.getResources().getString(R.string.record_active_info), Toast.LENGTH_LONG).show();
             }
         });
+
+        binding.lowerHandButton.setOnClickListener(l -> {
+            raiseHandViewModel.lowerHand();
+        });
     }
 
     private void createCameraEnumerator() {

+ 1 - 1
app/src/main/java/com/nextcloud/talk/raisehand/viewmodel/RaiseHandViewModel.kt

@@ -54,7 +54,7 @@ class RaiseHandViewModel @Inject constructor(private val repository: RequestAssi
         }
     }
 
-    private fun lowerHand() {
+    fun lowerHand() {
         _viewState.value = LoweredHandState
         if (isBreakoutRoom) {
             repository.withdrawRequestAssistance(roomToken)

+ 16 - 0
app/src/main/res/layout/call_activity.xml

@@ -159,6 +159,22 @@
                 android:layout_height="wrap_content"
                 android:layout_alignTop="@id/verticalCenter"
                 android:layout_marginTop="-50dp" />
+
+            <ImageButton
+                android:id="@+id/lower_hand_button"
+                android:layout_width="@dimen/min_size_clickable_area"
+                android:layout_height="@dimen/min_size_clickable_area"
+                android:layout_alignParentEnd="true"
+                android:layout_alignParentBottom="true"
+                android:layout_marginBottom="150dp"
+                android:layout_marginEnd="20dp"
+                android:contentDescription="@string/lower_hand"
+                android:background="@drawable/shape_oval"
+                android:backgroundTint="@color/call_buttons_background"
+                android:visibility="gone"
+                tools:visibility="visible"
+                app:srcCompat="@drawable/ic_baseline_do_not_touch_24" />
+
         </RelativeLayout>
 
     </LinearLayout>