CallQuality indicator in audio and conference views
This commit is contained in:
parent
bfb9440f9c
commit
7ce7895e9f
5 changed files with 52 additions and 0 deletions
Binary file not shown.
Before Width: | Height: | Size: 587 B After Width: | Height: | Size: 905 B |
|
@ -23,6 +23,7 @@
|
||||||
android:layout_width="wrap_content" android:layout_height="fill_parent"
|
android:layout_width="wrap_content" android:layout_height="fill_parent"
|
||||||
android:layout_centerVertical="true">
|
android:layout_centerVertical="true">
|
||||||
<TextView android:id="@+id/status_label" style="@style/callee_status" />
|
<TextView android:id="@+id/status_label" style="@style/callee_status" />
|
||||||
|
<ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/QoS" android:src="@drawable/stat_sys_signal_0" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" />
|
||||||
<ImageView android:id="@+id/callee_status_paused" style="@style/callee_status" android:src="@drawable/conf_status_paused" android:visibility="gone"/>
|
<ImageView android:id="@+id/callee_status_paused" style="@style/callee_status" android:src="@drawable/conf_status_paused" android:visibility="gone"/>
|
||||||
<ImageView android:id="@+id/callee_status_secured" style="@style/callee_status" android:src="@drawable/conf_secured" android:visibility="gone"/>
|
<ImageView android:id="@+id/callee_status_secured" style="@style/callee_status" android:src="@drawable/conf_secured" android:visibility="gone"/>
|
||||||
<ImageView android:id="@+id/callee_status_maybe_secured" style="@style/callee_status" android:src="@drawable/conf_maybe_secured" android:visibility="gone"/>
|
<ImageView android:id="@+id/callee_status_maybe_secured" style="@style/callee_status" android:src="@drawable/conf_maybe_secured" android:visibility="gone"/>
|
||||||
|
|
|
@ -64,6 +64,8 @@ public abstract class AbstractCalleesActivity extends ListActivity implements Li
|
||||||
|
|
||||||
private Set<Chronometer> mChronometers = new HashSet<Chronometer>();
|
private Set<Chronometer> mChronometers = new HashSet<Chronometer>();
|
||||||
|
|
||||||
|
private float oldQuality = 0;
|
||||||
|
private Runnable mCallQualityUpdater;
|
||||||
@Override
|
@Override
|
||||||
/**
|
/**
|
||||||
* Called by the child classes AFTER their own onCreate.
|
* Called by the child classes AFTER their own onCreate.
|
||||||
|
@ -210,6 +212,26 @@ public abstract class AbstractCalleesActivity extends ListActivity implements Li
|
||||||
timer.setBase(SystemClock.elapsedRealtime() - 1000 * callDuration);
|
timer.setBase(SystemClock.elapsedRealtime() - 1000 * callDuration);
|
||||||
timer.start();
|
timer.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected final void registerCallQualityListener(final View v, final LinphoneCall call) {
|
||||||
|
final Handler callqualityHandler = new Handler();
|
||||||
|
callqualityHandler.postDelayed(mCallQualityUpdater = new Runnable(){
|
||||||
|
public void run() {
|
||||||
|
if (call==null){
|
||||||
|
mCallQualityUpdater=null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
float newQuality = call.getCurrentQuality();
|
||||||
|
if ((int) newQuality != oldQuality){
|
||||||
|
updateQualityOfSignalIcon(v, newQuality);
|
||||||
|
oldQuality = newQuality;
|
||||||
|
}
|
||||||
|
|
||||||
|
callqualityHandler.postDelayed(this, 1000);
|
||||||
|
}
|
||||||
|
},1000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -248,4 +270,29 @@ public abstract class AbstractCalleesActivity extends ListActivity implements Li
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void updateQualityOfSignalIcon(View v, float quality)
|
||||||
|
{
|
||||||
|
ImageView qos = (ImageView) v.findViewById(R.id.QoS);
|
||||||
|
if (quality >= 4) // Good Quality
|
||||||
|
{
|
||||||
|
qos.setImageDrawable(getResources().getDrawable(R.drawable.stat_sys_signal_4));
|
||||||
|
}
|
||||||
|
else if (quality >= 3) // Average quality
|
||||||
|
{
|
||||||
|
qos.setImageDrawable(getResources().getDrawable(R.drawable.stat_sys_signal_3));
|
||||||
|
}
|
||||||
|
else if (quality >= 2) // Low quality
|
||||||
|
{
|
||||||
|
qos.setImageDrawable(getResources().getDrawable(R.drawable.stat_sys_signal_2));
|
||||||
|
}
|
||||||
|
else if (quality >= 1) // Very low quality
|
||||||
|
{
|
||||||
|
qos.setImageDrawable(getResources().getDrawable(R.drawable.stat_sys_signal_1));
|
||||||
|
}
|
||||||
|
else // Worst quality
|
||||||
|
{
|
||||||
|
qos.setImageDrawable(getResources().getDrawable(R.drawable.stat_sys_signal_0));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -101,6 +101,8 @@ public class ConferenceDetailsActivity extends AbstractCalleesActivity {
|
||||||
setCalleePicture(pictureView, address);
|
setCalleePicture(pictureView, address);
|
||||||
|
|
||||||
registerCallDurationTimer(v, call);
|
registerCallDurationTimer(v, call);
|
||||||
|
registerCallQualityListener(v, call);
|
||||||
|
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -456,6 +456,7 @@ public class IncallActivity extends AbstractCalleesActivity implements
|
||||||
|
|
||||||
boolean statusPaused = state== State.Paused || state == State.PausedByRemote;
|
boolean statusPaused = state== State.Paused || state == State.PausedByRemote;
|
||||||
setVisibility(v, R.id.callee_status_paused, statusPaused);
|
setVisibility(v, R.id.callee_status_paused, statusPaused);
|
||||||
|
setVisibility(v, R.id.QoS, !statusPaused);
|
||||||
|
|
||||||
final OnLongClickListener showCallActionsLongListener = new OnLongClickListener() {
|
final OnLongClickListener showCallActionsLongListener = new OnLongClickListener() {
|
||||||
public boolean onLongClick(View v) {
|
public boolean onLongClick(View v) {
|
||||||
|
@ -538,6 +539,7 @@ public class IncallActivity extends AbstractCalleesActivity implements
|
||||||
}
|
}
|
||||||
|
|
||||||
registerCallDurationTimer(v, call);
|
registerCallDurationTimer(v, call);
|
||||||
|
registerCallQualityListener(v, call);
|
||||||
|
|
||||||
enableView(v, R.id.callee_status_details, showCallActionsSimpleListener, true);
|
enableView(v, R.id.callee_status_details, showCallActionsSimpleListener, true);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue