Do not use sliders if phone is unlocked
This commit is contained in:
parent
2a85dc43d5
commit
d9df197d3d
3 changed files with 82 additions and 77 deletions
|
@ -163,7 +163,6 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:alpha="0.2"/>
|
android:alpha="0.2"/>
|
||||||
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:src="@drawable/arrow_hangup"
|
android:src="@drawable/arrow_hangup"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
|
|
@ -71,6 +71,7 @@
|
||||||
<bool name="automatically_start_intercepted_outgoing_gsm_call">true</bool><!-- This settings handle the behavior of the view waiting for the remote provisioning configuration to be done -->
|
<bool name="automatically_start_intercepted_outgoing_gsm_call">true</bool><!-- This settings handle the behavior of the view waiting for the remote provisioning configuration to be done -->
|
||||||
<bool name="hide_camera_settings">false</bool>
|
<bool name="hide_camera_settings">false</bool>
|
||||||
<bool name="hide_in_call_stats">false</bool>
|
<bool name="hide_in_call_stats">false</bool>
|
||||||
|
<bool name="do_not_use_sliders_to_answer_hangup_call_if_phone_unlocked">true</bool>
|
||||||
|
|
||||||
<!-- Settings -->
|
<!-- Settings -->
|
||||||
<bool name="disable_every_log">false</bool>
|
<bool name="disable_every_log">false</bool>
|
||||||
|
|
|
@ -20,6 +20,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
|
import android.app.KeyguardManager;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.pm.ActivityInfo;
|
import android.content.pm.ActivityInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
@ -65,6 +67,7 @@ public class CallIncomingActivity extends LinphoneGenericActivity {
|
||||||
private boolean alreadyAcceptedOrDeniedCall, begin;
|
private boolean alreadyAcceptedOrDeniedCall, begin;
|
||||||
private float answerX, oldMove;
|
private float answerX, oldMove;
|
||||||
private float declineX;
|
private float declineX;
|
||||||
|
private KeyguardManager mKeyguardManager;
|
||||||
|
|
||||||
public static CallIncomingActivity instance() {
|
public static CallIncomingActivity instance() {
|
||||||
return instance;
|
return instance;
|
||||||
|
@ -100,23 +103,33 @@ public class CallIncomingActivity extends LinphoneGenericActivity {
|
||||||
|
|
||||||
accept = findViewById(R.id.accept);
|
accept = findViewById(R.id.accept);
|
||||||
lookupCurrentCall();
|
lookupCurrentCall();
|
||||||
|
|
||||||
if (LinphonePreferences.instance() != null && mCall != null && mCall.getRemoteParams() != null &&
|
if (LinphonePreferences.instance() != null && mCall != null && mCall.getRemoteParams() != null &&
|
||||||
LinphonePreferences.instance().shouldAutomaticallyAcceptVideoRequests() &&
|
LinphonePreferences.instance().shouldAutomaticallyAcceptVideoRequests() &&
|
||||||
mCall.getRemoteParams().videoEnabled()) {
|
mCall.getRemoteParams().videoEnabled()) {
|
||||||
accept.setImageResource(R.drawable.call_video_start);
|
accept.setImageResource(R.drawable.call_video_start);
|
||||||
}
|
}
|
||||||
|
|
||||||
decline = findViewById(R.id.decline);
|
decline = findViewById(R.id.decline);
|
||||||
arrow = findViewById(R.id.arrow_hangup);
|
arrow = findViewById(R.id.arrow_hangup);
|
||||||
|
|
||||||
|
mKeyguardManager = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
|
||||||
|
boolean doNotUseSliders = getResources().getBoolean(R.bool.do_not_use_sliders_to_answer_hangup_call_if_phone_unlocked);
|
||||||
|
if (doNotUseSliders && !mKeyguardManager.inKeyguardRestrictedInputMode()) {
|
||||||
accept.setOnClickListener(new View.OnClickListener() {
|
accept.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
answer();
|
||||||
decline.setVisibility(View.GONE);
|
|
||||||
acceptUnlock.setVisibility(View.VISIBLE);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
decline.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
decline();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
accept.setOnTouchListener(new View.OnTouchListener() {
|
accept.setOnTouchListener(new View.OnTouchListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouch(View view, MotionEvent motionEvent) {
|
public boolean onTouch(View view, MotionEvent motionEvent) {
|
||||||
|
@ -179,15 +192,7 @@ public class CallIncomingActivity extends LinphoneGenericActivity {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
decline.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
accept.setVisibility(View.GONE);
|
|
||||||
acceptUnlock.setVisibility(View.VISIBLE);
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
mListener = new CoreListenerStub() {
|
mListener = new CoreListenerStub() {
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue