Improved incoming call's answer and delete buttons UI
This commit is contained in:
parent
1491cb9710
commit
cd1449c157
3 changed files with 100 additions and 90 deletions
|
@ -527,7 +527,7 @@ public final class LinphoneService extends Service {
|
|||
}
|
||||
|
||||
int notificationTextId;
|
||||
int inconId;
|
||||
int iconId;
|
||||
switch (call.getState()) {
|
||||
case Released:
|
||||
case End:
|
||||
|
@ -537,15 +537,15 @@ public final class LinphoneService extends Service {
|
|||
case Paused:
|
||||
case PausedByRemote:
|
||||
case Pausing:
|
||||
inconId = R.drawable.topbar_call_notification;
|
||||
iconId = R.drawable.topbar_call_notification;
|
||||
notificationTextId = R.string.incall_notif_paused;
|
||||
break;
|
||||
default:
|
||||
if (call.getCurrentParams().videoEnabled()) {
|
||||
inconId = R.drawable.topbar_videocall_notification;
|
||||
iconId = R.drawable.topbar_videocall_notification;
|
||||
notificationTextId = R.string.incall_notif_video;
|
||||
} else {
|
||||
inconId = R.drawable.topbar_call_notification;
|
||||
iconId = R.drawable.topbar_call_notification;
|
||||
notificationTextId = R.string.incall_notif_active;
|
||||
}
|
||||
break;
|
||||
|
@ -565,7 +565,7 @@ public final class LinphoneService extends Service {
|
|||
Intent notifIntent = new Intent(this, incomingReceivedActivity);
|
||||
notifIntent.putExtra("Notification", true);
|
||||
mNotifContentIntent = PendingIntent.getActivity(this, 0, notifIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
Notification notification = Compatibility.createInCallNotification(getApplicationContext(), notif.notificationId, showAnswerAction, mNotificationTitle, getString(notificationTextId), inconId, bm, name, mNotifContentIntent);
|
||||
Notification notification = Compatibility.createInCallNotification(getApplicationContext(), notif.notificationId, showAnswerAction, mNotificationTitle, getString(notificationTextId), iconId, bm, name, mNotifContentIntent);
|
||||
|
||||
notifyWrapper(notif.notificationId, notification);
|
||||
}
|
||||
|
|
|
@ -60,7 +60,8 @@ public class CallIncomingActivity extends LinphoneGenericActivity {
|
|||
private static CallIncomingActivity instance;
|
||||
|
||||
private TextView name, number;
|
||||
private ImageView contactPicture, accept, decline, arrow;
|
||||
private ImageView contactPicture, acceptIcon;
|
||||
private LinearLayout accept, decline;
|
||||
private Call mCall;
|
||||
private CoreListenerStub mListener;
|
||||
private LinearLayout acceptUnlock;
|
||||
|
@ -102,17 +103,17 @@ public class CallIncomingActivity extends LinphoneGenericActivity {
|
|||
acceptUnlock = findViewById(R.id.acceptUnlock);
|
||||
declineUnlock = findViewById(R.id.declineUnlock);
|
||||
|
||||
acceptIcon = findViewById(R.id.acceptIcon);
|
||||
accept = findViewById(R.id.accept);
|
||||
lookupCurrentCall();
|
||||
|
||||
if (LinphonePreferences.instance() != null && mCall != null && mCall.getRemoteParams() != null &&
|
||||
LinphonePreferences.instance().shouldAutomaticallyAcceptVideoRequests() &&
|
||||
mCall.getRemoteParams().videoEnabled()) {
|
||||
accept.setImageResource(R.drawable.call_video_start);
|
||||
acceptIcon.setImageResource(R.drawable.call_video_start);
|
||||
}
|
||||
|
||||
decline = findViewById(R.id.decline);
|
||||
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);
|
||||
|
@ -131,47 +132,46 @@ public class CallIncomingActivity extends LinphoneGenericActivity {
|
|||
}
|
||||
});
|
||||
} else {
|
||||
acceptUnlock.setVisibility(View.VISIBLE);
|
||||
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;
|
||||
answerX = motionEvent.getX() - accept.getWidth();
|
||||
begin = true;
|
||||
oldMove = 0;
|
||||
break;
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
curX = motionEvent.getX();
|
||||
curX = motionEvent.getX() - accept.getWidth();
|
||||
view.scrollBy((int) (answerX - curX), view.getScrollY());
|
||||
oldMove -= answerX - curX;
|
||||
answerX = curX;
|
||||
if (oldMove < -25)
|
||||
begin = false;
|
||||
if (curX < arrow.getWidth() && !begin) {
|
||||
if (curX < (screenWidth / 4) - accept.getWidth() && !begin) {
|
||||
answer();
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case MotionEvent.ACTION_UP:
|
||||
view.scrollTo(0, view.getScrollY());
|
||||
decline.setVisibility(View.VISIBLE);
|
||||
acceptUnlock.setVisibility(View.GONE);
|
||||
view.scrollTo(0, view.getScrollY());
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
declineUnlock.setVisibility(View.VISIBLE);
|
||||
decline.setOnTouchListener(new View.OnTouchListener() {
|
||||
@Override
|
||||
public boolean onTouch(View view, MotionEvent motionEvent) {
|
||||
float curX;
|
||||
switch (motionEvent.getAction()) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
declineUnlock.setVisibility(View.VISIBLE);
|
||||
accept.setVisibility(View.GONE);
|
||||
declineX = motionEvent.getX();
|
||||
break;
|
||||
|
@ -179,15 +179,14 @@ public class CallIncomingActivity extends LinphoneGenericActivity {
|
|||
curX = motionEvent.getX();
|
||||
view.scrollBy((int) (declineX - curX), view.getScrollY());
|
||||
declineX = curX;
|
||||
if (curX > (screenWidth - arrow.getWidth() * 4)) {
|
||||
if (curX > (3 * screenWidth / 4)) {
|
||||
decline();
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case MotionEvent.ACTION_UP:
|
||||
view.scrollTo(0, view.getScrollY());
|
||||
accept.setVisibility(View.VISIBLE);
|
||||
declineUnlock.setVisibility(View.GONE);
|
||||
view.scrollTo(0, view.getScrollY());
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -93,88 +93,99 @@
|
|||
android:layout_alignParentBottom="true"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/decline"
|
||||
android:src="@drawable/call_hangup"
|
||||
android:background="@drawable/hangup"
|
||||
android:contentDescription="@string/content_description_decline"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:padding="12dp"/>
|
||||
<LinearLayout
|
||||
android:id="@+id/decline"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal"
|
||||
android:background="@color/colorI"
|
||||
android:gravity="center"
|
||||
android:padding="12dp">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/acceptUnlock"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
android:orientation="horizontal"
|
||||
android:background="@color/colorA"
|
||||
android:paddingLeft="15dp"
|
||||
android:paddingTop="15dp"
|
||||
android:paddingBottom="15dp"
|
||||
android:layout_gravity="bottom">
|
||||
<ImageView
|
||||
android:src="@drawable/call_hangup"
|
||||
android:contentDescription="@string/content_description_decline"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<ImageView
|
||||
android:src="@drawable/arrow_accept"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
<LinearLayout
|
||||
android:id="@+id/declineUnlock"
|
||||
android:visibility="gone"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:src="@drawable/arrow_accept"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:alpha="0.6"/>
|
||||
<ImageView
|
||||
android:id="@+id/arrow_hangup"
|
||||
android:src="@drawable/arrow_hangup"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/acceptArrow"
|
||||
android:src="@drawable/arrow_accept"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:alpha="0.2"/>
|
||||
</LinearLayout>
|
||||
<ImageView
|
||||
android:src="@drawable/arrow_hangup"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:alpha="0.6"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/accept"
|
||||
android:src="@drawable/call_audio_start"
|
||||
android:background="@drawable/call"
|
||||
android:contentDescription="@string/content_description_accept"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:padding="12dp"/>
|
||||
<ImageView
|
||||
android:src="@drawable/arrow_hangup"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:alpha="0.2"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/declineUnlock"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
android:orientation="horizontal"
|
||||
android:background="@color/colorD"
|
||||
android:paddingLeft="15dp"
|
||||
android:paddingTop="15dp"
|
||||
android:paddingBottom="15dp"
|
||||
android:layout_gravity="bottom">
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/arrow_hangup"
|
||||
android:src="@drawable/arrow_hangup"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:alpha="0.2"/>
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:src="@drawable/arrow_hangup"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:alpha="0.6"/>
|
||||
<LinearLayout
|
||||
android:id="@+id/accept"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal"
|
||||
android:background="@color/colorL"
|
||||
android:gravity="center"
|
||||
android:padding="12dp">
|
||||
|
||||
<ImageView
|
||||
android:src="@drawable/arrow_hangup"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
<LinearLayout
|
||||
android:id="@+id/acceptUnlock"
|
||||
android:visibility="gone"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
</LinearLayout>
|
||||
<ImageView
|
||||
android:src="@drawable/arrow_accept"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:alpha="0.2"/>
|
||||
|
||||
<ImageView
|
||||
android:src="@drawable/arrow_accept"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:alpha="0.6"/>
|
||||
|
||||
<ImageView
|
||||
android:src="@drawable/arrow_accept"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/acceptIcon"
|
||||
android:src="@drawable/call_audio_start"
|
||||
android:contentDescription="@string/content_description_accept"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
Loading…
Reference in a new issue