Enhancements:

- Numpad component factorizing setAddressWidget
- Digit uses style
- No more NewOutgoingCallReceiver and the associated magic
  Now uses CALL_PRIVILEDGED
- Move Video classes to core.video package and lower visibility
- Merged AndroidCameraRecord5Impl and AndroidCameraRecordImpl
This commit is contained in:
Guillaume Beraudo 2011-02-23 15:37:28 +01:00
parent d89d9c3a3b
commit 97ba73de8d
30 changed files with 331 additions and 406 deletions

View file

@ -66,13 +66,7 @@
<receiver android:name="NetworkManager">
<intent-filter><action android:name="android.net.conn.CONNECTIVITY_CHANGE"></action></intent-filter>
</receiver>
<receiver android:name="OutgoingCallReceiver">
<intent-filter android:priority="0">
<action android:name="android.intent.action.NEW_OUTGOING_CALL"/>
</intent-filter>
</receiver>
<receiver android:name="BootReceiver">
<intent-filter><action android:name="android.intent.action.BOOT_COMPLETED"></action></intent-filter>
</receiver>
@ -84,7 +78,7 @@
<activity android:name=".core.tutorials.TestVideoActivity"
<activity android:name="core.tutorials.video.TestVideoActivity"
android:label="Video test"
android:theme="@android:style/Theme.NoTitleBar"
android:launchMode="singleTask"

View file

@ -3,62 +3,60 @@
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout android:id="@+id/LinearLayout02"
android:layout_height="wrap_content" android:layout_width="fill_parent">
<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:layout_weight="0.2"/>
<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="&lt;"/>
</LinearLayout>
<LinearLayout android:layout_height="wrap_content" android:layout_width="fill_parent">
<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:layout_weight="0.2"/>
<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="&lt;"/>
</LinearLayout>
<FrameLayout android:layout_height="wrap_content"
android:layout_width="fill_parent" android:id="@+id/IncallAddressLayout">
<EditText android:layout_height="wrap_content" android:lines="1"
android:id="@+id/DisplayNameView" android:clickable="false"
android:cursorVisible="false" android:gravity="center"
android:layout_width="fill_parent"></EditText>
<org.linphone.ui.MuteMicButton
android:id="@+id/mic_mute_button" android:layout_height="wrap_content"
android:layout_width="wrap_content" android:layout_weight="0.5"
checked="@drawable/mic_muted" unchecked="@drawable/mic_active"
android:layout_gravity="left|center_vertical" />
<org.linphone.ui.SpeakerButton
android:id="@+id/speaker_button" android:layout_height="wrap_content"
android:layout_width="wrap_content" android:layout_weight="0.5"
checked="@drawable/speaker_32_on" unchecked="@drawable/speaker_32_off"
android:layout_gravity="right|center_vertical" />
</FrameLayout>
</LinearLayout>
<View android:layout_width="0px" android:visibility="invisible" android:layout_weight="1" android:layout_height="fill_parent" />
<FrameLayout android:layout_height="wrap_content"
android:layout_width="fill_parent" android:id="@+id/IncallAddressLayout">
<EditText android:text="@+id/EditText01"
android:layout_height="wrap_content" android:lines="1"
android:id="@+id/DisplayNameView" android:clickable="false"
android:cursorVisible="false" android:gravity="center"
android:layout_width="fill_parent"></EditText>
<org.linphone.ui.MuteMicButton
android:id="@+id/mic_mute_button" android:layout_height="wrap_content"
android:layout_width="wrap_content" android:layout_weight="0.5"
checked="@drawable/mic_muted" unchecked="@drawable/mic_active"
android:layout_gravity="left|center_vertical" />
<org.linphone.ui.SpeakerButton
android:id="@+id/speaker_button" android:layout_height="wrap_content"
android:layout_width="wrap_content" android:layout_weight="0.5"
checked="@drawable/speaker_32_on" unchecked="@drawable/speaker_32_off"
android:layout_gravity="right|center_vertical" />
</FrameLayout>
</LinearLayout>
<TableLayout android:layout_width="fill_parent" android:id="@+id/Dialer"
android:layout_height="fill_parent" android:layout_weight="1">
<TableRow android:layout_height="fill_parent" android:layout_width="fill_parent" android:id="@+id/IncallControlRow" >
<org.linphone.ui.AddVideoButton android:layout_height="fill_parent" android:layout_width="fill_parent" android:id="@+id/AddVideo" android:layout_weight="1" android:src="@drawable/startvideo_green" android:background="@drawable/clavier_bg"/>
<org.linphone.ui.HangCallButton android:layout_height="fill_parent" android:layout_width="fill_parent" android:id="@+id/HangUp" android:layout_weight="1" android:src="@drawable/stopcall_red" android:background="@drawable/clavier_bg"/>
</TableRow>
</TableLayout>
<LinearLayout android:layout_height="fill_parent"
android:layout_width="fill_parent" android:id="@+id/CallControlRow" android:layout_weight="1">
<LinearLayout android:id="@+id/CallControlRow" android:layout_height="wrap_content" android:layout_width="fill_parent" android:gravity="bottom">
<org.linphone.ui.CallButton android:id="@+id/Call"
android:layout_height="fill_parent" android:layout_width="fill_parent" android:layout_weight="0.25" android:background="@drawable/clavier_bg" android:src="@drawable/startcall_green"/>
<org.linphone.ui.HangCallButton android:layout_height="fill_parent" android:layout_width="fill_parent"
android:layout_weight="0.25" android:id="@+id/Decline" android:background="@drawable/clavier_bg" android:src="@drawable/stopcall_red"/>
<org.linphone.ui.HangCallButton android:id="@+id/Decline" android:layout_height="fill_parent" android:layout_width="fill_parent"
android:layout_weight="0.25" android:background="@drawable/clavier_bg" android:src="@drawable/stopcall_red"/>
</LinearLayout>
<EditText android:layout_width="fill_parent" android:id="@+id/status_label"
<LinearLayout android:id="@+id/IncallControlRow" android:layout_height="wrap_content" android:layout_width="fill_parent" android:gravity="bottom">
<org.linphone.ui.AddVideoButton android:id="@+id/AddVideo" android:layout_height="fill_parent" android:layout_width="fill_parent" android:layout_weight="0.25" android:src="@drawable/startvideo_green" android:background="@drawable/clavier_bg"/>
<org.linphone.ui.HangCallButton android:id="@+id/HangUp" android:layout_height="fill_parent" android:layout_width="fill_parent" android:layout_weight="0.25" android:src="@drawable/stopcall_red" android:background="@drawable/clavier_bg"/>
</LinearLayout>
<EditText android:id="@+id/status_label" android:layout_width="fill_parent"
android:clickable="false" android:focusable="false"
android:cursorVisible="false" android:textSize="12sp" android:height="15sp"
android:background="@android:color/transparent" android:textColor="@android:color/white"
android:lines="1" android:layout_height="wrap_content"></EditText>
</LinearLayout>

View file

@ -5,8 +5,7 @@
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout android:id="@+id/LinearLayout02"
android:layout_height="wrap_content" android:layout_width="fill_parent">
<LinearLayout android:layout_height="wrap_content" android:layout_width="fill_parent">
<LinearLayout android:layout_height="wrap_content"
android:layout_width="fill_parent" android:id="@+id/Addresslayout">
<org.linphone.ui.AddressText android:id="@+id/SipUri" android:background="@drawable/clavier_bg_grey" android:hint="sip:" android:layout_width="fill_parent"
@ -33,52 +32,23 @@
android:layout_height="wrap_content" android:layout_width="wrap_content"
checked="@drawable/speaker_32_on" unchecked="@drawable/speaker_32_off"
android:layout_gravity="right|center_vertical"/>
</FrameLayout>
</LinearLayout>
<TableLayout android:layout_width="fill_parent" android:id="@+id/Dialer"
android:layout_height="fill_parent" android:layout_weight="1">
<TableRow android:layout_height="fill_parent"
android:layout_weight="1" android:id="@+id/DialerRow01"
android:layout_width="fill_parent">
<org.linphone.ui.Digit android:id="@+id/Digit1" android:text="1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:textColor="@android:color/black" android:background="@drawable/clavier_bg" android:textStyle="bold" android:textSize="20sp" android:layout_weight="1" />
<org.linphone.ui.Digit android:id="@+id/Digit2" android:text="2" android:layout_width="fill_parent" android:layout_height="fill_parent" android:textColor="@android:color/black" android:background="@drawable/clavier_bg" android:textStyle="bold" android:textSize="20sp" android:layout_weight="1" />
<org.linphone.ui.Digit android:id="@+id/Digit3" android:text="3" android:layout_width="fill_parent" android:layout_height="fill_parent" android:textColor="@android:color/black" android:background="@drawable/clavier_bg" android:textStyle="bold" android:textSize="20sp" android:layout_weight="1" />
</TableRow>
<TableRow android:layout_height="fill_parent"
android:layout_weight="1" android:id="@+id/DialerRow02"
android:layout_width="fill_parent">
<org.linphone.ui.Digit android:id="@+id/Digit4" android:text="4" android:layout_width="fill_parent" android:layout_height="fill_parent" android:textColor="@android:color/black" android:background="@drawable/clavier_bg" android:textStyle="bold" android:textSize="20sp" android:layout_weight="1" />
<org.linphone.ui.Digit android:id="@+id/Digit5" android:text="5" android:layout_width="fill_parent" android:layout_height="fill_parent" android:textColor="@android:color/black" android:background="@drawable/clavier_bg" android:textStyle="bold" android:textSize="20sp" android:layout_weight="1" />
<org.linphone.ui.Digit android:id="@+id/Digit6" android:text="6" android:layout_width="fill_parent" android:layout_height="fill_parent" android:textColor="@android:color/black" android:background="@drawable/clavier_bg" android:textStyle="bold" android:textSize="20sp" android:layout_weight="1" />
</TableRow>
<TableRow android:layout_weight="1" android:layout_height="fill_parent"
android:id="@+id/DialerRow03" android:layout_width="fill_parent">
<org.linphone.ui.Digit android:id="@+id/Digit7" android:text="7" android:layout_width="fill_parent" android:layout_height="fill_parent" android:textColor="@android:color/black" android:background="@drawable/clavier_bg" android:textStyle="bold" android:textSize="20sp" android:layout_weight="1" />
<org.linphone.ui.Digit android:id="@+id/Digit8" android:text="8" android:layout_width="fill_parent" android:layout_height="fill_parent" android:textColor="@android:color/black" android:background="@drawable/clavier_bg" android:textStyle="bold" android:textSize="20sp" android:layout_weight="1" />
<org.linphone.ui.Digit android:id="@+id/Digit9" android:text="9" android:layout_width="fill_parent" android:layout_height="fill_parent" android:textColor="@android:color/black" android:background="@drawable/clavier_bg" android:textStyle="bold" android:textSize="20sp" android:layout_weight="1" />
</TableRow>
<TableRow android:layout_weight="1" android:layout_height="fill_parent"
android:id="@+id/DialerRow04" android:layout_width="fill_parent">
<org.linphone.ui.Digit android:id="@+id/DigitStar" android:text="*" android:layout_width="fill_parent" android:layout_height="fill_parent" android:textColor="@android:color/black" android:background="@drawable/clavier_bg" android:textStyle="bold" android:textSize="20sp" android:layout_weight="1" />
<org.linphone.ui.Digit android:id="@+id/Digit00" android:text="0+" android:layout_width="fill_parent" android:layout_height="fill_parent" android:textColor="@android:color/black" android:background="@drawable/clavier_bg" android:textStyle="bold" android:textSize="20sp" android:layout_weight="1" />
<org.linphone.ui.Digit android:id="@+id/DigitHash" android:text="#" android:layout_width="fill_parent" android:layout_height="fill_parent" android:textColor="@android:color/black" android:background="@drawable/clavier_bg" android:textStyle="bold" android:textSize="20sp" android:layout_weight="1" />
</TableRow>
<TableRow android:layout_height="fill_parent" android:layout_width="fill_parent" android:id="@+id/IncallControlRow">
<org.linphone.ui.AddVideoButton android:layout_height="fill_parent" android:layout_width="fill_parent" android:id="@+id/AddVideo" android:layout_weight="1" android:src="@drawable/startvideo_green" android:background="@drawable/clavier_bg"/>
<org.linphone.ui.HangCallButton android:layout_height="fill_parent" android:layout_width="fill_parent" android:id="@+id/HangUp" android:layout_weight="1" android:src="@drawable/stopcall_red" android:background="@drawable/clavier_bg"/>
</TableRow>
</TableLayout>
<LinearLayout android:id="@+id/LinearLayout01" android:layout_height="wrap_content" android:orientation="vertical" android:layout_width="fill_parent">
<LinearLayout android:layout_height="fill_parent" android:layout_width="fill_parent" android:id="@+id/CallControlRow">
<org.linphone.ui.Numpad android:id="@+id/Dialer" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="4" />
<LinearLayout android:layout_height="wrap_content" android:orientation="vertical" android:layout_width="fill_parent">
<LinearLayout android:id="@+id/CallControlRow" android:layout_height="fill_parent" android:layout_width="fill_parent">
<org.linphone.ui.CallButton android:id="@+id/Call" android:layout_height="fill_parent" android:layout_width="fill_parent" android:layout_weight="0.25" android:src="@drawable/startcall_green" android:background="@drawable/clavier_bg"/>
<org.linphone.ui.HangCallButton android:layout_height="fill_parent" android:layout_width="fill_parent" android:layout_weight="0.25" android:id="@+id/Decline" android:src="@drawable/stopcall_red" android:background="@drawable/clavier_bg"/>
</LinearLayout><EditText android:layout_width="fill_parent" android:id="@+id/status_label" android:clickable="false" android:focusable="false" android:cursorVisible="false" android:textSize="12sp" android:height="15sp" android:layout_height="wrap_content" android:background="@android:color/transparent" android:textColor="@android:color/white"></EditText>
</LinearLayout>
<LinearLayout android:id="@+id/IncallControlRow" android:layout_height="fill_parent" android:layout_width="fill_parent">
<org.linphone.ui.AddVideoButton android:id="@+id/AddVideo" android:src="@drawable/startvideo_green" android:layout_height="fill_parent" android:layout_width="fill_parent" android:layout_weight="0.25" android:background="@drawable/clavier_bg"/>
<org.linphone.ui.HangCallButton android:id="@+id/HangUp" android:src="@drawable/stopcall_red" android:layout_height="fill_parent" android:layout_width="fill_parent" android:layout_weight="0.25" android:background="@drawable/clavier_bg"/>
</LinearLayout>
<EditText android:id="@+id/status_label" android:clickable="false" android:focusable="false" android:cursorVisible="false" android:textSize="12sp" android:height="15sp" android:layout_height="wrap_content" android:layout_width="fill_parent" android:background="@android:color/transparent" android:textColor="@android:color/white" />
</LinearLayout>

31
res/layout/numpad.xml Normal file
View file

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<TableRow android:layout_height="fill_parent" android:layout_weight="1" android:layout_width="fill_parent">
<org.linphone.ui.Digit android:id="@+id/Digit1" android:text="1" style="@style/DialerDigit" />
<org.linphone.ui.Digit android:id="@+id/Digit2" android:text="2" style="@style/DialerDigit" />
<org.linphone.ui.Digit android:id="@+id/Digit3" android:text="3" style="@style/DialerDigit" />
</TableRow>
<TableRow android:layout_height="fill_parent" android:layout_weight="1" android:layout_width="fill_parent">
<org.linphone.ui.Digit android:id="@+id/Digit4" android:text="4" style="@style/DialerDigit" />
<org.linphone.ui.Digit android:id="@+id/Digit5" android:text="5" style="@style/DialerDigit" />
<org.linphone.ui.Digit android:id="@+id/Digit6" android:text="6" style="@style/DialerDigit" />
</TableRow>
<TableRow android:layout_weight="1" android:layout_height="fill_parent" android:layout_width="fill_parent">
<org.linphone.ui.Digit android:id="@+id/Digit7" android:text="7" style="@style/DialerDigit" />
<org.linphone.ui.Digit android:id="@+id/Digit8" android:text="8" style="@style/DialerDigit" />
<org.linphone.ui.Digit android:id="@+id/Digit9" android:text="9" style="@style/DialerDigit" />
</TableRow>
<TableRow android:layout_weight="1" android:layout_height="fill_parent" android:layout_width="fill_parent">
<org.linphone.ui.Digit android:id="@+id/DigitStar" android:text="*" style="@style/DialerDigit" />
<org.linphone.ui.Digit android:id="@+id/Digit00" android:text="0+" style="@style/DialerDigit" />
<org.linphone.ui.Digit android:id="@+id/DigitHash" android:text="#" style="@style/DialerDigit" />
</TableRow>
</TableLayout>
<!-- android:layout_width="fill_parent" android:layout_height="fill_parent" android:textColor="@android:color/black" android:background="@drawable/clavier_bg" android:textStyle="bold" android:textSize="20sp" android:layout_weight="1" -->

View file

@ -1,26 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:padding="6dip" android:layout_height="wrap_content"
android:id="@+id/outcall_chooser_linear_v" android:layout_width="fill_parent"
android:gravity="center">
<LinearLayout android:id="@+id/LinearLayout02"
android:layout_height="wrap_content" android:layout_width="fill_parent"
android:layout_weight="0.5" android:gravity="center">
<ImageButton android:layout_width="wrap_content"
android:layout_height="wrap_content" android:src="@drawable/logo_linphone_57x57"
android:id="@+id/outcall_chooser_linphone_button" android:background="@android:color/transparent"></ImageButton>
</LinearLayout>
<LinearLayout android:id="@+id/LinearLayout01"
android:layout_width="fill_parent" android:layout_weight=".5"
android:gravity="center" android:layout_height="fill_parent">
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="@string/outcall_chooser_cellular"
android:layout_below="@+id/outcall_text" android:layout_alignRight="@+id/outcall_text"
android:id="@+id/outcall_chooser_cellular_button"></Button>
</LinearLayout>
</LinearLayout>

View file

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="pref_handle_outcall_keys">
<item>off</item>
<item>ask_for_outcall_interception</item>
<item>alway_intercept_out_call</item>
</string-array>
</resources>

View file

@ -37,9 +37,6 @@
<string name="pref_ilbc_summary">iLBC might be unavailable depending on ARM processor and Android OS version.</string>
<string name="pref_echo_cancellation">Echo cancellation</string>
<string name="pref_echo_cancellation_key">pref_echo_cancellation_key</string>
<string name="pref_handle_outcall_summarry">Configure how cellular calls are redirected to voip when possible</string>
<string name="pref_handle_outcall">Redirect cellular calls</string>
<string name="pref_handle_outcall_key">pref_handle_outcall_key_v2</string>
<string name="pref_autostart">Start at boot time</string>
<string name="pref_autostart_key">pref_autostart_key</string>
<string name="outcall_chooser_cellular">Cellular</string>
@ -109,10 +106,4 @@
<string name="ec_calibrating">Calibrating...</string>
<string name="ec_calibrated">Calibrated [%s ms]</string>
<string name="failed">failed</string>
<string-array name="pref_handle_outcall_values">
<item>Off</item>
<item>On demand</item>
<item>Always</item>
</string-array>
</resources>

View file

@ -35,7 +35,6 @@
<EditTextPreference android:title="@string/pref_stun_server"
android:key="@string/pref_stun_server_key"></EditTextPreference>
<ListPreference android:key="@string/pref_handle_outcall_key" android:title="@string/pref_handle_outcall" android:summary="@string/pref_handle_outcall_summarry" android:entryValues="@array/pref_handle_outcall_keys" android:entries="@array/pref_handle_outcall_values" android:defaultValue="ask_for_outcall_interception"></ListPreference>
</PreferenceCategory>

View file

@ -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 {

View file

@ -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.

View file

@ -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);

View file

@ -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,

View file

@ -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();
}
});
}
}

View file

@ -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);
}
}
}

View file

@ -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;

View file

@ -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<Size> oneShotSupportedVideoSizes() {
Camera camera = Camera.open();
List<Size> supportedVideoSizes =camera.getParameters().getSupportedPreviewSizes();
camera.release();
return supportedVideoSizes;
}
@Override
protected List<Size> getSupportedPreviewSizes(Parameters parameters) {
return parameters.getSupportedPreviewSizes();
}
}

View file

@ -38,4 +38,8 @@ public class Version {
return buildVersion < value;
}
public static int sdk() {
return buildVersion;
}
}

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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) {

View file

@ -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++) {

View file

@ -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;

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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<Size> oneShotSupportedVideoSizes() {
Camera camera = Camera.open();
List<Size> supportedVideoSizes =camera.getParameters().getSupportedPreviewSizes();
camera.release();
return supportedVideoSizes;
}
@Override
protected List<Size> getSupportedPreviewSizes(Parameters parameters) {
return parameters.getSupportedPreviewSizes();
}
@Override
protected void lowLevelSetPreviewCallback(Camera camera, PreviewCallback cb) {

View file

@ -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

View file

@ -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);

View file

@ -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) {

View file

@ -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<AddressAwareWidget> retrieveChildren(ViewGroup viewGroup) {
final Collection<AddressAwareWidget> views = new ArrayList<AddressAwareWidget>();
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;
}
}