فهرست منبع

- set bottom margin for grid for voicecall
- temporarily comment out setOnTouchListener for grid (disables toggle of controls for now)
- set android:scrollbars="vertical" for gridview
- add callControlsHeight for item height calculation
- add fake height to item that scrolling is testable

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>

Marcel Hibbe 3 سال پیش
والد
کامیت
64d98aefb4

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

@@ -33,18 +33,21 @@ public class ParticipantsAdapter extends BaseAdapter {
     private final ArrayList<ParticipantDisplayItem> participantDisplayItems;
     private final RelativeLayout gridViewWrapper;
     private final LinearLayout callInfosLinearLayout;
+    private final LinearLayout callControlsLinearLayout;
     private final int columns;
     private final boolean isVoiceOnlyCall;
 
     public ParticipantsAdapter(Context mContext,
                                Map<String, ParticipantDisplayItem> participantDisplayItems,
                                RelativeLayout gridViewWrapper,
-                               LinearLayout linearLayout,
+                               LinearLayout callInfosLinearLayout,
+                               LinearLayout callControlsLinearLayout,
                                int columns,
                                boolean isVoiceOnlyCall) {
         this.mContext = mContext;
         this.gridViewWrapper = gridViewWrapper;
-        this.callInfosLinearLayout = linearLayout;
+        this.callInfosLinearLayout = callInfosLinearLayout;
+        this.callControlsLinearLayout = callControlsLinearLayout;
         this.columns = columns;
         this.isVoiceOnlyCall = isVoiceOnlyCall;
 
@@ -136,11 +139,18 @@ public class ParticipantsAdapter extends BaseAdapter {
 
     private int scaleGridViewItemHeight() {
         int headerHeight = 0;
+        int callControlsHeight = 0;
         if (callInfosLinearLayout.getVisibility() == View.VISIBLE && isVoiceOnlyCall) {
             headerHeight = callInfosLinearLayout.getHeight();
         }
-        int itemHeight = (gridViewWrapper.getHeight() - headerHeight) / getRowsCount(getCount());
-        return itemHeight;
+        if (callControlsLinearLayout.getVisibility() == View.VISIBLE && isVoiceOnlyCall) {
+            callControlsHeight = callControlsLinearLayout.getHeight();
+        }
+        int itemHeight = (gridViewWrapper.getHeight() - headerHeight - callControlsHeight) / getRowsCount(getCount());
+//        if (itemHeight < 9000) {
+//            itemHeight = 9000;
+//        }
+        return itemHeight + 10;
     }
 
     private int getRowsCount(int items) {

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

@@ -49,10 +49,6 @@ import android.widget.ProgressBar;
 import android.widget.RelativeLayout;
 import android.widget.TextView;
 
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import androidx.appcompat.app.AppCompatActivity;
-
 import com.bluelinelabs.logansquare.LoganSquare;
 import com.facebook.drawee.view.SimpleDraweeView;
 import com.nextcloud.talk.R;
@@ -143,6 +139,9 @@ import java.util.concurrent.TimeUnit;
 
 import javax.inject.Inject;
 
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.appcompat.app.AppCompatActivity;
 import autodagger.AutoInjector;
 import butterknife.BindView;
 import butterknife.OnClick;
@@ -484,8 +483,10 @@ public class CallController extends BaseController {
             cameraControlButton.setVisibility(View.GONE);
             pipVideoView.setVisibility(View.GONE);
 
-            RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
+            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,400);
             gridView.setLayoutParams(params);
         } else {
             callControlEnableSpeaker.setVisibility(View.GONE);
@@ -502,15 +503,15 @@ public class CallController extends BaseController {
             pipVideoView.setOnTouchListener(new SelfVideoTouchListener());
         }
 
-        gridView.setOnTouchListener(new View.OnTouchListener() {
-            public boolean onTouch(View v, MotionEvent me) {
-                int action = me.getActionMasked();
-                if (action == MotionEvent.ACTION_DOWN) {
-                    showCallControls();
-                }
-                return true;
-            }
-        });
+//        gridView.setOnTouchListener(new View.OnTouchListener() {
+//            public boolean onTouch(View v, MotionEvent me) {
+//                int action = me.getActionMasked();
+//                if (action == MotionEvent.ACTION_DOWN) {
+//                    showCallControls();
+//                }
+//                return true;
+//            }
+//        });
 
         initGridAdapter();
     }
@@ -561,11 +562,20 @@ public class CallController extends BaseController {
                 }
             });
 
+            LinearLayout callControlsLinearLayout = controllerCallLayout.findViewById(R.id.callControlsLinearLayout);
+            callControlsLinearLayout.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
+                @Override
+                public void onGlobalLayout() {
+                    callControlsLinearLayout.getViewTreeObserver().removeOnGlobalLayoutListener(this);
+                }
+            });
+
             participantsAdapter = new ParticipantsAdapter(
                     this.getActivity(),
                     participantDisplayItems,
                     gridViewWrapper,
                     callInfosLinearLayout,
+                    callControlsLinearLayout,
                     columns,
                     isVoiceOnlyCall);
             gridView.setAdapter(participantsAdapter);

+ 2 - 0
app/src/main/res/layout/controller_call.xml

@@ -52,6 +52,8 @@
                 android:gravity="center"
                 android:stretchMode="columnWidth"
                 android:numColumns="2"
+                android:scrollbars="vertical"
+                android:background="#fff000"
                 />
 
             <FrameLayout