Skip to content
Snippets Groups Projects
Commit d1976533 authored by Alexandre Savard's avatar Alexandre Savard
Browse files

#17013: Display and Update Call State in CallElementList

parent e41f5211
No related branches found
No related tags found
No related merge requests found
......@@ -84,6 +84,16 @@ as that of the covered work.
android:paddingLeft="@dimen/padding_small"
android:text="Small Text"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="@+id/callstate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/display_name"
android:layout_toRightOf="@+id/phones"
android:paddingBottom="@dimen/padding_small"
android:paddingLeft="@dimen/padding_small"
android:text="Small Text"
android:textAppearance="?android:attr/textAppearanceSmall" />
<!--
<ImageButton
android:id="@+id/imageButton1"
......
......@@ -74,9 +74,10 @@ import com.savoirfairelinux.sflphone.service.ISipService;
*/
public class CallElementList extends ListFragment implements LoaderManager.LoaderCallbacks<Cursor>
{
final String TAG = "CallElementList";
private static final String TAG = "CallElementList";
private static final String CURRENT_STATE_LABEL = " CURRENT STATE: ";
private ContactManager mContactManager;
private ArrayAdapter mAdapter;
private CallElementAdapter mAdapter;
private String mCurFilter;
private SFLPhoneHome sflphoneHome;
private ISipService service;
......@@ -198,6 +199,7 @@ public class CallElementList extends ListFragment implements LoaderManager.Loade
entryView.photo = (ImageView) rowView.findViewById(R.id.photo);
entryView.displayName = (TextView) rowView.findViewById(R.id.display_name);
entryView.phones = (TextView) rowView.findViewById(R.id.phones);
entryView.state = (TextView) rowView.findViewById(R.id.callstate);
// Cache the view obects in the tag
// so they can be re-accessed later
......@@ -209,8 +211,10 @@ public class CallElementList extends ListFragment implements LoaderManager.Loade
// Transfer the stock data from the data object
// to the view objects
SipCall call = (SipCall) mCallList.get(position);
entryView.displayName.setText(call.mCallInfo.mDisplayName);
entryView.phones.setText(call.mCallInfo.mPhone);
call.setAssociatedRowView(rowView);
entryView.displayName.setText(call.getDisplayName());
entryView.phones.setText(call.getPhone());
entryView.state.setText(CURRENT_STATE_LABEL + call.getCallStateString());
return rowView;
}
......@@ -222,7 +226,8 @@ public class CallElementList extends ListFragment implements LoaderManager.Loade
protected Button button;
protected ImageView photo;
protected TextView displayName;
protected TextView phones;
protected TextView phones;
protected TextView state;
}
public CallElementList(ISipService s, SFLPhoneHome home)
......@@ -264,7 +269,7 @@ public class CallElementList extends ListFragment implements LoaderManager.Loade
// Create an empty adapter we will use to display the loaded data.
List calls = new ArrayList();
ArrayList calls = new ArrayList();
mAdapter = new CallElementAdapter(getActivity(), calls);
setListAdapter(mAdapter);
......
......@@ -37,10 +37,12 @@ import android.os.Parcelable;
import android.os.Parcel;
import android.os.RemoteException;
import android.util.Log;
import android.view.View;
import java.util.ArrayList;
import com.savoirfairelinux.sflphone.service.ISipService;
import com.savoirfairelinux.sflphone.client.CallActivity;
import com.savoirfairelinux.sflphone.client.CallElementList.CallElementView;
public class SipCall
{
......@@ -49,6 +51,7 @@ public class SipCall
// Update UI on actions (answer, hangup)
static private CallElementList mCallElementList = null;
static private SFLPhoneHome mHome = null;
private View mRowView = null;
public static final int CALL_STATE_NONE = 0;
public static final int CALL_STATE_INCOMING = 1;
......@@ -148,6 +151,11 @@ public class SipCall
mHome = home;
}
public void setAssociatedRowView(View view)
{
mRowView = view;
}
public void setCallID(String callID) {
mCallInfo.mCallID = callID;
}
......@@ -198,6 +206,44 @@ public class SipCall
public void setCallState(int callState) {
mCallInfo.mCallState = callState;
if(mRowView == null)
return;
String state;
switch(mCallInfo.mCallState) {
case CALL_STATE_INCOMING:
state = "INCOMING";
break;
case CALL_STATE_RINGING:
state = "RINGING";
break;
case CALL_STATE_CURRENT:
state = "CURRENT";
break;
case CALL_STATE_HUNGUP:
state = "HUNGUP";
break;
case CALL_STATE_BUSY:
state = "BUSY";
break;
case CALL_STATE_FAILURE:
state = "FAILURE";
break;
case CALL_STATE_HOLD:
state = "HOLD";
break;
case CALL_STATE_UNHOLD:
state = "UNHOLD";
break;
default:
state = "NULL";
}
CallElementView entryView = (CallElementView) mRowView.getTag();
final String CURRENT_STATE_LABEL = " CURRENT STATE: ";
entryView.state.setText(CURRENT_STATE_LABEL + getCallStateString());
}
public int getCallStateInt() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment