Fix preview size in video call
This commit is contained in:
parent
a53f55ece9
commit
90b977dd2b
6 changed files with 81 additions and 255 deletions
|
@ -1,96 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="fill_parent"
|
|
||||||
android:gravity="bottom|center_horizontal">
|
|
||||||
|
|
||||||
<org.linphone.ui.CameraView
|
|
||||||
android:id="@+id/video_background"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="fill_parent"
|
|
||||||
android:layout_weight="1" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_horizontal|bottom"
|
|
||||||
android:orientation="vertical" >
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:id="@+id/Addresslayout">
|
|
||||||
|
|
||||||
<org.linphone.ui.AddressText
|
|
||||||
android:id="@+id/SipUri"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:hint="sip:"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:lines="1"
|
|
||||||
android:singleLine="true"
|
|
||||||
android:layout_weight="0.2"
|
|
||||||
android:editable="@bool/allow_edit_in_dialer"/>
|
|
||||||
|
|
||||||
<org.linphone.ui.EraseButton
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:id="@+id/Erase"
|
|
||||||
style="@style/DialerDigit"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_weight="0.8"
|
|
||||||
android:text="<"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<org.linphone.ui.Numpad
|
|
||||||
android:id="@+id/Dialer"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="fill_parent"
|
|
||||||
android:layout_weight="0.5" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_height="fill_parent"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_weight="0.5"
|
|
||||||
android:layout_marginLeft="40dp"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<org.linphone.ui.CallButton
|
|
||||||
android:id="@+id/Call"
|
|
||||||
android:layout_height="fill_parent"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_weight="3"
|
|
||||||
android:background="@drawable/clavier_bg"
|
|
||||||
android:src="@drawable/startcall_green" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
style="@style/DialerDigit"
|
|
||||||
android:id="@+id/switch_camera"
|
|
||||||
android:layout_height="fill_parent"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_weight="5"
|
|
||||||
android:text="@string/menu_videocall_switch_camera_title" />
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/status_label"
|
|
||||||
android:clickable="false"
|
|
||||||
android:focusable="false"
|
|
||||||
android:cursorVisible="false"
|
|
||||||
android:textSize="12sp"
|
|
||||||
android:background="#00000000"
|
|
||||||
android:layout_height="fill_parent"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_weight="7"
|
|
||||||
android:textColor="@android:color/white" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</FrameLayout>
|
|
|
@ -1,149 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<RelativeLayout
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:ui="http://schemas.android.com/apk/res/org.linphone"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/conf_header"
|
|
||||||
android:layout_alignParentTop="true"
|
|
||||||
android:layout_marginBottom="10dip"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignWithParentIfMissing="true"
|
|
||||||
android:minHeight="60sp"
|
|
||||||
android:background="@drawable/conf_callee_selector_normal" >
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:text="@string/conf_conference"
|
|
||||||
style="@style/callee_address"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="center"
|
|
||||||
android:layout_gravity="center_vertical" />
|
|
||||||
|
|
||||||
<ImageButton
|
|
||||||
android:id="@+id/conf_header_details"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="fill_parent"
|
|
||||||
android:scaleType="center"
|
|
||||||
android:src="@drawable/conf_details"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/incall_controls_layout"
|
|
||||||
android:layout_alignParentBottom="true"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="bottom|center_horizontal">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<org.linphone.ui.ToggleImageButton
|
|
||||||
android:id="@+id/toggleMuteMic"
|
|
||||||
style="@style/incall_control"
|
|
||||||
ui:checked="@drawable/incall_micro_inverse"
|
|
||||||
ui:unchecked="@drawable/incall_micro"
|
|
||||||
ui:bgdrawables="true" />
|
|
||||||
|
|
||||||
<ImageButton
|
|
||||||
android:id="@+id/incallNumpadShow"
|
|
||||||
style="@style/incall_control"
|
|
||||||
android:background="@drawable/incall_dialpad" />
|
|
||||||
|
|
||||||
<org.linphone.ui.ToggleImageButton
|
|
||||||
android:id="@+id/toggleSpeaker"
|
|
||||||
style="@style/incall_control"
|
|
||||||
ui:checked="@drawable/incall_speaker_inverse"
|
|
||||||
ui:unchecked="@drawable/incall_speaker"
|
|
||||||
ui:bgdrawables="true" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<ImageButton
|
|
||||||
android:id="@+id/addCall"
|
|
||||||
style="@style/incall_control"
|
|
||||||
android:background="@drawable/incall_add" />
|
|
||||||
|
|
||||||
<ImageButton
|
|
||||||
android:id="@+id/conf_simple_merge"
|
|
||||||
style="@style/incall_control"
|
|
||||||
android:visibility="gone"
|
|
||||||
android:background="@drawable/incall_merge" />
|
|
||||||
|
|
||||||
<org.linphone.ui.ToggleImageButton
|
|
||||||
android:id="@+id/conf_simple_pause"
|
|
||||||
style="@style/incall_control"
|
|
||||||
ui:checked="@drawable/incall_pause_inverse"
|
|
||||||
ui:unchecked="@drawable/incall_pause"
|
|
||||||
ui:bgdrawables="true" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/conf_simple_video"
|
|
||||||
style="@style/incall_control"
|
|
||||||
android:text="@string/conf_simple_video_bt_txt"
|
|
||||||
android:background="@drawable/clavier_bg" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<ImageButton
|
|
||||||
android:id="@+id/incallHang"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="@drawable/clavier_bg"
|
|
||||||
android:minHeight="60dip"
|
|
||||||
android:src="@drawable/stopcall_red" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
android:id="@+id/picture_wrapper"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_above="@id/incall_controls_layout">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/incall_picture"
|
|
||||||
android:visibility="gone"
|
|
||||||
android:layout_centerInParent="true"
|
|
||||||
android:paddingBottom="8dip"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:scaleType="fitCenter"
|
|
||||||
android:minWidth="120dip"
|
|
||||||
android:minHeight="120dip" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
<ListView
|
|
||||||
android:id="@android:id/list"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:drawSelectorOnTop="true"
|
|
||||||
android:dividerHeight="10dip"
|
|
||||||
android:divider="@android:color/transparent"
|
|
||||||
android:layout_below="@id/conf_header"
|
|
||||||
android:layout_above="@id/picture_wrapper"
|
|
||||||
android:layout_alignWithParentIfMissing="true"
|
|
||||||
android:fadeScrollbars="false" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
44
res/layout-xlarge/videocall.xml
Executable file
44
res/layout-xlarge/videocall.xml
Executable file
|
@ -0,0 +1,44 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/video_frame"
|
||||||
|
android:layout_height="fill_parent" android:layout_width="fill_parent">
|
||||||
|
|
||||||
|
<org.linphone.mediastream.video.display.GL2JNIView
|
||||||
|
android:visibility="visible"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:id="@+id/video_surface">
|
||||||
|
</org.linphone.mediastream.video.display.GL2JNIView>
|
||||||
|
|
||||||
|
<SurfaceView
|
||||||
|
android:layout_height="148dip"
|
||||||
|
android:layout_width="176dip"
|
||||||
|
android:id="@+id/video_capture_surface"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_marginBottom="15dip"
|
||||||
|
android:layout_marginRight="15dip" >
|
||||||
|
</SurfaceView>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="88dip"
|
||||||
|
android:layout_height="72dip"
|
||||||
|
android:id="@+id/imageView1"
|
||||||
|
android:src="@drawable/video_muted"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_marginBottom="15dip"
|
||||||
|
android:layout_marginRight="15dip" >
|
||||||
|
</ImageView>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/QoS"
|
||||||
|
android:src="@drawable/stat_sys_signal_0"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_alignParentLeft="true" >
|
||||||
|
</ImageView>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
|
@ -42,6 +42,7 @@ import org.linphone.ui.Numpad;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.ActivityInfo;
|
import android.content.pm.ActivityInfo;
|
||||||
|
@ -109,18 +110,13 @@ public class IncallActivity extends AbstractCalleesActivity implements
|
||||||
private View mConferenceVirtualCallee;
|
private View mConferenceVirtualCallee;
|
||||||
private int mMultipleCallsLimit;
|
private int mMultipleCallsLimit;
|
||||||
private boolean mAllowTransfers;
|
private boolean mAllowTransfers;
|
||||||
|
|
||||||
private boolean isXLargeScreen()
|
|
||||||
{
|
|
||||||
return (getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
if (finishIfAutoRestartAfterACrash(savedInstanceState)) {
|
if (finishIfAutoRestartAfterACrash(savedInstanceState)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!isXLargeScreen())
|
if (!Version.isXLargeScreen(this))
|
||||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||||
|
|
||||||
setContentView(R.layout.incall_layout);
|
setContentView(R.layout.incall_layout);
|
||||||
|
@ -665,7 +661,7 @@ public class IncallActivity extends AbstractCalleesActivity implements
|
||||||
@Override
|
@Override
|
||||||
public void onConfigurationChanged(Configuration newConfig)
|
public void onConfigurationChanged(Configuration newConfig)
|
||||||
{
|
{
|
||||||
if (!isXLargeScreen())
|
if (!Version.isXLargeScreen(this))
|
||||||
{
|
{
|
||||||
// Do nothing to not recreate the activity on smartphone if screen is rotated
|
// Do nothing to not recreate the activity on smartphone if screen is rotated
|
||||||
super.onConfigurationChanged(null);
|
super.onConfigurationChanged(null);
|
||||||
|
|
|
@ -22,8 +22,9 @@ package org.linphone;
|
||||||
|
|
||||||
import org.linphone.LinphoneSimpleListener.LinphoneOnCallStateChangedListener;
|
import org.linphone.LinphoneSimpleListener.LinphoneOnCallStateChangedListener;
|
||||||
import org.linphone.core.LinphoneCall;
|
import org.linphone.core.LinphoneCall;
|
||||||
import org.linphone.core.Log;
|
|
||||||
import org.linphone.core.LinphoneCall.State;
|
import org.linphone.core.LinphoneCall.State;
|
||||||
|
import org.linphone.core.Log;
|
||||||
|
import org.linphone.mediastream.Version;
|
||||||
import org.linphone.mediastream.video.AndroidVideoWindowImpl;
|
import org.linphone.mediastream.video.AndroidVideoWindowImpl;
|
||||||
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
|
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
|
||||||
|
|
||||||
|
@ -35,14 +36,19 @@ import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
import android.os.PowerManager.WakeLock;
|
import android.os.PowerManager.WakeLock;
|
||||||
|
import android.view.Display;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
import android.view.Surface;
|
||||||
import android.view.SurfaceHolder;
|
import android.view.SurfaceHolder;
|
||||||
import android.view.SurfaceView;
|
import android.view.SurfaceView;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.WindowManager;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
|
import android.widget.RelativeLayout.LayoutParams;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For Android SDK >= 5
|
* For Android SDK >= 5
|
||||||
|
@ -121,7 +127,6 @@ public class VideoCallActivity extends Activity implements LinphoneOnCallStateCh
|
||||||
PowerManager pm = (PowerManager)getSystemService(Context.POWER_SERVICE);
|
PowerManager pm = (PowerManager)getSystemService(Context.POWER_SERVICE);
|
||||||
mWakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK|PowerManager.ON_AFTER_RELEASE,Log.TAG);
|
mWakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK|PowerManager.ON_AFTER_RELEASE,Log.TAG);
|
||||||
mWakeLock.acquire();
|
mWakeLock.acquire();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateQualityOfSignalIcon(float quality)
|
void updateQualityOfSignalIcon(float quality)
|
||||||
|
@ -321,7 +326,33 @@ public class VideoCallActivity extends Activity implements LinphoneOnCallStateCh
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void resizePreview() {
|
||||||
|
Display display = ((WindowManager) mVideoCaptureViewReady.getContext().getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
|
||||||
|
int rotation = display.getRotation();
|
||||||
|
LayoutParams params;
|
||||||
|
|
||||||
|
int w, h;
|
||||||
|
if (Version.isXLargeScreen(this)) {
|
||||||
|
w = 176;
|
||||||
|
h = 148;
|
||||||
|
} else {
|
||||||
|
w = 88;
|
||||||
|
h = 74;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rotation == Surface.ROTATION_90 || rotation == Surface.ROTATION_270) {
|
||||||
|
params = new LayoutParams(h, w);
|
||||||
|
} else {
|
||||||
|
params = new LayoutParams(w, h);
|
||||||
|
}
|
||||||
|
params.setMargins(0, 0, 15, 15);
|
||||||
|
params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
|
||||||
|
params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
|
||||||
|
mVideoCaptureViewReady.setLayoutParams(params);
|
||||||
|
}
|
||||||
|
|
||||||
public void onConfigurationChanged(Configuration newConfig) {
|
public void onConfigurationChanged(Configuration newConfig) {
|
||||||
|
resizePreview();
|
||||||
super.onConfigurationChanged(null);
|
super.onConfigurationChanged(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit cc40a4f2a7f6fc6eab689208804868d836ddcd8e
|
Subproject commit 06968d9ad3849676847c678568f8fde125084cdd
|
Loading…
Reference in a new issue