mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-27 08:55:54 +03:00
set constants for min item height and call controls height
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
64d98aefb4
commit
98f8a29eae
3 changed files with 11 additions and 20 deletions
|
@ -15,6 +15,7 @@ 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;
|
||||
|
@ -28,12 +29,12 @@ 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;
|
||||
private final RelativeLayout gridViewWrapper;
|
||||
private final LinearLayout callInfosLinearLayout;
|
||||
private final LinearLayout callControlsLinearLayout;
|
||||
private final int columns;
|
||||
private final boolean isVoiceOnlyCall;
|
||||
|
||||
|
@ -41,13 +42,11 @@ public class ParticipantsAdapter extends BaseAdapter {
|
|||
Map<String, ParticipantDisplayItem> participantDisplayItems,
|
||||
RelativeLayout gridViewWrapper,
|
||||
LinearLayout callInfosLinearLayout,
|
||||
LinearLayout callControlsLinearLayout,
|
||||
int columns,
|
||||
boolean isVoiceOnlyCall) {
|
||||
this.mContext = mContext;
|
||||
this.gridViewWrapper = gridViewWrapper;
|
||||
this.callInfosLinearLayout = callInfosLinearLayout;
|
||||
this.callControlsLinearLayout = callControlsLinearLayout;
|
||||
this.columns = columns;
|
||||
this.isVoiceOnlyCall = isVoiceOnlyCall;
|
||||
|
||||
|
@ -143,14 +142,14 @@ public class ParticipantsAdapter extends BaseAdapter {
|
|||
if (callInfosLinearLayout.getVisibility() == View.VISIBLE && isVoiceOnlyCall) {
|
||||
headerHeight = callInfosLinearLayout.getHeight();
|
||||
}
|
||||
if (callControlsLinearLayout.getVisibility() == View.VISIBLE && isVoiceOnlyCall) {
|
||||
callControlsHeight = callControlsLinearLayout.getHeight();
|
||||
if (isVoiceOnlyCall) {
|
||||
callControlsHeight = CallController.CALL_CONTROLS_HEIGHT;
|
||||
}
|
||||
int itemHeight = (gridViewWrapper.getHeight() - headerHeight - callControlsHeight) / getRowsCount(getCount());
|
||||
// if (itemHeight < 9000) {
|
||||
// itemHeight = 9000;
|
||||
// }
|
||||
return itemHeight + 10;
|
||||
if (itemHeight < ITEM_MIN_HEIGHT) {
|
||||
itemHeight = ITEM_MIN_HEIGHT;
|
||||
}
|
||||
return itemHeight;
|
||||
}
|
||||
|
||||
private int getRowsCount(int items) {
|
||||
|
|
|
@ -163,6 +163,8 @@ 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,
|
||||
|
@ -486,7 +488,7 @@ 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,400);
|
||||
params.setMargins(0,0,0, CALL_CONTROLS_HEIGHT);
|
||||
gridView.setLayoutParams(params);
|
||||
} else {
|
||||
callControlEnableSpeaker.setVisibility(View.GONE);
|
||||
|
@ -562,20 +564,11 @@ 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);
|
||||
|
|
|
@ -53,7 +53,6 @@
|
|||
android:stretchMode="columnWidth"
|
||||
android:numColumns="2"
|
||||
android:scrollbars="vertical"
|
||||
android:background="#fff000"
|
||||
/>
|
||||
|
||||
<FrameLayout
|
||||
|
|
Loading…
Reference in a new issue