Browse Source

define call controls height in dimens.xml

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
Marcel Hibbe 3 năm trước cách đây
mục cha
commit
c07ef4acc8

+ 1 - 2
app/src/main/java/com/nextcloud/talk/adapters/ParticipantsAdapter.java

@@ -15,7 +15,6 @@ import com.facebook.drawee.backends.pipeline.Fresco;
 import com.facebook.drawee.interfaces.DraweeController;
 import com.facebook.drawee.view.SimpleDraweeView;
 import com.nextcloud.talk.R;
-import com.nextcloud.talk.controllers.CallController;
 import com.nextcloud.talk.utils.DisplayUtils;
 
 import org.webrtc.MediaStream;
@@ -142,7 +141,7 @@ public class ParticipantsAdapter extends BaseAdapter {
             headerHeight = callInfosLinearLayout.getHeight();
         }
         if (isVoiceOnlyCall) {
-            callControlsHeight = CallController.CALL_CONTROLS_HEIGHT;
+            callControlsHeight = Math.round(mContext.getResources().getDimension(R.dimen.call_controls_height));
         }
         int itemHeight = (gridViewWrapper.getHeight() - headerHeight - callControlsHeight) / getRowsCount(getCount());
         int itemMinHeight = Math.round(mContext.getResources().getDimension(R.dimen.call_grid_item_min_height));

+ 3 - 3
app/src/main/java/com/nextcloud/talk/controllers/CallController.java

@@ -163,8 +163,6 @@ public class CallController extends BaseController {
 
     private static final String TAG = "CallController";
 
-    public static final int CALL_CONTROLS_HEIGHT = 300;
-
     private static final String[] PERMISSIONS_CALL = {
             android.Manifest.permission.CAMERA,
             android.Manifest.permission.RECORD_AUDIO,
@@ -488,7 +486,9 @@ public class CallController extends BaseController {
             RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                                                                                  ViewGroup.LayoutParams.WRAP_CONTENT);
             params.addRule(RelativeLayout.BELOW, R.id.callInfosLinearLayout);
-            params.setMargins(0,0,0, CALL_CONTROLS_HEIGHT);
+            int callControlsHeight =
+                    Math.round(getApplicationContext().getResources().getDimension(R.dimen.call_controls_height));
+            params.setMargins(0,0,0, callControlsHeight);
             gridView.setLayoutParams(params);
         } else {
             callControlEnableSpeaker.setVisibility(View.GONE);

+ 7 - 8
app/src/main/res/layout/controller_call.xml

@@ -134,18 +134,17 @@
     <LinearLayout
         android:id="@+id/callControlsLinearLayout"
         android:layout_width="match_parent"
-        android:layout_height="wrap_content"
+        android:layout_height="@dimen/call_controls_height"
         android:animateLayoutChanges="true"
         android:orientation="horizontal"
         android:background="@android:color/transparent"
         android:gravity="center"
-        android:layout_alignBottom="@id/linearWrapperLayout"
-        android:layout_marginBottom="16dp">
+        android:layout_alignBottom="@id/linearWrapperLayout">
 
         <com.facebook.drawee.view.SimpleDraweeView
             android:id="@+id/callControlToggleChat"
             android:layout_width="60dp"
-            android:layout_height="80dp"
+            android:layout_height="match_parent"
             android:layout_marginStart="40dp"
             android:layout_marginEnd="10dp"
             app:backgroundImage="@color/call_buttons_background"
@@ -157,7 +156,7 @@
         <com.facebook.drawee.view.SimpleDraweeView
             android:id="@+id/callControlEnableSpeaker"
             android:layout_width="60dp"
-            android:layout_height="80dp"
+            android:layout_height="match_parent"
             android:layout_marginStart="10dp"
             android:layout_marginEnd="10dp"
             app:backgroundImage="@color/call_buttons_background"
@@ -167,7 +166,7 @@
         <com.facebook.drawee.view.SimpleDraweeView
             android:id="@+id/call_control_camera"
             android:layout_width="60dp"
-            android:layout_height="80dp"
+            android:layout_height="match_parent"
             android:layout_marginStart="10dp"
             android:layout_marginEnd="10dp"
             android:alpha="0.7"
@@ -178,7 +177,7 @@
         <com.facebook.drawee.view.SimpleDraweeView
             android:id="@+id/call_control_microphone"
             android:layout_width="60dp"
-            android:layout_height="80dp"
+            android:layout_height="match_parent"
             android:layout_marginStart="10dp"
             android:layout_marginEnd="10dp"
             android:alpha="0.7"
@@ -189,7 +188,7 @@
         <com.facebook.drawee.view.SimpleDraweeView
             android:id="@+id/callControlHangupView"
             android:layout_width="60dp"
-            android:layout_height="80dp"
+            android:layout_height="match_parent"
             android:layout_marginStart="10dp"
             android:layout_marginEnd="40dp"
             app:backgroundImage="@color/nc_darkRed"

+ 1 - 0
app/src/main/res/values/dimens.xml

@@ -59,4 +59,5 @@
     <dimen name="default_login_width">400dp</dimen>
 
     <dimen name="call_grid_item_min_height">180dp</dimen>
+    <dimen name="call_controls_height">110dp</dimen>
 </resources>