Ability to limit number of calls / hide transfers.
This commit is contained in:
parent
95e8740e38
commit
c4838ad1fa
6 changed files with 53 additions and 23 deletions
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
<bool name="use_android_contact_picker">true</bool>
|
<bool name="use_android_contact_picker">true</bool>
|
||||||
|
|
||||||
<bool name="useFirstLoginActivity">false</bool>
|
<bool name="useFirstLoginActivity">false</bool>
|
||||||
<bool name="useMenuSettings">true</bool>
|
<bool name="useMenuSettings">true</bool>
|
||||||
<bool name="useMenuAbout">true</bool>
|
<bool name="useMenuAbout">true</bool>
|
||||||
<bool name="use_incall_activity">false</bool>
|
<bool name="use_incall_activity">false</bool>
|
||||||
|
@ -17,6 +17,8 @@
|
||||||
<bool name="use_incoming_call_activity">true</bool>
|
<bool name="use_incoming_call_activity">true</bool>
|
||||||
<bool name="show_full_remote_address_on_incoming_call">true</bool>
|
<bool name="show_full_remote_address_on_incoming_call">true</bool>
|
||||||
|
|
||||||
|
<bool name="allow_transfers">true</bool>
|
||||||
|
|
||||||
<bool name="allow_edit_in_dialer">true</bool>
|
<bool name="allow_edit_in_dialer">true</bool>
|
||||||
<color name="conf_active_bg_color">#191970</color>
|
<color name="conf_active_bg_color">#191970</color>
|
||||||
|
|
||||||
|
|
|
@ -116,12 +116,15 @@ public class ConferenceActivity extends ListActivity implements
|
||||||
private ToggleButton mMuteMicButton;
|
private ToggleButton mMuteMicButton;
|
||||||
private ToggleButton mSpeakerButton;
|
private ToggleButton mSpeakerButton;
|
||||||
private boolean useVideoActivity;
|
private boolean useVideoActivity;
|
||||||
|
private int multipleCallsLimit;
|
||||||
|
private boolean allowTransfers;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
setContentView(R.layout.conferencing);
|
setContentView(R.layout.conferencing);
|
||||||
|
|
||||||
|
allowTransfers = getResources().getBoolean(R.bool.allow_transfers);
|
||||||
|
|
||||||
confHeaderView = findViewById(R.id.conf_header);
|
confHeaderView = findViewById(R.id.conf_header);
|
||||||
confHeaderView.setOnClickListener(this);
|
confHeaderView.setOnClickListener(this);
|
||||||
|
|
||||||
|
@ -129,7 +132,11 @@ public class ConferenceActivity extends ListActivity implements
|
||||||
|
|
||||||
findViewById(R.id.incallNumpadShow).setOnClickListener(this);
|
findViewById(R.id.incallNumpadShow).setOnClickListener(this);
|
||||||
findViewById(R.id.conf_simple_merge).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);
|
findViewById(R.id.conf_simple_permute).setOnClickListener(this);
|
||||||
|
|
||||||
mMuteMicButton = (ToggleButton) findViewById(R.id.toggleMuteMic);
|
mMuteMicButton = (ToggleButton) findViewById(R.id.toggleMuteMic);
|
||||||
|
@ -140,6 +147,7 @@ public class ConferenceActivity extends ListActivity implements
|
||||||
waitHelper = new LinphoneManagerWaitHelper(this, this);
|
waitHelper = new LinphoneManagerWaitHelper(this, this);
|
||||||
waitHelper.doManagerDependentOnCreate();
|
waitHelper.doManagerDependentOnCreate();
|
||||||
useVideoActivity = getResources().getBoolean(R.bool.use_video_activity);
|
useVideoActivity = getResources().getBoolean(R.bool.use_video_activity);
|
||||||
|
|
||||||
// workaroundStatusBarBug();
|
// workaroundStatusBarBug();
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
}
|
}
|
||||||
|
@ -150,6 +158,7 @@ public class ConferenceActivity extends ListActivity implements
|
||||||
setListAdapter(new CalleeListAdapter(calls));
|
setListAdapter(new CalleeListAdapter(calls));
|
||||||
|
|
||||||
findViewById(R.id.incallHang).setOnClickListener(this);
|
findViewById(R.id.incallHang).setOnClickListener(this);
|
||||||
|
multipleCallsLimit = lc().getMaxCalls();
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void onResumeWhenManagerReady() {
|
public void onResumeWhenManagerReady() {
|
||||||
|
@ -162,11 +171,19 @@ public class ConferenceActivity extends ListActivity implements
|
||||||
adapter.linphoneCalls.clear();
|
adapter.linphoneCalls.clear();
|
||||||
adapter.linphoneCalls.addAll(getInitialCalls());
|
adapter.linphoneCalls.addAll(getInitialCalls());
|
||||||
}
|
}
|
||||||
adapter.notifyDataSetInvalidated();
|
recreateActivity(adapter);
|
||||||
adapter.notifyDataSetChanged();
|
|
||||||
LinphoneManager.startProximitySensorForActivity(this);
|
LinphoneManager.startProximitySensorForActivity(this);
|
||||||
mSpeakerButton.setChecked(LinphoneManager.getInstance().isSpeakerOn());
|
mSpeakerButton.setChecked(LinphoneManager.getInstance().isSpeakerOn());
|
||||||
mMuteMicButton.setChecked(LinphoneManager.getLc().isMicMuted());
|
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
|
@Override
|
||||||
|
@ -464,8 +481,9 @@ public class ConferenceActivity extends ListActivity implements
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean aConferenceIsPossible() {
|
private boolean aConferenceIsPossible() {
|
||||||
if (lc().getCallsNb() < 2)
|
if (lc().getCallsNb() < 2) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (LinphoneCall call : linphoneCalls) {
|
for (LinphoneCall call : linphoneCalls) {
|
||||||
final LinphoneCall.State state = call.getState();
|
final LinphoneCall.State state = call.getState();
|
||||||
|
@ -601,8 +619,8 @@ public class ConferenceActivity extends ListActivity implements
|
||||||
View content = getLayoutInflater().inflate(R.layout.conf_choices_dialog, null);
|
View content = getLayoutInflater().inflate(R.layout.conf_choices_dialog, null);
|
||||||
Dialog dialog = new AlertDialog.Builder(ConferenceActivity.this).setView(content).create();
|
Dialog dialog = new AlertDialog.Builder(ConferenceActivity.this).setView(content).create();
|
||||||
OnClickListener l = new CallActionListener(call, dialog);
|
OnClickListener l = new CallActionListener(call, dialog);
|
||||||
enableView(content, R.id.transfer_existing, l, !isInConference && numberOfCalls >=2);
|
enableView(content, R.id.transfer_existing, l, allowTransfers && !isInConference && numberOfCalls >=2);
|
||||||
enableView(content, R.id.transfer_new, l, !isInConference);
|
enableView(content, R.id.transfer_new, l, allowTransfers && !isInConference);
|
||||||
enableView(content, R.id.remove_from_conference, l, isInConference);
|
enableView(content, R.id.remove_from_conference, l, isInConference);
|
||||||
enableView(content, R.id.merge_to_conference, l, showMergeToConf);
|
enableView(content, R.id.merge_to_conference, l, showMergeToConf);
|
||||||
enableView(content, R.id.pause, l,!isInConference && showPause);
|
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 (state == State.IncomingReceived || state == State.OutgoingRinging) {
|
||||||
if (!adapter.linphoneCalls.contains(call)) {
|
if (!adapter.linphoneCalls.contains(call)) {
|
||||||
adapter.linphoneCalls.add(call);
|
adapter.linphoneCalls.add(call);
|
||||||
Collections.sort(adapter.linphoneCalls,
|
Collections.sort(adapter.linphoneCalls, ConferenceActivity.this);
|
||||||
ConferenceActivity.this);
|
recreateActivity(adapter);
|
||||||
adapter.notifyDataSetInvalidated();
|
|
||||||
adapter.notifyDataSetChanged();
|
|
||||||
} else {
|
} 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) {
|
} else if (state == State.Paused || state == State.PausedByRemote || state == State.StreamsRunning) {
|
||||||
Collections.sort(adapter.linphoneCalls,
|
Collections.sort(adapter.linphoneCalls, ConferenceActivity.this);
|
||||||
ConferenceActivity.this);
|
|
||||||
adapter.notifyDataSetChanged();
|
adapter.notifyDataSetChanged();
|
||||||
} else if (state == State.CallEnd) {
|
} else if (state == State.CallEnd) {
|
||||||
adapter.linphoneCalls.remove(call);
|
adapter.linphoneCalls.remove(call);
|
||||||
Collections.sort(adapter.linphoneCalls,
|
Collections.sort(adapter.linphoneCalls, ConferenceActivity.this);
|
||||||
ConferenceActivity.this);
|
updateAddCallButton();
|
||||||
adapter.notifyDataSetInvalidated();
|
recreateActivity(adapter);
|
||||||
adapter.notifyDataSetChanged();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
updateConfState();
|
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) {
|
public int compare(LinphoneCall c1, LinphoneCall c2) {
|
||||||
if (c1 == c2)
|
if (c1 == c2)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -583,4 +583,9 @@ class LinphoneCoreImpl implements LinphoneCore {
|
||||||
public void setMediaEncryptionMandatory(boolean yesno) {
|
public void setMediaEncryptionMandatory(boolean yesno) {
|
||||||
setMediaEncryptionMandatory(nativePtr, yesno);
|
setMediaEncryptionMandatory(nativePtr, yesno);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native int getMaxCalls(long nativePtr);
|
||||||
|
public int getMaxCalls() {
|
||||||
|
return getMaxCalls(nativePtr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 67daaaa14d1d6ec4322f54c43a372fa51ee312de
|
Subproject commit 324551708e89dde781dc93a1eeae05532c8717f8
|
|
@ -320,6 +320,10 @@ public class TestConferenceActivity extends ConferenceActivity {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public int getMaxCalls() {
|
||||||
|
return 10;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue