diff --git a/res/values/non_localizable_custom.xml b/res/values/non_localizable_custom.xml index 6b6bd7947..626e4ebe2 100644 --- a/res/values/non_localizable_custom.xml +++ b/res/values/non_localizable_custom.xml @@ -6,7 +6,7 @@ true - false + false true true false @@ -17,9 +17,11 @@ true true + true + true #191970 linphone-android@belledonne-communications.com - \ No newline at end of file + diff --git a/src/org/linphone/ConferenceActivity.java b/src/org/linphone/ConferenceActivity.java index 8cc015a29..938703180 100644 --- a/src/org/linphone/ConferenceActivity.java +++ b/src/org/linphone/ConferenceActivity.java @@ -116,12 +116,15 @@ public class ConferenceActivity extends ListActivity implements private ToggleButton mMuteMicButton; private ToggleButton mSpeakerButton; private boolean useVideoActivity; - + private int multipleCallsLimit; + private boolean allowTransfers; @Override protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.conferencing); + allowTransfers = getResources().getBoolean(R.bool.allow_transfers); + confHeaderView = findViewById(R.id.conf_header); confHeaderView.setOnClickListener(this); @@ -129,7 +132,11 @@ public class ConferenceActivity extends ListActivity implements findViewById(R.id.incallNumpadShow).setOnClickListener(this); findViewById(R.id.conf_simple_merge).setOnClickListener(this); - findViewById(R.id.conf_simple_transfer).setOnClickListener(this); + View transferView = findViewById(R.id.conf_simple_transfer); + transferView.setOnClickListener(this); + if (!allowTransfers) { + transferView.setVisibility(View.GONE); + } findViewById(R.id.conf_simple_permute).setOnClickListener(this); mMuteMicButton = (ToggleButton) findViewById(R.id.toggleMuteMic); @@ -140,6 +147,7 @@ public class ConferenceActivity extends ListActivity implements waitHelper = new LinphoneManagerWaitHelper(this, this); waitHelper.doManagerDependentOnCreate(); useVideoActivity = getResources().getBoolean(R.bool.use_video_activity); + // workaroundStatusBarBug(); super.onCreate(savedInstanceState); } @@ -150,6 +158,7 @@ public class ConferenceActivity extends ListActivity implements setListAdapter(new CalleeListAdapter(calls)); findViewById(R.id.incallHang).setOnClickListener(this); + multipleCallsLimit = lc().getMaxCalls(); } @Override public void onResumeWhenManagerReady() { @@ -162,11 +171,19 @@ public class ConferenceActivity extends ListActivity implements adapter.linphoneCalls.clear(); adapter.linphoneCalls.addAll(getInitialCalls()); } - adapter.notifyDataSetInvalidated(); - adapter.notifyDataSetChanged(); + recreateActivity(adapter); LinphoneManager.startProximitySensorForActivity(this); mSpeakerButton.setChecked(LinphoneManager.getInstance().isSpeakerOn()); mMuteMicButton.setChecked(LinphoneManager.getLc().isMicMuted()); + + if (multipleCallsLimit > 0) { + updateAddCallButton(); + } + } + + private void updateAddCallButton() { + boolean limitReached = lc().getCallsNb() >= multipleCallsLimit; + findViewById(R.id.addCall).setVisibility(limitReached ? GONE : VISIBLE); } @Override @@ -464,8 +481,9 @@ public class ConferenceActivity extends ListActivity implements } private boolean aConferenceIsPossible() { - if (lc().getCallsNb() < 2) + if (lc().getCallsNb() < 2) { return false; + } int count = 0; for (LinphoneCall call : linphoneCalls) { final LinphoneCall.State state = call.getState(); @@ -595,14 +613,14 @@ public class ConferenceActivity extends ListActivity implements unhookCallButton.setOnClickListener(l); removeFromConfButton.setOnClickListener(l); addVideoButton.setOnClickListener(l); - + v.setOnClickListener(new OnClickListener() { public void onClick(View v) { View content = getLayoutInflater().inflate(R.layout.conf_choices_dialog, null); Dialog dialog = new AlertDialog.Builder(ConferenceActivity.this).setView(content).create(); OnClickListener l = new CallActionListener(call, dialog); - enableView(content, R.id.transfer_existing, l, !isInConference && numberOfCalls >=2); - enableView(content, R.id.transfer_new, l, !isInConference); + 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.merge_to_conference, l, showMergeToConf); enableView(content, R.id.pause, l,!isInConference && showPause); @@ -665,23 +683,19 @@ public class ConferenceActivity extends ListActivity implements if (state == State.IncomingReceived || state == State.OutgoingRinging) { if (!adapter.linphoneCalls.contains(call)) { adapter.linphoneCalls.add(call); - Collections.sort(adapter.linphoneCalls, - ConferenceActivity.this); - adapter.notifyDataSetInvalidated(); - adapter.notifyDataSetChanged(); + Collections.sort(adapter.linphoneCalls, ConferenceActivity.this); + recreateActivity(adapter); } else { - Log.e("Call should not be in the call lists : " + stateStr); + 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, - ConferenceActivity.this); + Collections.sort(adapter.linphoneCalls, ConferenceActivity.this); adapter.notifyDataSetChanged(); } else if (state == State.CallEnd) { adapter.linphoneCalls.remove(call); - Collections.sort(adapter.linphoneCalls, - ConferenceActivity.this); - adapter.notifyDataSetInvalidated(); - adapter.notifyDataSetChanged(); + Collections.sort(adapter.linphoneCalls, ConferenceActivity.this); + updateAddCallButton(); + recreateActivity(adapter); } updateConfState(); @@ -689,6 +703,11 @@ public class ConferenceActivity extends ListActivity implements }); } + private void recreateActivity(CalleeListAdapter adapter) { + adapter.notifyDataSetInvalidated(); + adapter.notifyDataSetChanged(); + } + public int compare(LinphoneCall c1, LinphoneCall c2) { if (c1 == c2) return 0; diff --git a/src/org/linphone/LinphoneService.java b/src/org/linphone/LinphoneService.java index ad98417aa..f34718c9d 100644 --- a/src/org/linphone/LinphoneService.java +++ b/src/org/linphone/LinphoneService.java @@ -123,7 +123,7 @@ public final class LinphoneService extends Service implements LinphoneServiceLis Intent notifIntent = new Intent(this, LinphoneActivity.class); mNotifContentIntent = PendingIntent.getActivity(this, 0, notifIntent, 0); mNotif.setLatestEventInfo(this, notificationTitle,"", mNotifContentIntent); - + LinphoneManager.createAndStart(this, this); LinphoneManager.getLc().setPresenceInfo(0, null, OnlineStatus.Online); instance = this; // instance is ready once linphone manager has been created diff --git a/src/org/linphone/core/LinphoneCoreImpl.java b/src/org/linphone/core/LinphoneCoreImpl.java index 139e1a30f..b2a26a976 100644 --- a/src/org/linphone/core/LinphoneCoreImpl.java +++ b/src/org/linphone/core/LinphoneCoreImpl.java @@ -583,4 +583,9 @@ class LinphoneCoreImpl implements LinphoneCore { public void setMediaEncryptionMandatory(boolean yesno) { setMediaEncryptionMandatory(nativePtr, yesno); } + + private native int getMaxCalls(long nativePtr); + public int getMaxCalls() { + return getMaxCalls(nativePtr); + } } diff --git a/submodules/linphone b/submodules/linphone index 67daaaa14..324551708 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 67daaaa14d1d6ec4322f54c43a372fa51ee312de +Subproject commit 324551708e89dde781dc93a1eeae05532c8717f8 diff --git a/test/org/linphone/TestConferenceActivity.java b/test/org/linphone/TestConferenceActivity.java index a7cb40db0..31fd3a971 100644 --- a/test/org/linphone/TestConferenceActivity.java +++ b/test/org/linphone/TestConferenceActivity.java @@ -320,6 +320,10 @@ public class TestConferenceActivity extends ConferenceActivity { } return null; } + @Override + public int getMaxCalls() { + return 10; + } }