Fixed auto answer + go back to incoming/outgoing call buttons
This commit is contained in:
parent
f38bc0bfed
commit
6e8d2cf7dd
7 changed files with 44 additions and 22 deletions
|
@ -96,7 +96,7 @@ public class LinphoneManager implements SensorEventListener {
|
||||||
private final SensorManager mSensorManager;
|
private final SensorManager mSensorManager;
|
||||||
private final Sensor mProximity;
|
private final Sensor mProximity;
|
||||||
private final MediaScanner mMediaScanner;
|
private final MediaScanner mMediaScanner;
|
||||||
private Timer mTimer;
|
private Timer mTimer, mAutoAnswerTimer;
|
||||||
private final Handler mHandler = new Handler();
|
private final Handler mHandler = new Handler();
|
||||||
|
|
||||||
private final LinphonePreferences mPrefs;
|
private final LinphonePreferences mPrefs;
|
||||||
|
@ -231,8 +231,8 @@ public class LinphoneManager implements SensorEventListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
mTimer = new Timer("Auto answer");
|
mAutoAnswerTimer = new Timer("Auto answer");
|
||||||
mTimer.schedule(lTask, mPrefs.getAutoAnswerTime());
|
mAutoAnswerTimer.schedule(lTask, mPrefs.getAutoAnswerTime());
|
||||||
} else if (state == State.End || state == State.Error) {
|
} else if (state == State.End || state == State.Error) {
|
||||||
if (mCore.getCallsNb() == 0) {
|
if (mCore.getCallsNb() == 0) {
|
||||||
// Disabling proximity sensor
|
// Disabling proximity sensor
|
||||||
|
@ -424,6 +424,7 @@ public class LinphoneManager implements SensorEventListener {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mTimer.cancel();
|
mTimer.cancel();
|
||||||
|
if (mAutoAnswerTimer != null) mAutoAnswerTimer.cancel();
|
||||||
destroyCore();
|
destroyCore();
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
Log.e("[Manager] Destroy Core Runtime Exception: " + e);
|
Log.e("[Manager] Destroy Core Runtime Exception: " + e);
|
||||||
|
|
|
@ -35,7 +35,6 @@ import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import org.linphone.LinphoneManager;
|
import org.linphone.LinphoneManager;
|
||||||
import org.linphone.R;
|
import org.linphone.R;
|
||||||
import org.linphone.call.CallActivity;
|
|
||||||
import org.linphone.contacts.ContactsActivity;
|
import org.linphone.contacts.ContactsActivity;
|
||||||
import org.linphone.contacts.ContactsManager;
|
import org.linphone.contacts.ContactsManager;
|
||||||
import org.linphone.core.Call;
|
import org.linphone.core.Call;
|
||||||
|
@ -184,7 +183,7 @@ public class DialerActivity extends MainActivity implements AddressText.AddressC
|
||||||
new View.OnClickListener() {
|
new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
startActivity(new Intent(DialerActivity.this, CallActivity.class));
|
goBackToCall();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,9 @@ import java.util.ArrayList;
|
||||||
import org.linphone.LinphoneManager;
|
import org.linphone.LinphoneManager;
|
||||||
import org.linphone.LinphoneService;
|
import org.linphone.LinphoneService;
|
||||||
import org.linphone.R;
|
import org.linphone.R;
|
||||||
|
import org.linphone.call.CallActivity;
|
||||||
|
import org.linphone.call.CallIncomingActivity;
|
||||||
|
import org.linphone.call.CallOutgoingActivity;
|
||||||
import org.linphone.chat.ChatActivity;
|
import org.linphone.chat.ChatActivity;
|
||||||
import org.linphone.compatibility.Compatibility;
|
import org.linphone.compatibility.Compatibility;
|
||||||
import org.linphone.contacts.ContactsActivity;
|
import org.linphone.contacts.ContactsActivity;
|
||||||
|
@ -593,6 +596,36 @@ public abstract class MainActivity extends LinphoneGenericActivity
|
||||||
|
|
||||||
// Navigation between actvities
|
// Navigation between actvities
|
||||||
|
|
||||||
|
public void goBackToCall() {
|
||||||
|
boolean incoming = false;
|
||||||
|
boolean outgoing = false;
|
||||||
|
Call[] calls = LinphoneManager.getCore().getCalls();
|
||||||
|
|
||||||
|
for (Call call : calls) {
|
||||||
|
Call.State state = call.getState();
|
||||||
|
switch (state) {
|
||||||
|
case IncomingEarlyMedia:
|
||||||
|
case IncomingReceived:
|
||||||
|
incoming = true;
|
||||||
|
break;
|
||||||
|
case OutgoingEarlyMedia:
|
||||||
|
case OutgoingInit:
|
||||||
|
case OutgoingProgress:
|
||||||
|
case OutgoingRinging:
|
||||||
|
outgoing = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (incoming) {
|
||||||
|
startActivity(new Intent(this, CallIncomingActivity.class));
|
||||||
|
} else if (outgoing) {
|
||||||
|
startActivity(new Intent(this, CallOutgoingActivity.class));
|
||||||
|
} else {
|
||||||
|
startActivity(new Intent(this, CallActivity.class));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void addFlagsToIntent(Intent intent) {
|
private void addFlagsToIntent(Intent intent) {
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION | Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION | Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,16 +33,14 @@ import org.linphone.utils.LinphoneUtils;
|
||||||
public class VideoZoomHelper extends GestureDetector.SimpleOnGestureListener
|
public class VideoZoomHelper extends GestureDetector.SimpleOnGestureListener
|
||||||
implements CompatibilityScaleGestureListener {
|
implements CompatibilityScaleGestureListener {
|
||||||
private View mVideoView;
|
private View mVideoView;
|
||||||
private Context mContext;
|
|
||||||
private GestureDetector mGestureDetector;
|
private GestureDetector mGestureDetector;
|
||||||
private float mZoomFactor = 1.f;
|
private float mZoomFactor = 1.f;
|
||||||
private float mZoomCenterX, mZoomCenterY;
|
private float mZoomCenterX, mZoomCenterY;
|
||||||
private CompatibilityScaleGestureDetector mScaleDetector;
|
private CompatibilityScaleGestureDetector mScaleDetector;
|
||||||
|
|
||||||
public VideoZoomHelper(Context context, View videoView) {
|
public VideoZoomHelper(Context context, View videoView) {
|
||||||
mContext = context;
|
mGestureDetector = new GestureDetector(context, this);
|
||||||
mGestureDetector = new GestureDetector(mContext, this);
|
mScaleDetector = new CompatibilityScaleGestureDetector(context);
|
||||||
mScaleDetector = new CompatibilityScaleGestureDetector(mContext);
|
|
||||||
mScaleDetector.setOnScaleListener(this);
|
mScaleDetector.setOnScaleListener(this);
|
||||||
|
|
||||||
mVideoView = videoView;
|
mVideoView = videoView;
|
||||||
|
@ -146,8 +144,6 @@ public class VideoZoomHelper extends GestureDetector.SimpleOnGestureListener
|
||||||
}
|
}
|
||||||
|
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
mContext = null;
|
|
||||||
|
|
||||||
if (mVideoView != null) {
|
if (mVideoView != null) {
|
||||||
mVideoView.setOnTouchListener(null);
|
mVideoView.setOnTouchListener(null);
|
||||||
mVideoView = null;
|
mVideoView = null;
|
||||||
|
|
|
@ -64,7 +64,7 @@ import java.util.List;
|
||||||
import org.linphone.LinphoneManager;
|
import org.linphone.LinphoneManager;
|
||||||
import org.linphone.LinphoneService;
|
import org.linphone.LinphoneService;
|
||||||
import org.linphone.R;
|
import org.linphone.R;
|
||||||
import org.linphone.call.CallActivity;
|
import org.linphone.activities.MainActivity;
|
||||||
import org.linphone.contacts.ContactAddress;
|
import org.linphone.contacts.ContactAddress;
|
||||||
import org.linphone.contacts.ContactsManager;
|
import org.linphone.contacts.ContactsManager;
|
||||||
import org.linphone.contacts.ContactsUpdatedListener;
|
import org.linphone.contacts.ContactsUpdatedListener;
|
||||||
|
@ -209,7 +209,7 @@ public class ChatMessagesFragment extends Fragment
|
||||||
new View.OnClickListener() {
|
new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
startActivity(new Intent(getActivity(), CallActivity.class));
|
((MainActivity) getActivity()).goBackToCall();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -35,7 +34,7 @@ import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.linphone.LinphoneManager;
|
import org.linphone.LinphoneManager;
|
||||||
import org.linphone.R;
|
import org.linphone.R;
|
||||||
import org.linphone.call.CallActivity;
|
import org.linphone.activities.MainActivity;
|
||||||
import org.linphone.contacts.ContactsManager;
|
import org.linphone.contacts.ContactsManager;
|
||||||
import org.linphone.contacts.ContactsUpdatedListener;
|
import org.linphone.contacts.ContactsUpdatedListener;
|
||||||
import org.linphone.core.ChatMessage;
|
import org.linphone.core.ChatMessage;
|
||||||
|
@ -126,7 +125,7 @@ public class ChatRoomsFragment extends Fragment
|
||||||
new View.OnClickListener() {
|
new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
startActivity(new Intent(getActivity(), CallActivity.class));
|
((MainActivity) getActivity()).goBackToCall();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -72,12 +72,6 @@
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<TextureView
|
|
||||||
android:id="@+id/videoSurface"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:visibility="gone" />
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/menu"
|
android:id="@+id/menu"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
Loading…
Reference in a new issue