Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2019-04-09 13:27:50 +02:00
parent 48fdee2a65
commit 67b590d9d0
3 changed files with 26 additions and 9 deletions

View File

@ -35,10 +35,7 @@ import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.*;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
@ -98,6 +95,7 @@ import pub.devrel.easypermissions.AfterPermissionGranted;
import javax.inject.Inject;
import java.io.IOException;
import java.lang.reflect.Field;
import java.util.*;
import java.util.concurrent.TimeUnit;
@ -268,6 +266,8 @@ public class CallController extends BaseController {
.setRepeatCount(PulseAnimation.INFINITE)
.setRepeatMode(PulseAnimation.REVERSE);
setPipVideoViewDimensions();
try {
cache.evictAll();
} catch (IOException e) {
@ -540,7 +540,6 @@ public class CallController extends BaseController {
if (enumerator.isFrontFacing(deviceName)) {
Logging.d(TAG, "Creating front facing camera capturer.");
VideoCapturer videoCapturer = enumerator.createCapturer(deviceName, null);
if (videoCapturer != null) {
pipVideoView.setMirror(true);
return videoCapturer;
@ -1431,7 +1430,7 @@ public class CallController extends BaseController {
videoCapturer.startCapture(1280, 720, 30);
}
}
private void processUsersInRoom(List<HashMap<String, Object>> users) {
List<String> newSessions = new ArrayList<>();
Set<String> oldSesssions = new HashSet<>();
@ -1608,13 +1607,31 @@ public class CallController extends BaseController {
public void onMessageEvent(ConfigurationChangeEvent configurationChangeEvent) {
powerManagerUtils.setOrientation(Objects.requireNonNull(getResources()).getConfiguration().orientation);
if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
remoteRenderersLayout.setOrientation(LinearLayout.HORIZONTAL);
} else if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
remoteRenderersLayout.setOrientation(LinearLayout.VERTICAL);
}
setPipVideoViewDimensions();
}
private void setPipVideoViewDimensions() {
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) pipVideoView.getLayoutParams();
if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
remoteRenderersLayout.setOrientation(LinearLayout.HORIZONTAL);
layoutParams.height = (int) getResources().getDimension(R.dimen.large_preview_dimension);
layoutParams.width = FrameLayout.LayoutParams.WRAP_CONTENT;
pipVideoView.setLayoutParams(layoutParams);
} else if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
remoteRenderersLayout.setOrientation(LinearLayout.VERTICAL);
layoutParams.height = FrameLayout.LayoutParams.WRAP_CONTENT;
layoutParams.width = (int) getResources().getDimension(R.dimen.large_preview_dimension);
pipVideoView.setLayoutParams(layoutParams);
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onMessageEvent(PeerConnectionEvent peerConnectionEvent) {
if (peerConnectionEvent.getPeerConnectionEventType().equals(PeerConnectionEvent.PeerConnectionEventType

View File

@ -82,8 +82,8 @@
<org.webrtc.SurfaceViewRenderer
android:id="@+id/pip_video_view"
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_width="@dimen/large_preview_dimension"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="16dp"
android:visibility="invisible" />
@ -94,7 +94,6 @@
android:layout_height="40dp"
android:layout_gravity="center_horizontal|bottom"
android:layout_marginBottom="20dp"
app:checked="false"
app:enableInitialAnimation="false"
app:frontBackgroundColor="@color/colorPrimary"

View File

@ -16,4 +16,5 @@
<dimen name="chat_text_size">14sp</dimen>
<dimen name="message_bubble_corners_radius">6dp</dimen>
<dimen name="message_bubble_corners_padding">8dp</dimen>
<dimen name="large_preview_dimension">120dp</dimen>
</resources>