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 Sensor mProximity;
|
||||
private final MediaScanner mMediaScanner;
|
||||
private Timer mTimer;
|
||||
private Timer mTimer, mAutoAnswerTimer;
|
||||
private final Handler mHandler = new Handler();
|
||||
|
||||
private final LinphonePreferences mPrefs;
|
||||
|
@ -231,8 +231,8 @@ public class LinphoneManager implements SensorEventListener {
|
|||
}
|
||||
}
|
||||
};
|
||||
mTimer = new Timer("Auto answer");
|
||||
mTimer.schedule(lTask, mPrefs.getAutoAnswerTime());
|
||||
mAutoAnswerTimer = new Timer("Auto answer");
|
||||
mAutoAnswerTimer.schedule(lTask, mPrefs.getAutoAnswerTime());
|
||||
} else if (state == State.End || state == State.Error) {
|
||||
if (mCore.getCallsNb() == 0) {
|
||||
// Disabling proximity sensor
|
||||
|
@ -424,6 +424,7 @@ public class LinphoneManager implements SensorEventListener {
|
|||
|
||||
try {
|
||||
mTimer.cancel();
|
||||
if (mAutoAnswerTimer != null) mAutoAnswerTimer.cancel();
|
||||
destroyCore();
|
||||
} catch (RuntimeException e) {
|
||||
Log.e("[Manager] Destroy Core Runtime Exception: " + e);
|
||||
|
|
|
@ -35,7 +35,6 @@ import java.util.ArrayList;
|
|||
import java.util.Collection;
|
||||
import org.linphone.LinphoneManager;
|
||||
import org.linphone.R;
|
||||
import org.linphone.call.CallActivity;
|
||||
import org.linphone.contacts.ContactsActivity;
|
||||
import org.linphone.contacts.ContactsManager;
|
||||
import org.linphone.core.Call;
|
||||
|
@ -184,7 +183,7 @@ public class DialerActivity extends MainActivity implements AddressText.AddressC
|
|||
new View.OnClickListener() {
|
||||
@Override
|
||||
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.LinphoneService;
|
||||
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.compatibility.Compatibility;
|
||||
import org.linphone.contacts.ContactsActivity;
|
||||
|
@ -593,6 +596,36 @@ public abstract class MainActivity extends LinphoneGenericActivity
|
|||
|
||||
// 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) {
|
||||
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
|
||||
implements CompatibilityScaleGestureListener {
|
||||
private View mVideoView;
|
||||
private Context mContext;
|
||||
private GestureDetector mGestureDetector;
|
||||
private float mZoomFactor = 1.f;
|
||||
private float mZoomCenterX, mZoomCenterY;
|
||||
private CompatibilityScaleGestureDetector mScaleDetector;
|
||||
|
||||
public VideoZoomHelper(Context context, View videoView) {
|
||||
mContext = context;
|
||||
mGestureDetector = new GestureDetector(mContext, this);
|
||||
mScaleDetector = new CompatibilityScaleGestureDetector(mContext);
|
||||
mGestureDetector = new GestureDetector(context, this);
|
||||
mScaleDetector = new CompatibilityScaleGestureDetector(context);
|
||||
mScaleDetector.setOnScaleListener(this);
|
||||
|
||||
mVideoView = videoView;
|
||||
|
@ -146,8 +144,6 @@ public class VideoZoomHelper extends GestureDetector.SimpleOnGestureListener
|
|||
}
|
||||
|
||||
public void destroy() {
|
||||
mContext = null;
|
||||
|
||||
if (mVideoView != null) {
|
||||
mVideoView.setOnTouchListener(null);
|
||||
mVideoView = null;
|
||||
|
|
|
@ -64,7 +64,7 @@ import java.util.List;
|
|||
import org.linphone.LinphoneManager;
|
||||
import org.linphone.LinphoneService;
|
||||
import org.linphone.R;
|
||||
import org.linphone.call.CallActivity;
|
||||
import org.linphone.activities.MainActivity;
|
||||
import org.linphone.contacts.ContactAddress;
|
||||
import org.linphone.contacts.ContactsManager;
|
||||
import org.linphone.contacts.ContactsUpdatedListener;
|
||||
|
@ -209,7 +209,7 @@ public class ChatMessagesFragment extends Fragment
|
|||
new View.OnClickListener() {
|
||||
@Override
|
||||
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.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -35,7 +34,7 @@ import java.util.Arrays;
|
|||
import java.util.List;
|
||||
import org.linphone.LinphoneManager;
|
||||
import org.linphone.R;
|
||||
import org.linphone.call.CallActivity;
|
||||
import org.linphone.activities.MainActivity;
|
||||
import org.linphone.contacts.ContactsManager;
|
||||
import org.linphone.contacts.ContactsUpdatedListener;
|
||||
import org.linphone.core.ChatMessage;
|
||||
|
@ -126,7 +125,7 @@ public class ChatRoomsFragment extends Fragment
|
|||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startActivity(new Intent(getActivity(), CallActivity.class));
|
||||
((MainActivity) getActivity()).goBackToCall();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -72,12 +72,6 @@
|
|||
|
||||
</RelativeLayout>
|
||||
|
||||
<TextureView
|
||||
android:id="@+id/videoSurface"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/menu"
|
||||
android:layout_width="match_parent"
|
||||
|
|
Loading…
Reference in a new issue