Fix Save dialog on call view after a rotation
This commit is contained in:
parent
40ee88eba5
commit
bdb578121f
4 changed files with 51 additions and 31 deletions
|
@ -17,6 +17,7 @@ Group changes to describe their impact on the project, as follows:
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Rotation after screen locking
|
- Rotation after screen locking
|
||||||
|
- Contacts background task
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
|
|
@ -113,6 +113,8 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
||||||
private int cameraNumber;
|
private int cameraNumber;
|
||||||
private CountDownTimer timer;
|
private CountDownTimer timer;
|
||||||
private boolean isVideoCallPaused = false;
|
private boolean isVideoCallPaused = false;
|
||||||
|
private Dialog dialog = null;
|
||||||
|
private static long TimeRemind = 0;
|
||||||
|
|
||||||
private static PowerManager powerManager;
|
private static PowerManager powerManager;
|
||||||
private static PowerManager.WakeLock wakeLock;
|
private static PowerManager.WakeLock wakeLock;
|
||||||
|
@ -225,24 +227,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
||||||
boolean autoAcceptCameraPolicy = LinphonePreferences.instance().shouldAutomaticallyAcceptVideoRequests();
|
boolean autoAcceptCameraPolicy = LinphonePreferences.instance().shouldAutomaticallyAcceptVideoRequests();
|
||||||
if (remoteVideo && !localVideo && !autoAcceptCameraPolicy && !LinphoneManager.getLc().isInConference()) {
|
if (remoteVideo && !localVideo && !autoAcceptCameraPolicy && !LinphoneManager.getLc().isInConference()) {
|
||||||
showAcceptCallUpdateDialog();
|
showAcceptCallUpdateDialog();
|
||||||
timer = new CountDownTimer(SECONDS_BEFORE_DENYING_CALL_UPDATE, 1000) {
|
createTimerForDialog(SECONDS_BEFORE_DENYING_CALL_UPDATE);
|
||||||
public void onTick(long millisUntilFinished) { }
|
|
||||||
public void onFinish() {
|
|
||||||
//TODO dismiss dialog
|
|
||||||
acceptCallUpdate(false);
|
|
||||||
}
|
|
||||||
}.start();
|
|
||||||
|
|
||||||
/*showAcceptCallUpdateDialog();
|
|
||||||
|
|
||||||
timer = new CountDownTimer(SECONDS_BEFORE_DENYING_CALL_UPDATE, 1000) {
|
|
||||||
public void onTick(long millisUntilFinished) { }
|
|
||||||
public void onFinish() {
|
|
||||||
//TODO dismiss dialog
|
|
||||||
|
|
||||||
}
|
|
||||||
}.start();*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
// else if (remoteVideo && !LinphoneManager.getLc().isInConference() && autoAcceptCameraPolicy) {
|
// else if (remoteVideo && !LinphoneManager.getLc().isInConference() && autoAcceptCameraPolicy) {
|
||||||
// mHandler.post(new Runnable() {
|
// mHandler.post(new Runnable() {
|
||||||
|
@ -286,6 +271,11 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
||||||
isSpeakerEnabled = savedInstanceState.getBoolean("Speaker");
|
isSpeakerEnabled = savedInstanceState.getBoolean("Speaker");
|
||||||
isMicMuted = savedInstanceState.getBoolean("Mic");
|
isMicMuted = savedInstanceState.getBoolean("Mic");
|
||||||
isVideoCallPaused = savedInstanceState.getBoolean("VideoCallPaused");
|
isVideoCallPaused = savedInstanceState.getBoolean("VideoCallPaused");
|
||||||
|
if (savedInstanceState.getBoolean("AskingVideo")) {
|
||||||
|
showAcceptCallUpdateDialog();
|
||||||
|
TimeRemind = savedInstanceState.getLong("TimeRemind");
|
||||||
|
createTimerForDialog(TimeRemind);
|
||||||
|
}
|
||||||
refreshInCallActions();
|
refreshInCallActions();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
|
@ -314,6 +304,21 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void createTimerForDialog(long time) {
|
||||||
|
timer = new CountDownTimer(time , 1000) {
|
||||||
|
public void onTick(long millisUntilFinished) {
|
||||||
|
TimeRemind = millisUntilFinished;
|
||||||
|
}
|
||||||
|
public void onFinish() {
|
||||||
|
if (dialog != null) {
|
||||||
|
dialog.dismiss();
|
||||||
|
dialog = null;
|
||||||
|
}
|
||||||
|
acceptCallUpdate(false);
|
||||||
|
}
|
||||||
|
}.start();
|
||||||
|
}
|
||||||
|
|
||||||
private boolean isVideoEnabled(LinphoneCall call) {
|
private boolean isVideoEnabled(LinphoneCall call) {
|
||||||
if(call != null){
|
if(call != null){
|
||||||
return call.getCurrentParamsCopy().getVideoEnabled();
|
return call.getCurrentParamsCopy().getVideoEnabled();
|
||||||
|
@ -326,7 +331,9 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
||||||
outState.putBoolean("Speaker", LinphoneManager.getLc().isSpeakerEnabled());
|
outState.putBoolean("Speaker", LinphoneManager.getLc().isSpeakerEnabled());
|
||||||
outState.putBoolean("Mic", LinphoneManager.getLc().isMicMuted());
|
outState.putBoolean("Mic", LinphoneManager.getLc().isMicMuted());
|
||||||
outState.putBoolean("VideoCallPaused", isVideoCallPaused);
|
outState.putBoolean("VideoCallPaused", isVideoCallPaused);
|
||||||
|
outState.putBoolean("AskingVideo", (dialog != null));
|
||||||
|
outState.putLong("TimeRemind", TimeRemind);
|
||||||
|
if (dialog != null) dialog.dismiss();
|
||||||
super.onSaveInstanceState(outState);
|
super.onSaveInstanceState(outState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1138,7 +1145,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
||||||
|
|
||||||
|
|
||||||
private void showAcceptCallUpdateDialog() {
|
private void showAcceptCallUpdateDialog() {
|
||||||
final Dialog dialog = new Dialog(this);
|
dialog = new Dialog(this);
|
||||||
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
Drawable d = new ColorDrawable(ContextCompat.getColor(this, R.color.colorC));
|
Drawable d = new ColorDrawable(ContextCompat.getColor(this, R.color.colorC));
|
||||||
d.setAlpha(200);
|
d.setAlpha(200);
|
||||||
|
@ -1166,6 +1173,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
|
dialog = null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1176,6 +1184,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
||||||
CallActivity.instance().acceptCallUpdate(false);
|
CallActivity.instance().acceptCallUpdate(false);
|
||||||
}
|
}
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
|
dialog = null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
dialog.show();
|
dialog.show();
|
||||||
|
@ -1290,6 +1299,16 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
||||||
return super.onKeyDown(keyCode, event);
|
return super.onKeyDown(keyCode, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override // Never invoke actually
|
||||||
|
public void onBackPressed() {
|
||||||
|
if (dialog != null) {
|
||||||
|
acceptCallUpdate(false);
|
||||||
|
dialog.dismiss();
|
||||||
|
dialog = null;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
public void bindAudioFragment(CallAudioFragment fragment) {
|
public void bindAudioFragment(CallAudioFragment fragment) {
|
||||||
audioCallFragment = fragment;
|
audioCallFragment = fragment;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,19 +30,19 @@ import android.view.ViewGroup;
|
||||||
*/
|
*/
|
||||||
public class CallAudioFragment extends Fragment {
|
public class CallAudioFragment extends Fragment {
|
||||||
private CallActivity incallActvityInstance;
|
private CallActivity incallActvityInstance;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
View view = inflater.inflate(R.layout.audio, container, false);
|
View view = inflater.inflate(R.layout.audio, container, false);
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStart() {
|
public void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
incallActvityInstance = (CallActivity) getActivity();
|
incallActvityInstance = (CallActivity) getActivity();
|
||||||
|
|
||||||
if (incallActvityInstance != null) {
|
if (incallActvityInstance != null) {
|
||||||
incallActvityInstance.bindAudioFragment(this);
|
incallActvityInstance.bindAudioFragment(this);
|
||||||
}
|
}
|
||||||
|
@ -52,19 +52,19 @@ public class CallAudioFragment extends Fragment {
|
||||||
incallActvityInstance.removeCallbacks();
|
incallActvityInstance.removeCallbacks();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class SwipeGestureDetector implements OnTouchListener {
|
class SwipeGestureDetector implements OnTouchListener {
|
||||||
static final int MIN_DISTANCE = 100;
|
static final int MIN_DISTANCE = 100;
|
||||||
private float downX, upX;
|
private float downX, upX;
|
||||||
private boolean lock;
|
private boolean lock;
|
||||||
|
|
||||||
private SwipeListener listener;
|
private SwipeListener listener;
|
||||||
|
|
||||||
public SwipeGestureDetector(SwipeListener swipeListener) {
|
public SwipeGestureDetector(SwipeListener swipeListener) {
|
||||||
super();
|
super();
|
||||||
listener = swipeListener;
|
listener = swipeListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouch(View v, MotionEvent event) {
|
public boolean onTouch(View v, MotionEvent event) {
|
||||||
switch(event.getAction()){
|
switch(event.getAction()){
|
||||||
|
@ -72,7 +72,7 @@ public class CallAudioFragment extends Fragment {
|
||||||
lock = false;
|
lock = false;
|
||||||
downX = event.getX();
|
downX = event.getX();
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case MotionEvent.ACTION_MOVE:
|
case MotionEvent.ACTION_MOVE:
|
||||||
if (lock) {
|
if (lock) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -91,7 +91,7 @@ public class CallAudioFragment extends Fragment {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface SwipeListener {
|
interface SwipeListener {
|
||||||
void onRightToLeftSwipe();
|
void onRightToLeftSwipe();
|
||||||
void onLeftToRightSwipe();
|
void onLeftToRightSwipe();
|
||||||
|
|
|
@ -869,7 +869,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
||||||
missedCalls.setText(missedCallsCount + "");
|
missedCalls.setText(missedCallsCount + "");
|
||||||
missedCalls.setVisibility(View.VISIBLE);
|
missedCalls.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
LinphoneManager.getLc().resetMissedCallsCount();
|
if (LinphoneManager.isInstanciated()) LinphoneManager.getLc().resetMissedCallsCount();
|
||||||
missedCalls.clearAnimation();
|
missedCalls.clearAnimation();
|
||||||
missedCalls.setVisibility(View.GONE);
|
missedCalls.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue