Upgrade in call stats view

This commit is contained in:
Erwan Croze 2016-10-14 15:28:00 +02:00
parent b3bfd69348
commit 88ed78ee32
5 changed files with 165 additions and 399 deletions

View file

@ -1,198 +1,104 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical|center"
android:id="@+id/call_stats_audio"
android:textStyle="bold"
android:textColor="@color/colorB"
android:textSize="18sp"
android:text="@string/call_stats_audio"
tools:gravity="center" />
<TableLayout
android:id="@+id/callStatsAudio"
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="left|center"
android:paddingBottom="10dp"
android:paddingLeft="5dp"
android:paddingRight="5dp">
android:layout_height="match_parent">
<TableRow
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:gravity="center_vertical|center"
android:id="@+id/call_stats_audio"
android:textStyle="bold"
android:textColor="@color/colorB"
android:textSize="18sp"
android:text="@string/call_stats_audio"
tools:gravity="center" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left|center_vertical"
android:text="@string/call_stats_codec"
android:textStyle="bold"
android:textColor="@color/colorB"
android:textSize="12sp"/>
<TableLayout
android:id="@+id/callStatsAudio"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="left|center"
android:paddingBottom="10dp"
android:paddingLeft="5dp"
android:paddingRight="5dp">
<TextView
android:id="@+id/codec_audio"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:paddingLeft="5dp"
android:gravity="right|center_vertical"
android:text="@string/call_stats_codec"
android:gravity="center"
android:textColor="@color/colorB"
android:textSize="12sp"/>
</TableRow>
<TableRow
android:stretchColumns="0"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left|center_vertical"
android:text="@string/call_stats_encoder_name"
android:textStyle="bold"
android:textColor="@color/colorB"
android:textSize="12sp"/>
</TableRow>
<TableRow
android:stretchColumns="0"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/encoder_audio"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:gravity="right|center_vertical"
android:textColor="@color/colorB"
android:textSize="12sp"/>
</TableRow>
<TableRow
android:stretchColumns="0"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left|center_vertical"
android:text="@string/call_stats_decoder_name"
android:textStyle="bold"
android:text="@string/call_stats_encoder_name"
android:gravity="center"
android:textColor="@color/colorB"
android:textSize="12sp"/>
</TableRow>
<TableRow
android:stretchColumns="0"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/decoder_audio"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:gravity="right|center_vertical"
android:text="@string/call_stats_decoder_name"
android:gravity="center"
android:textColor="@color/colorB"
android:textSize="12sp"/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left|center_vertical"
android:text="@string/call_stats_upload"
android:textStyle="bold"
android:textColor="@color/colorB"
android:textSize="12sp"/>
<TextView
android:id="@+id/uploadBandwith_audio"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:gravity="right|center_vertical"
android:text="@string/call_stats_upload"
android:gravity="center"
android:textColor="@color/colorB"
android:textSize="12sp"/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left|center_vertical"
android:text="@string/call_stats_download"
android:textColor="@color/colorB"
android:textStyle="bold"
android:textSize="12sp"/>
<TextView
android:id="@+id/downloadBandwith_audio"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:gravity="right|center_vertical"
android:text="@string/call_stats_download"
android:gravity="center"
android:textColor="@color/colorB"
android:textSize="12sp"/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left|center_vertical"
android:text="@string/call_stats_ice"
android:textStyle="bold"
android:textColor="@color/colorB"
android:textSize="12sp"/>
<TextView
android:id="@+id/ice_audio"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:gravity="right|center_vertical"
android:text="@string/call_stats_ice"
android:gravity="center"
android:textColor="@color/colorB"
android:textSize="12sp"/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:id="@+id/ip_audio"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="left|center_vertical"
android:text="@string/call_stats_sender_loss_rate"
android:textStyle="bold"
android:paddingLeft="5dp"
android:text="@string/call_stats_ip"
android:gravity="center"
android:textColor="@color/colorB"
android:textSize="12sp"/>
@ -201,154 +107,73 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:gravity="right|center_vertical"
android:text="@string/call_stats_sender_loss_rate"
android:gravity="center"
android:textColor="@color/colorB"
android:textSize="12sp"/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left|center_vertical"
android:text="@string/call_stats_receiver_loss_rate"
android:textStyle="bold"
android:textColor="@color/colorB"
android:textSize="12sp"/>
<TextView
android:id="@+id/receiverLossRateAudio"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:gravity="right|center_vertical"
android:text="@string/call_stats_receiver_loss_rate"
android:gravity="center"
android:textColor="@color/colorB"
android:textSize="12sp"/>
</TableRow>
</TableLayout>
</TableLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical|center"
android:id="@+id/call_stats_video"
android:textStyle="bold"
android:textColor="@color/colorB"
android:textSize="18sp"
android:text="@string/call_stats_video"
tools:gravity="center" />
<TableLayout
android:id="@+id/callStatsVideo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="left|center"
android:paddingBottom="10dp"
android:paddingLeft="5dp"
android:paddingRight="5dp">
<TableRow
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:gravity="center_vertical|center"
android:id="@+id/call_stats_video"
android:textStyle="bold"
android:textColor="@color/colorB"
android:textSize="18sp"
android:text="@string/call_stats_video"
tools:gravity="center" />
<TableLayout
android:id="@+id/callStatsVideo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="left|center"
android:paddingBottom="10dp"
android:paddingLeft="5dp"
android:paddingRight="5dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left|center_vertical"
android:text="@string/call_stats_codec"
android:textStyle="bold"
android:textColor="@color/colorB"
android:textSize="12sp"/>
<TextView
android:id="@+id/codec_video"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:gravity="right|center_vertical"
android:text="@string/call_stats_codec"
android:gravity="center"
android:textColor="@color/colorB"
android:textSize="12sp"/>
</TableRow>
<TableRow
android:stretchColumns="0"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left|center_vertical"
android:text="@string/call_stats_encoder_name"
android:textStyle="bold"
android:textColor="@color/colorB"
android:textSize="12sp"/>
</TableRow>
<TableRow
android:stretchColumns="0"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/encoder_video"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:gravity="right|center_vertical"
android:text="@string/call_stats_encoder_name"
android:gravity="center"
android:textColor="@color/colorB"
android:textSize="12sp"/>
</TableRow>
<TableRow
android:stretchColumns="0"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left|center_vertical"
android:text="@string/call_stats_decoder_name"
android:textStyle="bold"
android:textColor="@color/colorB"
android:textSize="12sp"/>
</TableRow>
<TableRow
android:stretchColumns="0"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/decoder_video"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:gravity="right|center_vertical"
android:textColor="@color/colorB"
android:textSize="12sp"/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left|center_vertical"
android:text="@string/call_stats_upload"
android:textStyle="bold"
android:text="@string/call_stats_decoder_name"
android:gravity="center"
android:textColor="@color/colorB"
android:textSize="12sp"/>
@ -357,46 +182,19 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:gravity="right|center_vertical"
android:text="@string/call_stats_upload"
android:gravity="center"
android:textColor="@color/colorB"
android:textSize="12sp"/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left|center_vertical"
android:text="@string/call_stats_download"
android:textColor="@color/colorB"
android:textStyle="bold"
android:textSize="12sp"/>
<TextView
android:id="@+id/downloadBandwith_video"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:gravity="right|center_vertical"
android:textColor="@color/colorB"
android:textSize="12sp"/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left|center_vertical"
android:text="@string/call_stats_ice"
android:textStyle="bold"
android:text="@string/call_stats_download"
android:gravity="center"
android:textColor="@color/colorB"
android:textSize="12sp"/>
@ -405,22 +203,18 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:gravity="right|center_vertical"
android:text="@string/call_stats_ice"
android:gravity="center"
android:textColor="@color/colorB"
android:textSize="12sp"/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:id="@+id/ip_video"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="left|center_vertical"
android:text="@string/call_stats_sender_loss_rate"
android:textStyle="bold"
android:paddingLeft="5dp"
android:text="@string/call_stats_ip"
android:gravity="center"
android:textColor="@color/colorB"
android:textSize="12sp"/>
@ -429,47 +223,19 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:gravity="right|center_vertical"
android:text="@string/call_stats_sender_loss_rate"
android:gravity="center"
android:textColor="@color/colorB"
android:textSize="12sp"/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left|center_vertical"
android:text="@string/call_stats_receiver_loss_rate"
android:textStyle="bold"
android:textColor="@color/colorB"
android:textSize="12sp"/>
<TextView
android:id="@+id/receiverLossRateVideo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:gravity="right|center_vertical"
android:textColor="@color/colorB"
android:textSize="12sp"/>
</TableRow>
<TableRow
android:id="@+id/video_resolution_layout_sent"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left|center_vertical"
android:text="@string/call_stats_video_resolution_sent"
android:textStyle="bold"
android:text="@string/call_stats_receiver_loss_rate"
android:gravity="center"
android:textColor="@color/colorB"
android:textSize="12sp"/>
@ -478,37 +244,22 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:gravity="right|center_vertical"
android:text="@string/call_stats_video_resolution_sent"
android:gravity="center"
android:textColor="@color/colorB"
android:textSize="12sp"/>
</TableRow>
<TableRow
android:id="@+id/video_resolution_layout_received"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left|center_vertical"
android:text="@string/call_stats_video_resolution_received"
android:textStyle="bold"
android:textColor="@color/colorB"
android:textSize="12sp"/>
<TextView
android:id="@+id/video_resolution_received"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:gravity="right|center_vertical"
android:text="@string/call_stats_video_resolution_received"
android:gravity="center"
android:textColor="@color/colorB"
android:textSize="12sp"/>
</TableRow>
</TableLayout>
</LinearLayout>
</TableLayout>
</LinearLayout>
</ScrollView>

View file

@ -1,16 +1,9 @@
<?xml version='1.0' encoding='UTF-8'?>
<resources>
<!--Custom-->
<string name="app_name">Linphone</string>
<string name="service_name">Linphone Service</string>
<string name="addressbook_label">Linphone</string>
<string name="notification_title">Linphone</string>
<string name="wait_dialog_text">Uruchamianie</string>
<string name="notification_registered">%s zarejestrowany</string>
<string name="notification_register_failure">%s nie udało się zarejestrować</string>
<string name="tunnel_host"></string>
<string name="about_version">Linphone Android %s</string>
<string name="about_liblinphone_version">Linphone Core %s</string>
<string name="about_text">GNU General Public License V2\n © 2010-2016 Belledonne Communications</string>
<string name="about_link">www.linphone.org</string>
<string name="sync_account_name">kontakt linphone</string>
@ -60,8 +53,6 @@
<string name="assistant_login_linphone">Użyj konta Linphone</string>
<string name="assistant_login_generic">Użyj konta SIP</string>
<string name="assistant_remote_provisioning">Pobierz zdalną konfigurację</string>
<string name="assistant_create_account_part_1">1/2</string>
<string name="assistant_create_account_part_2">2/2</string>
<string name="assistant_display_name_optional">Wyświetl nazwę (opcjonalnie)</string>
<string name="assistant_linphone_account">Skonfiguruj konto Linphone</string>
<string name="assistant_generic_account">Skonfiguruj konto SIP</string>

View file

@ -207,13 +207,14 @@
<string name="call_stats_audio">Audio</string>
<string name="call_stats_video">Video</string>
<string name="call_stats_codec">Codec:</string>
<string name="call_stats_ip">Afinet:</string>
<string name="call_stats_upload">Upload bandwidth:</string>
<string name="call_stats_download">Download bandwidth:</string>
<string name="call_stats_ice">ICE connectivity:</string>
<string name="call_stats_video_resolution_sent">Sent video resolution:</string>
<string name="call_stats_video_resolution_received">Received video resolution:</string>
<string name="call_stats_sender_loss_rate">Sender loss rate</string>
<string name="call_stats_receiver_loss_rate">Receiver loss rate</string>
<string name="call_stats_sender_loss_rate">Sender loss rate:</string>
<string name="call_stats_receiver_loss_rate">Receiver loss rate:</string>
<string name="call_stats_encoder_name">Encoder:</string>
<string name="call_stats_decoder_name">Decoder:</string>
<string name="call">Call</string>

View file

@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import java.text.DecimalFormat;
import java.util.Timer;
import java.util.TimerTask;
@ -43,6 +44,7 @@ import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.content.ContextCompat;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
@ -68,12 +70,12 @@ public class StatusFragment extends Fragment {
private LinphoneCoreListenerBase mListener;
private Dialog ZRTPdialog = null;
private int mDisplayedQuality = -1;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.status, container, false);
statusText = (TextView) view.findViewById(R.id.status_text);
statusLed = (ImageView) view.findViewById(R.id.status_led);
callQuality = (ImageView) view.findViewById(R.id.call_quality);
@ -84,7 +86,7 @@ public class StatusFragment extends Fragment {
// We create it once to not delay the first display
populateSliderContent();
mListener = new LinphoneCoreListenerBase(){
@Override
public void registrationState(final LinphoneCore lc, final LinphoneProxyConfig proxy, final LinphoneCore.RegistrationState state, String smessage) {
@ -106,7 +108,7 @@ public class StatusFragment extends Fragment {
statusLed.setImageResource(getStatusIconResource(state, true));
statusText.setText(getStatusIconText(state));
}
try {
statusText.setOnClickListener(new OnClickListener() {
@Override
@ -116,10 +118,10 @@ public class StatusFragment extends Fragment {
});
} catch (IllegalStateException ise) {}
}
@Override
public void notifyReceived(LinphoneCore lc, LinphoneEvent ev, String eventName, LinphoneContent content) {
if(!content.getType().equals("application")) return;
if(!content.getSubtype().equals("simple-message-summary")) return;
@ -140,12 +142,12 @@ public class StatusFragment extends Fragment {
voicemailCount.setVisibility(View.GONE);
}
}
};
isAttached = true;
Activity activity = getActivity();
if (activity instanceof LinphoneActivity) {
((LinphoneActivity) activity).updateStatusFragment(this);
isInCall = false;
@ -164,14 +166,14 @@ public class StatusFragment extends Fragment {
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) {
lc.addListener(mListener);
LinphoneProxyConfig lpc = lc.getDefaultProxyConfig();
if (lpc != null) {
mListener.registrationState(lc, lpc, lpc.getState(), null);
}
}
}
@Override
public void onDetach() {
super.onDetach();
@ -183,7 +185,7 @@ public class StatusFragment extends Fragment {
private void populateSliderContent() {
if (LinphoneManager.isInstanciated() && LinphoneManager.getLc() != null) {
voicemailCount.setVisibility(View.GONE);
if (isInCall && isAttached) {
//LinphoneCall call = LinphoneManager.getLc().getCurrentCall();
//initCallStatsRefresher(call, callStats);
@ -225,17 +227,17 @@ public class StatusFragment extends Fragment {
} catch (Exception e) {
Log.e(e);
}
return R.drawable.led_disconnected;
}
private String getStatusIconText(LinphoneCore.RegistrationState state) {
Context context = getActivity();
if (!isAttached && LinphoneActivity.isInstanciated())
context = LinphoneActivity.instance();
else if (!isAttached && LinphoneService.isReady())
context = LinphoneService.instance();
try {
if (state == RegistrationState.RegistrationOk && LinphoneManager.getLcIfManagerNotDestroyedOrNull().getDefaultProxyConfig().isRegistered()) {
return context.getString(R.string.status_connected);
@ -249,7 +251,7 @@ public class StatusFragment extends Fragment {
} catch (Exception e) {
Log.e(e);
}
return context.getString(R.string.status_not_connected);
}
@ -267,7 +269,7 @@ public class StatusFragment extends Fragment {
}
float newQuality = mCurrentCall.getCurrentQuality();
updateQualityOfSignalIcon(newQuality);
if (isInCall) {
refreshHandler.postDelayed(this, 1000);
} else
@ -275,10 +277,10 @@ public class StatusFragment extends Fragment {
}
}, 1000);
}
void updateQualityOfSignalIcon(float quality) {
int iQuality = (int) quality;
if (iQuality == mDisplayedQuality) return;
if (quality >= 4) // Good Quality
{
@ -303,7 +305,7 @@ public class StatusFragment extends Fragment {
}
mDisplayedQuality = iQuality;
}
@Override
public void onResume() {
super.onResume();
@ -315,7 +317,7 @@ public class StatusFragment extends Fragment {
if (lpc != null) {
mListener.registrationState(lc, lpc, lpc.getState(), null);
}
LinphoneCall call = lc.getCurrentCall();
if (isInCall && (call != null || lc.getConferenceSize() > 1 || lc.getCallsNb() > 0)) {
if (call != null) {
@ -340,22 +342,22 @@ public class StatusFragment extends Fragment {
encryption.setVisibility(View.GONE);
}
}
@Override
public void onPause() {
super.onPause();
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) {
lc.removeListener(mListener);
}
if (mCallQualityUpdater != null) {
refreshHandler.removeCallbacks(mCallQualityUpdater);
mCallQualityUpdater = null;
}
}
public void refreshStatusItems(final LinphoneCall call, boolean isVideoEnabled) {
if (call != null) {
voicemailCount.setVisibility(View.GONE);
@ -366,7 +368,7 @@ public class StatusFragment extends Fragment {
} else {
//background.setVisibility(View.VISIBLE);
}
if (mediaEncryption == MediaEncryption.SRTP || (mediaEncryption == MediaEncryption.ZRTP && call.isAuthenticationTokenVerified()) || mediaEncryption == MediaEncryption.DTLS) {
encryption.setImageResource(R.drawable.security_ok);
} else if (mediaEncryption == MediaEncryption.ZRTP && !call.isAuthenticationTokenVerified()) {
@ -374,7 +376,7 @@ public class StatusFragment extends Fragment {
} else {
encryption.setImageResource(R.drawable.security_ko);
}
if (mediaEncryption == MediaEncryption.ZRTP) {
encryption.setOnClickListener(new OnClickListener() {
@Override
@ -387,7 +389,7 @@ public class StatusFragment extends Fragment {
}
}
}
public void showZRTPDialog(final LinphoneCall call) {
if (getActivity() == null) {
Log.w("Can't display ZRTP popup, no Activity");
@ -438,10 +440,14 @@ public class StatusFragment extends Fragment {
}
}
private void formatText(TextView tv, String name, String value) {
tv.setText(Html.fromHtml("<b>" + name + " </b>" + value));
}
private void displayMediaStats(LinphoneCallParams params, LinphoneCallStats stats
, PayloadType media , View layout, TextView title, TextView codec, TextView dl
, TextView ul, TextView ice, TextView senderLossRate, TextView receiverLossRate
, TextView enc, TextView dec, TextView videoResolutionSent
, TextView ul, TextView ice, TextView ip, TextView senderLossRate
, TextView receiverLossRate, TextView enc, TextView dec, TextView videoResolutionSent
, TextView videoResolutionReceived, boolean isVideo) {
if (stats != null) {
layout.setVisibility(View.VISIBLE);
@ -453,30 +459,44 @@ public class StatusFragment extends Fragment {
LinphoneManager.getInstance().getOpenH264DownloadHelper().isCodecFound()) {
mime = "OpenH264";
}
codec.setText(mime + " / " + (media.getRate() / 1000) + "kHz");
formatText(codec, getString(R.string.call_stats_codec),
mime + " / " + (media.getRate() / 1000) + "kHz");
}
enc.setText(stats.getEncoderName(media));
dec.setText(stats.getDecoderName(media));
dl.setText(String.valueOf((int) stats.getDownloadBandwidth()) + " kbits/s");
ul.setText(String.valueOf((int) stats.getUploadBandwidth()) + " kbits/s");
ice.setText(stats.getIceState().toString());
senderLossRate.setText(stats.getSenderLossRate() + "%");
receiverLossRate.setText(stats.getReceiverLossRate()+ "%");
formatText(enc, getString(R.string.call_stats_encoder_name),
stats.getEncoderName(media));
formatText(dec, getString(R.string.call_stats_decoder_name),
stats.getDecoderName(media));
formatText(dl, getString(R.string.call_stats_download),
String.valueOf((int) stats.getDownloadBandwidth()) + " kbits/s");
formatText(ul, getString(R.string.call_stats_upload),
String.valueOf((int) stats.getUploadBandwidth()) + " kbits/s");
formatText(ice, getString(R.string.call_stats_ice),
stats.getIceState().toString());
formatText(ip, getString(R.string.call_stats_ip),
(stats.getIsIpV6Active()) ? "IpV6" : "IpV4");
formatText(senderLossRate, getString(R.string.call_stats_sender_loss_rate),
new DecimalFormat("##.##").format(stats.getSenderLossRate()) + "%");
formatText(receiverLossRate, getString(R.string.call_stats_receiver_loss_rate),
new DecimalFormat("##.##").format(stats.getReceiverLossRate())+ "%");
if (isVideo) {
videoResolutionSent.setText("\u2191 " + params.getSentVideoSize().toDisplayableString());
videoResolutionReceived.setText("\u2193 " + params.getReceivedVideoSize().toDisplayableString());
formatText(videoResolutionSent,
getString(R.string.call_stats_video_resolution_sent),
"\u2191 " + params.getSentVideoSize().toDisplayableString());
formatText(videoResolutionReceived,
getString(R.string.call_stats_video_resolution_received),
"\u2193 " + params.getReceivedVideoSize().toDisplayableString());
}
} else {
layout.setVisibility(View.GONE);
title.setVisibility(TextView.GONE);
}
}
public void initCallStatsRefresher(final LinphoneCall call, final View view) {
if (mTimer != null && mTask != null) {
return;
}
mTimer = new Timer();
mTask = new TimerTask() {
@Override
@ -506,17 +526,20 @@ public class StatusFragment extends Fragment {
final TextView receiverLossRateAudio = (TextView) view.findViewById(R.id.receiverLossRateAudio);
final TextView senderLossRateVideo = (TextView) view.findViewById(R.id.senderLossRateVideo);
final TextView receiverLossRateVideo = (TextView) view.findViewById(R.id.receiverLossRateVideo);
final TextView ipAudio = (TextView) view.findViewById(R.id.ip_audio);
final TextView ipVideo = (TextView) view.findViewById(R.id.ip_video);
final View videoLayout = view.findViewById(R.id.callStatsVideo);
final View audioLayout = view.findViewById(R.id.callStatsAudio);
if (titleAudio == null || codecAudio == null || dlVideo == null || iceAudio == null
|| videoResolutionSent == null || videoLayout == null || titleVideo == null
|| codecVideo == null || dlAudio == null || ulAudio == null
|| ulVideo == null || iceVideo == null || videoResolutionReceived == null) {
|| ipVideo == null || ipAudio == null || codecVideo == null
|| dlAudio == null || ulAudio == null || ulVideo == null || iceVideo == null
|| videoResolutionReceived == null) {
mTimer.cancel();
return;
}
mHandler.post(new Runnable() {
@Override
public void run() {
@ -534,13 +557,13 @@ public class StatusFragment extends Fragment {
displayMediaStats(params, audioStats, payloadAudio, audioLayout
, titleAudio, codecAudio, dlAudio, ulAudio, iceAudio
, senderLossRateAudio, receiverLossRateAudio
,ipAudio, senderLossRateAudio, receiverLossRateAudio
, encoderAudio, decoderAudio, null, null
, false);
displayMediaStats(params, videoStats, payloadVideo, videoLayout
, titleVideo, codecVideo, dlVideo, ulVideo, iceVideo
, senderLossRateVideo, receiverLossRateVideo
, ipVideo, senderLossRateVideo, receiverLossRateVideo
, encoderVideo, decoderVideo
, videoResolutionSent, videoResolutionReceived
, true);

@ -1 +1 @@
Subproject commit a56c6bb514eaf40876ea2d98ea16f23e608a48c5
Subproject commit 36c73a9d0abf498253c3f437fb14849ae8d158d6