Skip to content
Snippets Groups Projects
Commit 6c4cedba authored by Adrien Béraud's avatar Adrien Béraud
Browse files

ui: show call number

Tuleap: #178
Change-Id: I7b7b439333e0cf165b7bbe1a6738b692a1f1e619
parent dac0f641
No related branches found
No related tags found
No related merge requests found
...@@ -67,6 +67,7 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa ...@@ -67,6 +67,7 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa
private WakeLock mScreenWakeLock; private WakeLock mScreenWakeLock;
private ImageView contactBubbleView; private ImageView contactBubbleView;
private TextView contactBubbleTxt; private TextView contactBubbleTxt;
private TextView contactBubbleNumTxt;
private View acceptButton; private View acceptButton;
private View refuseButton; private View refuseButton;
private View hangupButton; private View hangupButton;
...@@ -147,6 +148,7 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa ...@@ -147,6 +148,7 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa
if (conf == null) { if (conf == null) {
contactBubbleView.setImageBitmap(null); contactBubbleView.setImageBitmap(null);
contactBubbleTxt.setText(""); contactBubbleTxt.setText("");
contactBubbleNumTxt.setText("");
acceptButton.setVisibility(View.GONE); acceptButton.setVisibility(View.GONE);
refuseButton.setVisibility(View.GONE); refuseButton.setVisibility(View.GONE);
hangupButton.setVisibility(View.GONE); hangupButton.setVisibility(View.GONE);
...@@ -370,9 +372,6 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa ...@@ -370,9 +372,6 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa
break; break;
case Activity.RESULT_CANCELED: case Activity.RESULT_CANCELED:
default: default:
/*synchronized (mBubbleModel) {
mBubbleModel.clear();
}*/
initNormalStateDisplay(); initNormalStateDisplay();
break; break;
} }
...@@ -386,28 +385,12 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa ...@@ -386,28 +385,12 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa
contactBubbleView = (ImageView) rootView.findViewById(R.id.contact_bubble); contactBubbleView = (ImageView) rootView.findViewById(R.id.contact_bubble);
contactBubbleTxt = (TextView) rootView.findViewById(R.id.contact_bubble_txt); contactBubbleTxt = (TextView) rootView.findViewById(R.id.contact_bubble_txt);
contactBubbleNumTxt = (TextView) rootView.findViewById(R.id.contact_bubble_num_txt);
acceptButton = rootView.findViewById(R.id.call_accept_btn); acceptButton = rootView.findViewById(R.id.call_accept_btn);
refuseButton = rootView.findViewById(R.id.call_refuse_btn); refuseButton = rootView.findViewById(R.id.call_refuse_btn);
hangupButton = rootView.findViewById(R.id.call_hangup_btn); hangupButton = rootView.findViewById(R.id.call_hangup_btn);
mCallStatusTxt = (TextView) rootView.findViewById(R.id.call_status_txt); mCallStatusTxt = (TextView) rootView.findViewById(R.id.call_status_txt);
mSecuritySwitch = (ViewSwitcher) rootView.findViewById(R.id.security_switcher); mSecuritySwitch = (ViewSwitcher) rootView.findViewById(R.id.security_switcher);
/*mToggleSpeakers = (ToggleButton) rootView.findViewById(R.id.speaker_toggle);
mToggleSpeakers.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
try {
mCallbacks.getRemoteService().toggleSpeakerPhone(isChecked);
} catch (RemoteException e) {
e.printStackTrace();
}
}
});*/
securityIndicator = rootView.findViewById(R.id.security_indicator); securityIndicator = rootView.findViewById(R.id.security_indicator);
return rootView; return rootView;
} }
...@@ -416,6 +399,21 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa ...@@ -416,6 +399,21 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa
return mCallbacks.getDisplayedConference(); return mCallbacks.getDisplayedConference();
} }
private void initContactDisplay(final SipCall call) {
CallContact contact = call.getContact();
final String name = contact.getDisplayName();
contactBubbleTxt.setText(name);
if (call.getNumber().contentEquals(name)) {
contactBubbleNumTxt.setVisibility(View.GONE);
} else {
contactBubbleNumTxt.setVisibility(View.VISIBLE);
contactBubbleNumTxt.setText(call.getNumber());
}
new ContactPictureTask(getActivity(), contactBubbleView, contact).run();
mCallbacks.getSupportActionBar().setTitle(name);
}
private void initNormalStateDisplay() { private void initNormalStateDisplay() {
Log.i(TAG, "Start normal display"); Log.i(TAG, "Start normal display");
mCallbacks.startTimer(); mCallbacks.startTimer();
...@@ -423,16 +421,15 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa ...@@ -423,16 +421,15 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa
refuseButton.setVisibility(View.GONE); refuseButton.setVisibility(View.GONE);
final SipCall call = getConference().getParticipants().get(0); final SipCall call = getConference().getParticipants().get(0);
CallContact contact = call.getContact(); final String call_id = call.getCallId();
new ContactPictureTask(getActivity(), contactBubbleView, contact).run(); initContactDisplay(call);
contactBubbleTxt.setText(contact.getDisplayName());
hangupButton.setVisibility(View.VISIBLE); hangupButton.setVisibility(View.VISIBLE);
hangupButton.setOnClickListener(new OnClickListener() { hangupButton.setOnClickListener(new OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
try { try {
mCallbacks.getRemoteService().hangUp(call.getCallId()); mCallbacks.getRemoteService().hangUp(call_id);
mCallbacks.terminateCall(); mCallbacks.terminateCall();
} catch (RemoteException e) { } catch (RemoteException e) {
e.printStackTrace(); e.printStackTrace();
...@@ -440,17 +437,14 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa ...@@ -440,17 +437,14 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa
} }
}); });
mCallbacks.getSupportActionBar().setTitle(contact.getDisplayName());
updateSecurityDisplay(); updateSecurityDisplay();
} }
private void updateSecurityDisplay() { private void updateSecurityDisplay() {
//First we check if all participants use a security layer. //First we check if all participants use a security layer.
boolean secure_call = !getConference().getParticipants().isEmpty(); boolean secure_call = !getConference().getParticipants().isEmpty();
for (SipCall c : getConference().getParticipants()) { for (SipCall c : getConference().getParticipants())
//Account acc = mCallbacks.getService().getAccount(c.getAccount());
secure_call &= c instanceof SecureSipCall && ((SecureSipCall)c).isSecure(); secure_call &= c instanceof SecureSipCall && ((SecureSipCall)c).isSecure();
}
securityIndicator.setVisibility(secure_call ? View.VISIBLE : View.GONE); securityIndicator.setVisibility(secure_call ? View.VISIBLE : View.GONE);
if (!secure_call) if (!secure_call)
...@@ -521,9 +515,7 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa ...@@ -521,9 +515,7 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa
} }
} else { } else {
final SipCall call = getConference().getParticipants().get(0); final SipCall call = getConference().getParticipants().get(0);
CallContact contact = call.getContact(); initContactDisplay(call);
new ContactPictureTask(getActivity(), contactBubbleView, contact).run();
contactBubbleTxt.setText(contact.getDisplayName());
acceptButton.setVisibility(View.VISIBLE); acceptButton.setVisibility(View.VISIBLE);
acceptButton.setOnClickListener(new OnClickListener() { acceptButton.setOnClickListener(new OnClickListener() {
@Override @Override
...@@ -552,7 +544,6 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa ...@@ -552,7 +544,6 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa
} }
}); });
hangupButton.setVisibility(View.GONE); hangupButton.setVisibility(View.GONE);
mCallbacks.getSupportActionBar().setTitle(contact.getDisplayName());
} }
} }
...@@ -560,9 +551,7 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa ...@@ -560,9 +551,7 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa
Log.i(TAG, "Start outgoing display"); Log.i(TAG, "Start outgoing display");
final SipCall call = getConference().getParticipants().get(0); final SipCall call = getConference().getParticipants().get(0);
CallContact contact = call.getContact(); initContactDisplay(call);
new ContactPictureTask(getActivity(), contactBubbleView, contact).run();
contactBubbleTxt.setText(contact.getDisplayName());
acceptButton.setVisibility(View.GONE); acceptButton.setVisibility(View.GONE);
refuseButton.setVisibility(View.GONE); refuseButton.setVisibility(View.GONE);
...@@ -580,7 +569,6 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa ...@@ -580,7 +569,6 @@ public class CallFragment extends CallableWrapperFragment implements CallInterfa
} }
}); });
mCallbacks.getSupportActionBar().setTitle(contact.getDisplayName());
} }
/* /*
......
...@@ -18,19 +18,35 @@ ...@@ -18,19 +18,35 @@
android:id="@+id/contact_bubble" android:id="@+id/contact_bubble"
android:layout_width="200dp" android:layout_width="200dp"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:layout_above="@+id/contact_bubble_txt"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_margin="16dp" /> android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="16dp"
android:layout_above="@+id/contact_bubble_txt" />
<TextView <TextView
android:id="@+id/contact_bubble_txt" android:id="@+id/contact_bubble_txt"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:textAppearance="?android:attr/textAppearanceLarge" android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/text_color_primary" /> android:textColor="@color/text_color_primary"
android:text="Adrien Béraud"
android:layout_above="@+id/contact_bubble_num_txt"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView
android:id="@+id/contact_bubble_num_txt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/text_color_secondary"
android:text="(514) 279-2035"
android:layout_alignParentLeft="false"
android:layout_alignParentStart="false"
android:layout_alignParentBottom="true" />
</RelativeLayout> </RelativeLayout>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment