Improved call stats updater + updated liblinphone

This commit is contained in:
Sylvain Berfini 2012-10-02 10:28:08 +02:00
parent 90e2b7f4b0
commit a7449bb46b
3 changed files with 60 additions and 59 deletions

View file

@ -30,7 +30,7 @@
<supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true"/> <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true"/>
<application android:label="@string/app_name" android:debuggable="true" android:icon="@drawable/logo_linphone_57x57" android:largeHeap="true"> <application android:label="@string/app_name" android:debuggable= "true" android:icon="@drawable/logo_linphone_57x57" android:largeHeap="true">
<activity android:name="org.linphone.LinphoneLauncherActivity" <activity android:name="org.linphone.LinphoneLauncherActivity"
android:label="@string/app_name" android:label="@string/app_name"

View file

@ -70,6 +70,8 @@ public class StatusFragment extends Fragment {
private Toast zrtpToast; private Toast zrtpToast;
private CountDownTimer zrtpHack; private CountDownTimer zrtpHack;
private boolean hideZrtpToast = false; private boolean hideZrtpToast = false;
private Timer mTimer;
private TimerTask mTask;
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
@ -159,7 +161,7 @@ public class StatusFragment extends Fragment {
sliderContentAccounts.setVisibility(View.GONE); sliderContentAccounts.setVisibility(View.GONE);
callStats.setVisibility(View.GONE); callStats.setVisibility(View.GONE);
if (isInCall && getResources().getBoolean(R.bool.display_call_stats)) { if (isInCall && isAttached && getResources().getBoolean(R.bool.display_call_stats)) {
callStats.setVisibility(View.VISIBLE); callStats.setVisibility(View.VISIBLE);
LinphoneCall call = LinphoneManager.getLc().getCurrentCall(); LinphoneCall call = LinphoneManager.getLc().getCurrentCall();
initCallStatsRefresher(call, callStats); initCallStatsRefresher(call, callStats);
@ -445,15 +447,16 @@ public class StatusFragment extends Fragment {
} }
private void initCallStatsRefresher(final LinphoneCall call, final View view) { private void initCallStatsRefresher(final LinphoneCall call, final View view) {
new Thread(new Runnable() { if (mTimer != null && mTask != null) {
@Override return;
public void run() { }
final Timer timer = new Timer();
TimerTask lTask = new TimerTask() { mTimer = new Timer();
mTask = new TimerTask() {
@Override @Override
public void run() { public void run() {
if (call == null) { if (call == null) {
timer.cancel(); mTimer.cancel();
return; return;
} }
@ -463,7 +466,7 @@ public class StatusFragment extends Fragment {
final TextView ul = (TextView) view.findViewById(R.id.uploadBandwith); final TextView ul = (TextView) view.findViewById(R.id.uploadBandwith);
final TextView ice = (TextView) view.findViewById(R.id.ice); final TextView ice = (TextView) view.findViewById(R.id.ice);
if (codec == null || dl == null || ul == null || ice == null) { if (codec == null || dl == null || ul == null || ice == null) {
timer.cancel(); mTimer.cancel();
return; return;
} }
@ -473,7 +476,7 @@ public class StatusFragment extends Fragment {
mHandler.post(new Runnable() { mHandler.post(new Runnable() {
@Override @Override
public void run() { public void run() {
title.setText("Audio"); title.setText("Video");
PayloadType payload = call.getCurrentParamsCopy().getUsedVideoCodec(); PayloadType payload = call.getCurrentParamsCopy().getUsedVideoCodec();
if (payload != null) { if (payload != null) {
codec.setText(payload.getMime()); codec.setText(payload.getMime());
@ -490,7 +493,7 @@ public class StatusFragment extends Fragment {
mHandler.post(new Runnable() { mHandler.post(new Runnable() {
@Override @Override
public void run() { public void run() {
title.setText("Video"); title.setText("Audio");
PayloadType payload = call.getCurrentParamsCopy().getUsedAudioCodec(); PayloadType payload = call.getCurrentParamsCopy().getUsedAudioCodec();
if (payload != null) { if (payload != null) {
codec.setText(payload.getMime()); codec.setText(payload.getMime());
@ -504,9 +507,7 @@ public class StatusFragment extends Fragment {
} }
} }
}; };
timer.scheduleAtFixedRate(lTask, 0, 1500); mTimer.scheduleAtFixedRate(mTask, 0, 1500);
}
}).start();
} }
class AccountsListAdapter extends BaseAdapter { class AccountsListAdapter extends BaseAdapter {

@ -1 +1 @@
Subproject commit e6d835fa745550a043e18a3b850d0cb353ef9ae8 Subproject commit 438a8f4f73e54aa53cd9ac349f354601704a5862