mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-23 13:35:33 +03:00
display overlay instead of grid in pip view for group calls
this is a quick and dirty solution until "speaker view" is introduced in the future which should be used for the pip view. Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
57804c8d62
commit
a0c95113bf
2 changed files with 82 additions and 40 deletions
|
@ -559,52 +559,53 @@ public class CallActivity extends BaseActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initGridAdapter() {
|
private void initGridAdapter() {
|
||||||
if (binding.conversationRelativeLayout != null) {
|
int columns;
|
||||||
|
int participantsInGrid = participantDisplayItems.size();
|
||||||
int columns;
|
if (getResources() != null && getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
|
||||||
int participantsInGrid = participantDisplayItems.size();
|
if (participantsInGrid > 2) {
|
||||||
if (getResources() != null && getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
|
columns = 2;
|
||||||
if (participantsInGrid > 2) {
|
|
||||||
columns = 2;
|
|
||||||
} else {
|
|
||||||
columns = 1;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (participantsInGrid > 2) {
|
columns = 1;
|
||||||
columns = 3;
|
|
||||||
} else if (participantsInGrid > 1) {
|
|
||||||
columns = 2;
|
|
||||||
} else {
|
|
||||||
columns = 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (participantsInGrid > 2) {
|
||||||
|
columns = 3;
|
||||||
|
} else if (participantsInGrid > 1) {
|
||||||
|
columns = 2;
|
||||||
|
} else {
|
||||||
|
columns = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
binding.gridview.setNumColumns(columns);
|
binding.gridview.setNumColumns(columns);
|
||||||
|
|
||||||
binding.conversationRelativeLayout.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
binding.conversationRelativeLayout.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onGlobalLayout() {
|
public void onGlobalLayout() {
|
||||||
binding.conversationRelativeLayout.getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
binding.conversationRelativeLayout.getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
||||||
int height = binding.conversationRelativeLayout.getMeasuredHeight();
|
int height = binding.conversationRelativeLayout.getMeasuredHeight();
|
||||||
binding.gridview.setMinimumHeight(height);
|
binding.gridview.setMinimumHeight(height);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
binding.callInfosLinearLayout.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
binding.callInfosLinearLayout.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onGlobalLayout() {
|
public void onGlobalLayout() {
|
||||||
binding.callInfosLinearLayout.getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
binding.callInfosLinearLayout.getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
participantsAdapter = new ParticipantsAdapter(
|
participantsAdapter = new ParticipantsAdapter(
|
||||||
this,
|
this,
|
||||||
participantDisplayItems,
|
participantDisplayItems,
|
||||||
binding.conversationRelativeLayout,
|
binding.conversationRelativeLayout,
|
||||||
binding.callInfosLinearLayout,
|
binding.callInfosLinearLayout,
|
||||||
columns,
|
columns,
|
||||||
isVoiceOnlyCall);
|
isVoiceOnlyCall);
|
||||||
binding.gridview.setAdapter(participantsAdapter);
|
binding.gridview.setAdapter(participantsAdapter);
|
||||||
|
|
||||||
|
if (isInPipMode){
|
||||||
|
updateUiForPipMode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2470,6 +2471,13 @@ public class CallActivity extends BaseActivity {
|
||||||
binding.selfVideoViewWrapper.setVisibility(View.GONE);
|
binding.selfVideoViewWrapper.setVisibility(View.GONE);
|
||||||
binding.callStates.callStateRelativeLayout.setVisibility(View.GONE);
|
binding.callStates.callStateRelativeLayout.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
if (participantDisplayItems.size() > 1){
|
||||||
|
binding.pipCallConversationNameTextView.setText(conversationName);
|
||||||
|
binding.pipGroupCallOverlay.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
binding.pipGroupCallOverlay.setVisibility(View.INVISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
binding.selfVideoRenderer.release();
|
binding.selfVideoRenderer.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2483,6 +2491,8 @@ public class CallActivity extends BaseActivity {
|
||||||
|
|
||||||
binding.callInfosLinearLayout.setVisibility(View.VISIBLE);
|
binding.callInfosLinearLayout.setVisibility(View.VISIBLE);
|
||||||
binding.selfVideoViewWrapper.setVisibility(View.VISIBLE);
|
binding.selfVideoViewWrapper.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
binding.pipGroupCallOverlay.setVisibility(View.INVISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onConfigurationChanged(Configuration newConfig) {
|
public void onConfigurationChanged(Configuration newConfig) {
|
||||||
|
|
|
@ -197,4 +197,36 @@
|
||||||
app:roundAsCircle="true" />
|
app:roundAsCircle="true" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/pipGroupCallOverlay"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:background="@color/black"
|
||||||
|
android:gravity="center"
|
||||||
|
android:visibility="invisible">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/pipCallConversationNameTextView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="-30dp"
|
||||||
|
android:layout_marginBottom="15dp"
|
||||||
|
android:layout_marginStart="5dp"
|
||||||
|
android:layout_marginEnd="5dp"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:maxLines="3"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="16sp"
|
||||||
|
tools:text="our group call" />
|
||||||
|
|
||||||
|
<com.facebook.drawee.view.SimpleDraweeView
|
||||||
|
android:layout_width="80dp"
|
||||||
|
android:layout_height="80dp"
|
||||||
|
app:backgroundImage="@drawable/ic_circular_group"
|
||||||
|
app:roundAsCircle="true" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
Loading…
Reference in a new issue