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,94 +103,96 @@ 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);
|
||||||
accept.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
|
|
||||||
decline.setVisibility(View.GONE);
|
mKeyguardManager = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
|
||||||
acceptUnlock.setVisibility(View.VISIBLE);
|
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() {
|
||||||
});
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
accept.setOnTouchListener(new View.OnTouchListener() {
|
answer();
|
||||||
@Override
|
|
||||||
public boolean onTouch(View view, MotionEvent motionEvent) {
|
|
||||||
float curX;
|
|
||||||
switch (motionEvent.getAction()) {
|
|
||||||
case MotionEvent.ACTION_DOWN:
|
|
||||||
acceptUnlock.setVisibility(View.VISIBLE);
|
|
||||||
decline.setVisibility(View.GONE);
|
|
||||||
answerX = motionEvent.getX() + accept.getWidth() / 2;
|
|
||||||
begin = true;
|
|
||||||
oldMove = 0;
|
|
||||||
break;
|
|
||||||
case MotionEvent.ACTION_MOVE:
|
|
||||||
curX = motionEvent.getX();
|
|
||||||
view.scrollBy((int) (answerX - curX), view.getScrollY());
|
|
||||||
oldMove -= answerX - curX;
|
|
||||||
answerX = curX;
|
|
||||||
if (oldMove < -25)
|
|
||||||
begin = false;
|
|
||||||
if (curX < arrow.getWidth() && !begin) {
|
|
||||||
answer();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case MotionEvent.ACTION_UP:
|
|
||||||
view.scrollTo(0, view.getScrollY());
|
|
||||||
decline.setVisibility(View.VISIBLE);
|
|
||||||
acceptUnlock.setVisibility(View.GONE);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return true;
|
});
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
decline.setOnTouchListener(new View.OnTouchListener() {
|
decline.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouch(View view, MotionEvent motionEvent) {
|
public void onClick(View v) {
|
||||||
float curX;
|
decline();
|
||||||
switch (motionEvent.getAction()) {
|
|
||||||
case MotionEvent.ACTION_DOWN:
|
|
||||||
declineUnlock.setVisibility(View.VISIBLE);
|
|
||||||
accept.setVisibility(View.GONE);
|
|
||||||
declineX = motionEvent.getX();
|
|
||||||
break;
|
|
||||||
case MotionEvent.ACTION_MOVE:
|
|
||||||
curX = motionEvent.getX();
|
|
||||||
view.scrollBy((int) (declineX - curX), view.getScrollY());
|
|
||||||
declineX = curX;
|
|
||||||
if (curX > (screenWidth - arrow.getWidth() * 4)) {
|
|
||||||
decline();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case MotionEvent.ACTION_UP:
|
|
||||||
view.scrollTo(0, view.getScrollY());
|
|
||||||
accept.setVisibility(View.VISIBLE);
|
|
||||||
declineUnlock.setVisibility(View.GONE);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return true;
|
});
|
||||||
}
|
} else {
|
||||||
});
|
accept.setOnTouchListener(new View.OnTouchListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onTouch(View view, MotionEvent motionEvent) {
|
||||||
|
float curX;
|
||||||
|
switch (motionEvent.getAction()) {
|
||||||
|
case MotionEvent.ACTION_DOWN:
|
||||||
|
acceptUnlock.setVisibility(View.VISIBLE);
|
||||||
|
decline.setVisibility(View.GONE);
|
||||||
|
answerX = motionEvent.getX() + accept.getWidth() / 2;
|
||||||
|
begin = true;
|
||||||
|
oldMove = 0;
|
||||||
|
break;
|
||||||
|
case MotionEvent.ACTION_MOVE:
|
||||||
|
curX = motionEvent.getX();
|
||||||
|
view.scrollBy((int) (answerX - curX), view.getScrollY());
|
||||||
|
oldMove -= answerX - curX;
|
||||||
|
answerX = curX;
|
||||||
|
if (oldMove < -25)
|
||||||
|
begin = false;
|
||||||
|
if (curX < arrow.getWidth() && !begin) {
|
||||||
|
answer();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case MotionEvent.ACTION_UP:
|
||||||
|
view.scrollTo(0, view.getScrollY());
|
||||||
|
decline.setVisibility(View.VISIBLE);
|
||||||
|
acceptUnlock.setVisibility(View.GONE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
decline.setOnTouchListener(new View.OnTouchListener() {
|
||||||
decline.setOnClickListener(new View.OnClickListener() {
|
@Override
|
||||||
@Override
|
public boolean onTouch(View view, MotionEvent motionEvent) {
|
||||||
public void onClick(View v) {
|
float curX;
|
||||||
accept.setVisibility(View.GONE);
|
switch (motionEvent.getAction()) {
|
||||||
acceptUnlock.setVisibility(View.VISIBLE);
|
case MotionEvent.ACTION_DOWN:
|
||||||
}
|
declineUnlock.setVisibility(View.VISIBLE);
|
||||||
});
|
accept.setVisibility(View.GONE);
|
||||||
|
declineX = motionEvent.getX();
|
||||||
|
break;
|
||||||
|
case MotionEvent.ACTION_MOVE:
|
||||||
|
curX = motionEvent.getX();
|
||||||
|
view.scrollBy((int) (declineX - curX), view.getScrollY());
|
||||||
|
declineX = curX;
|
||||||
|
if (curX > (screenWidth - arrow.getWidth() * 4)) {
|
||||||
|
decline();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case MotionEvent.ACTION_UP:
|
||||||
|
view.scrollTo(0, view.getScrollY());
|
||||||
|
accept.setVisibility(View.VISIBLE);
|
||||||
|
declineUnlock.setVisibility(View.GONE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
mListener = new CoreListenerStub() {
|
mListener = new CoreListenerStub() {
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue