Merge pull request #1387 from nextcloud/bugfix/1308/improveGridViewDesign

Bugfix/1308/improve grid view design
This commit is contained in:
Marcel Hibbe 2021-07-02 14:56:33 +02:00 committed by GitHub
commit 8adfb7c2cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 70 additions and 55 deletions

View file

@ -39,12 +39,12 @@ public class ParticipantsAdapter extends BaseAdapter {
public ParticipantsAdapter(Context mContext,
Map<String, ParticipantDisplayItem> participantDisplayItems,
RelativeLayout gridViewWrapper,
LinearLayout linearLayout,
LinearLayout callInfosLinearLayout,
int columns,
boolean isVoiceOnlyCall) {
this.mContext = mContext;
this.gridViewWrapper = gridViewWrapper;
this.callInfosLinearLayout = linearLayout;
this.callInfosLinearLayout = callInfosLinearLayout;
this.columns = columns;
this.isVoiceOnlyCall = isVoiceOnlyCall;
@ -136,10 +136,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());
if (isVoiceOnlyCall) {
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));
if (itemHeight < itemMinHeight) {
itemHeight = itemMinHeight;
}
return itemHeight;
}

View file

@ -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,12 @@ 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);
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);
@ -508,7 +511,7 @@ public class CallController extends BaseController {
if (action == MotionEvent.ACTION_DOWN) {
showCallControls();
}
return true;
return false;
}
});
@ -521,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;

View file

@ -24,11 +24,12 @@
<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"
android:orientation="vertical"
android:gravity="center">
android:gravity="center"
android:orientation="vertical">
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/avatarImageView"
@ -48,20 +49,25 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="6dp"
android:layout_marginStart="10dp"
android:textColor="@android:color/white" />
android:layout_marginBottom="6dp"
android:ellipsize="end"
android:maxEms="8"
android:maxLines="1"
android:textColor="@color/white"
tools:text="Bill Murray 12345678901234567890" />
<ImageView
android:id="@+id/remote_audio_off"
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_marginBottom="6dp"
android:layout_marginStart="10dp"
android:layout_alignParentBottom="true"
android:layout_marginStart="10dp"
android:layout_marginBottom="6dp"
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:src="@drawable/ic_mic_off_white_24px"
android:visibility="invisible"
tools:visibility="visible" />
</RelativeLayout>

View file

@ -21,14 +21,14 @@
-->
<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/controllerCallLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:fitsSystemWindows="true"
tools:context=".activities.MagicCallActivity">
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/controllerCallLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical"
tools:context=".activities.MagicCallActivity">
<LinearLayout
android:id="@+id/linearWrapperLayout"
@ -40,9 +40,9 @@
android:id="@+id/conversationRelativeLayoutView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@color/grey950"
android:visibility="visible"
android:layout_weight="1"
tools:visibility="visible">
<GridView
@ -50,9 +50,9 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:stretchMode="columnWidth"
android:numColumns="2"
/>
android:scrollbars="vertical"
android:stretchMode="columnWidth" />
<FrameLayout
android:id="@+id/selfVideoView"
@ -65,8 +65,8 @@
android:layout_height="150dp"
android:layout_gravity="center"
android:layout_margin="16dp"
android:visibility="invisible"
android:clickable="false"
android:visibility="invisible"
tools:visibility="visible" />
<com.facebook.drawee.view.SimpleDraweeView
@ -84,8 +84,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:animateLayoutChanges="true"
android:orientation="vertical"
android:gravity="center"
android:orientation="vertical"
android:paddingTop="20dp">
<TextView
@ -98,7 +98,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="Voice Call"/>
tools:text="Voice Call" />
<TextView
android:id="@+id/callConversationNameTextView"
@ -114,18 +114,19 @@
tools:text="Marsellus Wallace" />
</LinearLayout>
<View android:id="@+id/verticalCenter"
<View
android:id="@+id/verticalCenter"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"/>
android:layout_centerVertical="true" />
<include
layout="@layout/call_states"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignTop="@id/verticalCenter"
android:layout_marginTop="-50dp"/>
android:layout_marginTop="-50dp" />
</RelativeLayout>
</LinearLayout>
@ -133,30 +134,28 @@
<LinearLayout
android:id="@+id/callControlsLinearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="@dimen/call_controls_height"
android:layout_alignBottom="@id/linearWrapperLayout"
android:animateLayoutChanges="true"
android:orientation="horizontal"
android:background="@android:color/transparent"
android:gravity="center"
android:layout_alignBottom="@id/linearWrapperLayout"
android:layout_marginBottom="16dp">
android:orientation="horizontal">
<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"
android:elevation="10dp"
app:backgroundImage="@color/call_buttons_background"
app:placeholderImage="@drawable/ic_comment_white"
app:roundAsCircle="true"
android:elevation="10dp"
/>
app:roundAsCircle="true" />
<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"
@ -166,7 +165,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"
@ -177,7 +176,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"
@ -188,7 +187,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"
@ -196,4 +195,4 @@
app:roundAsCircle="true" />
</LinearLayout>
</RelativeLayout>
</RelativeLayout>

View file

@ -57,4 +57,7 @@
<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>
<dimen name="call_controls_height">110dp</dimen>
</resources>

View file

@ -1 +1 @@
437
436