Multicall OK + Fix LC iterate issue
BIN
res/drawable-hdpi/conference_default.png
Normal file
After Width: | Height: | Size: 8.2 KiB |
BIN
res/drawable-hdpi/conference_over.png
Normal file
After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2 KiB |
Before Width: | Height: | Size: 3 KiB After Width: | Height: | Size: 2 KiB |
Before Width: | Height: | Size: 3 KiB After Width: | Height: | Size: 2 KiB |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 596 B After Width: | Height: | Size: 570 B |
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 5 KiB After Width: | Height: | Size: 3.3 KiB |
8
res/drawable/conference.xml
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true"
|
||||
android:drawable="@drawable/conference_over" />
|
||||
<item
|
||||
android:drawable="@drawable/conference_default" />
|
||||
</selector>
|
||||
|
|
@ -172,6 +172,16 @@
|
|||
android:contentDescription="@string/content_description_pause"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/pause_off" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/conference"
|
||||
android:visibility="gone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:contentDescription="@string/content_description_conference"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/conference" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/video"
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:gravity="bottom"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
|
@ -17,8 +18,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.2"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="fitXY"
|
||||
android:scaleType="fitEnd"
|
||||
android:src="@drawable/mark"
|
||||
android:visibility="invisible" />
|
||||
|
||||
|
@ -27,8 +27,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.2"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="fitXY"
|
||||
android:scaleType="fitEnd"
|
||||
android:src="@drawable/mark"
|
||||
android:visibility="invisible" />
|
||||
|
||||
|
@ -37,18 +36,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.24"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="fitEnd"
|
||||
android:src="@drawable/dialer"
|
||||
android:visibility="invisible" />
|
||||
|
||||
<ImageView
|
||||
android:contentDescription="@string/content_description_mark"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.2"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/mark"
|
||||
android:visibility="invisible" />
|
||||
|
||||
|
@ -57,8 +45,16 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.2"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="fitXY"
|
||||
android:scaleType="fitEnd"
|
||||
android:src="@drawable/mark"
|
||||
android:visibility="invisible" />
|
||||
|
||||
<ImageView
|
||||
android:contentDescription="@string/content_description_mark"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.2"
|
||||
android:scaleType="fitEnd"
|
||||
android:src="@drawable/mark"
|
||||
android:visibility="invisible" />
|
||||
|
||||
|
@ -75,7 +71,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="20dp">
|
||||
android:paddingTop="40dp">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/fragmentContainer"
|
||||
|
@ -98,6 +94,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:layout="@layout/status" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<LinearLayout
|
||||
|
|
|
@ -50,6 +50,6 @@
|
|||
android:layout_height="wrap_content"
|
||||
linphone:picture="@drawable/unknown_small"
|
||||
android:layout_gravity="center"
|
||||
android:paddingBottom="10sp" />
|
||||
android:paddingBottom="10dp" />
|
||||
|
||||
</LinearLayout>
|
|
@ -179,6 +179,16 @@
|
|||
android:contentDescription="@string/content_description_pause"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/pause_off" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/conference"
|
||||
android:visibility="gone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:contentDescription="@string/content_description_conference"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/conference" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/hangUp"
|
||||
|
|
|
@ -289,6 +289,7 @@
|
|||
<string name="content_description_back"></string>
|
||||
<string name="content_description_setup_ok"></string>
|
||||
<string name="content_description_message_status"></string>
|
||||
<string name="content_description_conference"></string>
|
||||
<string name="content_description_mark"></string>
|
||||
|
||||
<string name="setup_title">Account Setup Assistant</string>
|
||||
|
|
|
@ -21,6 +21,7 @@ import org.linphone.core.LinphoneAddress;
|
|||
import org.linphone.core.LinphoneCall;
|
||||
import org.linphone.core.LinphoneCall.State;
|
||||
import org.linphone.core.LinphoneCoreFactory;
|
||||
import org.linphone.core.Log;
|
||||
import org.linphone.ui.AvatarWithShadow;
|
||||
|
||||
import android.app.Activity;
|
||||
|
@ -31,6 +32,7 @@ import android.os.SystemClock;
|
|||
import android.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Chronometer;
|
||||
import android.widget.ImageView;
|
||||
|
@ -41,16 +43,20 @@ import android.widget.TextView;
|
|||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
public class AudioCallFragment extends Fragment {
|
||||
public class AudioCallFragment extends Fragment implements OnClickListener {
|
||||
private static final int rowHeight = 75; // Value set in active_call.xml
|
||||
// private static final int rowImageHeight = 100; // Value set in active_call.xml
|
||||
private static final int rowImageHeight = 75; // Value set in avatar.xml
|
||||
private static final int botMarginIfImage = 25;
|
||||
private static final int rowThickRatio = 85; // Ratio dependent from the image
|
||||
private static final int topMargin = (int) ((rowHeight * rowThickRatio) / 100);
|
||||
// private static final int topMarginWithImage = topMargin + rowImageHeight;
|
||||
private static final int topMarginWithImage = topMargin + rowImageHeight + botMarginIfImage;
|
||||
|
||||
private RelativeLayout callsList;
|
||||
private LayoutInflater inflater;
|
||||
private ViewGroup container;
|
||||
private boolean previousCallIsActive = false;
|
||||
|
||||
private InCallActivity incallActvityInstance;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
|
@ -75,6 +81,7 @@ public class AudioCallFragment extends Fragment {
|
|||
displayOrHideContactPicture(callView, pictureUri, hide);
|
||||
setRowBackgroundAndPadding(callView, resources, index);
|
||||
registerCallDurationTimer(callView, call);
|
||||
previousCallIsActive = !hide;
|
||||
}
|
||||
|
||||
private void setContactName(LinearLayout callView, LinphoneAddress lAddress, String sipUri, Resources resources) {
|
||||
|
@ -93,6 +100,9 @@ public class AudioCallFragment extends Fragment {
|
|||
private boolean displayCallStatusIconAndReturnCallPaused(LinearLayout callView, LinphoneCall call) {
|
||||
boolean isCallPaused;
|
||||
ImageView callState = (ImageView) callView.findViewById(R.id.callStatus);
|
||||
callState.setTag(call);
|
||||
callState.setOnClickListener(this);
|
||||
|
||||
if (call.getState() == State.Paused || call.getState() == State.PausedByRemote || call.getState() == State.Pausing) {
|
||||
callState.setImageResource(R.drawable.pause_default);
|
||||
isCallPaused = true;
|
||||
|
@ -103,6 +113,7 @@ public class AudioCallFragment extends Fragment {
|
|||
callState.setImageResource(R.drawable.play_default);
|
||||
isCallPaused = false;
|
||||
}
|
||||
|
||||
return isCallPaused;
|
||||
}
|
||||
|
||||
|
@ -121,7 +132,11 @@ public class AudioCallFragment extends Fragment {
|
|||
callView.findViewById(R.id.row).setBackgroundResource(R.drawable.sel_call_first);
|
||||
} else {
|
||||
callView.findViewById(R.id.row).setBackgroundResource(R.drawable.sel_call);
|
||||
callView.setPadding(0, LinphoneUtils.pixelsToDpi(resources, topMargin * index), 0, 0);
|
||||
if (previousCallIsActive) {
|
||||
callView.setPadding(0, LinphoneUtils.pixelsToDpi(resources, topMarginWithImage * index), 0, 0);
|
||||
} else {
|
||||
callView.setPadding(0, LinphoneUtils.pixelsToDpi(resources, topMargin * index), 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -140,12 +155,27 @@ public class AudioCallFragment extends Fragment {
|
|||
timer.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int id = v.getId();
|
||||
switch (id) {
|
||||
case R.id.callStatus:
|
||||
LinphoneCall call = (LinphoneCall) v.getTag();
|
||||
if (incallActvityInstance != null) {
|
||||
Log.e("InCallActivity instanciated");
|
||||
incallActvityInstance.pauseOrResumeCall(call);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
super.onAttach(activity);
|
||||
incallActvityInstance = (InCallActivity) activity;
|
||||
|
||||
if (InCallActivity.isInstanciated()) {
|
||||
InCallActivity.instance().bindAudioFragment(this);
|
||||
if (incallActvityInstance != null) {
|
||||
incallActvityInstance.bindAudioFragment(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.linphone.core.LinphoneCall;
|
|||
import org.linphone.core.LinphoneCall.State;
|
||||
import org.linphone.core.LinphoneCallParams;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.Log;
|
||||
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
|
||||
import org.linphone.ui.Numpad;
|
||||
|
||||
|
@ -63,7 +64,7 @@ public class InCallActivity extends FragmentActivity implements
|
|||
private Handler mHandler = new Handler();
|
||||
private Handler mControlsHandler = new Handler();
|
||||
private Runnable mControls;
|
||||
private ImageView video, micro, speaker, addCall, pause, hangUp, dialer, switchCamera, options, transfer;
|
||||
private ImageView video, micro, speaker, addCall, pause, hangUp, dialer, switchCamera, options, transfer, conference;
|
||||
private StatusFragment status;
|
||||
private AudioCallFragment audioCallFragment;
|
||||
private VideoCallFragment videoCallFragment;
|
||||
|
@ -153,6 +154,8 @@ public class InCallActivity extends FragmentActivity implements
|
|||
pause.setEnabled(false);
|
||||
hangUp = (ImageView) findViewById(R.id.hangUp);
|
||||
hangUp.setOnClickListener(this);
|
||||
conference = (ImageView) findViewById(R.id.conference);
|
||||
conference.setOnClickListener(this);
|
||||
dialer = (ImageView) findViewById(R.id.dialer);
|
||||
dialer.setOnClickListener(this);
|
||||
dialer.setEnabled(false);
|
||||
|
@ -177,19 +180,10 @@ public class InCallActivity extends FragmentActivity implements
|
|||
}
|
||||
}
|
||||
|
||||
private void enableAndRefreshInCallActions() {
|
||||
private void refreshInCallActions() {
|
||||
mHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
options.setEnabled(true);
|
||||
video.setEnabled(true);
|
||||
micro.setEnabled(true);
|
||||
speaker.setEnabled(true);
|
||||
addCall.setEnabled(true);
|
||||
transfer.setEnabled(true);
|
||||
pause.setEnabled(true);
|
||||
dialer.setEnabled(true);
|
||||
|
||||
if (!isVideoActivatedInSettings()) {
|
||||
video.setEnabled(false);
|
||||
} else {
|
||||
|
@ -211,6 +205,40 @@ public class InCallActivity extends FragmentActivity implements
|
|||
} else {
|
||||
micro.setImageResource(R.drawable.micro_on);
|
||||
}
|
||||
|
||||
if (LinphoneManager.getLc().getCallsNb() > 1) {
|
||||
conference.setVisibility(View.VISIBLE);
|
||||
pause.setVisibility(View.GONE);
|
||||
} else {
|
||||
conference.setVisibility(View.GONE);
|
||||
pause.setVisibility(View.VISIBLE);
|
||||
|
||||
List<LinphoneCall> pausedCalls = LinphoneUtils.getCallsInState(LinphoneManager.getLc(), Arrays.asList(State.Paused));
|
||||
if (pausedCalls.size() == 1) {
|
||||
pause.setImageResource(R.drawable.pause_on);
|
||||
} else {
|
||||
pause.setImageResource(R.drawable.pause_off);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void enableAndRefreshInCallActions() {
|
||||
mHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
options.setEnabled(true);
|
||||
video.setEnabled(true);
|
||||
micro.setEnabled(true);
|
||||
speaker.setEnabled(true);
|
||||
addCall.setEnabled(true);
|
||||
transfer.setEnabled(true);
|
||||
pause.setEnabled(true);
|
||||
dialer.setEnabled(true);
|
||||
conference.setEnabled(true);
|
||||
|
||||
refreshInCallActions();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -247,7 +275,7 @@ public class InCallActivity extends FragmentActivity implements
|
|||
goBackToDialer();
|
||||
}
|
||||
else if (id == R.id.pause) {
|
||||
pause();
|
||||
pauseOrResumeCall();
|
||||
}
|
||||
else if (id == R.id.hangUp) {
|
||||
hangUp();
|
||||
|
@ -255,6 +283,9 @@ public class InCallActivity extends FragmentActivity implements
|
|||
else if (id == R.id.dialer) {
|
||||
hideOrDisplayNumpad();
|
||||
}
|
||||
else if (id == R.id.conference) {
|
||||
enterConference();
|
||||
}
|
||||
else if (id == R.id.switchCamera) {
|
||||
if (videoCallFragment != null) {
|
||||
videoCallFragment.switchCamera();
|
||||
|
@ -351,18 +382,29 @@ public class InCallActivity extends FragmentActivity implements
|
|||
LinphoneManager.getLc().enableSpeaker(isSpeakerEnabled);
|
||||
}
|
||||
|
||||
private void pause() {
|
||||
private void pauseOrResumeCall() {
|
||||
LinphoneCore lc = LinphoneManager.getLc();
|
||||
LinphoneCall call = lc.getCurrentCall();
|
||||
pauseOrResumeCall(call);
|
||||
}
|
||||
|
||||
public void pauseOrResumeCall(LinphoneCall call) {
|
||||
Log.e("Call = " + call);
|
||||
LinphoneCore lc = LinphoneManager.getLc();
|
||||
if (call != null && LinphoneUtils.isCallRunning(call)) {
|
||||
Log.e("Pausing call " + call);
|
||||
lc.pauseCall(call);
|
||||
pause.setImageResource(R.drawable.pause_on);
|
||||
} else {
|
||||
List<LinphoneCall> pausedCalls = LinphoneUtils.getCallsInState(lc, Arrays.asList(State.Paused));
|
||||
if (pausedCalls.size() == 1) {
|
||||
LinphoneCall callToResume = pausedCalls.get(0);
|
||||
lc.resumeCall(callToResume);
|
||||
pause.setImageResource(R.drawable.pause_off);
|
||||
Log.e("CallToResume " + callToResume);
|
||||
if ((call != null && callToResume.equals(call)) || call == null) {
|
||||
Log.e("Resuming call " + callToResume);
|
||||
lc.resumeCall(callToResume);
|
||||
pause.setImageResource(R.drawable.pause_off);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -380,6 +422,10 @@ public class InCallActivity extends FragmentActivity implements
|
|||
}
|
||||
}
|
||||
|
||||
private void enterConference() {
|
||||
//TODO
|
||||
}
|
||||
|
||||
public void displayVideoCallControlsIfHidden() {
|
||||
if (mControlsLayout != null) {
|
||||
if (mControlsLayout.getVisibility() != View.VISIBLE) {
|
||||
|
@ -661,6 +707,7 @@ public class InCallActivity extends FragmentActivity implements
|
|||
});
|
||||
}
|
||||
}
|
||||
refreshInCallActions();
|
||||
|
||||
if (audioCallFragment != null) {
|
||||
mHandler.post(new Runnable() {
|
||||
|
@ -688,6 +735,7 @@ public class InCallActivity extends FragmentActivity implements
|
|||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
instance = this;
|
||||
LinphoneManager.addListener(this);
|
||||
LinphoneManager.startProximitySensorForActivity(this);
|
||||
|
||||
|
|
|
@ -795,7 +795,11 @@ public final class LinphoneManager implements LinphoneCoreListener {
|
|||
mTimer.cancel();
|
||||
mLc.destroy();
|
||||
mServiceContext.unregisterReceiver(instance.mKeepAliveReceiver);
|
||||
} finally {
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
finally {
|
||||
mLc = null;
|
||||
instance = null;
|
||||
}
|
||||
|
|