diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 01b1d972e..967ce5274 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -79,6 +79,12 @@
+
+
+
+
+
diff --git a/res/layout/conf_callee.xml b/res/layout/conf_callee.xml
index a63fea3a4..faff7916f 100644
--- a/res/layout/conf_callee.xml
+++ b/res/layout/conf_callee.xml
@@ -12,27 +12,18 @@
android:layout_width="wrap_content" android:layout_height="fill_parent"
android:layout_centerVertical="true">
+ android:visibility="gone"
+ android:layout_width="wrap_content" android:layout_height="wrap_content" />
-
-
-
-
-
+ android:visibility="gone"
+ android:layout_width="wrap_content" android:layout_height="wrap_content" />
-
-
+
diff --git a/res/layout/conf_callee_older_devices.xml b/res/layout/conf_callee_older_devices.xml
index 3b21cd493..86eb82a86 100644
--- a/res/layout/conf_callee_older_devices.xml
+++ b/res/layout/conf_callee_older_devices.xml
@@ -21,24 +21,11 @@
-
-
-
-
-
-
diff --git a/res/layout/conf_choices_admin.xml b/res/layout/conf_choices_admin.xml
deleted file mode 100644
index cc7963fb3..000000000
--- a/res/layout/conf_choices_admin.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/res/layout/conf_choices_dialog.xml b/res/layout/conf_choices_dialog.xml
index bce46ca5a..7d2fd1581 100644
--- a/res/layout/conf_choices_dialog.xml
+++ b/res/layout/conf_choices_dialog.xml
@@ -41,15 +41,6 @@
android:layout_width="wrap_content" android:layout_height="wrap_content" />
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/res/layout/conf_details_participant_choices_dialog.xml b/res/layout/conf_details_participant_choices_dialog.xml
new file mode 100644
index 000000000..f7a79b68e
--- /dev/null
+++ b/res/layout/conf_details_participant_choices_dialog.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/res/layout/conference_details_layout.xml b/res/layout/conference_details_layout.xml
new file mode 100644
index 000000000..1960221e6
--- /dev/null
+++ b/res/layout/conference_details_layout.xml
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/res/layout/conferencing.xml b/res/layout/incall_layout.xml
similarity index 87%
rename from res/layout/conferencing.xml
rename to res/layout/incall_layout.xml
index 6027dcdc5..b9f15d338 100644
--- a/res/layout/conferencing.xml
+++ b/res/layout/incall_layout.xml
@@ -10,10 +10,6 @@
-
-
@@ -25,8 +21,10 @@
-
+
diff --git a/res/layout/incall_view.xml b/res/layout/incall_view.xml
deleted file mode 100644
index 714cf5cbf..000000000
--- a/res/layout/incall_view.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/res/values/callee_style.xml b/res/values/callee_style.xml
index a6fe15731..7107e9915 100644
--- a/res/values/callee_style.xml
+++ b/res/values/callee_style.xml
@@ -18,7 +18,7 @@
- marquee
-
diff --git a/res/values/strings.xml b/res/values/strings.xml
index d9edcfd4e..c3cf6f6ea 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -15,7 +15,10 @@
Error adding new call
Transfer initiated
Transfer call to
+ New call
Resume call
+ Cannot resume call paused by remote
+ Show details
Warning: service is not ready
@@ -58,7 +61,7 @@
No active call
DTMFs
- You host a conference
+ Conference
You are part of it
Go out
You are out of it
diff --git a/src/org/linphone/AbstractContactPickerActivity.java b/src/org/linphone/AbstractContactPickerActivityNew.java
similarity index 98%
rename from src/org/linphone/AbstractContactPickerActivity.java
rename to src/org/linphone/AbstractContactPickerActivityNew.java
index 698e40e9e..87f6dcc5b 100644
--- a/src/org/linphone/AbstractContactPickerActivity.java
+++ b/src/org/linphone/AbstractContactPickerActivityNew.java
@@ -55,7 +55,7 @@ import android.widget.AdapterView.OnItemClickListener;
* @author Guillaume Beraudo
*
*/
-public abstract class AbstractContactPickerActivity extends Activity implements FilterQueryProvider {
+public abstract class AbstractContactPickerActivityNew extends Activity implements FilterQueryProvider {
private ListView mContactList;
protected EditText mcontactFilter;
diff --git a/src/org/linphone/ConferenceDetailsActivity.java b/src/org/linphone/ConferenceDetailsActivity.java
new file mode 100644
index 000000000..4e224d62b
--- /dev/null
+++ b/src/org/linphone/ConferenceDetailsActivity.java
@@ -0,0 +1,252 @@
+/*
+ConferenceActivity.java
+Copyright (C) 2011 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 java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.linphone.LinphoneSimpleListener.LinphoneOnCallStateChangedListener;
+import org.linphone.core.LinphoneAddress;
+import org.linphone.core.LinphoneCall;
+import org.linphone.core.LinphoneCore;
+import org.linphone.core.Log;
+import org.linphone.core.LinphoneCall.State;
+import org.linphone.mediastream.Version;
+import org.linphone.ui.IncallTimer;
+
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.app.ListActivity;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.Handler;
+import android.text.TextUtils;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.View.OnClickListener;
+import android.widget.BaseAdapter;
+import android.widget.ImageView;
+import android.widget.TextView;
+import android.widget.ToggleButton;
+
+/**
+ * List participants of a conference call.
+ *
+ * @author Guillaume Beraudo
+ *
+ */
+public class ConferenceDetailsActivity extends ListActivity implements LinphoneOnCallStateChangedListener, OnClickListener {
+
+ private ConfListAdapter mListAdapter;
+ private List mLinphoneCalls = Collections.emptyList();
+ private Handler mHandler = new Handler();
+ public static boolean active;
+
+ private ToggleButton mMuteMicButton;
+ private ToggleButton mSpeakerButton;
+ private Runnable mDurationUpdateRunnable;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ setContentView(R.layout.conference_details_layout);
+ setListAdapter(mListAdapter = new ConfListAdapter());
+ mMuteMicButton = (ToggleButton) findViewById(R.id.toggleMuteMic);
+ mMuteMicButton.setOnClickListener(this);
+ mSpeakerButton = (ToggleButton) findViewById(R.id.toggleSpeaker);
+ mSpeakerButton.setOnClickListener(this);
+ mDurationUpdateRunnable = new Runnable() {
+ @Override
+ public void run() {
+ updateCallDurations();
+ }
+ };
+ super.onCreate(savedInstanceState);
+ }
+
+ @Override
+ protected void onResume() {
+ mLinphoneCalls = LinphoneUtils.getLinphoneCallsInConf(lc());
+ if (mLinphoneCalls.size() != 0) {
+ active = true;
+ updateUI();
+ mSpeakerButton.setChecked(LinphoneManager.getInstance().isSpeakerOn());
+ mMuteMicButton.setChecked(LinphoneManager.getLc().isMicMuted());
+ LinphoneManager.addListener(this);
+ LinphoneManager.startProximitySensorForActivity(this);
+ mHandler.post(mDurationUpdateRunnable);
+ } else {
+ finish();
+ }
+ super.onResume();
+ }
+
+ @Override
+ protected void onPause() {
+ LinphoneManager.removeListener(this);
+ LinphoneManager.stopProximitySensorForActivity(this);
+ active = false;
+ super.onPause();
+ }
+
+ @Override
+ public void onCallStateChanged(LinphoneCall c, State s, String m) {
+ mHandler.post(new Runnable() {
+ public void run() {
+ mLinphoneCalls = LinphoneUtils.getLinphoneCallsInConf(lc());
+ updateUI();
+ }
+ });
+ }
+
+ private LinphoneCore lc() {
+ return LinphoneManager.getLc();
+ }
+
+ private void updateUI() {
+ mCallDurationsMap.clear();
+ mListAdapter.notifyDataSetChanged();
+ }
+
+ private Map mCallDurationsMap = new HashMap();
+ private void updateCallDurations() {
+ for (LinphoneCall call : mCallDurationsMap.keySet()) {
+ IncallTimer timer = mCallDurationsMap.get(call);
+ timer.setDuration(call.getDuration());
+ }
+ if (active) mHandler.postDelayed(mDurationUpdateRunnable, 1000);
+ }
+
+ private class ConfListAdapter extends BaseAdapter {
+ public int getCount() {
+ return mLinphoneCalls.size();
+ }
+
+ public Object getItem(int position) {
+ return mLinphoneCalls.get(position);
+ }
+
+ public long getItemId(int position) {
+ return position;
+ }
+
+ @Override
+ public View getView(int position, View v, ViewGroup parent) {
+ Log.i("IncallActivity.getView(",position,") out of ", mLinphoneCalls.size());
+ if (v == null) {
+ if (Version.sdkAboveOrEqual(Version.API06_ECLAIR_201)) {
+ v = getLayoutInflater().inflate(R.layout.conf_details_participant, null);
+ } else {
+ throw new RuntimeException("to implement");
+// v = getLayoutInflater().inflate(R.layout.conf_callee_older_devices, null);
+ }
+ }
+
+ final LinphoneCall call = mLinphoneCalls.get(position);
+ LinphoneAddress address = call.getRemoteAddress();
+ String mainText = address.getDisplayName();
+ String complText = address.getUserName();
+ if (Version.sdkAboveOrEqual(Version.API05_ECLAIR_20)
+ && getResources().getBoolean(R.bool.show_full_remote_address_on_incoming_call)) {
+ complText += "@" + address.getDomain();
+ }
+ TextView mainTextView = (TextView) v.findViewById(R.id.name);
+ TextView complTextView = (TextView) v.findViewById(R.id.address);
+ if (TextUtils.isEmpty(mainText)) {
+ mainTextView.setText(complText);
+ complTextView.setVisibility(View.GONE);
+ } else {
+ mainTextView.setText(mainText);
+ complTextView.setText(complText);
+ complTextView.setVisibility(View.VISIBLE);
+ }
+
+ v.setOnClickListener(new OnClickListener() {
+ public void onClick(View v) {
+ if (lc().soundResourcesLocked()) {
+ return;
+ }
+ View content = getLayoutInflater().inflate(R.layout.conf_details_participant_choices_dialog, null);
+ Dialog dialog = new AlertDialog.Builder(ConferenceDetailsActivity.this).setView(content).create();
+ OnClickListener l = new CallActionListener(call, dialog);
+ enableView(content, R.id.remove_from_conference, l, true);
+ enableView(content, R.id.terminate_call, l, true);
+ dialog.show();
+ }
+
+ private void enableView(View root, int id, OnClickListener l, boolean enable) {
+ LinphoneUtils.enableView(root, id, l, enable);
+ }
+ });
+
+ ImageView pictureView = (ImageView) v.findViewById(R.id.picture);
+ // May be greatly sped up using a drawable cache
+ Uri uri = LinphoneUtils.findUriPictureOfContactAndSetDisplayName(address, getContentResolver());
+ LinphoneUtils.setImagePictureFromUri(ConferenceDetailsActivity.this, pictureView, uri, R.drawable.unknown_person);
+
+ mCallDurationsMap.put(call, (IncallTimer) findViewById(R.id.callee_duration));
+ return v;
+ }
+
+ }
+
+ private class CallActionListener implements OnClickListener {
+ private LinphoneCall call;
+ private Dialog dialog;
+ public CallActionListener(LinphoneCall call, Dialog dialog) {
+ this.call = call;
+ this.dialog = dialog;
+ }
+ public void onClick(View v) {
+ switch (v.getId()) {
+ case R.id.terminate_call:
+ lc().terminateCall(call);
+ break;
+ case R.id.remove_from_conference:
+ lc().removeFromConference(call);
+ if (LinphoneUtils.countConferenceCalls(lc()) == 0) {
+ finish();
+ }
+ break;
+ default:
+ throw new RuntimeException("unknown id " + v.getId());
+ }
+ if (dialog != null) dialog.dismiss();
+ }
+ }
+
+ @Override
+ public void onClick(View v) {
+ switch (v.getId()) {
+ case R.id.toggleMuteMic:
+ lc().muteMic(((ToggleButton) v).isChecked());
+ break;
+ case R.id.toggleSpeaker:
+ if (((ToggleButton) v).isChecked()) {
+ LinphoneManager.getInstance().routeAudioToSpeaker();
+ } else {
+ LinphoneManager.getInstance().routeAudioToReceiver();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/org/linphone/ContactPickerActivityNew.java b/src/org/linphone/ContactPickerActivityNew.java
index 1dcade954..885c1d7e8 100644
--- a/src/org/linphone/ContactPickerActivityNew.java
+++ b/src/org/linphone/ContactPickerActivityNew.java
@@ -48,7 +48,7 @@ import android.text.TextUtils;
* @author Guillaume Beraudo
*
*/
-public class ContactPickerActivityNew extends AbstractContactPickerActivity {
+public class ContactPickerActivityNew extends AbstractContactPickerActivityNew {
diff --git a/src/org/linphone/DialerActivity.java b/src/org/linphone/DialerActivity.java
index 4974b1076..264edd89a 100644
--- a/src/org/linphone/DialerActivity.java
+++ b/src/org/linphone/DialerActivity.java
@@ -18,7 +18,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.linphone;
-import org.linphone.LinphoneManager.NewOutgoingCallUiListener;
import org.linphone.LinphoneService.LinphoneGuiListener;
import org.linphone.core.LinphoneCall;
import org.linphone.core.Log;
@@ -49,7 +48,7 @@ import android.widget.Toast;
*
*
*/
-public class DialerActivity extends Activity implements LinphoneGuiListener, NewOutgoingCallUiListener {
+public class DialerActivity extends Activity implements LinphoneGuiListener {
private TextView mStatus;
private Handler mHandler;
@@ -221,11 +220,6 @@ public class DialerActivity extends Activity implements LinphoneGuiListener, New
}
}
- public void onCallEncryptionChanged(LinphoneCall call, boolean encrypted, String t) {
- // done in incall view
- }
-
-
@Override
protected void onResume() {
// When coming back from a video call, if the phone orientation is different
diff --git a/src/org/linphone/FirstLoginActivity.java b/src/org/linphone/FirstLoginActivity.java
index b932b8c30..67c2c5c2e 100644
--- a/src/org/linphone/FirstLoginActivity.java
+++ b/src/org/linphone/FirstLoginActivity.java
@@ -85,7 +85,7 @@ public class FirstLoginActivity extends Activity implements OnClickListener {
LinphoneManager.getInstance().initializePayloads();
try {
- LinphoneManager.getInstance().initFromConf(getApplicationContext());
+ LinphoneManager.getInstance().initFromConf();
} catch (Throwable e) {
Log.e(e, "Error while initializing from config in first login activity");
toast(R.string.error);;
diff --git a/src/org/linphone/IncallActivity.java b/src/org/linphone/IncallActivity.java
index 53c07f6d4..8a362640b 100644
--- a/src/org/linphone/IncallActivity.java
+++ b/src/org/linphone/IncallActivity.java
@@ -51,8 +51,8 @@ import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
-import android.view.WindowManager;
import android.view.View.OnClickListener;
+import android.view.View.OnLongClickListener;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.ImageView;
@@ -69,22 +69,18 @@ public class IncallActivity extends ListActivity implements
LinphoneOnCallStateChangedListener,
LinphoneOnCallEncryptionChangedListener,
Comparator,
+ OnLongClickListener,
OnClickListener {
- private View confHeaderView;
static boolean active;
- private boolean unMuteOnReturnFromUriPicker;
+ private boolean mUnMuteOnReturnFromUriPicker;
// Start Override to test block
protected LinphoneCore lc() {
return LinphoneManager.getLc();
}
- protected List getInitialCalls() {
- return LinphoneUtils.getLinphoneCalls(lc());
- }
-
// End override to test block
private static final int numpad_dialog_id = 1;
@@ -93,15 +89,6 @@ public class IncallActivity extends ListActivity implements
- @SuppressWarnings("unused")
- private void workaroundStatusBarBug() {
- // call from onCreate to get a clean display on full screen no icons
- // otherwise the upper side of the activity may be corrupted
- getWindow().setFlags(
- WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
- WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
- }
-
private void pauseCurrentCallOrLeaveConference() {
LinphoneCall call = lc().getCurrentCall();
if (call != null) lc().pauseCall(call);
@@ -110,41 +97,41 @@ public class IncallActivity extends ListActivity implements
private ToggleButton mMuteMicButton;
private ToggleButton mSpeakerButton;
- private int multipleCallsLimit;
- private boolean allowTransfers;
+ private View mConferenceVirtualCallee;
+ private int mMultipleCallsLimit;
+ private boolean mAllowTransfers;
+ private List mNotInConfCalls = Collections.emptyList();
+ private CalleeListAdapter mListAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
- setContentView(R.layout.conferencing);
+ setContentView(R.layout.incall_layout);
- allowTransfers = getResources().getBoolean(R.bool.allow_transfers);
-
- confHeaderView = findViewById(R.id.conf_header);
- confHeaderView.setOnClickListener(this);
+ mAllowTransfers = getResources().getBoolean(R.bool.allow_transfers);
findViewById(R.id.addCall).setOnClickListener(this);
findViewById(R.id.incallNumpadShow).setOnClickListener(this);
findViewById(R.id.conf_simple_merge).setOnClickListener(this);
- findViewById(R.id.conf_simple_resume).setOnClickListener(this);
View transferView = findViewById(R.id.conf_simple_transfer);
transferView.setOnClickListener(this);
- if (!allowTransfers) {
+ if (!mAllowTransfers) {
transferView.setVisibility(View.GONE);
}
- findViewById(R.id.conf_simple_permute).setOnClickListener(this);
mMuteMicButton = (ToggleButton) findViewById(R.id.toggleMuteMic);
mMuteMicButton.setOnClickListener(this);
mSpeakerButton = (ToggleButton) findViewById(R.id.toggleSpeaker);
mSpeakerButton.setOnClickListener(this);
- List calls = getInitialCalls();
- setListAdapter(new CalleeListAdapter(calls));
+ setListAdapter(mListAdapter = new CalleeListAdapter());
findViewById(R.id.incallHang).setOnClickListener(this);
- multipleCallsLimit = lc().getMaxCalls();
+ mMultipleCallsLimit = lc().getMaxCalls();
+ mConferenceVirtualCallee = findViewById(R.id.conf_header);
+ mConferenceVirtualCallee.setOnClickListener(this);
+ mConferenceVirtualCallee.setOnLongClickListener(this);
// workaroundStatusBarBug();
super.onCreate(savedInstanceState);
}
@@ -156,8 +143,8 @@ public class IncallActivity extends ListActivity implements
private void updateAddCallButton() {
boolean limitReached = false;
- if (multipleCallsLimit > 0) {
- limitReached = lc().getCallsNb() >= multipleCallsLimit;
+ if (mMultipleCallsLimit > 0) {
+ limitReached = lc().getCallsNb() >= mMultipleCallsLimit;
}
int establishedCallsNb = LinphoneUtils.getRunningOrPausedCalls(lc()).size();
@@ -175,42 +162,23 @@ public class IncallActivity extends ListActivity implements
super.onNewIntent(intent);
}
- protected void registerLinphoneListener(boolean register) {
- if (register)
- LinphoneManager.addListener(this);
- else
- LinphoneManager.removeListener(this);
- }
-
-
-
@Override
protected void onResume() {
active=true;
- registerLinphoneListener(true);
- updateCalleeImage();
- updateConfState();
- updateSimpleControlButtons();
- updateSoundLock();
- updateDtmfButton();
- CalleeListAdapter adapter = (CalleeListAdapter) getListAdapter();
- if (adapter.linphoneCalls.size() != lc().getCallsNb()) {
- adapter.linphoneCalls.clear();
- adapter.linphoneCalls.addAll(getInitialCalls());
- }
- recreateActivity(adapter);
+ mNotInConfCalls = LinphoneUtils.getLinphoneCallsNotInConf(lc());
+ LinphoneManager.addListener(this);
LinphoneManager.startProximitySensorForActivity(this);
mSpeakerButton.setChecked(LinphoneManager.getInstance().isSpeakerOn());
mMuteMicButton.setChecked(LinphoneManager.getLc().isMicMuted());
- updateAddCallButton();
+ recreateActivity();
super.onResume();
}
@Override
protected void onPause() {
active=false;
- registerLinphoneListener(false);
+ LinphoneManager.removeListener(this);
LinphoneManager.stopProximitySensorForActivity(this);
super.onPause();
}
@@ -219,7 +187,7 @@ public class IncallActivity extends ListActivity implements
ImageView view = (ImageView) findViewById(R.id.incall_picture);
LinphoneCall currentCall = lc().getCurrentCall();
- if (lc().getCallsNb() != 1 || currentCall == null) {
+ if (currentCall == null || lc().getCallsNb() != 1) {
view.setVisibility(GONE);
return;
}
@@ -231,10 +199,9 @@ public class IncallActivity extends ListActivity implements
}
private void enableView(View root, int id, OnClickListener l, boolean enable) {
- View v = root.findViewById(id);
- v.setVisibility(enable ? VISIBLE : GONE);
- v.setOnClickListener(l);
+ LinphoneUtils.enableView(root, id, l, enable);
}
+
@Override
protected Dialog onCreateDialog(final int id) {
switch (id) {
@@ -257,36 +224,6 @@ public class IncallActivity extends ListActivity implements
}
- // protected void conferenceMerge(boolean hostInTheConference, LinphoneCall
- // ... calls) {
- // for (LinphoneCall call: calls) {
- // getLc().addToConference(call, false);
- // }
- // getLc().enterConference(hostInTheConference);
- // }
-
- // FIXME hack; should have an event?
- protected final void hackTriggerConfStateUpdate() {
- updateConfState();
- }
-
- private final void updateConfState() {
- if (lc().getCallsNb() == 0) {
- setResult(RESULT_OK);
- finish();
- }
-
- boolean inConf = lc().isInConference();
-
- int bgColor = getResources().getColor(inConf? R.color.conf_active_bg_color : android.R.color.transparent);
- confHeaderView.setBackgroundColor(bgColor);
- confHeaderView.setVisibility(lc().getConferenceSize() > 0 ? VISIBLE: GONE);
-
-// TextView v = (TextView) confHeaderView
-// .findViewById(R.id.conf_self_attending);
-// v.setText(inConf ? R.string.in_conf : R.string.out_conf);
- }
-
private LinphoneCall activateCallOnReturnFromUriPicker;
private boolean enterConferenceOnReturnFromUriPicker;
private void openUriPicker(String pickerType, int requestCode) {
@@ -301,57 +238,67 @@ public class IncallActivity extends ListActivity implements
intent.putExtra(UriPickerActivity.EXTRA_PICKER_TYPE, pickerType);
startActivityForResult(intent, requestCode);
if (!lc().isMicMuted()) {
- unMuteOnReturnFromUriPicker = true;
+ mUnMuteOnReturnFromUriPicker = true;
lc().muteMic(true);
((ToggleButton) findViewById(R.id.toggleMuteMic)).setChecked(true);
}
}
+
+ @Override
+ public boolean onLongClick(View v) {
+ switch (v.getId()) {
+ case R.id.conf_header:
+ if (Version.sdkAboveOrEqual(Version.API05_ECLAIR_20)) {
+ LinphoneActivity.instance().startConferenceDetailsActivity();
+ } else {
+ Log.i("conference details disabled for older phones");
+ }
+ break;
+ default:
+ break;
+ }
+ return false;
+ }
+
+ private void enterConferenceAndUpdateUI(boolean enterConf) {
+ if (enterConf) {
+ boolean success = lc().enterConference();
+ if (success) {
+ mConferenceVirtualCallee.setBackgroundResource(R.drawable.conf_callee_active_bg);
+ }
+ } else {
+ lc().leaveConference();
+ mConferenceVirtualCallee.setBackgroundResource(R.drawable.conf_callee_bg);
+ }
+ }
+
+ private void terminateCurrentCallOrConferenceOrAll() {
+ LinphoneCall currentCall = lc().getCurrentCall();
+ if (currentCall != null) {
+ lc().terminateCall(currentCall);
+ } else if (lc().isInConference()) {
+ lc().terminateConference();
+ } else {
+ lc().terminateAllCalls();
+ }
+
+ // activity should be closed automatically by LinphoneActivity when no more calls exist
+ // setResult(RESULT_OK);
+ // finish();
+ }
+
public void onClick(View v) {
switch (v.getId()) {
case R.id.addCall:
openUriPicker(UriPickerActivity.EXTRA_PICKER_TYPE_ADD, ID_ADD_CALL);
break;
- case R.id.conf_header:
- View content = getLayoutInflater().inflate(R.layout.conf_choices_admin, null);
- final Dialog dialog = new AlertDialog.Builder(IncallActivity.this).setView(content).create();
- boolean isInConference = lc().isInConference();
- OnClickListener l = new OnClickListener() {
- public void onClick(View v) {
- switch (v.getId()) {
- case R.id.conf_add_all_to_conference_button:
- lc().addAllToConference();
- updateConfState();
- break;
- case R.id.conf_enter_button:
- lc().enterConference();
- updateConfState();
- break;
- case R.id.conf_leave_button:
- lc().leaveConference();
- updateConfState();
- break;
- case R.id.conf_terminate_button:
- lc().terminateConference();
- findViewById(R.id.conf_header).setVisibility(GONE);
- break;
- default:
- break;
- }
- dialog.dismiss();
- }
- };
- enableView(content, R.id.conf_enter_button, l, !isInConference);
- enableView(content, R.id.conf_leave_button, l, isInConference);
- content.findViewById(R.id.conf_terminate_button).setOnClickListener(l);
- content.findViewById(R.id.conf_add_all_to_conference_button).setOnClickListener(l);
-
- dialog.show();
- break;
case R.id.incallHang:
- lc().terminateAllCalls();
- setResult(RESULT_OK);
- finish();
+ terminateCurrentCallOrConferenceOrAll();
+ break;
+ case R.id.conf_header:
+ boolean enterConf = !lc().isInConference();
+ enterConferenceAndUpdateUI(enterConf);
break;
case R.id.incallNumpadShow:
showDialog(numpad_dialog_id);
@@ -360,28 +307,15 @@ public class IncallActivity extends ListActivity implements
findViewById(R.id.conf_control_buttons).setVisibility(GONE);
lc().addAllToConference();
break;
- case R.id.conf_simple_resume:
- findViewById(R.id.conf_control_buttons).setVisibility(GONE);
- handleSimpleResume();
- break;
case R.id.conf_simple_transfer:
findViewById(R.id.conf_control_buttons).setVisibility(GONE);
LinphoneCall tCall = lc().getCurrentCall();
if (tCall != null) {
- prepareForTransferingExistingCall(tCall);
+ prepareForTransferingExistingOrNewCall(tCall);
} else {
Toast.makeText(this, R.string.conf_simple_no_current_call, Toast.LENGTH_SHORT).show();
}
break;
- case R.id.conf_simple_permute:
- findViewById(R.id.conf_control_buttons).setVisibility(GONE);
- for (LinphoneCall call : LinphoneUtils.getLinphoneCalls(lc())) {
- if (State.Paused == call.getState()) {
- lc().resumeCall(call);
- break;
- }
- }
- break;
case R.id.toggleMuteMic:
lc().muteMic(((ToggleButton) v).isChecked());
break;
@@ -398,48 +332,31 @@ public class IncallActivity extends ListActivity implements
}
- private void handleSimpleResume() {
- int nbCalls = lc().getCallsNb();
- if (nbCalls == 0) {
- return;
- } else if (nbCalls == 1) {
- // resume first one
- for (LinphoneCall call : LinphoneUtils.getLinphoneCalls(lc())) {
- if (call.getState() == State.Paused) {
- lc().resumeCall(call);
- break;
- }
- }
- } else {
- // Create a dialog for user to select
- final List existingCalls = LinphoneUtils.getLinphoneCalls(lc());
- final List numbers = new ArrayList(existingCalls.size());
- Resources r = getResources();
- for(LinphoneCall c : existingCalls) {
- numbers.add(LinphoneManager.extractADisplayName(r, c.getRemoteAddress()));
- }
- ListAdapter adapter = new ArrayAdapter(IncallActivity.this, android.R.layout.select_dialog_item, numbers);
- DialogInterface.OnClickListener l = new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- lc().resumeCall(existingCalls.get(which));
- }
- };
- new AlertDialog.Builder(IncallActivity.this).setTitle(R.string.resume_dialog_title).setAdapter(adapter, l).create().show();
- }
- }
-
- private void prepareForTransferingExistingCall(final LinphoneCall call) {
+ private void prepareForTransferingExistingOrNewCall(final LinphoneCall call) {
final List existingCalls = LinphoneUtils.getLinphoneCalls(lc());
+ if (existingCalls.size() == 1) {
+ // Only possible choice is transfer to new call: doing it directly.
+ mCallToTransfer = call;
+ openUriPicker(UriPickerActivity.EXTRA_PICKER_TYPE_TRANSFER, ID_TRANSFER_CALL);
+ return;
+ }
existingCalls.remove(call);
- final List numbers = new ArrayList(existingCalls.size());
+ final List numbers = new ArrayList(existingCalls.size() + 1);
Resources r = getResources();
for(LinphoneCall c : existingCalls) {
numbers.add(LinphoneManager.extractADisplayName(r, c.getRemoteAddress()));
}
+ numbers.add(getString(R.string.transfer_to_new_call));
ListAdapter adapter = new ArrayAdapter(IncallActivity.this, android.R.layout.select_dialog_item, numbers);
DialogInterface.OnClickListener l = new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
- lc().transferCallToAnother(call, existingCalls.get(which));
+ if (which == numbers.size() -1) {
+ // Last one is transfer to new call
+ mCallToTransfer = call;
+ openUriPicker(UriPickerActivity.EXTRA_PICKER_TYPE_TRANSFER, ID_TRANSFER_CALL);
+ } else {
+ lc().transferCallToAnother(call, existingCalls.get(which));
+ }
}
};
new AlertDialog.Builder(IncallActivity.this).setTitle(R.string.transfer_dialog_title).setAdapter(adapter, l).create().show();
@@ -463,28 +380,12 @@ public class IncallActivity extends ListActivity implements
case R.id.terminate_call:
lc().terminateCall(call);
break;
- case R.id.pause:
- lc().pauseCall(call);
- break;
- case R.id.resume:
- lc().resumeCall(call);
- break;
- case R.id.unhook_call:
- try {
- lc().acceptCall(call);
- } catch (LinphoneCoreException e) {
- throw new RuntimeException(e);
- }
- break;
case R.id.transfer_existing:
- prepareForTransferingExistingCall(call);
+ prepareForTransferingExistingOrNewCall(call);
break;
case R.id.transfer_new:
openUriPicker(UriPickerActivity.EXTRA_PICKER_TYPE_TRANSFER, ID_TRANSFER_CALL);
- callToTransfer = call;
- break;
- case R.id.remove_from_conference:
- lc().removeFromConference(call);
+ mCallToTransfer = call;
break;
case R.id.addVideo:
if (!LinphoneManager.getInstance().addVideo()) {
@@ -507,18 +408,12 @@ public class IncallActivity extends ListActivity implements
}
}
private class CalleeListAdapter extends BaseAdapter {
- private List linphoneCalls;
-
- public CalleeListAdapter(List calls) {
- linphoneCalls = calls;
- }
-
public int getCount() {
- return linphoneCalls != null ? linphoneCalls.size() : 0;
+ return mNotInConfCalls.size();
}
public Object getItem(int position) {
- return linphoneCalls.get(position);
+ return mNotInConfCalls.get(position);
}
public long getItemId(int position) {
@@ -530,7 +425,7 @@ public class IncallActivity extends ListActivity implements
return false;
}
int count = 0;
- for (LinphoneCall call : linphoneCalls) {
+ for (LinphoneCall call : mNotInConfCalls) {
final LinphoneCall.State state = call.getState();
boolean connectionEstablished = state == State.StreamsRunning
|| state == State.Paused
@@ -544,25 +439,28 @@ public class IncallActivity extends ListActivity implements
}
private void setVisibility(View v, int id, boolean visible) {
- v.findViewById(id).setVisibility(visible ? VISIBLE : GONE);
+ LinphoneUtils.setVisibility(v, id, visible);
}
private void setVisibility(View v, boolean visible) {
- v.setVisibility(visible ? VISIBLE : GONE);
+ LinphoneUtils.setVisibility(v, visible);
}
- private void setStatusLabel(View v, State state, boolean inConf, boolean activeOne) {
+ private void setStatusLabel(View v, State state, boolean activeOne) {
String statusLabel = getStateText(state);
-
- if (activeOne)
- statusLabel=getString(R.string.status_active_call);
-
- if (inConf)
- statusLabel=getString(R.string.status_conf_call);
-
((TextView) v.findViewById(R.id.status_label)).setText(statusLabel);
}
+ private boolean highlightCall(LinphoneCall call) {
+ final State state = call.getState();
+ return state == State.StreamsRunning
+ || state == State.OutgoingRinging
+ || state == State.OutgoingEarlyMedia
+ || state == State.OutgoingInit
+ || state == State.OutgoingProgress
+ ;
+ }
+
public View getView(int position, View v, ViewGroup parent) {
- Log.i("IncallActivity.getView(",position,") out of ", linphoneCalls.size());
+ Log.i("IncallActivity.getView(",position,") out of ", mNotInConfCalls.size());
if (v == null) {
if (Version.sdkAboveOrEqual(Version.API06_ECLAIR_201)) {
v = getLayoutInflater().inflate(R.layout.conf_callee, null);
@@ -571,16 +469,12 @@ public class IncallActivity extends ListActivity implements
}
}
- final LinphoneCall call = linphoneCalls.get(position);
+ final LinphoneCall call = mNotInConfCalls.get(position);
final LinphoneCall.State state = call.getState();
LinphoneAddress address = call.getRemoteAddress();
String mainText = address.getDisplayName();
String complText = address.getUserName();
- if (Version.sdkAboveOrEqual(Version.API05_ECLAIR_20)
- && getResources().getBoolean(R.bool.show_full_remote_address_on_incoming_call)) {
- complText += "@" + address.getDomain();
- }
TextView mainTextView = (TextView) v.findViewById(R.id.name);
TextView complTextView = (TextView) v.findViewById(R.id.address);
if (TextUtils.isEmpty(mainText)) {
@@ -592,20 +486,15 @@ public class IncallActivity extends ListActivity implements
complTextView.setVisibility(View.VISIBLE);
}
- final boolean isInConference = call.isInConference();
- boolean currentlyActiveCall = !isInConference
- && state == State.StreamsRunning;
-
- setStatusLabel(v, state, isInConference, currentlyActiveCall);
+ boolean highlighted = highlightCall(call);
+ setStatusLabel(v, state, highlighted);
int bgDrawableId = R.drawable.conf_callee_selector_normal;
if (state == State.IncomingReceived) {
bgDrawableId = R.drawable.conf_callee_selector_incoming;
- } else if (currentlyActiveCall) {
+ } else if (highlighted) {
bgDrawableId = R.drawable.conf_callee_selector_active;
- } else if (isInConference) {
- bgDrawableId = R.drawable.conf_callee_selector_inconf;
}
v.setBackgroundResource(bgDrawableId);
@@ -613,35 +502,11 @@ public class IncallActivity extends ListActivity implements
|| state == State.Paused
|| state == State.PausedByRemote;
View confButton = v.findViewById(R.id.merge_to_conference);
- final boolean showMergeToConf = !isInConference && connectionEstablished
- && aConferenceIsPossible();
+ final boolean showMergeToConf = connectionEstablished && aConferenceIsPossible();
setVisibility(confButton, false);
- View unhookCallButton = v.findViewById(R.id.unhook_call);
- boolean showUnhook = state == State.IncomingReceived;
- setVisibility(unhookCallButton, showUnhook);
-
- View terminateCallButton = v.findViewById(R.id.terminate_call);
- boolean showTerminate = state == State.IncomingReceived
- || state == State.OutgoingRinging || state == State.OutgoingEarlyMedia
- || state == State.OutgoingInit || state == State.OutgoingProgress;
- setVisibility(terminateCallButton, showTerminate);
-
- View pauseButton = v.findViewById(R.id.pause);
- final boolean showPause = !isInConference
- && state == State.StreamsRunning;
- setVisibility(pauseButton, false);
-
- View resumeButton = v.findViewById(R.id.resume);
- final boolean showResume = !isInConference
- && state == State.Paused;
- setVisibility(resumeButton, false);
-
- View removeFromConfButton = v.findViewById(R.id.remove_from_conference);
- setVisibility(removeFromConfButton, false);
-
- final int numberOfCalls = linphoneCalls.size();
- boolean showAddVideo = State.StreamsRunning == state && !isInConference
+ final int numberOfCalls = mNotInConfCalls.size();
+ boolean showAddVideo = State.StreamsRunning == state
&& Version.isVideoCapable()
&& LinphoneManager.getInstance().isVideoEnabled();
View addVideoButton = v.findViewById(R.id.addVideo);
@@ -650,23 +515,15 @@ public class IncallActivity extends ListActivity implements
boolean statusPaused = state== State.Paused || state == State.PausedByRemote;
setVisibility(v, R.id.callee_status_paused, statusPaused);
- setVisibility(v, R.id.callee_status_inconf, isInConference);
-
final OnClickListener l = new CallActionListener(call);
confButton.setOnClickListener(l);
- terminateCallButton.setOnClickListener(l);
- pauseButton.setOnClickListener(l);
- resumeButton.setOnClickListener(l);
- unhookCallButton.setOnClickListener(l);
- removeFromConfButton.setOnClickListener(l);
addVideoButton.setOnClickListener(l);
String mediaEncryption = call.getCurrentParamsCopy().getMediaEncryption();
if ("none".equals(mediaEncryption)) {
- boolean showUnencrypted = Version.hasZrtp();
setVisibility(v, R.id.callee_status_secured, false);
setVisibility(v, R.id.callee_status_maybe_secured, false);
- setVisibility(v, R.id.callee_status_not_secured, showUnencrypted);
+ setVisibility(v, R.id.callee_status_not_secured, false);
} else {
boolean reallySecured = !Version.hasZrtp() || call.isAuthenticationTokenVerified();
setVisibility(v, R.id.callee_status_secured, reallySecured);
@@ -674,20 +531,17 @@ public class IncallActivity extends ListActivity implements
setVisibility(v, R.id.callee_status_not_secured, false);
}
- v.setOnClickListener(new OnClickListener() {
- public void onClick(View v) {
+ v.setOnLongClickListener(new OnLongClickListener() {
+ public boolean onLongClick(View v) {
if (lc().soundResourcesLocked()) {
- return;
+ return false;
}
View content = getLayoutInflater().inflate(R.layout.conf_choices_dialog, null);
Dialog dialog = new AlertDialog.Builder(IncallActivity.this).setView(content).create();
OnClickListener l = new CallActionListener(call, dialog);
- enableView(content, R.id.transfer_existing, l, allowTransfers && !isInConference && numberOfCalls >=2);
- enableView(content, R.id.transfer_new, l, allowTransfers && !isInConference);
- enableView(content, R.id.remove_from_conference, l, isInConference);
+ enableView(content, R.id.transfer_existing, l, mAllowTransfers && numberOfCalls >=2);
+ enableView(content, R.id.transfer_new, l, mAllowTransfers);
enableView(content, R.id.merge_to_conference, l, showMergeToConf);
- enableView(content, R.id.pause, l,!isInConference && showPause);
- enableView(content, R.id.resume, l, !isInConference && showResume);
enableView(content, R.id.terminate_call, l, true);
String mediaEncryption = call.getCurrentParamsCopy().getMediaEncryption();
@@ -710,6 +564,21 @@ public class IncallActivity extends ListActivity implements
}
dialog.show();
+ return true;
+ }
+ });
+
+ v.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ State actualState = call.getState();
+ if (State.StreamsRunning == actualState) {
+ lc().pauseCall(call);
+ } else if (State.Paused == actualState) {
+ lc().resumeCall(call);
+ } else if (State.PausedByRemote == actualState) {
+ Toast.makeText(IncallActivity.this, getString(R.string.cannot_resume_paused_by_remote_call), Toast.LENGTH_SHORT).show();
+ }
}
});
@@ -730,14 +599,16 @@ public class IncallActivity extends ListActivity implements
private String getStateText(State state) {
int id;
- if (state == State.IncomingReceived) {
- id=R.string.state_incoming_received;
- } else if (state == State.OutgoingRinging) {
- id=R.string.state_outgoing_ringing;
+ if (state == State.StreamsRunning) {
+ id=R.string.status_active_call;
} else if (state == State.Paused) {
id=R.string.state_paused;
} else if (state == State.PausedByRemote) {
id=R.string.state_paused_by_remote;
+ } else if (state == State.IncomingReceived) {
+ id=R.string.state_incoming_received;
+ } else if (state == State.OutgoingRinging) {
+ id=R.string.state_outgoing_ringing;
} else {
return "";
}
@@ -746,78 +617,56 @@ public class IncallActivity extends ListActivity implements
private Handler mHandler = new Handler();
- private static int conferenceCalleesNb(LinphoneCore lc) {
- int count = lc.getConferenceSize();
- if (lc.isInConference()) count--;
- return count;
- }
-
private void updateSimpleControlButtons() {
LinphoneCall activeCall = lc().getCurrentCall();
View control = findViewById(R.id.conf_control_buttons);
- int callNb = lc().getCallsNb();
-
- View permute = control.findViewById(R.id.conf_simple_permute);
- boolean showPermute = activeCall != null && callNb == 2;
- permute.setVisibility(showPermute ? VISIBLE : GONE);
-
- View resume = control.findViewById(R.id.conf_simple_resume);
- boolean showResume = activeCall == null && LinphoneUtils.hasExistingResumeableCall(lc());
- resume.setVisibility(showResume ? VISIBLE : GONE);
+ int nonConfCallsNb = LinphoneUtils.countNonConferenceCalls(lc());
View merge = control.findViewById(R.id.conf_simple_merge);
- boolean showMerge = callNb >= 2 && callNb > conferenceCalleesNb(lc());
+ boolean showMerge = nonConfCallsNb >=2
+ || (lc().getConferenceSize() > 0 && nonConfCallsNb > 0);
merge.setVisibility(showMerge ? VISIBLE : GONE);
View transfer = control.findViewById(R.id.conf_simple_transfer);
- boolean showTransfer = callNb >=2 && activeCall != null && allowTransfers;
+ boolean showTransfer = mAllowTransfers && activeCall != null;
transfer.setVisibility(showTransfer ? VISIBLE : GONE);
- boolean showControl = (showMerge || showPermute || showResume || showTransfer) || lc().getConferenceSize() > 0;
+ boolean showControl = showMerge || showTransfer;
control.setVisibility(showControl ? VISIBLE : GONE);
}
- public void onCallStateChanged(final LinphoneCall call, final State state,
- final String message) {
- final String stateStr = call + " " + state.toString();
- Log.d("IncallActivity received state ",stateStr);
-
+ public void onCallStateChanged(final LinphoneCall c, final State s, String m) {
mHandler.post(new Runnable() {
public void run() {
- CalleeListAdapter adapter = (CalleeListAdapter) getListAdapter();
- Log.d("IncallActivity applying state ",stateStr);
- updateSimpleControlButtons();
- updateCalleeImage();
- updateSoundLock();
- updateAddCallButton();
- updateDtmfButton();
- if (state == State.IncomingReceived || state == State.OutgoingRinging) {
- if (!adapter.linphoneCalls.contains(call)) {
- adapter.linphoneCalls.add(call);
- Collections.sort(adapter.linphoneCalls, IncallActivity.this);
- recreateActivity(adapter);
- } else {
- Log.e("Call should not be in the call lists : ", stateStr);
- }
- } else if (state == State.Paused || state == State.PausedByRemote || state == State.StreamsRunning) {
- Collections.sort(adapter.linphoneCalls, IncallActivity.this);
- adapter.notifyDataSetChanged();
- } else if (state == State.CallEnd || state == State.Error || state == State.CallReleased) {
- if (adapter.linphoneCalls.contains(call)) {
- adapter.linphoneCalls.remove(call);
- Collections.sort(adapter.linphoneCalls, IncallActivity.this);
- recreateActivity(adapter);
- }
- }
-
- updateConfState();
+ mNotInConfCalls = LinphoneUtils.getLinphoneCallsNotInConf(lc());
+ recreateActivity();
}
});
}
- private void recreateActivity(CalleeListAdapter adapter) {
- adapter.notifyDataSetInvalidated();
- adapter.notifyDataSetChanged();
+ private void updateConfItem() {
+ boolean confExists = lc().getConferenceSize() > 0;
+ View confView = findViewById(R.id.conf_header);
+ confView.setVisibility(confExists? VISIBLE : GONE);
+
+ if (confExists) {
+ if (lc().isInConference()) {
+ confView.setBackgroundResource(R.drawable.conf_callee_selector_active);
+ } else {
+ confView.setBackgroundResource(R.drawable.conf_callee_selector_normal);
+ }
+ }
+ }
+
+ private void recreateActivity() {
+ updateSimpleControlButtons();
+ updateCalleeImage();
+ updateSoundLock();
+ updateAddCallButton();
+ updateDtmfButton();
+ updateConfItem();
+
+ mListAdapter.notifyDataSetChanged();
}
public int compare(LinphoneCall c1, LinphoneCall c2) {
@@ -853,10 +702,10 @@ public class IncallActivity extends ListActivity implements
return true;
}
- private LinphoneCall callToTransfer;
+ private LinphoneCall mCallToTransfer;
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
- if (unMuteOnReturnFromUriPicker) {
+ if (mUnMuteOnReturnFromUriPicker) {
lc().muteMic(false);
((ToggleButton) findViewById(R.id.toggleMuteMic)).setChecked(false);
}
@@ -866,7 +715,7 @@ public class IncallActivity extends ListActivity implements
uri = data.getStringExtra(UriPickerActivity.EXTRA_CALLEE_URI);
}
if (resultCode != RESULT_OK || TextUtils.isEmpty(uri)) {
- callToTransfer = null;
+ mCallToTransfer = null;
Toast.makeText(this, R.string.uri_picking_canceled, Toast.LENGTH_LONG).show();
eventuallyResumeConfOrCallOnPickerReturn(true);
return;
@@ -895,11 +744,11 @@ public class IncallActivity extends ListActivity implements
}
break;
case ID_TRANSFER_CALL:
- lc().transferCall(callToTransfer, uri);
+ lc().transferCall(mCallToTransfer, uri);
// don't re-enter conference if call to transfer from conference
- boolean doResume = !callToTransfer.isInConference();
+ boolean doResume = !mCallToTransfer.isInConference();
// don't resume call if it is the call to transfer
- doResume &= activateCallOnReturnFromUriPicker != callToTransfer;
+ doResume &= activateCallOnReturnFromUriPicker != mCallToTransfer;
eventuallyResumeConfOrCallOnPickerReturn(doResume);
Toast.makeText(this, R.string.transfer_started, Toast.LENGTH_LONG).show();
break;
@@ -913,7 +762,7 @@ public class IncallActivity extends ListActivity implements
if (activateCallOnReturnFromUriPicker != null) {
lc().resumeCall(activateCallOnReturnFromUriPicker);
} else if (enterConferenceOnReturnFromUriPicker) {
- lc().enterConference();
+ enterConferenceAndUpdateUI(true);
}
}
activateCallOnReturnFromUriPicker = null;
@@ -951,8 +800,7 @@ public class IncallActivity extends ListActivity implements
String authenticationToken) {
mHandler.post(new Runnable() {
public void run() {
- CalleeListAdapter adapter = (CalleeListAdapter) getListAdapter();
- recreateActivity(adapter);
+ recreateActivity();
}
});
}
diff --git a/src/org/linphone/LinphoneActivity.java b/src/org/linphone/LinphoneActivity.java
index 4fb07d39c..299ca78c4 100644
--- a/src/org/linphone/LinphoneActivity.java
+++ b/src/org/linphone/LinphoneActivity.java
@@ -49,7 +49,6 @@ import android.media.AudioManager;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
-import android.os.PowerManager;
import android.preference.PreferenceManager;
import android.text.Html;
import android.view.Menu;
@@ -71,12 +70,11 @@ public class LinphoneActivity extends TabActivity implements
static final int FIRST_LOGIN_ACTIVITY = 101;
static final int INCOMING_CALL_ACTIVITY = 103;
private static final int incall_activity = 104;
+ private static final int conferenceDetailsActivity = 105;
private static final String PREF_CHECK_CONFIG = "pref_check_config";
private static LinphoneActivity instance;
- private PowerManager.WakeLock mWakeLock;
-
private SensorManager mSensorManager;
private Sensor mAccelerometer;
private int previousRotation = -1;
@@ -110,9 +108,6 @@ public class LinphoneActivity extends TabActivity implements
useMenuAbout = getResources().getBoolean(R.bool.useMenuAbout);
checkAccount = !useFirstLoginActivity;
- PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
- mWakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK|PowerManager.ON_AFTER_RELEASE,Log.TAG+"#"+getClass().getName());
-
mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this);
@@ -451,15 +446,10 @@ public class LinphoneActivity extends TabActivity implements
if (IncallActivity.active) {
return;
}
-
- mHandler.post(new Runnable() {
- public void run() {
- startActivityForResult(new Intent().setClass(
- LinphoneActivity.this,
- IncallActivity.class),
- incall_activity);
- }
- });
+ startActivityForResult(new Intent().setClass(
+ LinphoneActivity.this,
+ IncallActivity.class),
+ incall_activity);
}
public void startIncomingCallActivity(LinphoneCall pendingCall) {
@@ -469,14 +459,7 @@ public class LinphoneActivity extends TabActivity implements
startActivityForResult(intent, INCOMING_CALL_ACTIVITY);
}
- public void finishVideoActivity() {
- mHandler.post(new Runnable() {
- public void run() {
- finishActivity(video_activity);
- }
- });
- }
-
+
@Override
public void onCallStateChanged(LinphoneCall call, State state,
String message) {
@@ -494,7 +477,6 @@ public class LinphoneActivity extends TabActivity implements
}
if (state==State.OutgoingInit || state==State.IncomingReceived) {
startOrientationSensor();
- enterIncallMode();
} else if (state==State.Error || state==State.CallEnd){
stopOrientationSensor();
finishActivity(INCOMING_CALL_ACTIVITY);
@@ -502,7 +484,6 @@ public class LinphoneActivity extends TabActivity implements
if (state==State.Connected) {
if (call.getDirection() == CallDirection.Incoming) {
startIncallActivity();
- enterIncallMode();
}
}
if (state == LinphoneCall.State.StreamsRunning && Version.isVideoCapable()) {
@@ -510,27 +491,30 @@ public class LinphoneActivity extends TabActivity implements
if (videoEnabled) {
startVideoActivity(call, 1000);
} else {
- finishVideoActivity();
+ finishActivity(video_activity);
}
}
if (state == LinphoneCall.State.CallUpdatedByRemote && Version.isVideoCapable()) {
if (VideoCallActivity.launched && !call.getCurrentParamsCopy().getVideoEnabled()) {
- finishVideoActivity();
+ finishActivity(video_activity);
}
}
if (state==State.Error){
showToast(R.string.call_error, message);
if (lc.getCallsNb() == 0){
- if (mWakeLock.isHeld()) mWakeLock.release();
- exitCallMode();
+ exitIncallActivity();
}
}else if (state==State.CallEnd){
if (lc.getCallsNb() == 0){
- exitCallMode();
+ exitIncallActivity();
}
}
+
+ if (ConferenceDetailsActivity.active && lc.getConferenceSize() == 0) {
+ finishActivity(conferenceDetailsActivity);
+ }
}
private void showToast(int id, String txt) {
@@ -542,30 +526,16 @@ public class LinphoneActivity extends TabActivity implements
});
}
- private void enterIncallMode() {
- LinphoneManager.startProximitySensorForActivity(this);
- if (!mWakeLock.isHeld()) mWakeLock.acquire();
- }
- private void exitCallMode() {
+
+ private void exitIncallActivity() {
finishActivity(incall_activity);
-
- if (mWakeLock.isHeld()) mWakeLock.release();
- mHandler.post(new Runnable() {
- @Override
- public void run() {
- LinphoneManager.stopProximitySensorForActivity(LinphoneActivity.this);
- }
- });
-
setVolumeControlStream(AudioManager.USE_DEFAULT_STREAM_TYPE);
}
@Override
protected void onDestroy() {
- if (mWakeLock.isHeld()) mWakeLock.release();
-
super.onDestroy();
}
@@ -575,21 +545,18 @@ public class LinphoneActivity extends TabActivity implements
super.onResume();
LinphoneCall pendingCall = LinphoneManager.getInstance().getPendingIncomingCall();
if (pendingCall != null) {
- LinphoneActivity.instance().startIncomingCallActivity(pendingCall);
- } else if (LinphoneManager.getLc().isIncall()) {
- enterIncallMode();
- }
-
- if (LinphoneManager.getLc().getCallsNb() > 0) {
- LinphoneManager.startProximitySensorForActivity(this);
- // removing is done directly in LinphoneActivity.onPause()
- }
+ startIncomingCallActivity(pendingCall);
+ }
}
@Override
public void goToDialer() {
selectDialerTab();
}
+
+ public void startConferenceDetailsActivity() {
+ startActivityForResult(new Intent().setClass(this, ConferenceDetailsActivity.class), conferenceDetailsActivity);
+ }
}
interface ContactPicked {
diff --git a/src/org/linphone/LinphoneConfigException.java b/src/org/linphone/LinphoneConfigException.java
deleted file mode 100644
index 998e0d8f3..000000000
--- a/src/org/linphone/LinphoneConfigException.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-LinphoneCoreException.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;
-
-@SuppressWarnings("serial")
-public class LinphoneConfigException extends LinphoneException {
-
- public LinphoneConfigException() {
- super();
- }
-
- public LinphoneConfigException(String detailMessage, Throwable throwable) {
- super(detailMessage, throwable);
- }
-
- public LinphoneConfigException(String detailMessage) {
- super(detailMessage);
- }
-
- public LinphoneConfigException(Throwable throwable) {
- super(throwable);
- }
-
-}
diff --git a/src/org/linphone/LinphoneLauncherActivity.java b/src/org/linphone/LinphoneLauncherActivity.java
index bf6cd424d..5de13dbde 100644
--- a/src/org/linphone/LinphoneLauncherActivity.java
+++ b/src/org/linphone/LinphoneLauncherActivity.java
@@ -20,12 +20,9 @@ package org.linphone;
import static android.content.Intent.ACTION_MAIN;
import android.app.Activity;
-import android.app.AlertDialog;
-import android.app.Dialog;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
-import android.view.View;
/**
*
diff --git a/src/org/linphone/LinphoneManager.java b/src/org/linphone/LinphoneManager.java
index 192b6c1fd..d4c2faa76 100644
--- a/src/org/linphone/LinphoneManager.java
+++ b/src/org/linphone/LinphoneManager.java
@@ -121,13 +121,15 @@ import android.view.WindowManager;
public final class LinphoneManager implements LinphoneCoreListener {
private static LinphoneManager instance;
+ private Context mServiceContext;
private AudioManager mAudioManager;
private PowerManager mPowerManager;
+ private ConnectivityManager mConnectivityManager;
private SharedPreferences mPref;
private Resources mR;
private LinphoneCore mLc;
private static Transports initialTransports;
- private static LinphonePreferenceManager lpm;
+ private static LinphonePreferenceManager sLPref;
private String lastLcStatusMessage;
private String basePath;
private static boolean sExited;
@@ -145,31 +147,34 @@ public final class LinphoneManager implements LinphoneCoreListener {
}
- private LinphoneManager(final Context c) {
+ private LinphoneManager(final Context c, LinphoneServiceListener listener) {
sExited=false;
+ mServiceContext = c;
+ mListenerDispatcher = new ListenerDispatcher(listener);
basePath = c.getFilesDir().getAbsolutePath();
- linphoneInitialConfigFile = basePath + "/linphonerc";
- linphoneConfigFile = basePath + "/.linphonerc";
- linphoneRootCaFile = basePath + "/rootca.pem";
- ringSoundFile = basePath + "/oldphone_mono.wav";
- ringbackSoundFile = basePath + "/ringback.wav";
+ mLinphoneInitialConfigFile = basePath + "/linphonerc";
+ mLinphoneConfigFile = basePath + "/.linphonerc";
+ mLinphoneRootCaFile = basePath + "/rootca.pem";
+ mRingSoundFile = basePath + "/oldphone_mono.wav";
+ mRingbackSoundFile = basePath + "/ringback.wav";
- lpm = LinphonePreferenceManager.getInstance(c);
+ sLPref = LinphonePreferenceManager.getInstance(c);
mAudioManager = ((AudioManager) c.getSystemService(Context.AUDIO_SERVICE));
mVibrator = (Vibrator) c.getSystemService(Context.VIBRATOR_SERVICE);
mPref = PreferenceManager.getDefaultSharedPreferences(c);
mPowerManager = (PowerManager) c.getSystemService(Context.POWER_SERVICE);
+ mConnectivityManager = (ConnectivityManager) c.getSystemService(Context.CONNECTIVITY_SERVICE);
mR = c.getResources();
}
private static final int LINPHONE_VOLUME_STREAM = STREAM_VOICE_CALL;
private static final int dbStep = 4;
/** Called when the activity is first created. */
- private final String linphoneInitialConfigFile;
- private final String linphoneRootCaFile;
- private final String linphoneConfigFile;
- private final String ringSoundFile;
- private final String ringbackSoundFile;
+ private final String mLinphoneInitialConfigFile;
+ private final String mLinphoneRootCaFile;
+ private final String mLinphoneConfigFile;
+ private final String mRingSoundFile;
+ private final String mRingbackSoundFile;
private Timer mTimer = new Timer("Linphone scheduler");
@@ -187,13 +192,13 @@ public final class LinphoneManager implements LinphoneCoreListener {
speakerOn ? "speaker" : "earpiece");
return;
}
- if (Hacks.needGalaxySAudioHack() || lpm.useGalaxySHack())
+ if (Hacks.needGalaxySAudioHack() || sLPref.useGalaxySHack())
setAudioModeIncallForGalaxyS();
- if (lpm.useSpecificAudioModeHack() != -1)
- mAudioManager.setMode(lpm.useSpecificAudioModeHack());
+ if (sLPref.useSpecificAudioModeHack() != -1)
+ mAudioManager.setMode(sLPref.useSpecificAudioModeHack());
- if (Hacks.needRoutingAPI() || lpm.useAudioRoutingAPIHack()) {
+ if (Hacks.needRoutingAPI() || sLPref.useAudioRoutingAPIHack()) {
mAudioManager.setRouting(
MODE_NORMAL,
speakerOn? ROUTE_SPEAKER : ROUTE_EARPIECE,
@@ -252,9 +257,8 @@ public final class LinphoneManager implements LinphoneCoreListener {
if (instance != null)
throw new RuntimeException("Linphone Manager is already initialized");
- instance = new LinphoneManager(c);
- instance.listenerDispatcher.setServiceListener(listener);
- instance.startLibLinphone(c);
+ instance = new LinphoneManager(c, listener);
+ instance.startLibLinphone();
TelephonyManager tm = (TelephonyManager) c.getSystemService(Context.TELEPHONY_SERVICE);
boolean gsmIdle = tm.getCallState() == TelephonyManager.CALL_STATE_IDLE;
setGsmIdle(gsmIdle);
@@ -282,7 +286,7 @@ public final class LinphoneManager implements LinphoneCoreListener {
public boolean isSpeakerOn() {
- if (Hacks.needRoutingAPI() || lpm.useAudioRoutingAPIHack()) {
+ if (Hacks.needRoutingAPI() || sLPref.useAudioRoutingAPIHack()) {
return mAudioManager.getRouting(MODE_NORMAL) == ROUTE_SPEAKER;
} else {
return mAudioManager.isSpeakerphoneOn();
@@ -301,11 +305,11 @@ public final class LinphoneManager implements LinphoneCoreListener {
try {
lAddress = mLc.interpretUrl(to);
if (mLc.isMyself(lAddress.asStringUriOnly())) {
- listenerDispatcher.tryingNewOutgoingCallButWrongDestinationAddress();
+ mListenerDispatcher.tryingNewOutgoingCallButWrongDestinationAddress();
return;
}
} catch (LinphoneCoreException e) {
- listenerDispatcher.tryingNewOutgoingCallButWrongDestinationAddress();
+ mListenerDispatcher.tryingNewOutgoingCallButWrongDestinationAddress();
return;
}
lAddress.setDisplayName(address.getDisplayedName());
@@ -322,7 +326,7 @@ public final class LinphoneManager implements LinphoneCoreListener {
} catch (LinphoneCoreException e) {
- listenerDispatcher.tryingNewOutgoingCallButCannotGetCallParameters();
+ mListenerDispatcher.tryingNewOutgoingCallButCannotGetCallParameters();
return;
}
}
@@ -392,23 +396,23 @@ public final class LinphoneManager implements LinphoneCoreListener {
}
}
- private synchronized void startLibLinphone(final Context context) {
+ private synchronized void startLibLinphone() {
try {
- copyAssetsFromPackage(context);
+ copyAssetsFromPackage();
mLc = LinphoneCoreFactory.instance().createLinphoneCore(
- this, linphoneConfigFile, linphoneInitialConfigFile, null);
+ this, mLinphoneConfigFile, mLinphoneInitialConfigFile, null);
mLc.enableIpv6(mPref.getBoolean(getString(R.string.pref_ipv6_key), false));
mLc.setZrtpSecretsCache(basePath+"/zrtp_secrets");
mLc.setPlaybackGain(3);
mLc.setRing(null);
- mLc.setRootCA(linphoneRootCaFile);
+ mLc.setRootCA(mLinphoneRootCaFile);
try {
- initFromConf(context);
+ initFromConf();
} catch (LinphoneException e) {
Log.w("no config ready yet");
}
@@ -423,27 +427,27 @@ public final class LinphoneManager implements LinphoneCoreListener {
IntentFilter lFilter = new IntentFilter(Intent.ACTION_SCREEN_ON);
lFilter.addAction(Intent.ACTION_SCREEN_OFF);
- context.registerReceiver(mKeepAliveReceiver, lFilter);
+ mServiceContext.registerReceiver(mKeepAliveReceiver, lFilter);
}
catch (Exception e) {
Log.e(e,"Cannot start linphone");
}
}
- private void copyAssetsFromPackage(Context context) throws IOException {
- copyIfNotExist(context, R.raw.oldphone_mono,ringSoundFile);
- copyIfNotExist(context, R.raw.ringback,ringbackSoundFile);
- copyFromPackage(context, R.raw.linphonerc, new File(linphoneInitialConfigFile).getName());
- copyIfNotExist(context, R.raw.rootca, new File(linphoneRootCaFile).getName());
+ private void copyAssetsFromPackage() throws IOException {
+ copyIfNotExist(R.raw.oldphone_mono,mRingSoundFile);
+ copyIfNotExist(R.raw.ringback,mRingbackSoundFile);
+ copyFromPackage(R.raw.linphonerc, new File(mLinphoneInitialConfigFile).getName());
+ copyIfNotExist(R.raw.rootca, new File(mLinphoneRootCaFile).getName());
}
- private void copyIfNotExist(Context context, int ressourceId,String target) throws IOException {
+ private void copyIfNotExist(int ressourceId,String target) throws IOException {
File lFileToCopy = new File(target);
if (!lFileToCopy.exists()) {
- copyFromPackage(context, ressourceId,lFileToCopy.getName());
+ copyFromPackage(ressourceId,lFileToCopy.getName());
}
}
- private void copyFromPackage(Context context, int ressourceId,String target) throws IOException{
- FileOutputStream lOutputStream = context.openFileOutput (target, 0);
+ private void copyFromPackage(int ressourceId,String target) throws IOException{
+ FileOutputStream lOutputStream = mServiceContext.openFileOutput (target, 0);
InputStream lInputStream = mR.openRawResource(ressourceId);
int readByte;
byte[] buff = new byte[8048];
@@ -469,7 +473,7 @@ public final class LinphoneManager implements LinphoneCoreListener {
return false;
}
- public void initFromConf(Context context) throws LinphoneConfigException {
+ public void initFromConf() throws LinphoneConfigException {
//traces
boolean lIsDebug = true;//mPref.getBoolean(getString(R.string.pref_debug_key), false);
LinphoneCoreFactory.instance().setDebugMode(lIsDebug);
@@ -587,10 +591,8 @@ public final class LinphoneManager implements LinphoneCoreListener {
}
//init network state
- ConnectivityManager lConnectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
- NetworkInfo lInfo = lConnectivityManager.getActiveNetworkInfo();
- mLc.setNetworkReachable( lInfo !=null? lConnectivityManager.getActiveNetworkInfo().getState() ==NetworkInfo.State.CONNECTED:false);
-
+ NetworkInfo networkInfo = mConnectivityManager.getActiveNetworkInfo();
+ mLc.setNetworkReachable(networkInfo !=null? networkInfo.getState() == NetworkInfo.State.CONNECTED:false);
} catch (LinphoneCoreException e) {
throw new LinphoneConfigException(getString(R.string.wrong_settings),e);
}
@@ -668,19 +670,23 @@ public final class LinphoneManager implements LinphoneCoreListener {
mLc.enablePayloadType(videoCodec, enable);
}
- public static synchronized void destroy(Context context) {
- if (instance == null) return;
- sExited=true;
+ private void doDestroy() {
try {
- instance.mTimer.cancel();
- instance.mLc.destroy();
- context.unregisterReceiver(instance.mKeepAliveReceiver);
+ mTimer.cancel();
+ mLc.destroy();
+ mServiceContext.unregisterReceiver(instance.mKeepAliveReceiver);
} finally {
- instance.mLc = null;
+ mLc = null;
instance = null;
}
}
+ public static synchronized void destroy() {
+ if (instance == null) return;
+ sExited=true;
+ instance.doDestroy();
+ }
+
private String getString(int key) {
return mR.getString(key);
}
@@ -705,7 +711,7 @@ public final class LinphoneManager implements LinphoneCoreListener {
void onEcCalibrationStatus(EcCalibratorStatus status, int delayMs);
}
- private ListenerDispatcher listenerDispatcher = new ListenerDispatcher();
+ private ListenerDispatcher mListenerDispatcher;
private LinphoneCall ringingCall;
private MediaPlayer mRingerPlayer;
@@ -730,20 +736,20 @@ public final class LinphoneManager implements LinphoneCoreListener {
public void displayStatus(final LinphoneCore lc, final String message) {
Log.i(message);
lastLcStatusMessage=message;
- listenerDispatcher.onDisplayStatus(message);
+ mListenerDispatcher.onDisplayStatus(message);
}
public void globalState(final LinphoneCore lc, final LinphoneCore.GlobalState state, final String message) {
Log.i("new state [",state,"]");
- listenerDispatcher.onGlobalStateChanged(state, message);
+ mListenerDispatcher.onGlobalStateChanged(state, message);
}
public void registrationState(final LinphoneCore lc, final LinphoneProxyConfig cfg,final LinphoneCore.RegistrationState state,final String message) {
Log.i("new state ["+state+"]");
- listenerDispatcher.onRegistrationStateChanged(state, message);
+ mListenerDispatcher.onRegistrationStateChanged(state, message);
}
private int savedMaxCallWhileGsmIncall;
@@ -807,7 +813,7 @@ public final class LinphoneManager implements LinphoneCoreListener {
}
if (state == State.Connected) {
- if (Hacks.needSoftvolume() || LinphonePreferenceManager.getInstance().useSoftvolume()) {
+ if (Hacks.needSoftvolume() || sLPref.useSoftvolume()) {
adjustSoftwareVolume(0); // Synchronize
}
}
@@ -833,12 +839,12 @@ public final class LinphoneManager implements LinphoneCoreListener {
Log.i("New call active while incall (CPU only) wake lock already active");
}
}
- listenerDispatcher.onCallStateChanged(call, state, message);
+ mListenerDispatcher.onCallStateChanged(call, state, message);
}
public void callEncryptionChanged(LinphoneCore lc, LinphoneCall call,
boolean encrypted, String authenticationToken) {
- listenerDispatcher.onCallEncryptionChanged(call, encrypted, authenticationToken);
+ mListenerDispatcher.onCallEncryptionChanged(call, encrypted, authenticationToken);
}
public void ecCalibrationStatus(final LinphoneCore lc,final EcCalibratorStatus status, final int delayMs,
@@ -881,7 +887,7 @@ public final class LinphoneManager implements LinphoneCoreListener {
if (mRingerPlayer == null) {
mRingerPlayer = new MediaPlayer();
mRingerPlayer.setAudioStreamType(STREAM_RING);
- listenerDispatcher.onRingerPlayerCreated(mRingerPlayer);
+ mListenerDispatcher.onRingerPlayerCreated(mRingerPlayer);
mRingerPlayer.prepare();
mRingerPlayer.setLooping(true);
mRingerPlayer.start();
@@ -983,7 +989,7 @@ public final class LinphoneManager implements LinphoneCoreListener {
}
public boolean acceptCallIfIncomingPending() throws LinphoneCoreException {
- if (Hacks.needGalaxySAudioHack() || lpm.useGalaxySHack())
+ if (Hacks.needGalaxySAudioHack() || sLPref.useGalaxySHack())
setAudioModeIncallForGalaxyS();
if (mLc.isInComingInvitePending()) {
@@ -994,7 +1000,7 @@ public final class LinphoneManager implements LinphoneCoreListener {
}
public boolean acceptCall(LinphoneCall call) {
- if (Hacks.needGalaxySAudioHack() || lpm.useGalaxySHack())
+ if (Hacks.needGalaxySAudioHack() || sLPref.useGalaxySHack())
setAudioModeIncallForGalaxyS();
try {
@@ -1131,8 +1137,8 @@ public final class LinphoneManager implements LinphoneCoreListener {
private class ListenerDispatcher implements LinphoneServiceListener {
private LinphoneServiceListener serviceListener;
- public void setServiceListener(LinphoneServiceListener s) {
- this.serviceListener = s;
+ public ListenerDispatcher(LinphoneServiceListener listener) {
+ this.serviceListener = listener;
}
public void onCallEncryptionChanged(LinphoneCall call,
@@ -1205,4 +1211,26 @@ public final class LinphoneManager implements LinphoneCoreListener {
return incomingPending ? currentCall : null;
}
+
+
+
+ @SuppressWarnings("serial")
+ public static class LinphoneConfigException extends LinphoneException {
+
+ public LinphoneConfigException() {
+ super();
+ }
+
+ public LinphoneConfigException(String detailMessage, Throwable throwable) {
+ super(detailMessage, throwable);
+ }
+
+ public LinphoneConfigException(String detailMessage) {
+ super(detailMessage);
+ }
+
+ public LinphoneConfigException(Throwable throwable) {
+ super(throwable);
+ }
+ }
}
diff --git a/src/org/linphone/LinphonePreferenceManager.java b/src/org/linphone/LinphonePreferenceManager.java
index 449155fa5..a9906fa44 100644
--- a/src/org/linphone/LinphonePreferenceManager.java
+++ b/src/org/linphone/LinphonePreferenceManager.java
@@ -37,14 +37,6 @@ public class LinphonePreferenceManager {
return c.getString(key);
}
- public static final synchronized LinphonePreferenceManager getInstance() {
- if (instance == null) {
- throw new RuntimeException("LinphonePreferenceManager not instanciated");
- }
- return instance;
- }
-
-
public boolean useSoftvolume() {
return p.getBoolean(
getString(R.string.pref_audio_soft_volume_key), false);
diff --git a/src/org/linphone/LinphonePreferencesActivity.java b/src/org/linphone/LinphonePreferencesActivity.java
index 74cba276b..c86710588 100644
--- a/src/org/linphone/LinphonePreferencesActivity.java
+++ b/src/org/linphone/LinphonePreferencesActivity.java
@@ -25,16 +25,16 @@ import static org.linphone.R.string.ec_calibration_launch_message;
import static org.linphone.R.string.pref_codec_amr_key;
import static org.linphone.R.string.pref_codec_ilbc_key;
import static org.linphone.R.string.pref_codec_speex16_key;
-import static org.linphone.R.string.pref_echo_canceller_calibration_key;
-import static org.linphone.R.string.pref_video_enable_key;
-import static org.linphone.R.string.pref_echo_limiter_key;
import static org.linphone.R.string.pref_echo_cancellation_key;
-
+import static org.linphone.R.string.pref_echo_canceller_calibration_key;
+import static org.linphone.R.string.pref_echo_limiter_key;
+import static org.linphone.R.string.pref_video_enable_key;
import java.util.Arrays;
import java.util.List;
import org.linphone.LinphoneManager.EcCalibrationListener;
+import org.linphone.LinphoneManager.LinphoneConfigException;
import org.linphone.core.LinphoneCore;
import org.linphone.core.LinphoneCoreException;
import org.linphone.core.Log;
@@ -280,9 +280,8 @@ public class LinphonePreferencesActivity extends PreferenceActivity implements E
}
try {
- LinphoneManager.getInstance().initFromConf(getApplicationContext());
+ LinphoneManager.getInstance().initFromConf();
} catch (LinphoneException e) {
-
if (! (e instanceof LinphoneConfigException)) {
Log.e(e, "Cannot update config");
return;
diff --git a/src/org/linphone/LinphoneService.java b/src/org/linphone/LinphoneService.java
index 30ec78ef7..307369aa8 100644
--- a/src/org/linphone/LinphoneService.java
+++ b/src/org/linphone/LinphoneService.java
@@ -291,7 +291,7 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
stopForegroundCompat(NOTIF_ID);
LinphoneManager.getLcIfManagerNotDestroyedOrNull().setPresenceInfo(0, null, OnlineStatus.Offline);
- LinphoneManager.destroy(this);
+ LinphoneManager.destroy();
instance=null;
}
@@ -369,10 +369,7 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
public interface LinphoneGuiListener extends NewOutgoingCallUiListener {
void onDisplayStatus(String message);
void onGlobalStateChangedToOn(String message);
-// void onRegistrationStateChanged(RegistrationState state, String message);
void onCallStateChanged(LinphoneCall call, State state, String message);
- void onCallEncryptionChanged(LinphoneCall call, boolean encrypted,
- String authenticationToken);
}
@@ -414,12 +411,7 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
public void onCallEncryptionChanged(final LinphoneCall call, final boolean encrypted,
final String authenticationToken) {
- mHandler.post(new Runnable() {
- public void run() {
- if (guiListener() != null)
- guiListener().onCallEncryptionChanged(call, encrypted, authenticationToken);
- }
- });
+ // IncallActivity registers itself to this event and handle it.
}
}
diff --git a/src/org/linphone/LinphoneUtils.java b/src/org/linphone/LinphoneUtils.java
index ef59af2b1..86d16e9f5 100644
--- a/src/org/linphone/LinphoneUtils.java
+++ b/src/org/linphone/LinphoneUtils.java
@@ -18,11 +18,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.linphone;
+import static android.view.View.GONE;
+import static android.view.View.VISIBLE;
+
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
import org.linphone.core.LinphoneAddress;
@@ -41,6 +45,8 @@ import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.view.KeyEvent;
+import android.view.View;
+import android.view.View.OnClickListener;
import android.widget.ImageView;
/**
@@ -116,6 +122,7 @@ public final class LinphoneUtils {
return null;
}
+
public static void setImagePictureFromUri(Context c, ImageView view, Uri uri, int notFoundResource) {
if (uri == null) {
view.setImageResource(notFoundResource);
@@ -129,12 +136,33 @@ public final class LinphoneUtils {
if (Version.sdkAboveOrEqual(Version.API06_ECLAIR_201)) {
view.setImageURI(uri);
} else {
+ @SuppressWarnings("deprecation")
Bitmap bitmap = android.provider.Contacts.People.loadContactPhoto(c, uri, notFoundResource, null);
view.setImageBitmap(bitmap);
}
}
}
+ public static final List getLinphoneCallsNotInConf(LinphoneCore lc) {
+ List calls = getLinphoneCalls(lc);
+ Iterator iterator = calls.iterator();
+ while (iterator.hasNext()) {
+ LinphoneCall call = iterator.next();
+ if (call.isInConference()) iterator.remove();
+ }
+ return calls;
+ }
+
+ public static final List getLinphoneCallsInConf(LinphoneCore lc) {
+ List calls = getLinphoneCalls(lc);
+ Iterator iterator = calls.iterator();
+ while (iterator.hasNext()) {
+ LinphoneCall call = iterator.next();
+ if (!call.isInConference()) iterator.remove();
+ }
+ return calls;
+ }
+
@SuppressWarnings("unchecked")
public static final List getLinphoneCalls(LinphoneCore lc) {
return (List) lc.getCalls();
@@ -159,5 +187,31 @@ public final class LinphoneUtils {
}
return foundCalls;
}
+
+ public static final int countConferenceCalls(LinphoneCore lc) {
+ int count = lc.getConferenceSize();
+ if (lc.isInConference()) count--;
+ return count;
+ }
+
+ public static int countVirtualCalls(LinphoneCore lc) {
+ return lc.getCallsNb() - countConferenceCalls(lc);
+ }
+ public static int countNonConferenceCalls(LinphoneCore lc) {
+ return lc.getCallsNb() - countConferenceCalls(lc);
+ }
+
+ public static void setVisibility(View v, int id, boolean visible) {
+ v.findViewById(id).setVisibility(visible ? VISIBLE : GONE);
+ }
+ public static void setVisibility(View v, boolean visible) {
+ v.setVisibility(visible ? VISIBLE : GONE);
+ }
+ public static void enableView(View root, int id, OnClickListener l, boolean enable) {
+ View v = root.findViewById(id);
+ v.setVisibility(enable ? VISIBLE : GONE);
+ v.setOnClickListener(l);
+ }
+
}
diff --git a/src/org/linphone/core/LinphoneCoreImpl.java b/src/org/linphone/core/LinphoneCoreImpl.java
index 7f63f0cb3..363ac8ac4 100644
--- a/src/org/linphone/core/LinphoneCoreImpl.java
+++ b/src/org/linphone/core/LinphoneCoreImpl.java
@@ -501,9 +501,9 @@ class LinphoneCoreImpl implements LinphoneCore {
leaveConference(nativePtr);
}
- private native void enterConference(long nativePtr);
- public synchronized void enterConference() {
- enterConference(nativePtr);
+ private native boolean enterConference(long nativePtr);
+ public synchronized boolean enterConference() {
+ return enterConference(nativePtr);
}
private native boolean isInConference(long nativePtr);
diff --git a/src/org/linphone/ui/IncallTimer.java b/src/org/linphone/ui/IncallTimer.java
index 80992fa60..5234af1c5 100644
--- a/src/org/linphone/ui/IncallTimer.java
+++ b/src/org/linphone/ui/IncallTimer.java
@@ -65,29 +65,7 @@ public class IncallTimer extends TextView {
}
}
-
- /**
- * Format time as "days - hh : mm : ss".
- * @param seconds
- * @return formated string
- */
- /*protected String formatTime(final int seconds) {
- int value = seconds;
- StringBuilder sb = new StringBuilder();
-
- for (int base : Arrays.asList(60, 60, 24)) {
- if (value == 0) break;
-
- int remainder = value % base;
- value /= base;
-
- if (sb.length() != 0) sb.insert(0, " : ");
- sb.insert(0, remainder < 10 ? "0" + remainder : remainder);
- }
-
- if (value != 0) sb.insert(0, value + " - ");
-
- return sb.toString();
+ public void setDuration(int duration) {
+ super.setText(formatTime(duration));
}
- */
}
diff --git a/submodules/linphone b/submodules/linphone
index 50d784112..ab498e8e8 160000
--- a/submodules/linphone
+++ b/submodules/linphone
@@ -1 +1 @@
-Subproject commit 50d784112932f7bcdfe2e7fb69dcfc5c27546d0a
+Subproject commit ab498e8e8cea496d6eb96a72d76cd987e49be544
diff --git a/test/org/linphone/TestConferenceActivity.java b/test/org/linphone/TestConferenceActivity.java
deleted file mode 100644
index 77fe7a936..000000000
--- a/test/org/linphone/TestConferenceActivity.java
+++ /dev/null
@@ -1,437 +0,0 @@
-/*
-TestIncallCalleeBoxes.java
-Copyright (C) 2011 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 java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.linphone.core.CallDirection;
-import org.linphone.core.LinphoneAddress;
-import org.linphone.core.LinphoneAuthInfo;
-import org.linphone.core.LinphoneCall;
-import org.linphone.core.LinphoneCallLog;
-import org.linphone.core.LinphoneCallParams;
-import org.linphone.core.LinphoneChatRoom;
-import org.linphone.core.LinphoneCore;
-import org.linphone.core.LinphoneCoreException;
-import org.linphone.core.LinphoneFriend;
-import org.linphone.core.LinphoneProxyConfig;
-import org.linphone.core.OnlineStatus;
-import org.linphone.core.PayloadType;
-import org.linphone.core.VideoSize;
-import org.linphone.core.LinphoneCall.State;
-
-import android.os.Bundle;
-import android.os.Handler;
-
-/**
- * @author Guillaume Beraudo
- */
-public class TestConferenceActivity extends IncallActivity {
-
- private Handler mHandler = new Handler();
- private LinphoneCoreTest mTestLc;
- protected final LinphoneCore lc() {return mTestLc;}
-
- private void simulateCallAccepted(final LinphoneCall call, int millis) {
- mHandler.postDelayed(new Runnable() {
- public void run() {
- lc().pauseAllCalls();
- ((LinphoneCallTest)call).state = State.StreamsRunning;
- onCallStateChanged(call, call.getState(), "simulated out call answered");
- }
- }, millis);
- }
- private void delayedCallEvent(final LinphoneCall call, final State targetState, int millis) {
- mHandler.postDelayed(new Runnable() {
- public void run() {
- ((LinphoneCallTest)call).state = targetState;
- onCallStateChanged(call, call.getState(), "simulated delayed state change " + targetState);
- }
- }, millis);
- }
-
- protected final List getInitialCalls() {
- List calls = new ArrayList();
- int duration=0;
- mTestLc = new LinphoneCoreTest(calls);
- calls.add(new LinphoneCallTest(duration++, "Tartampion", "06.25.45.98.54", State.StreamsRunning));
- calls.add(new LinphoneCallTest(duration++, "Durand", "durand@sip.linphone.org", State.StreamsRunning));
- // calls.add(new LinphoneCallTest(duration++, "Poupoux", "01.58.68.75.32", State.StreamsRunning));
- calls.add(new LinphoneCallTest(duration++, "Tante Germaine", "+33 1.58.68.75.32", State.Paused));
- // calls.add(new LinphoneCallTest(duration++, "M. Le président ", "3615 Elysée", State.Paused));
- calls.add(new LinphoneCallTest(duration++, "01.58.68.75.32", "01.58.68.75.32", State.StreamsRunning));
- calls.add(new LinphoneCallTest(duration++, "A ringing out guy", "out-ringing@sip.linphone.org", State.OutgoingRinging));
- calls.add(new LinphoneCallTest(duration++, "A calling in guy", "in@sip.linphone.org", State.IncomingReceived));
-
- ((LinphoneCallTest)calls.get(0)).inConf=true;
- ((LinphoneCallTest)calls.get(1)).inConf=true;
-
- simulateCallAccepted(calls.get(4), 5000);
- Collections.sort(calls, this);
-
- mTestLc = new LinphoneCoreTest(calls);
- return calls;
- }
-
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- //if (!serviceStarted) startService(new Intent(ACTION_MAIN).setClass(this, LinphoneService.class));
-
- findViewById(R.id.toggleMuteMic).setOnClickListener(null);
- findViewById(R.id.toggleSpeaker).setOnClickListener(null);
-
- super.onCreate(savedInstanceState);
- }
-
-
-
-
- private class LinphoneCoreTest implements LinphoneCore {
- List calls;
- public LinphoneCoreTest(List calls) {
- this.calls = new ArrayList(calls);
- //don't keep only the list reference (concurrent access in onStateChanged).
- }
- public void acceptCall(LinphoneCall call) throws LinphoneCoreException {
- if (isInConference()) {
- leaveConference();
- } else {
- LinphoneCall current = getCurrentCall();
- if (current != null) pauseCall(current);
- }
- changeState(call, State.StreamsRunning);
- }
- public void addAuthInfo(LinphoneAuthInfo info) {}
- public void addFriend(LinphoneFriend lf) throws LinphoneCoreException {}
- public void addProxyConfig(LinphoneProxyConfig p) throws LinphoneCoreException {}
- public void adjustSoftwareVolume(int i) {}
- public void clearAuthInfos() {}
- public void clearCallLogs() {}
- public void clearProxyConfigs() {}
- public LinphoneChatRoom createChatRoom(String to) {return null;}
- public LinphoneCallParams createDefaultCallParameters() {return null;}
- public void destroy() {}
- public void enableEchoCancellation(boolean enable) {}
- public void enableEchoLimiter(boolean val) {}
- public void enableIpv6(boolean enable) {}
- public void enableKeepAlive(boolean enable) {}
- public void enablePayloadType(PayloadType pt, boolean e)throws LinphoneCoreException {}
- public void enableSpeaker(boolean value) {}
- public void enableVideo(boolean vcapEnabled, boolean displayEnabled) {}
- public PayloadType findPayloadType(String mime, int clockRate) {return null;}
- public PayloadType[] getAudioCodecs() {return null;}
- @SuppressWarnings("unchecked")
- public List getCallLogs() {return null;}
- public LinphoneCall getCurrentCall() {
- LinphoneCall active = null;
- for (LinphoneCall call : calls) {
- if (call.isInConference() || !call.getState().equals(State.StreamsRunning)) continue;
- if (active != null) throw new RuntimeException("There are several active calls!");
- active = call;
- }
- return active;
- }
- public LinphoneProxyConfig getDefaultProxyConfig() {return null;}
- public FirewallPolicy getFirewallPolicy() {return null;}
- public int getPlayLevel() {return 0;}
- public float getPlaybackGain() {return 0;}
- public VideoSize getPreferredVideoSize() {return null;}
- public LinphoneAddress getRemoteAddress() {return null;}
- public String getRing() {return null;}
- public Transports getSignalingTransportPorts() {return null;}
- public String getStunServer() {return null;}
- public PayloadType[] getVideoCodecs() {return null;}
- public LinphoneAddress interpretUrl(String d)throws LinphoneCoreException {return null;}
- public LinphoneCall invite(String d) throws LinphoneCoreException {return null;}
- public LinphoneCall invite(LinphoneAddress to)throws LinphoneCoreException {return null;}
- public LinphoneCall inviteAddressWithParams(LinphoneAddress d, LinphoneCallParams p)
- throws LinphoneCoreException {return null;}
- public boolean isEchoCancellationEnabled() {return false;}
- public boolean isInComingInvitePending() {return false;}
- public boolean isIncall() {return false;}
- public boolean isKeepAliveEnabled() {return false;}
- public boolean isMicMuted() {return false;}
- public boolean isNetworkReachable() {return false;}
- public boolean isSpeakerEnabled() {return false;}
- public boolean isVideoEnabled() {return false;}
- public void iterate() {}
- public void muteMic(boolean isMuted) {}
- public boolean pauseAllCalls() {
- // FIXME may not be right
- for (LinphoneCall call : calls) {
- if (!call.isInConference()) {
- if (call.getState().equals(State.StreamsRunning) || call.getState().equals(State.PausedByRemote))
- pauseCall(call);
- }
- }
- return false;
- }
- public boolean pauseCall(LinphoneCall call) {
- changeState(call, State.Paused);
- return true;
- }
- public void playDtmf(char number, int duration) {}
- public boolean resumeCall(LinphoneCall call) {
- if (isInConference()) leaveConference();
- pauseAllCalls();
- changeState(call, State.StreamsRunning);
- return true;
- }
- public void sendDtmf(char number) {}
- public void setDefaultProxyConfig(LinphoneProxyConfig proxyCfg) {}
- public void setDownloadBandwidth(int bw) {}
- public void setDownloadPtime(int ptime) {}
- public void setFirewallPolicy(FirewallPolicy pol) {}
- public void setNetworkReachable(boolean isReachable) {}
- public void setPlayLevel(int level) {}
- public void setPlaybackGain(float gain) {}
- public void setPreferredVideoSize(VideoSize vSize) {}
- public void setPresenceInfo(int m, String a, OnlineStatus s) {}
- public void setPreviewWindow(Object w) {}
- public void setRing(String path) {}
- public void setRootCA(String path) {}
- public void setSignalingTransportPorts(Transports transports) {}
- public void setStunServer(String stunServer) {}
- public void setUploadBandwidth(int bw) {}
- public void setUploadPtime(int ptime) {}
- public void setVideoWindow(Object w) {}
- public void setZrtpSecretsCache(String file) {}
- public void startEchoCalibration(Object d)throws LinphoneCoreException {}
- public void stopDtmf() {}
- public void terminateCall(LinphoneCall call) {
- changeStateInConf(call, false);
- changeState(call, State.CallEnd);
- }
- public int updateCall(LinphoneCall call, LinphoneCallParams params) {return 0;}
- private boolean partOfConf;
- public void enterConference() {
- pauseAllCalls();
- partOfConf=true;
- hackTriggerConfStateUpdate(); // FIXME hack; should have an event?
- }
- public void leaveConference() {
- partOfConf=false;
- hackTriggerConfStateUpdate(); // FIXME hack; should have an event?
- }
- public boolean isInConference() {return partOfConf;}
- public int getConferenceSize() {
- int count=0;
- for (LinphoneCall c : calls) {
- if (c.isInConference()) count++;
- }
- return count;
- }
- public void addAllToConference() {
- for (LinphoneCall c : calls) {
- final LinphoneCall.State state = c.getState();
- boolean connectionEstablished = state == State.StreamsRunning || state == State.Paused || state == State.PausedByRemote;
- if (connectionEstablished) {
- changeState(c, State.StreamsRunning);
- changeStateInConf(c, true);
- }
- }
- enterConference();
- }
- public void addToConference(LinphoneCall call) {
- if (getConferenceSize() == 0) {
- addAllToConference();
- } else {
- boolean mergingActiveCall = call.equals(getCurrentCall());
- changeState(call, State.StreamsRunning);
- changeStateInConf(call, true);
- if (mergingActiveCall) enterConference();
- }
- }
- public void terminateConference() {
- leaveConference();
- for (LinphoneCall call : calls) {
- if (!call.isInConference()) continue;
- terminateCall(call);
- }
- }
- private void changeState(LinphoneCall call, State state) {
- ((LinphoneCallTest)call).state=state;
- onCallStateChanged(call, state, "triggered by stub");
- }
- private void changeStateInConf(LinphoneCall call, boolean inConf) {
- ((LinphoneCallTest)call).inConf=inConf;
- onCallStateChanged(call, call.getState(), "in conf state changed");
- }
- public int getCallsNb() {
- int count=0;
- for (LinphoneCall call : calls) {
- if (!State.CallEnd.equals(call.getState())) count++;
- }
- return count;
- }
- public void terminateAllCalls() {
- terminateConference();
- for(LinphoneCall call : calls) {
- if (!State.CallEnd.equals(call.getState())) terminateCall(call);
- }
- }
- @SuppressWarnings("unchecked")
- public List getCalls() {
- return new ArrayList(calls);
- }
- public void removeFromConference(LinphoneCall call) {
- changeStateInConf(call, false);
- changeState(call, State.Paused);
- }
- public void transferCall(LinphoneCall call, String referTo) {
- terminateCall(call);
- }
- public void transferCallToAnother(LinphoneCall callToTransfer, LinphoneCall destination) {
- if (!State.Paused.equals(callToTransfer.getState())) {
- throw new RuntimeException("call to transfer should be paused first");
- }
- terminateCall(callToTransfer);
- delayedCallEvent(destination, State.CallEnd, 3000);
- }
- public int getVideoDevice() {return 0;}
- public void setDeviceRotation(int rotation) {}
- public void setVideoDevice(int id) {}
- @Override
- public LinphoneCall findCallFromUri(String uri) {
- for (LinphoneCall call : calls) {
- if (call.getRemoteAddress().asStringUriOnly().equals(uri)) {
- return call;
- }
- }
- return null;
- }
- @Override
- public int getMaxCalls() {
- return 10;
- }
- @Override
- public boolean isMyself(String uri) {
- return false;
- }
- @Override
- public boolean soundResourcesLocked() {
- // TODO Auto-generated method stub
- return false;
- }
- @Override
- public void setMaxCalls(int max) {
- // TODO Auto-generated method stub
-
- }
- @Override
- public String getMediaEncryption() {
- // TODO Auto-generated method stub
- return null;
- }
- @Override
- public boolean isMediaEncryptionMandatory() {
- // TODO Auto-generated method stub
- return false;
- }
- @Override
- public void setMediaEncryption(String menc) {
- // TODO Auto-generated method stub
-
- }
- @Override
- public void setMediaEncryptionMandatory(boolean yesno) {
- // TODO Auto-generated method stub
-
- }
- @Override
- public boolean isEchoLimiterEnabled() {
- // TODO Auto-generated method stub
- return false;
- }
- }
-
-
- private static class LinphoneAddressTest implements LinphoneAddress {
- private String displayName;
- private String number;
- public LinphoneAddressTest(String niceName, String number) {
- this.displayName = niceName;
- this.number = number;}
- public String asString() {return displayName;}
- public String asStringUriOnly() {return getUserName() + "@" + getDomain();}
- public String getDisplayName() {return displayName;}
- public String getDomain() {return "example.org";}
- public String getPort() {return "5060";}
- public int getPortInt() {return 5060;}
- public String getUserName() {return number;}
- public void setDisplayName(String name) {}
- public void setDomain(String domain) {}
- public void setPort(String port) {}
- public void setPortInt(int port) {}
- public void setUserName(String username) {}
- public void clean() {}
- @Override public String toString() {return displayName;}
- }
-
-
-
- private static class LinphoneCallTest implements LinphoneCall {
- private boolean inConf;
- private State state;
- private LinphoneAddress remoteAddress;
- private int duration;
-
- public LinphoneCallTest(int duration, String name, String number, State state) {
- this.duration = duration;
- this.state = state;
- remoteAddress = new LinphoneAddressTest(name, number);
- }
-
- public void enableCamera(boolean enabled) {}
- public void enableEchoCancellation(boolean enable) {}
- public void enableEchoLimiter(boolean enable) {}
- public String getAuthenticationToken() {return null;}
- public float getAverageQuality() {return 0;}
- public LinphoneCallLog getCallLog() {return null;}
- public LinphoneCallParams getCurrentParamsCopy() {return null;}
- public float getCurrentQuality() {return 0;}
- public CallDirection getDirection() {return null;}
- public int getDuration() {return duration;}
- public LinphoneAddress getRemoteAddress() {return remoteAddress;}
- public LinphoneCall getReplacedCall() {return null;}
- public State getState() {return state;}
- public boolean isAuthenticationTokenVerified() {return false;}
- public boolean isEchoCancellationEnabled() {return false;}
- public boolean isEchoLimiterEnabled() {return false;}
- public boolean isInConference() { return inConf;}
- public boolean cameraEnabled() {return false;}
-
- @Override
- public void setAuthenticationTokenVerified(boolean verified) {
- // TODO Auto-generated method stub
-
- }
- }
-
-
- @Override
- protected void registerLinphoneListener(boolean register) {
- // Do nothing (especially, don't call LinphoneManager!)
- }
-}
-
-