iPad UI like for Android tablets
This commit is contained in:
parent
8df7709ac9
commit
81a4b0e29d
3 changed files with 264 additions and 3 deletions
95
res/layout-xlarge-land/dialer.xml
Normal file
95
res/layout-xlarge-land/dialer.xml
Normal file
|
@ -0,0 +1,95 @@
|
||||||
|
<?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">
|
||||||
|
|
||||||
|
<SurfaceView
|
||||||
|
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"
|
||||||
|
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="20dp"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<org.linphone.ui.CallButton
|
||||||
|
android:id="@+id/Call"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@drawable/clavier_bg"
|
||||||
|
android:src="@drawable/startcall_green" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/switch_camera"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_weight="3"
|
||||||
|
android:text="@string/menu_videocall_switch_camera_title" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/status_label"
|
||||||
|
android:clickable="false"
|
||||||
|
android:focusable="false"
|
||||||
|
android:cursorVisible="false"
|
||||||
|
android:textSize="0sp"
|
||||||
|
android:background="#000000"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_weight="4"
|
||||||
|
android:visibility="invisible"
|
||||||
|
android:textColor="@android:color/white" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</FrameLayout>
|
95
res/layout-xlarge/dialer.xml
Normal file
95
res/layout-xlarge/dialer.xml
Normal file
|
@ -0,0 +1,95 @@
|
||||||
|
<?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">
|
||||||
|
|
||||||
|
<SurfaceView
|
||||||
|
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"
|
||||||
|
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="20dp"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<org.linphone.ui.CallButton
|
||||||
|
android:id="@+id/Call"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@drawable/clavier_bg"
|
||||||
|
android:src="@drawable/startcall_green" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/switch_camera"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_weight="3"
|
||||||
|
android:text="@string/menu_videocall_switch_camera_title" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/status_label"
|
||||||
|
android:clickable="false"
|
||||||
|
android:focusable="false"
|
||||||
|
android:cursorVisible="false"
|
||||||
|
android:textSize="0sp"
|
||||||
|
android:background="#000000"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_weight="4"
|
||||||
|
android:visibility="invisible"
|
||||||
|
android:textColor="@android:color/white" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</FrameLayout>
|
|
@ -18,6 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
package org.linphone;
|
package org.linphone;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
@ -27,6 +28,7 @@ import org.linphone.core.LinphoneCall.State;
|
||||||
import org.linphone.core.LinphoneCore.RegistrationState;
|
import org.linphone.core.LinphoneCore.RegistrationState;
|
||||||
import org.linphone.core.LinphoneProxyConfig;
|
import org.linphone.core.LinphoneProxyConfig;
|
||||||
import org.linphone.core.Log;
|
import org.linphone.core.Log;
|
||||||
|
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
|
||||||
import org.linphone.ui.AddressAware;
|
import org.linphone.ui.AddressAware;
|
||||||
import org.linphone.ui.AddressText;
|
import org.linphone.ui.AddressText;
|
||||||
import org.linphone.ui.CallButton;
|
import org.linphone.ui.CallButton;
|
||||||
|
@ -37,11 +39,16 @@ import android.app.AlertDialog;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
import android.hardware.Camera;
|
||||||
|
import android.hardware.Camera.CameraInfo;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.SurfaceHolder;
|
||||||
|
import android.view.SurfaceHolder.Callback;
|
||||||
|
import android.view.SurfaceView;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.widget.Adapter;
|
import android.widget.Adapter;
|
||||||
|
@ -80,6 +87,11 @@ public class DialerActivity extends Activity implements LinphoneGuiListener {
|
||||||
protected String username;
|
protected String username;
|
||||||
private String key;
|
private String key;
|
||||||
|
|
||||||
|
private SurfaceView mVideoCaptureViewReady;
|
||||||
|
private int mCurrentCameraId = 0;
|
||||||
|
|
||||||
|
private Camera mCamera;
|
||||||
|
|
||||||
private static final String CURRENT_ADDRESS = "org.linphone.current-address";
|
private static final String CURRENT_ADDRESS = "org.linphone.current-address";
|
||||||
private static final String CURRENT_DISPLAYNAME = "org.linphone.current-displayname";
|
private static final String CURRENT_DISPLAYNAME = "org.linphone.current-displayname";
|
||||||
private static final String PREVENT_DOUBLE_CALL = "prevent_call_on_phone_rotation";
|
private static final String PREVENT_DOUBLE_CALL = "prevent_call_on_phone_rotation";
|
||||||
|
@ -194,12 +206,63 @@ public class DialerActivity extends Activity implements LinphoneGuiListener {
|
||||||
mAddress = (AddressText) findViewById(R.id.SipUri);
|
mAddress = (AddressText) findViewById(R.id.SipUri);
|
||||||
((EraseButton) findViewById(R.id.Erase)).setAddressWidget(mAddress);
|
((EraseButton) findViewById(R.id.Erase)).setAddressWidget(mAddress);
|
||||||
|
|
||||||
|
|
||||||
mCall = (CallButton) findViewById(R.id.Call);
|
mCall = (CallButton) findViewById(R.id.Call);
|
||||||
mCall.setAddressWidget(mAddress);
|
mCall.setAddressWidget(mAddress);
|
||||||
|
|
||||||
mStatus = (TextView) findViewById(R.id.status_label);
|
mStatus = (TextView) findViewById(R.id.status_label);
|
||||||
|
|
||||||
|
// For the tablet landscape
|
||||||
|
final int numberOfCameras = Camera.getNumberOfCameras();
|
||||||
|
CameraInfo cameraInfo = new CameraInfo();
|
||||||
|
for (int i = 0; i < numberOfCameras; i++) {
|
||||||
|
Camera.getCameraInfo(i, cameraInfo);
|
||||||
|
if (cameraInfo.facing == CameraInfo.CAMERA_FACING_BACK) {
|
||||||
|
mCurrentCameraId = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mCamera = Camera.open(mCurrentCameraId);
|
||||||
|
|
||||||
|
mVideoCaptureViewReady = (SurfaceView) findViewById(R.id.video_background);
|
||||||
|
if (mVideoCaptureViewReady != null)
|
||||||
|
{
|
||||||
|
mVideoCaptureViewReady.getHolder().addCallback(new Callback() {
|
||||||
|
public void surfaceDestroyed(SurfaceHolder holder) {
|
||||||
|
if (mCamera != null) {
|
||||||
|
mCamera.stopPreview();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void surfaceCreated(SurfaceHolder holder) {
|
||||||
|
try {
|
||||||
|
if (mCamera != null) {
|
||||||
|
mCamera.setPreviewDisplay(holder);
|
||||||
|
}
|
||||||
|
} catch (IOException exception) {
|
||||||
|
Log.e("IOException caused by setPreviewDisplay()", exception);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void surfaceChanged(SurfaceHolder holder, int format, int width,
|
||||||
|
int height) {
|
||||||
|
Camera.Parameters parameters = mCamera.getParameters();
|
||||||
|
parameters.setPreviewSize(holder.getSurfaceFrame().width(), holder.getSurfaceFrame().height());
|
||||||
|
mVideoCaptureViewReady.requestLayout();
|
||||||
|
|
||||||
|
mCamera.setParameters(parameters);
|
||||||
|
mCamera.startPreview();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
mCamera.startPreview();
|
||||||
|
|
||||||
|
Button switchCamera = (Button) findViewById(R.id.switch_camera);
|
||||||
|
if (switchCamera != null)
|
||||||
|
{
|
||||||
|
switchCamera.setOnClickListener(new OnClickListener() {
|
||||||
|
public void onClick(View v) {
|
||||||
|
mCamera = Camera.open((mCurrentCameraId + 1) % numberOfCameras);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
SlidingDrawer drawer = (SlidingDrawer) findViewById(R.id.drawer);
|
SlidingDrawer drawer = (SlidingDrawer) findViewById(R.id.drawer);
|
||||||
if (drawer != null) {
|
if (drawer != null) {
|
||||||
drawer.setOnDrawerScrollListener(new OnDrawerScrollListener() {
|
drawer.setOnDrawerScrollListener(new OnDrawerScrollListener() {
|
||||||
|
@ -256,7 +319,15 @@ public class DialerActivity extends Activity implements LinphoneGuiListener {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPause() {
|
||||||
|
super.onPause();
|
||||||
|
|
||||||
|
if (mCamera != null) {
|
||||||
|
mCamera.release();
|
||||||
|
mCamera = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue