diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index c44111fef..7eb49ab52 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -66,13 +66,7 @@
-
-
-
-
-
-
-
+
@@ -84,7 +78,7 @@
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
diff --git a/res/layout/dialer.xml b/res/layout/dialer.xml
index a029f42c7..d79bc546b 100644
--- a/res/layout/dialer.xml
+++ b/res/layout/dialer.xml
@@ -5,8 +5,7 @@
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
-
+
+
+
+
+
+
+
+
diff --git a/res/layout/numpad.xml b/res/layout/numpad.xml
new file mode 100644
index 000000000..8ff240fa5
--- /dev/null
+++ b/res/layout/numpad.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/res/layout/outcall_choser.xml b/res/layout/outcall_choser.xml
deleted file mode 100644
index d1c116463..000000000
--- a/res/layout/outcall_choser.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/res/values/array.xml b/res/values/array.xml
deleted file mode 100644
index 55b12f0b3..000000000
--- a/res/values/array.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-- off
-- ask_for_outcall_interception
-- alway_intercept_out_call
-
-
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 99faf8fe9..9e353027e 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -37,9 +37,6 @@
iLBC might be unavailable depending on ARM processor and Android OS version.
Echo cancellation
pref_echo_cancellation_key
- Configure how cellular calls are redirected to voip when possible
- Redirect cellular calls
- pref_handle_outcall_key_v2
Start at boot time
pref_autostart_key
Cellular
@@ -109,10 +106,4 @@
Calibrating...
Calibrated [%s ms]
failed
-
-
-- Off
-- On demand
-- Always
-
diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml
index 95d922f8a..ec287fb62 100644
--- a/res/xml/preferences.xml
+++ b/res/xml/preferences.xml
@@ -35,7 +35,6 @@
-
diff --git a/src/org/linphone/BandwidthManager.java b/src/org/linphone/BandwidthManager.java
index 9d0bb5bb0..7f3e4e3f5 100644
--- a/src/org/linphone/BandwidthManager.java
+++ b/src/org/linphone/BandwidthManager.java
@@ -18,10 +18,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.linphone;
-import org.linphone.core.AndroidCameraRecordManager;
import org.linphone.core.LinphoneCallParams;
import org.linphone.core.LinphoneCore;
import org.linphone.core.VideoSize;
+import org.linphone.core.video.AndroidCameraRecordManager;
public class BandwidthManager {
diff --git a/src/org/linphone/CallManager.java b/src/org/linphone/CallManager.java
index a1e9a3feb..b7138bb3e 100644
--- a/src/org/linphone/CallManager.java
+++ b/src/org/linphone/CallManager.java
@@ -18,12 +18,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.linphone;
-import org.linphone.core.AndroidCameraRecordManager;
import org.linphone.core.LinphoneAddress;
import org.linphone.core.LinphoneCall;
import org.linphone.core.LinphoneCallParams;
import org.linphone.core.LinphoneCore;
import org.linphone.core.LinphoneCoreException;
+import org.linphone.core.video.AndroidCameraRecordManager;
/**
* Handle call updating, reinvites.
diff --git a/src/org/linphone/DialerActivity.java b/src/org/linphone/DialerActivity.java
index 03181ef68..9daff6f58 100644
--- a/src/org/linphone/DialerActivity.java
+++ b/src/org/linphone/DialerActivity.java
@@ -20,14 +20,14 @@ package org.linphone;
import org.linphone.LinphoneManager.NewOutgoingCallUiListener;
import org.linphone.LinphoneService.LinphoneGuiListener;
-import org.linphone.core.AndroidCameraRecordManager;
import org.linphone.core.LinphoneCall;
import org.linphone.core.LinphoneCore;
import org.linphone.core.LinphoneCall.State;
+import org.linphone.core.video.AndroidCameraRecordManager;
import org.linphone.ui.AddVideoButton;
+import org.linphone.ui.AddressAwareWidget;
import org.linphone.ui.AddressText;
import org.linphone.ui.CallButton;
-import org.linphone.ui.Digit;
import org.linphone.ui.EraseButton;
import org.linphone.ui.MuteMicButton;
import org.linphone.ui.SpeakerButton;
@@ -46,8 +46,6 @@ import android.preference.PreferenceManager;
import android.text.Html;
import android.util.Log;
import android.view.View;
-import android.widget.LinearLayout;
-import android.widget.TableRow;
import android.widget.TextView;
import android.widget.Toast;
@@ -76,8 +74,8 @@ public class DialerActivity extends Activity implements LinphoneGuiListener, Alr
private MuteMicButton mMute;
private SpeakerButton mSpeaker;
- private LinearLayout mCallControlRow;
- private TableRow mInCallControlRow;
+ private View mCallControlRow;
+ private View mInCallControlRow;
private View mAddressLayout;
private View mInCallAddressLayout;
@@ -138,15 +136,15 @@ public class DialerActivity extends Activity implements LinphoneGuiListener, Alr
mHangup = findViewById(R.id.HangUp);
- mCallControlRow = (LinearLayout) findViewById(R.id.CallControlRow);
- mAddressLayout = (View) findViewById(R.id.Addresslayout);
+ mCallControlRow = findViewById(R.id.CallControlRow);
+ mAddressLayout = findViewById(R.id.Addresslayout);
- mInCallControlRow = (TableRow) findViewById(R.id.IncallControlRow);
+ mInCallControlRow = findViewById(R.id.IncallControlRow);
mInCallControlRow.setVisibility(View.GONE);
- mInCallAddressLayout = (View) findViewById(R.id.IncallAddressLayout);
+ mInCallAddressLayout = findViewById(R.id.IncallAddressLayout);
mInCallAddressLayout.setVisibility(View.GONE);
- mMute = (MuteMicButton)findViewById(R.id.mic_mute_button);
- mSpeaker = (SpeakerButton)findViewById(R.id.speaker_button);
+ mMute = (MuteMicButton) findViewById(R.id.mic_mute_button);
+ mSpeaker = (SpeakerButton) findViewById(R.id.speaker_button);
try {
@@ -181,21 +179,10 @@ public class DialerActivity extends Activity implements LinphoneGuiListener, Alr
finish();
}
+ AddressAwareWidget numpad = (AddressAwareWidget) findViewById(R.id.Dialer);
+ if (numpad != null)
+ numpad.setAddressWidget(mAddress);
- if (findViewById(R.id.Digit00) != null) { // In landscape view, no keyboard
- ((Digit) findViewById(R.id.Digit00)).setAddressWidget(mAddress);
- ((Digit) findViewById(R.id.Digit1)).setAddressWidget(mAddress);
- ((Digit) findViewById(R.id.Digit2)).setAddressWidget(mAddress);
- ((Digit) findViewById(R.id.Digit3)).setAddressWidget(mAddress);
- ((Digit) findViewById(R.id.Digit4)).setAddressWidget(mAddress);
- ((Digit) findViewById(R.id.Digit5)).setAddressWidget(mAddress);
- ((Digit) findViewById(R.id.Digit6)).setAddressWidget(mAddress);
- ((Digit) findViewById(R.id.Digit7)).setAddressWidget(mAddress);
- ((Digit) findViewById(R.id.Digit8)).setAddressWidget(mAddress);
- ((Digit) findViewById(R.id.Digit9)).setAddressWidget(mAddress);
- ((Digit) findViewById(R.id.DigitStar)).setAddressWidget(mAddress);
- ((Digit) findViewById(R.id.DigitHash)).setAddressWidget(mAddress);
- }
mStatus = (TextView) findViewById(R.id.status_label);
diff --git a/src/org/linphone/LinphoneManager.java b/src/org/linphone/LinphoneManager.java
index 070fa0fd8..50b2ea57f 100644
--- a/src/org/linphone/LinphoneManager.java
+++ b/src/org/linphone/LinphoneManager.java
@@ -25,7 +25,6 @@ import java.io.InputStream;
import java.util.Timer;
import java.util.TimerTask;
-import org.linphone.core.AndroidCameraRecordManager;
import org.linphone.core.LinphoneAddress;
import org.linphone.core.LinphoneAuthInfo;
import org.linphone.core.LinphoneCall;
@@ -42,16 +41,16 @@ import org.linphone.core.LinphoneCore.EcCalibratorStatus;
import org.linphone.core.LinphoneCore.FirewallPolicy;
import org.linphone.core.LinphoneCore.GlobalState;
import org.linphone.core.LinphoneCore.RegistrationState;
+import org.linphone.core.video.AndroidCameraRecordManager;
import android.content.BroadcastReceiver;
-import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
-import android.content.pm.PackageManager;
import android.content.res.Resources;
+import android.hardware.Camera;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.net.ConnectivityManager;
@@ -83,7 +82,6 @@ public final class LinphoneManager implements LinphoneCoreListener {
private static LinphoneManager instance;
private AudioManager mAudioManager;
- private NewOutgoingCallUiListener newOutgoingCallUiListener;
private SharedPreferences mPref;
private Resources mR;
private LinphoneCore mLc;
@@ -95,7 +93,6 @@ public final class LinphoneManager implements LinphoneCoreListener {
mAudioManager = ((AudioManager) c.getSystemService(Context.AUDIO_SERVICE));
mVibrator = (Vibrator) c.getSystemService(Context.VIBRATOR_SERVICE);
mPref = PreferenceManager.getDefaultSharedPreferences(c);
- mPackageManager = c.getPackageManager();
mR = c.getResources();
// Register a sensor to track phoneOrientation for placing new calls.
@@ -111,8 +108,22 @@ public final class LinphoneManager implements LinphoneCoreListener {
mPhoneOrientation = o;
}
}.enable();
+
+ detectIfHasCamera();
}
+ private void detectIfHasCamera() {
+ Log.i(TAG, "Detecting if a camera is present");
+ try {
+ Camera camera = Camera.open();
+ if (hasCamera = camera != null) {
+ camera.release();
+ }
+ } catch (Throwable e) {}
+ Log.i(TAG, (hasCamera ? "A" : "No") + " camera is present");
+
+ }
+
public static final String TAG="Linphone";
/** Called when the activity is first created. */
private static final String LINPHONE_FACTORY_RC = "/data/data/org.linphone/files/linphonerc";
@@ -123,7 +134,7 @@ public final class LinphoneManager implements LinphoneCoreListener {
private Timer mTimer = new Timer("Linphone scheduler");
private BroadcastReceiver mKeepAliveReceiver = new KeepAliveReceiver();
- private PackageManager mPackageManager;
+ private boolean hasCamera;
@@ -157,12 +168,14 @@ public final class LinphoneManager implements LinphoneCoreListener {
}
}
- public synchronized static final LinphoneManager createAndStart(Context c, LinphoneServiceListener listener) {
+ public synchronized static final LinphoneManager createAndStart(
+ Context c, LinphoneServiceListener listener) {
if (instance != null)
throw new RuntimeException("Linphone Manager is already initialized");
instance = new LinphoneManager(c);
- instance.startLibLinphone(c, listener);
+ instance.serviceListener = listener;
+ instance.startLibLinphone(c);
return instance;
}
@@ -186,20 +199,16 @@ public final class LinphoneManager implements LinphoneCoreListener {
public void newOutgoingCall(AddressType address) {
String to = address.getText().toString();
- if (to.contains(OutgoingCallReceiver.TAG)) {
- to = to.replace(OutgoingCallReceiver.TAG, "");
- address.setText(to);
- }
if (mLc.isIncall()) {
- newOutgoingCallUiListener.onAlreadyInCall();
+ serviceListener.tryingNewOutgoingCallButAlreadyInCall();
return;
}
LinphoneAddress lAddress;
try {
lAddress = mLc.interpretUrl(to);
} catch (LinphoneCoreException e) {
- newOutgoingCallUiListener.onWrongDestinationAddress();
+ serviceListener.tryingNewOutgoingCallButWrongDestinationAddress();
return;
}
lAddress.setDisplayName(address.getDisplayedName());
@@ -211,7 +220,7 @@ public final class LinphoneManager implements LinphoneCoreListener {
CallManager.getInstance().inviteAddress(lAddress, prefVideoEnable && prefInitiateWithVideo);
} catch (LinphoneCoreException e) {
- newOutgoingCallUiListener.onCannotGetCallParameters();
+ serviceListener.tryingNewOutgoingCallButCannotGetCallParameters();
return;
}
}
@@ -223,10 +232,6 @@ public final class LinphoneManager implements LinphoneCoreListener {
AndroidCameraRecordManager.getInstance().setPhoneOrientation(mPhoneOrientation);
}
- public void setNewOutgoingCallUiListener(NewOutgoingCallUiListener l) {
- this.newOutgoingCallUiListener = l;
- }
-
public static interface AddressType {
void setText(CharSequence s);
CharSequence getText();
@@ -288,9 +293,8 @@ public final class LinphoneManager implements LinphoneCoreListener {
sendStaticImage(rm.toggleMute());
}
- private synchronized void startLibLinphone(final Context context, final LinphoneServiceListener listener) {
+ private synchronized void startLibLinphone(final Context context) {
try {
- this.serviceListener = listener;
copyAssetsFromPackage(context);
mLc = LinphoneCoreFactory.instance().createLinphoneCore(
@@ -370,28 +374,6 @@ public final class LinphoneManager implements LinphoneCoreListener {
}
- String sOutcalls = mPref.getString(getString(R.string.pref_handle_outcall_key), OutgoingCallReceiver.key_on_demand);
- boolean handleOutcalls = !sOutcalls.equalsIgnoreCase(OutgoingCallReceiver.key_off);
-
-/* Now useless, see enablePkgComponent
- * if (handleOutcalls){
- IntentFilter lFilter = new IntentFilter(Intent.ACTION_SCREEN_ON);
- lFilter.setPriority(0);
- lFilter.addAction(Intent.ACTION_NEW_OUTGOING_CALL);
- if (mOutgoingCallReceiver == null) {
- mOutgoingCallReceiver = new OutgoingCallReceiver();
- }
- context.registerReceiver(mOutgoingCallReceiver,lFilter);
- } else if (mOutgoingCallReceiver!=null) {
- context.unregisterReceiver(mOutgoingCallReceiver);
- mOutgoingCallReceiver=null;
- }*/
-
- // Enable/disable outgoing call receiver according to user wishes
- // Could be done already once when the preference is changed in UI.
- enablePkgComponent(context, OutgoingCallReceiver.class, handleOutcalls);
-
-
mLc.enableEchoCancellation(mPref.getBoolean(getString(R.string.pref_echo_cancellation_key),false));
} catch (LinphoneCoreException e) {
throw new LinphoneConfigException(getString(R.string.wrong_settings),e);
@@ -480,14 +462,6 @@ public final class LinphoneManager implements LinphoneCoreListener {
}
- private void enablePkgComponent(Context context, Class> clazz, boolean state) {
- mPackageManager.setComponentEnabledSetting(
- new ComponentName(context, clazz),
- state ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED
- : PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
- 0);
- }
-
private void enableDisableAudioCodec(String codec, int rate, int key) throws LinphoneCoreException {
PayloadType pt = mLc.findPayloadType(codec, rate);
if (pt !=null) {
@@ -517,7 +491,7 @@ public final class LinphoneManager implements LinphoneCoreListener {
}
public boolean hasCamera() {
- return mPackageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA);
+ return hasCamera;
}
public static synchronized void destroy(Context context) {
@@ -555,6 +529,9 @@ public final class LinphoneManager implements LinphoneCoreListener {
public interface LinphoneServiceListener {
void onGlobalStateChanged(GlobalState state, String message);
+ void tryingNewOutgoingCallButCannotGetCallParameters();
+ void tryingNewOutgoingCallButWrongDestinationAddress();
+ void tryingNewOutgoingCallButAlreadyInCall();
void onRegistrationStateChanged(RegistrationState state, String message);
void onCallStateChanged(LinphoneCall call, State state, String message);
void onEcCalibrationStatus(EcCalibratorStatus status, Object data,
diff --git a/src/org/linphone/LinphoneService.java b/src/org/linphone/LinphoneService.java
index 6993df5bc..adeaed939 100644
--- a/src/org/linphone/LinphoneService.java
+++ b/src/org/linphone/LinphoneService.java
@@ -21,6 +21,7 @@ package org.linphone;
import java.io.IOException;
import org.linphone.LinphoneManager.LinphoneServiceListener;
+import org.linphone.LinphoneManager.NewOutgoingCallUiListener;
import org.linphone.core.LinphoneCall;
import org.linphone.core.LinphoneCore;
import org.linphone.core.LinphoneCall.State;
@@ -234,7 +235,7 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
}
- public interface LinphoneGuiListener {
+ public interface LinphoneGuiListener extends NewOutgoingCallUiListener {
void onDisplayStatus(String message);
void onGlobalStateChangedToOn(String message);
// void onRegistrationStateChanged(RegistrationState state, String message);
@@ -250,5 +251,32 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
Log.e(LinphoneManager.TAG, "cannot set ringtone", e);
}
}
+
+ public void tryingNewOutgoingCallButAlreadyInCall() {
+ mHandler.post(new Runnable() {
+ public void run() {
+ if (guiListener() != null)
+ guiListener().onAlreadyInCall();
+ }
+ });
+ }
+
+ public void tryingNewOutgoingCallButCannotGetCallParameters() {
+ mHandler.post(new Runnable() {
+ public void run() {
+ if (guiListener() != null)
+ guiListener().onCannotGetCallParameters();
+ }
+ });
+ }
+
+ public void tryingNewOutgoingCallButWrongDestinationAddress() {
+ mHandler.post(new Runnable() {
+ public void run() {
+ if (guiListener() != null)
+ guiListener().onWrongDestinationAddress();
+ }
+ });
+ }
}
diff --git a/src/org/linphone/OutgoingCallReceiver.java b/src/org/linphone/OutgoingCallReceiver.java
deleted file mode 100644
index a26867f90..000000000
--- a/src/org/linphone/OutgoingCallReceiver.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
-OutgoingCallReceiver.java
-Copyright (C) 2010 Belledonne Communications, Grenoble, France
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
-package org.linphone;
-
-import android.app.Activity;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.net.Uri;
-import android.preference.PreferenceManager;
-import android.util.Log;
-
-/**
- * Intercept outgoing calls dialed through Android dialer.
- * Redirect the calls through Linphone according to user preferences.
- *
- */
-public class OutgoingCallReceiver extends BroadcastReceiver {
- public static final String TAG = ";0000000";
- public static final String key_off="off";
- public static final String key_on_demand="ask_for_outcall_interception";
- public static final String key_always="alway_intercept_out_call";
-
-
- @Override
- public void onReceive(Context context, Intent intent) {
- String to = intent.getStringExtra("android.intent.extra.PHONE_NUMBER");
-
- //do not catch ussd codes
- if (to==null || to.contains("#"))
- return;
-
- if (!to.contains(TAG)) {
- if (LinphoneService.isReady() && LinphoneManager.getLc().getDefaultProxyConfig()==null) {
- //just return
- return;
- }
- setResult(Activity.RESULT_OK,null, null);
- Intent lIntent = new Intent();
- // 1 check config
- if (PreferenceManager.getDefaultSharedPreferences(context).getString(context.getString(R.string.pref_handle_outcall_key),key_on_demand).equals(key_always)) {
- //start linphone directly
- lIntent.setClass(context, LinphoneActivity.class);
- } else {
- //start activity chooser
- lIntent.setAction(Intent.ACTION_CALL);
- }
-
- lIntent.setData(Uri.parse("tel:"+to+TAG));
- lIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- context.startActivity(lIntent);
-
- } else {
- setResult(Activity.RESULT_OK,to.replace(TAG, ""),null);
- }
- }
-
-}
diff --git a/src/org/linphone/VideoCallActivity.java b/src/org/linphone/VideoCallActivity.java
index 8023b2064..93157d837 100644
--- a/src/org/linphone/VideoCallActivity.java
+++ b/src/org/linphone/VideoCallActivity.java
@@ -20,10 +20,10 @@ package org.linphone;
-import org.linphone.core.AndroidCameraRecordManager;
import org.linphone.core.LinphoneCore;
import org.linphone.core.Version;
import org.linphone.core.VideoSize;
+import org.linphone.core.video.AndroidCameraRecordManager;
import android.app.Activity;
import android.content.Context;
@@ -38,6 +38,11 @@ import android.view.MenuItem;
import android.view.SurfaceView;
import android.view.ViewGroup.LayoutParams;
+/**
+ * For Android SDK >=
+ * @author Guillaume Beraudo
+ *
+ */
public class VideoCallActivity extends Activity {
private SurfaceView mVideoView;
private SurfaceView mVideoCaptureView;
diff --git a/src/org/linphone/core/AndroidCameraRecord5Impl.java b/src/org/linphone/core/AndroidCameraRecord5Impl.java
deleted file mode 100644
index 18e487d12..000000000
--- a/src/org/linphone/core/AndroidCameraRecord5Impl.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
-AndroidCameraRecordImplAPI5.java
-Copyright (C) 2010 Belledonne Communications, Grenoble, France
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
-package org.linphone.core;
-
-import java.util.List;
-
-import android.hardware.Camera;
-import android.hardware.Camera.Parameters;
-import android.hardware.Camera.Size;
-import android.util.Log;
-
-
-public class AndroidCameraRecord5Impl extends AndroidCameraRecordImpl {
-
- public AndroidCameraRecord5Impl(RecorderParams parameters) {
- super(parameters);
- }
-
- @Override
- protected void onSettingCameraParameters(Parameters parameters) {
- super.onSettingCameraParameters(parameters);
-
- if (parameters.getSupportedFocusModes().contains(Camera.Parameters.FOCUS_MODE_AUTO)) {
- Log.w(tag, "Auto Focus supported by camera device");
- parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO);
- } else {
- Log.w(tag, "Auto Focus not supported by camera device");
- if (parameters.getSupportedFocusModes().contains(Camera.Parameters.FOCUS_MODE_INFINITY)) {
- Log.w(tag, "Infinity Focus supported by camera device");
- parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_INFINITY);
- } else {
- Log.w(tag, "Infinity Focus not supported by camera device");
- }
- }
- }
-
- public static List oneShotSupportedVideoSizes() {
- Camera camera = Camera.open();
- List supportedVideoSizes =camera.getParameters().getSupportedPreviewSizes();
- camera.release();
- return supportedVideoSizes;
- }
-
- @Override
- protected List getSupportedPreviewSizes(Parameters parameters) {
- return parameters.getSupportedPreviewSizes();
- }
-}
diff --git a/src/org/linphone/core/Version.java b/src/org/linphone/core/Version.java
index 057fb53a3..c06a2efea 100644
--- a/src/org/linphone/core/Version.java
+++ b/src/org/linphone/core/Version.java
@@ -38,4 +38,8 @@ public class Version {
return buildVersion < value;
}
+ public static int sdk() {
+ return buildVersion;
+ }
+
}
\ No newline at end of file
diff --git a/src/org/linphone/core/tutorials/AndroidTutorialNotifier.java b/src/org/linphone/core/tutorials/AndroidTutorialNotifier.java
index 01e0555e2..7721f7dc1 100644
--- a/src/org/linphone/core/tutorials/AndroidTutorialNotifier.java
+++ b/src/org/linphone/core/tutorials/AndroidTutorialNotifier.java
@@ -23,11 +23,12 @@ import android.widget.TextView;
/**
* Write notifications to a TextView widget.
+ * This is an helper class, not a test activity.
*
* @author Guillaume Beraudo
*
*/
-public class AndroidTutorialNotifier extends TutorialNotifier {
+class AndroidTutorialNotifier extends TutorialNotifier {
private Handler mHandler;
private TextView outputTextView;
diff --git a/src/org/linphone/core/tutorials/JavaCameraRecordImpl.java b/src/org/linphone/core/tutorials/JavaCameraRecordImpl.java
index 33cc6b22e..a40bee238 100644
--- a/src/org/linphone/core/tutorials/JavaCameraRecordImpl.java
+++ b/src/org/linphone/core/tutorials/JavaCameraRecordImpl.java
@@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.linphone.core.tutorials;
-import org.linphone.core.AndroidCameraRecord;
+import org.linphone.core.video.AndroidCameraRecord;
import android.hardware.Camera;
import android.hardware.Camera.PreviewCallback;
@@ -26,7 +26,13 @@ import android.hardware.Camera.Size;
import android.util.Log;
import android.widget.TextView;
-public class JavaCameraRecordImpl extends AndroidCameraRecord implements PreviewCallback {
+/**
+ * This is an helper class, not a test activity.
+ *
+ * @author Guillaume Beraudo
+ *
+ */
+class JavaCameraRecordImpl extends AndroidCameraRecord implements PreviewCallback {
private TextView debug;
private long count = 0;
diff --git a/src/org/linphone/core/tutorials/TestVideoActivity.java b/src/org/linphone/core/tutorials/TestVideoActivity.java
index 6bbdab517..ce3a9185b 100644
--- a/src/org/linphone/core/tutorials/TestVideoActivity.java
+++ b/src/org/linphone/core/tutorials/TestVideoActivity.java
@@ -21,8 +21,8 @@ package org.linphone.core.tutorials;
import java.util.Stack;
import org.linphone.R;
-import org.linphone.core.AndroidCameraRecord;
import org.linphone.core.VideoSize;
+import org.linphone.core.video.AndroidCameraRecord;
import android.app.Activity;
import android.os.Bundle;
diff --git a/src/org/linphone/core/AndroidCameraConf.java b/src/org/linphone/core/video/AndroidCameraConf.java
similarity index 94%
rename from src/org/linphone/core/AndroidCameraConf.java
rename to src/org/linphone/core/video/AndroidCameraConf.java
index 523f249b0..1d430082e 100644
--- a/src/org/linphone/core/AndroidCameraConf.java
+++ b/src/org/linphone/core/video/AndroidCameraConf.java
@@ -16,13 +16,13 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-package org.linphone.core;
+package org.linphone.core.video;
import org.linphone.Hacks;
import android.util.Log;
-public class AndroidCameraConf {
+class AndroidCameraConf {
private static final String tag = "Linphone";
public void findFrontAndRearCameraIds(int[] frontCameraId, int[] rearCameraId, int[] cameraId) {
@@ -39,6 +39,7 @@ public class AndroidCameraConf {
}
public int getNumberOfCameras() {
+ Log.i(tag, "Detecting the number of cameras");
// Use hacks to guess the number of cameras
if (Hacks.isGalaxyS()) {
Log.d(tag, "Hack Galaxy S : has 2 cameras");
@@ -46,7 +47,7 @@ public class AndroidCameraConf {
} else
return 1;
}
-
+
public int getCameraOrientation(int cameraId) {
diff --git a/src/org/linphone/core/AndroidCameraConf9.java b/src/org/linphone/core/video/AndroidCameraConf9.java
similarity index 94%
rename from src/org/linphone/core/AndroidCameraConf9.java
rename to src/org/linphone/core/video/AndroidCameraConf9.java
index 07e49bab0..4c3713b83 100644
--- a/src/org/linphone/core/AndroidCameraConf9.java
+++ b/src/org/linphone/core/video/AndroidCameraConf9.java
@@ -16,11 +16,11 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-package org.linphone.core;
+package org.linphone.core.video;
import android.hardware.Camera;
-public class AndroidCameraConf9 extends AndroidCameraConf {
+class AndroidCameraConf9 extends AndroidCameraConf {
public void findFrontAndRearCameraIds9(Integer frontCameraId, Integer rearCameraId, Integer cameraId) {
for (int id=0; id < getNumberOfCameras(); id++) {
diff --git a/src/org/linphone/core/AndroidCameraRecord.java b/src/org/linphone/core/video/AndroidCameraRecord.java
similarity index 99%
rename from src/org/linphone/core/AndroidCameraRecord.java
rename to src/org/linphone/core/video/AndroidCameraRecord.java
index 6feafc322..64af664f5 100644
--- a/src/org/linphone/core/AndroidCameraRecord.java
+++ b/src/org/linphone/core/video/AndroidCameraRecord.java
@@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-package org.linphone.core;
+package org.linphone.core.video;
import java.util.ArrayList;
import java.util.Collections;
diff --git a/src/org/linphone/core/AndroidCameraRecord8Impl.java b/src/org/linphone/core/video/AndroidCameraRecord8.java
similarity index 92%
rename from src/org/linphone/core/AndroidCameraRecord8Impl.java
rename to src/org/linphone/core/video/AndroidCameraRecord8.java
index 490d9ad97..20805bd64 100644
--- a/src/org/linphone/core/AndroidCameraRecord8Impl.java
+++ b/src/org/linphone/core/video/AndroidCameraRecord8.java
@@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-package org.linphone.core;
+package org.linphone.core.video;
import android.hardware.Camera;
import android.hardware.Camera.Parameters;
@@ -30,10 +30,10 @@ import android.util.Log;
* @author Guillaume Beraudo
*
*/
-public class AndroidCameraRecord8Impl extends AndroidCameraRecord5Impl {
+class AndroidCameraRecord8 extends AndroidCameraRecordImpl {
- public AndroidCameraRecord8Impl(RecorderParams parameters) {
+ public AndroidCameraRecord8(RecorderParams parameters) {
super(parameters);
}
diff --git a/src/org/linphone/core/AndroidCameraRecord9Impl.java b/src/org/linphone/core/video/AndroidCameraRecord9.java
similarity index 86%
rename from src/org/linphone/core/AndroidCameraRecord9Impl.java
rename to src/org/linphone/core/video/AndroidCameraRecord9.java
index 0ddb283d2..d81e8103e 100644
--- a/src/org/linphone/core/AndroidCameraRecord9Impl.java
+++ b/src/org/linphone/core/video/AndroidCameraRecord9.java
@@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-package org.linphone.core;
+package org.linphone.core.video;
import android.hardware.Camera;
@@ -26,10 +26,10 @@ import android.hardware.Camera;
* @author Guillaume Beraudo
*
*/
-public class AndroidCameraRecord9Impl extends AndroidCameraRecord8Impl {
+class AndroidCameraRecord9 extends AndroidCameraRecord8 {
- public AndroidCameraRecord9Impl(RecorderParams parameters) {
+ public AndroidCameraRecord9(RecorderParams parameters) {
super(parameters);
}
diff --git a/src/org/linphone/core/AndroidCameraRecordImpl.java b/src/org/linphone/core/video/AndroidCameraRecordImpl.java
similarity index 67%
rename from src/org/linphone/core/AndroidCameraRecordImpl.java
rename to src/org/linphone/core/video/AndroidCameraRecordImpl.java
index f1a4f4844..9e30cca07 100644
--- a/src/org/linphone/core/AndroidCameraRecordImpl.java
+++ b/src/org/linphone/core/video/AndroidCameraRecordImpl.java
@@ -16,19 +16,24 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-package org.linphone.core;
+package org.linphone.core.video;
+
+import java.util.List;
import android.hardware.Camera;
+import android.hardware.Camera.Parameters;
import android.hardware.Camera.PreviewCallback;
+import android.hardware.Camera.Size;
import android.util.Log;
/**
* Record from Android camera.
+ * Android >= 5 (2.0) version.
*
* @author Guillaume Beraudo
*
*/
-public class AndroidCameraRecordImpl extends AndroidCameraRecord implements PreviewCallback {
+class AndroidCameraRecordImpl extends AndroidCameraRecord implements PreviewCallback {
private long filterCtxPtr;
private double timeElapsedBetweenFrames = 0;
@@ -85,7 +90,35 @@ public class AndroidCameraRecordImpl extends AndroidCameraRecord implements Prev
putImage(filterCtxPtr, data, rotation);
}
+ @Override
+ protected void onSettingCameraParameters(Parameters parameters) {
+ super.onSettingCameraParameters(parameters);
+ if (parameters.getSupportedFocusModes().contains(Camera.Parameters.FOCUS_MODE_AUTO)) {
+ Log.w(tag, "Auto Focus supported by camera device");
+ parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO);
+ } else {
+ Log.w(tag, "Auto Focus not supported by camera device");
+ if (parameters.getSupportedFocusModes().contains(Camera.Parameters.FOCUS_MODE_INFINITY)) {
+ Log.w(tag, "Infinity Focus supported by camera device");
+ parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_INFINITY);
+ } else {
+ Log.w(tag, "Infinity Focus not supported by camera device");
+ }
+ }
+ }
+
+ public static List oneShotSupportedVideoSizes() {
+ Camera camera = Camera.open();
+ List supportedVideoSizes =camera.getParameters().getSupportedPreviewSizes();
+ camera.release();
+ return supportedVideoSizes;
+ }
+
+ @Override
+ protected List getSupportedPreviewSizes(Parameters parameters) {
+ return parameters.getSupportedPreviewSizes();
+ }
@Override
protected void lowLevelSetPreviewCallback(Camera camera, PreviewCallback cb) {
diff --git a/src/org/linphone/core/AndroidCameraRecordManager.java b/src/org/linphone/core/video/AndroidCameraRecordManager.java
similarity index 94%
rename from src/org/linphone/core/AndroidCameraRecordManager.java
rename to src/org/linphone/core/video/AndroidCameraRecordManager.java
index ecf12c597..87c4f53ac 100644
--- a/src/org/linphone/core/AndroidCameraRecordManager.java
+++ b/src/org/linphone/core/video/AndroidCameraRecordManager.java
@@ -16,11 +16,12 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-package org.linphone.core;
+package org.linphone.core.video;
import java.util.List;
-import org.linphone.core.AndroidCameraRecord.RecorderParams;
+import org.linphone.core.Version;
+import org.linphone.core.video.AndroidCameraRecord.RecorderParams;
import android.hardware.Camera.Size;
import android.util.Log;
@@ -173,13 +174,13 @@ public class AndroidCameraRecordManager {
parameters.surfaceView = surfaceView;
if (Version.sdkAboveOrEqual(9)) {
- recorder = new AndroidCameraRecord9Impl(parameters);
+ recorder = new AndroidCameraRecord9(parameters);
} else if (Version.sdkAboveOrEqual(8)) {
- recorder = new AndroidCameraRecord8Impl(parameters);
+ recorder = new AndroidCameraRecord8(parameters);
} else if (Version.sdkAboveOrEqual(5)) {
- recorder = new AndroidCameraRecord5Impl(parameters);
- } else {
recorder = new AndroidCameraRecordImpl(parameters);
+ } else {
+ throw new RuntimeException("SDK version unsupported " + Version.sdk());
}
recorder.startPreview();
@@ -209,7 +210,7 @@ public class AndroidCameraRecordManager {
}
if (Version.sdkAboveOrEqual(5)) {
- supportedVideoSizes = AndroidCameraRecord5Impl.oneShotSupportedVideoSizes();
+ supportedVideoSizes = AndroidCameraRecordImpl.oneShotSupportedVideoSizes();
}
// eventually null
diff --git a/src/org/linphone/ui/AddressAwareWidget.java b/src/org/linphone/ui/AddressAwareWidget.java
index 5a46cc6db..451271e3f 100644
--- a/src/org/linphone/ui/AddressAwareWidget.java
+++ b/src/org/linphone/ui/AddressAwareWidget.java
@@ -18,6 +18,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.linphone.ui;
+
+
public interface AddressAwareWidget {
void setAddressWidget(AddressText address);
diff --git a/src/org/linphone/ui/Digit.java b/src/org/linphone/ui/Digit.java
index 89a52ceb0..023bbd5d0 100644
--- a/src/org/linphone/ui/Digit.java
+++ b/src/org/linphone/ui/Digit.java
@@ -25,10 +25,9 @@ import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
-import android.view.View.OnLongClickListener;
import android.widget.Button;
-public class Digit extends Button implements OnLongClickListener, AddressAwareWidget {
+public class Digit extends Button implements AddressAwareWidget {
private AddressText mAddress;
@@ -45,40 +44,32 @@ public class Digit extends Button implements OnLongClickListener, AddressAwareWi
setOnTouchListener(lListener);
if ("0+".equals(text)) {
- setOnLongClickListener(this);
+ setOnLongClickListener(lListener);
+
}
}
- public boolean onLongClick(View arg0) {
- // Called if "0+" dtmf
- LinphoneCore lc = LinphoneManager.getLc();
- lc.stopDtmf();
- int lBegin = mAddress.getSelectionStart();
- if (lBegin == -1) {
- lBegin = mAddress.getEditableText().length();
- }
- if (lBegin >=0) {
- mAddress.getEditableText().insert(lBegin,"+");
- }
- return true;
- }
public Digit(Context context, AttributeSet attrs, int style) {
super(context, attrs, style);
+ setLongClickable(true);
}
public Digit(Context context, AttributeSet attrs) {
super(context, attrs);
+ setLongClickable(true);
+
}
public Digit(Context context) {
super(context);
+ setLongClickable(true);
}
- private class DialKeyListener implements OnClickListener, OnTouchListener {
+ private class DialKeyListener implements OnClickListener, OnTouchListener, OnLongClickListener {
final CharSequence mKeyCode;
boolean mIsDtmfStarted=false;
@@ -117,6 +108,20 @@ public class Digit extends Button implements OnLongClickListener, AddressAwareWi
}
return false;
}
+
+ public boolean onLongClick(View v) {
+ // Called if "0+" dtmf
+ LinphoneCore lc = LinphoneManager.getLc();
+ lc.stopDtmf();
+ int lBegin = mAddress.getSelectionStart();
+ if (lBegin == -1) {
+ lBegin = mAddress.getEditableText().length();
+ }
+ if (lBegin >=0) {
+ mAddress.getEditableText().insert(lBegin,"+");
+ }
+ return true;
+ }
};
public void setAddressWidget(AddressText address) {
diff --git a/src/org/linphone/ui/Numpad.java b/src/org/linphone/ui/Numpad.java
new file mode 100644
index 000000000..5070c4842
--- /dev/null
+++ b/src/org/linphone/ui/Numpad.java
@@ -0,0 +1,64 @@
+/*
+NumpadView.java
+Copyright (C) 2010 Belledonne Communications, Grenoble, France
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+package org.linphone.ui;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.linphone.R;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.LinearLayout;
+
+public class Numpad extends LinearLayout implements AddressAwareWidget {
+
+ public Numpad(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ LayoutInflater.from(context).inflate(R.layout.numpad, this);
+ setLongClickable(true);
+ }
+
+ public void setAddressWidget(AddressText address) {
+ for (AddressAwareWidget v : retrieveChildren(this)) {
+ v.setAddressWidget(address);
+ }
+ }
+
+
+ private Collection retrieveChildren(ViewGroup viewGroup) {
+ final Collection views = new ArrayList();
+
+ for (int i = 0; i < viewGroup.getChildCount(); i++) {
+ View v = viewGroup.getChildAt(i);
+ if (v instanceof ViewGroup) {
+ views.addAll(retrieveChildren((ViewGroup) v));
+ } else {
+ if (v instanceof AddressAwareWidget)
+ views.add((AddressAwareWidget) v);
+ }
+ }
+
+ return views;
+ }
+
+}