Fix incoming call view
This commit is contained in:
parent
203d1d247e
commit
cbc9a6f1f2
4 changed files with 19 additions and 16 deletions
|
@ -110,7 +110,7 @@
|
||||||
android:src="@drawable/call_hangup"
|
android:src="@drawable/call_hangup"
|
||||||
android:background="@drawable/hangup"
|
android:background="@drawable/hangup"
|
||||||
android:contentDescription="@string/content_description_decline"
|
android:contentDescription="@string/content_description_decline"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:padding="12dp"/>
|
android:padding="12dp"/>
|
||||||
|
@ -151,7 +151,7 @@
|
||||||
android:src="@drawable/call_audio_start"
|
android:src="@drawable/call_audio_start"
|
||||||
android:background="@drawable/call"
|
android:background="@drawable/call"
|
||||||
android:contentDescription="@string/content_description_accept"
|
android:contentDescription="@string/content_description_accept"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:padding="12dp"/>
|
android:padding="12dp"/>
|
||||||
|
|
|
@ -110,7 +110,7 @@
|
||||||
android:src="@drawable/call_hangup"
|
android:src="@drawable/call_hangup"
|
||||||
android:background="@drawable/hangup"
|
android:background="@drawable/hangup"
|
||||||
android:contentDescription="@string/content_description_decline"
|
android:contentDescription="@string/content_description_decline"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:padding="15dp"/>
|
android:padding="15dp"/>
|
||||||
|
@ -151,7 +151,7 @@
|
||||||
android:src="@drawable/call_audio_start"
|
android:src="@drawable/call_audio_start"
|
||||||
android:background="@drawable/call"
|
android:background="@drawable/call"
|
||||||
android:contentDescription="@string/content_description_accept"
|
android:contentDescription="@string/content_description_accept"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:padding="15dp"/>
|
android:padding="15dp"/>
|
||||||
|
|
|
@ -96,7 +96,7 @@
|
||||||
android:src="@drawable/call_hangup"
|
android:src="@drawable/call_hangup"
|
||||||
android:background="@drawable/hangup"
|
android:background="@drawable/hangup"
|
||||||
android:contentDescription="@string/content_description_decline"
|
android:contentDescription="@string/content_description_decline"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:padding="12dp"/>
|
android:padding="12dp"/>
|
||||||
|
@ -137,7 +137,7 @@
|
||||||
android:src="@drawable/call_audio_start"
|
android:src="@drawable/call_audio_start"
|
||||||
android:background="@drawable/call"
|
android:background="@drawable/call"
|
||||||
android:contentDescription="@string/content_description_accept"
|
android:contentDescription="@string/content_description_accept"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:padding="12dp"/>
|
android:padding="12dp"/>
|
||||||
|
|
|
@ -48,13 +48,13 @@ public class CallIncomingActivity extends LinphoneGenericActivity implements Lin
|
||||||
private static CallIncomingActivity instance;
|
private static CallIncomingActivity instance;
|
||||||
|
|
||||||
private TextView name, number;
|
private TextView name, number;
|
||||||
private ImageView contactPicture, accept, decline;
|
private ImageView contactPicture, accept, decline, arrow;
|
||||||
private LinphoneCall mCall;
|
private LinphoneCall mCall;
|
||||||
private LinphoneCoreListenerBase mListener;
|
private LinphoneCoreListenerBase mListener;
|
||||||
private LinearLayout acceptUnlock;
|
private LinearLayout acceptUnlock;
|
||||||
private LinearLayout declineUnlock;
|
private LinearLayout declineUnlock;
|
||||||
private boolean alreadyAcceptedOrDeniedCall;
|
private boolean alreadyAcceptedOrDeniedCall, begin;
|
||||||
private float answerX;
|
private float answerX, oldMove;
|
||||||
private float declineX;
|
private float declineX;
|
||||||
|
|
||||||
public static CallIncomingActivity instance() {
|
public static CallIncomingActivity instance() {
|
||||||
|
@ -91,6 +91,7 @@ public class CallIncomingActivity extends LinphoneGenericActivity implements Lin
|
||||||
|
|
||||||
accept = (ImageView) findViewById(R.id.accept);
|
accept = (ImageView) findViewById(R.id.accept);
|
||||||
decline = (ImageView) findViewById(R.id.decline);
|
decline = (ImageView) findViewById(R.id.decline);
|
||||||
|
arrow = (ImageView) findViewById(R.id.arrow_hangup);
|
||||||
accept.setOnClickListener(new View.OnClickListener() {
|
accept.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -110,14 +111,18 @@ public class CallIncomingActivity extends LinphoneGenericActivity implements Lin
|
||||||
case MotionEvent.ACTION_DOWN:
|
case MotionEvent.ACTION_DOWN:
|
||||||
acceptUnlock.setVisibility(View.VISIBLE);
|
acceptUnlock.setVisibility(View.VISIBLE);
|
||||||
decline.setVisibility(View.GONE);
|
decline.setVisibility(View.GONE);
|
||||||
answerX = motionEvent.getX();
|
answerX = motionEvent.getX()+accept.getWidth()/2;
|
||||||
|
begin = true;
|
||||||
|
oldMove = 0;
|
||||||
break;
|
break;
|
||||||
case MotionEvent.ACTION_MOVE:
|
case MotionEvent.ACTION_MOVE:
|
||||||
curX = motionEvent.getX();
|
curX = motionEvent.getX();
|
||||||
if((answerX - curX) >= 0)
|
|
||||||
view.scrollBy((int) (answerX - curX), view.getScrollY());
|
view.scrollBy((int) (answerX - curX), view.getScrollY());
|
||||||
|
oldMove -= answerX - curX;
|
||||||
answerX = curX;
|
answerX = curX;
|
||||||
if (curX < screenWidth/4) {
|
if (oldMove < -25)
|
||||||
|
begin = false;
|
||||||
|
if (curX < arrow.getWidth() && !begin) {
|
||||||
answer();
|
answer();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -146,8 +151,7 @@ public class CallIncomingActivity extends LinphoneGenericActivity implements Lin
|
||||||
curX = motionEvent.getX();
|
curX = motionEvent.getX();
|
||||||
view.scrollBy((int) (declineX - curX), view.getScrollY());
|
view.scrollBy((int) (declineX - curX), view.getScrollY());
|
||||||
declineX = curX;
|
declineX = curX;
|
||||||
Log.w(curX);
|
if (curX > (screenWidth-arrow.getWidth()*4)) {
|
||||||
if (curX > (screenWidth/2)){
|
|
||||||
decline();
|
decline();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -157,7 +161,6 @@ public class CallIncomingActivity extends LinphoneGenericActivity implements Lin
|
||||||
accept.setVisibility(View.VISIBLE);
|
accept.setVisibility(View.VISIBLE);
|
||||||
declineUnlock.setVisibility(View.GONE);
|
declineUnlock.setVisibility(View.GONE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue