* #36284: integration of new fields in the android client.
diff --git a/src/org/sflphone/fragments/CallFragment.java b/src/org/sflphone/fragments/CallFragment.java
index 01f2655..5b0d30f 100644
--- a/src/org/sflphone/fragments/CallFragment.java
+++ b/src/org/sflphone/fragments/CallFragment.java
@@ -87,7 +87,7 @@
private TextView callStatusTxt;
private TextView codecNameTxt;
-
+
private ToggleButton speakers;
private BubblesView view;
@@ -251,11 +251,11 @@
codecNameTxt = (TextView) rootView.findViewById(R.id.codec_name_txt);
callStatusTxt = (TextView) rootView.findViewById(R.id.call_status_txt);
call_icon = BitmapFactory.decodeResource(getResources(), R.drawable.ic_action_call);
-
+
speakers = (ToggleButton) rootView.findViewById(R.id.speaker_toggle);
-
+
speakers.setOnCheckedChangeListener(new OnCheckedChangeListener() {
-
+
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
try {
@@ -263,7 +263,7 @@
} catch (RemoteException e) {
e.printStackTrace();
}
-
+
}
});
@@ -328,8 +328,8 @@
return false;
}
}, call_icon));
-
- if(conf.getParticipants().get(0).getAccount().isAutoanswerEnabled()){
+
+ if (conf.getParticipants().get(0).getAccount().isAutoanswerEnabled()) {
try {
mCallbacks.getService().accept(conf.getParticipants().get(0).getCallId());
} catch (RemoteException e) {
@@ -389,32 +389,24 @@
if (contact_bubble != null) {
contact_bubble.attractor.set(x, y);
((BubbleUser) contact_bubble).setConference(conf);
-
+
return contact_bubble;
}
- contact_bubble = new BubbleUser(getActivity(), CallContact.ContactBuilder.buildUserContact(getActivity().getContentResolver()), conf, x, y, BUBBLE_SIZE * 1.3f);
+ contact_bubble = new BubbleUser(getActivity(), CallContact.ContactBuilder.buildUserContact(getActivity().getContentResolver()), conf, x, y,
+ BUBBLE_SIZE * 1.3f);
try {
((BubbleUser) contact_bubble).setMute(mCallbacks.getService().isCaptureMuted());
} catch (RemoteException e) {
e.printStackTrace();
- } catch (NullPointerException e1){
+ } catch (NullPointerException e1) {
e1.printStackTrace();
}
model.addBubble(contact_bubble);
return contact_bubble;
}
- /**
- * Should be called when a bubble is removed from the model
- */
- void bubbleRemoved(Bubble b) {
- // if (b.associated_call == null) {
- // return;
- // }
- }
-
public void changeCallState(String callID, String newState) {
Log.i(TAG, "Call :" + callID + " " + newState);
if (newState.contentEquals("FAILURE")) {
@@ -424,7 +416,7 @@
e.printStackTrace();
}
}
- if(conf == null){
+ if (conf == null) {
return;
}
for (int i = 0; i < conf.getParticipants().size(); ++i) {
@@ -524,7 +516,7 @@
public void updateTime() {
long duration = System.currentTimeMillis() / 1000 - this.conf.getParticipants().get(0).getTimestamp_start();
- if(conf.isOnGoing())
+ if (conf.isOnGoing())
callStatusTxt.setText(String.format("%d:%02d:%02d", duration / 3600, duration % 3600 / 60, duration % 60));
}
@@ -552,6 +544,10 @@
}
public void updateCodecName(String currentAudioCodecName) {
- codecNameTxt.setText(currentAudioCodecName);
+ // In case of multiple codecs in the String
+ if (currentAudioCodecName.indexOf(' ') > 0)
+ codecNameTxt.setText(currentAudioCodecName.subSequence(0, currentAudioCodecName.indexOf(' ')));
+ else
+ codecNameTxt.setText(currentAudioCodecName);
}
}
diff --git a/src/org/sflphone/fragments/DetailsHistoryEntryFragment.java b/src/org/sflphone/fragments/DetailsHistoryEntryFragment.java
index 95c36f7..eca210d 100644
--- a/src/org/sflphone/fragments/DetailsHistoryEntryFragment.java
+++ b/src/org/sflphone/fragments/DetailsHistoryEntryFragment.java
@@ -236,10 +236,11 @@
final HistoryCall item = dataset.get(position);
- entryView.historyCallState.setText(item.getState());
+ entryView.historyCallState.setText(item.getDirection());
entryView.formatted_date.setText(item.getDate());
- // entryView.displayName.setText(item.getDisplayName());
entryView.duration.setText(item.getDurationString());
+ if(item.isIncoming() && item.isMissed())
+ convertView.setBackgroundColor(getResources().getColor(R.color.holo_red_light));
if (item.hasRecord()) {
entryView.record.setVisibility(View.VISIBLE);
diff --git a/src/org/sflphone/model/BubbleModel.java b/src/org/sflphone/model/BubbleModel.java
index 97a3cd2..9e2a5c4 100644
--- a/src/org/sflphone/model/BubbleModel.java
+++ b/src/org/sflphone/model/BubbleModel.java
@@ -89,13 +89,12 @@
// Iterators should not be used in frequently called methods
// to avoid garbage collection glitches caused by iterator objects.
for (int i = 0, n = bubbles.size(); i < n; i++) {
-
- if(i > bubbles.size()){ // prevent updating a bubble already removed
+
+ if (i > bubbles.size()) { // prevent updating a bubble already removed
return;
}
Bubble b = bubbles.get(i);
-
if (b.markedToDie) {
continue;
}
@@ -106,7 +105,7 @@
Attractor attractor = null;
PointF attractor_pos = b.attractor;
- float attractor_dist = (attractor_pos.x - bx) * (attractor_pos.x - bx) + (attractor_pos.y - by) * (attractor_pos.x - by);
+ float attractor_dist = (attractor_pos.x - bx) * (attractor_pos.x - bx) + (attractor_pos.y - by) * (attractor_pos.y - by);
for (int j = 0; j < attr_n; j++) {
try {
@@ -173,7 +172,6 @@
// Log.w(TAG, "update dx="+dt+" dy="+dy);
b.setPos((float) (bx + dx), (float) (by + dy));
- // Log.i(TAG,"Model:");
if (attractor != null && attractor_dist < attractor_dist_suck * attractor_dist_suck) {
b.dragged = false;
if (attractor.callback.onBubbleSucked(b)) {
diff --git a/src/org/sflphone/model/HistoryEntry.java b/src/org/sflphone/model/HistoryEntry.java
index ae0453e..a67067b 100644
--- a/src/org/sflphone/model/HistoryEntry.java
+++ b/src/org/sflphone/model/HistoryEntry.java
@@ -81,12 +81,10 @@
public void addHistoryCall(HistoryCall historyCall) {
calls.put(historyCall.call_start, historyCall);
- if (historyCall.getState().contentEquals(ServiceConstants.history.MISSED_STRING)) {
- ++missed_sum;
- } else if (historyCall.getState().contentEquals(ServiceConstants.history.INCOMING_STRING)) {
- ++incoming_sum;
- } else {
+ if (historyCall.getDirection().contentEquals(ServiceConstants.history.OUTGOING_STRING)) {
++outgoing_sum;
+ } else if (historyCall.isIncoming()) {
+ ++incoming_sum;
}
}
@@ -174,8 +172,10 @@
long call_start;
long call_end;
String number;
-
- String state;
+
+ boolean missed;
+ String direction;
+
String recordPath;
String timeFormatted;
String displayName;
@@ -183,13 +183,20 @@
public HistoryCall(HashMap<String, String> entry) {
call_end = Long.parseLong(entry.get(ServiceConstants.history.TIMESTAMP_STOP_KEY));
call_start = Long.parseLong(entry.get(ServiceConstants.history.TIMESTAMP_START_KEY));
- state = entry.get(ServiceConstants.history.STATE_KEY);
+
+ direction = entry.get(ServiceConstants.history.DIRECTION_KEY);
+ missed = entry.get(ServiceConstants.history.MISSED_KEY).contentEquals("true");
+
displayName = entry.get(ServiceConstants.history.DISPLAY_NAME_KEY);
recordPath = entry.get(ServiceConstants.history.RECORDING_PATH_KEY);
number = entry.get(ServiceConstants.history.PEER_NUMBER_KEY);
timeFormatted = HistoryManager.timeToHistoryConst(call_start);
}
+ public String getDirection() {
+ return direction;
+ }
+
public String getDate() {
return timeFormatted;
}
@@ -224,10 +231,6 @@
return displayName;
}
- public String getState() {
- return state;
- }
-
@Override
public int describeContents() {
return 0;
@@ -238,7 +241,8 @@
dest.writeLong(call_start);
dest.writeLong(call_end);
dest.writeString(number);
- dest.writeString(state);
+ dest.writeByte((byte) (missed ? 1 : 0));
+ dest.writeString(direction);
dest.writeString(recordPath);
dest.writeString(timeFormatted);
dest.writeString(displayName);
@@ -258,7 +262,8 @@
call_start = in.readLong();
call_end = in.readLong();
number = in.readString();
- state = in.readString();
+ missed = in.readByte() == 1 ? true : false;
+ direction = in.readString();
recordPath = in.readString();
timeFormatted = in.readString();
displayName = in.readString();
@@ -268,6 +273,14 @@
return recordPath.length() > 0;
}
+ public boolean isIncoming() {
+ return direction.contentEquals(ServiceConstants.history.INCOMING_STRING);
+ }
+
+ public boolean isMissed() {
+ return missed;
+ }
+
}
}
diff --git a/src/org/sflphone/service/ServiceConstants.java b/src/org/sflphone/service/ServiceConstants.java
index 94d8205..99ff767 100644
--- a/src/org/sflphone/service/ServiceConstants.java
+++ b/src/org/sflphone/service/ServiceConstants.java
@@ -12,7 +12,11 @@
public static final String DISPLAY_NAME_KEY = "display_name";
public static final String PEER_NUMBER_KEY = "peer_number";
public static final String RECORDING_PATH_KEY = "recordfile";
- public static final String STATE_KEY = "state";
+
+ // New fields
+ public static final String MISSED_KEY = "missed";
+ public static final String DIRECTION_KEY = "direction";
+
public static final String TIMESTAMP_START_KEY = "timestamp_start";
public static final String TIMESTAMP_STOP_KEY = "timestamp_stop";
public static final String AUDIO_CODEC_KEY = "audio_codec";
diff --git a/src/org/sflphone/service/SipService.java b/src/org/sflphone/service/SipService.java
index 2dc88bd..1e2ef12 100644
--- a/src/org/sflphone/service/SipService.java
+++ b/src/org/sflphone/service/SipService.java
@@ -1099,7 +1099,7 @@
//
// @Override
// protected StringVect doRun() throws SameThreadException {
- // Log.i(TAG, "SipService.getCallList() thread running...");
+ // Log.i(TAG, "SipService.getCallList() thread running...incoming");
// return callManagerJNI.getCallList();
// }
// }
diff --git a/src/org/sflphone/utils/SwigNativeConverter.java b/src/org/sflphone/utils/SwigNativeConverter.java
index 7d8817a..cb53dc5 100644
--- a/src/org/sflphone/utils/SwigNativeConverter.java
+++ b/src/org/sflphone/utils/SwigNativeConverter.java
@@ -66,10 +66,14 @@
entry.put(ServiceConstants.history.DISPLAY_NAME_KEY, tryToGet(swigmap.get(i), ServiceConstants.history.DISPLAY_NAME_KEY));
entry.put(ServiceConstants.history.PEER_NUMBER_KEY, tryToGet(swigmap.get(i), ServiceConstants.history.PEER_NUMBER_KEY));
entry.put(ServiceConstants.history.RECORDING_PATH_KEY, tryToGet(swigmap.get(i), ServiceConstants.history.RECORDING_PATH_KEY));
- entry.put(ServiceConstants.history.STATE_KEY, tryToGet(swigmap.get(i), ServiceConstants.history.STATE_KEY));
+ entry.put(ServiceConstants.history.DIRECTION_KEY, tryToGet(swigmap.get(i), ServiceConstants.history.DIRECTION_KEY));
+ entry.put(ServiceConstants.history.MISSED_KEY, tryToGet(swigmap.get(i), ServiceConstants.history.MISSED_KEY));
entry.put(ServiceConstants.history.TIMESTAMP_START_KEY, tryToGet(swigmap.get(i), ServiceConstants.history.TIMESTAMP_START_KEY));
entry.put(ServiceConstants.history.TIMESTAMP_STOP_KEY, tryToGet(swigmap.get(i), ServiceConstants.history.TIMESTAMP_STOP_KEY));
entry.put(ServiceConstants.history.AUDIO_CODEC_KEY, tryToGet(swigmap.get(i), ServiceConstants.history.AUDIO_CODEC_KEY));
+
+ if(entry.get(ServiceConstants.history.DIRECTION_KEY).isEmpty())
+ continue;
nativemap.add(entry);
}