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

set minHeight for call item by dp

reduce number of possible columns to avoid design issues

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

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

@@ -29,7 +29,6 @@ import java.util.Map;
 public class ParticipantsAdapter extends BaseAdapter {
 
     private static final String TAG = "ParticipantsAdapter";
-    private static final int ITEM_MIN_HEIGHT = 500;
 
     private final Context mContext;
     private final ArrayList<ParticipantDisplayItem> participantDisplayItems;
@@ -146,8 +145,9 @@ public class ParticipantsAdapter extends BaseAdapter {
             callControlsHeight = CallController.CALL_CONTROLS_HEIGHT;
         }
         int itemHeight = (gridViewWrapper.getHeight() - headerHeight - callControlsHeight) / getRowsCount(getCount());
-        if (itemHeight < ITEM_MIN_HEIGHT) {
-            itemHeight = ITEM_MIN_HEIGHT;
+        int itemMinHeight = Math.round(mContext.getResources().getDimension(R.dimen.call_grid_item_min_height));
+        if (itemHeight < itemMinHeight) {
+            itemHeight = itemMinHeight;
         }
         return itemHeight;
     }

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

@@ -524,18 +524,14 @@ public class CallController extends BaseController {
 
             int columns;
             int participantsInGrid = participantDisplayItems.size();
-            if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
-                if (participantsInGrid > 8) {
-                    columns = 3;
-                } else if (participantsInGrid > 2) {
+            if (getResources() != null && getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
+                if (participantsInGrid > 2) {
                     columns = 2;
                 } else {
                     columns = 1;
                 }
             } else {
-                if (participantsInGrid > 8) {
-                    columns = 4;
-                } else if (participantsInGrid > 2) {
+                if (participantsInGrid > 2) {
                     columns = 3;
                 } else if (participantsInGrid > 1) {
                     columns = 2;

+ 5 - 2
app/src/main/res/layout/call_item.xml

@@ -24,6 +24,7 @@
 
 <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"
     android:id="@+id/relative_layout"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
@@ -50,7 +51,8 @@
         android:layout_alignParentBottom="true"
         android:layout_marginBottom="6dp"
         android:layout_marginStart="10dp"
-        android:textColor="@android:color/white" />
+        android:textColor="@android:color/white"
+        tools:text="Bill Murray"/>
 
     <ImageView
         android:id="@+id/remote_audio_off"
@@ -62,6 +64,7 @@
         android:layout_toEndOf="@id/peer_nick_text_view"
         android:src="@drawable/ic_mic_off_white_24px"
         android:contentDescription="@string/nc_remote_audio_off"
-        android:visibility="invisible" />
+        android:visibility="invisible"
+        tools:visibility="visible"/>
 
 </RelativeLayout>

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

@@ -57,4 +57,6 @@
     <dimen name="standard_half_padding">8dp</dimen>
     <dimen name="standard_half_margin">8dp</dimen>
     <dimen name="default_login_width">400dp</dimen>
+
+    <dimen name="call_grid_item_min_height">180dp</dimen>
 </resources>