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

View file

@ -1,16 +1,9 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<resources> <resources>
<!--Custom--> <!--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="wait_dialog_text">Uruchamianie</string>
<string name="notification_registered">%s zarejestrowany</string> <string name="notification_registered">%s zarejestrowany</string>
<string name="notification_register_failure">%s nie udało się zarejestrować</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_text">GNU General Public License V2\n © 2010-2016 Belledonne Communications</string>
<string name="about_link">www.linphone.org</string> <string name="about_link">www.linphone.org</string>
<string name="sync_account_name">kontakt linphone</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_linphone">Użyj konta Linphone</string>
<string name="assistant_login_generic">Użyj konta SIP</string> <string name="assistant_login_generic">Użyj konta SIP</string>
<string name="assistant_remote_provisioning">Pobierz zdalną konfigurację</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_display_name_optional">Wyświetl nazwę (opcjonalnie)</string>
<string name="assistant_linphone_account">Skonfiguruj konto Linphone</string> <string name="assistant_linphone_account">Skonfiguruj konto Linphone</string>
<string name="assistant_generic_account">Skonfiguruj konto SIP</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_audio">Audio</string>
<string name="call_stats_video">Video</string> <string name="call_stats_video">Video</string>
<string name="call_stats_codec">Codec:</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_upload">Upload bandwidth:</string>
<string name="call_stats_download">Download bandwidth:</string> <string name="call_stats_download">Download bandwidth:</string>
<string name="call_stats_ice">ICE connectivity:</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_sent">Sent video resolution:</string>
<string name="call_stats_video_resolution_received">Received 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_sender_loss_rate">Sender loss rate:</string>
<string name="call_stats_receiver_loss_rate">Receiver 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_encoder_name">Encoder:</string>
<string name="call_stats_decoder_name">Decoder:</string> <string name="call_stats_decoder_name">Decoder:</string>
<string name="call">Call</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 along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
import java.text.DecimalFormat;
import java.util.Timer; import java.util.Timer;
import java.util.TimerTask; import java.util.TimerTask;
@ -43,6 +44,7 @@ import android.graphics.drawable.Drawable;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import android.text.Html;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
@ -68,12 +70,12 @@ public class StatusFragment extends Fragment {
private LinphoneCoreListenerBase mListener; private LinphoneCoreListenerBase mListener;
private Dialog ZRTPdialog = null; private Dialog ZRTPdialog = null;
private int mDisplayedQuality = -1; private int mDisplayedQuality = -1;
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.status, container, false); View view = inflater.inflate(R.layout.status, container, false);
statusText = (TextView) view.findViewById(R.id.status_text); statusText = (TextView) view.findViewById(R.id.status_text);
statusLed = (ImageView) view.findViewById(R.id.status_led); statusLed = (ImageView) view.findViewById(R.id.status_led);
callQuality = (ImageView) view.findViewById(R.id.call_quality); 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 // We create it once to not delay the first display
populateSliderContent(); populateSliderContent();
mListener = new LinphoneCoreListenerBase(){ mListener = new LinphoneCoreListenerBase(){
@Override @Override
public void registrationState(final LinphoneCore lc, final LinphoneProxyConfig proxy, final LinphoneCore.RegistrationState state, String smessage) { 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)); statusLed.setImageResource(getStatusIconResource(state, true));
statusText.setText(getStatusIconText(state)); statusText.setText(getStatusIconText(state));
} }
try { try {
statusText.setOnClickListener(new OnClickListener() { statusText.setOnClickListener(new OnClickListener() {
@Override @Override
@ -116,10 +118,10 @@ public class StatusFragment extends Fragment {
}); });
} catch (IllegalStateException ise) {} } catch (IllegalStateException ise) {}
} }
@Override @Override
public void notifyReceived(LinphoneCore lc, LinphoneEvent ev, String eventName, LinphoneContent content) { public void notifyReceived(LinphoneCore lc, LinphoneEvent ev, String eventName, LinphoneContent content) {
if(!content.getType().equals("application")) return; if(!content.getType().equals("application")) return;
if(!content.getSubtype().equals("simple-message-summary")) return; if(!content.getSubtype().equals("simple-message-summary")) return;
@ -140,12 +142,12 @@ public class StatusFragment extends Fragment {
voicemailCount.setVisibility(View.GONE); voicemailCount.setVisibility(View.GONE);
} }
} }
}; };
isAttached = true; isAttached = true;
Activity activity = getActivity(); Activity activity = getActivity();
if (activity instanceof LinphoneActivity) { if (activity instanceof LinphoneActivity) {
((LinphoneActivity) activity).updateStatusFragment(this); ((LinphoneActivity) activity).updateStatusFragment(this);
isInCall = false; isInCall = false;
@ -164,14 +166,14 @@ public class StatusFragment extends Fragment {
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) { if (lc != null) {
lc.addListener(mListener); lc.addListener(mListener);
LinphoneProxyConfig lpc = lc.getDefaultProxyConfig(); LinphoneProxyConfig lpc = lc.getDefaultProxyConfig();
if (lpc != null) { if (lpc != null) {
mListener.registrationState(lc, lpc, lpc.getState(), null); mListener.registrationState(lc, lpc, lpc.getState(), null);
} }
} }
} }
@Override @Override
public void onDetach() { public void onDetach() {
super.onDetach(); super.onDetach();
@ -183,7 +185,7 @@ public class StatusFragment extends Fragment {
private void populateSliderContent() { private void populateSliderContent() {
if (LinphoneManager.isInstanciated() && LinphoneManager.getLc() != null) { if (LinphoneManager.isInstanciated() && LinphoneManager.getLc() != null) {
voicemailCount.setVisibility(View.GONE); voicemailCount.setVisibility(View.GONE);
if (isInCall && isAttached) { if (isInCall && isAttached) {
//LinphoneCall call = LinphoneManager.getLc().getCurrentCall(); //LinphoneCall call = LinphoneManager.getLc().getCurrentCall();
//initCallStatsRefresher(call, callStats); //initCallStatsRefresher(call, callStats);
@ -225,17 +227,17 @@ public class StatusFragment extends Fragment {
} catch (Exception e) { } catch (Exception e) {
Log.e(e); Log.e(e);
} }
return R.drawable.led_disconnected; return R.drawable.led_disconnected;
} }
private String getStatusIconText(LinphoneCore.RegistrationState state) { private String getStatusIconText(LinphoneCore.RegistrationState state) {
Context context = getActivity(); Context context = getActivity();
if (!isAttached && LinphoneActivity.isInstanciated()) if (!isAttached && LinphoneActivity.isInstanciated())
context = LinphoneActivity.instance(); context = LinphoneActivity.instance();
else if (!isAttached && LinphoneService.isReady()) else if (!isAttached && LinphoneService.isReady())
context = LinphoneService.instance(); context = LinphoneService.instance();
try { try {
if (state == RegistrationState.RegistrationOk && LinphoneManager.getLcIfManagerNotDestroyedOrNull().getDefaultProxyConfig().isRegistered()) { if (state == RegistrationState.RegistrationOk && LinphoneManager.getLcIfManagerNotDestroyedOrNull().getDefaultProxyConfig().isRegistered()) {
return context.getString(R.string.status_connected); return context.getString(R.string.status_connected);
@ -249,7 +251,7 @@ public class StatusFragment extends Fragment {
} catch (Exception e) { } catch (Exception e) {
Log.e(e); Log.e(e);
} }
return context.getString(R.string.status_not_connected); return context.getString(R.string.status_not_connected);
} }
@ -267,7 +269,7 @@ public class StatusFragment extends Fragment {
} }
float newQuality = mCurrentCall.getCurrentQuality(); float newQuality = mCurrentCall.getCurrentQuality();
updateQualityOfSignalIcon(newQuality); updateQualityOfSignalIcon(newQuality);
if (isInCall) { if (isInCall) {
refreshHandler.postDelayed(this, 1000); refreshHandler.postDelayed(this, 1000);
} else } else
@ -275,10 +277,10 @@ public class StatusFragment extends Fragment {
} }
}, 1000); }, 1000);
} }
void updateQualityOfSignalIcon(float quality) { void updateQualityOfSignalIcon(float quality) {
int iQuality = (int) quality; int iQuality = (int) quality;
if (iQuality == mDisplayedQuality) return; if (iQuality == mDisplayedQuality) return;
if (quality >= 4) // Good Quality if (quality >= 4) // Good Quality
{ {
@ -303,7 +305,7 @@ public class StatusFragment extends Fragment {
} }
mDisplayedQuality = iQuality; mDisplayedQuality = iQuality;
} }
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
@ -315,7 +317,7 @@ public class StatusFragment extends Fragment {
if (lpc != null) { if (lpc != null) {
mListener.registrationState(lc, lpc, lpc.getState(), null); mListener.registrationState(lc, lpc, lpc.getState(), null);
} }
LinphoneCall call = lc.getCurrentCall(); LinphoneCall call = lc.getCurrentCall();
if (isInCall && (call != null || lc.getConferenceSize() > 1 || lc.getCallsNb() > 0)) { if (isInCall && (call != null || lc.getConferenceSize() > 1 || lc.getCallsNb() > 0)) {
if (call != null) { if (call != null) {
@ -340,22 +342,22 @@ public class StatusFragment extends Fragment {
encryption.setVisibility(View.GONE); encryption.setVisibility(View.GONE);
} }
} }
@Override @Override
public void onPause() { public void onPause() {
super.onPause(); super.onPause();
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull(); LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) { if (lc != null) {
lc.removeListener(mListener); lc.removeListener(mListener);
} }
if (mCallQualityUpdater != null) { if (mCallQualityUpdater != null) {
refreshHandler.removeCallbacks(mCallQualityUpdater); refreshHandler.removeCallbacks(mCallQualityUpdater);
mCallQualityUpdater = null; mCallQualityUpdater = null;
} }
} }
public void refreshStatusItems(final LinphoneCall call, boolean isVideoEnabled) { public void refreshStatusItems(final LinphoneCall call, boolean isVideoEnabled) {
if (call != null) { if (call != null) {
voicemailCount.setVisibility(View.GONE); voicemailCount.setVisibility(View.GONE);
@ -366,7 +368,7 @@ public class StatusFragment extends Fragment {
} else { } else {
//background.setVisibility(View.VISIBLE); //background.setVisibility(View.VISIBLE);
} }
if (mediaEncryption == MediaEncryption.SRTP || (mediaEncryption == MediaEncryption.ZRTP && call.isAuthenticationTokenVerified()) || mediaEncryption == MediaEncryption.DTLS) { if (mediaEncryption == MediaEncryption.SRTP || (mediaEncryption == MediaEncryption.ZRTP && call.isAuthenticationTokenVerified()) || mediaEncryption == MediaEncryption.DTLS) {
encryption.setImageResource(R.drawable.security_ok); encryption.setImageResource(R.drawable.security_ok);
} else if (mediaEncryption == MediaEncryption.ZRTP && !call.isAuthenticationTokenVerified()) { } else if (mediaEncryption == MediaEncryption.ZRTP && !call.isAuthenticationTokenVerified()) {
@ -374,7 +376,7 @@ public class StatusFragment extends Fragment {
} else { } else {
encryption.setImageResource(R.drawable.security_ko); encryption.setImageResource(R.drawable.security_ko);
} }
if (mediaEncryption == MediaEncryption.ZRTP) { if (mediaEncryption == MediaEncryption.ZRTP) {
encryption.setOnClickListener(new OnClickListener() { encryption.setOnClickListener(new OnClickListener() {
@Override @Override
@ -387,7 +389,7 @@ public class StatusFragment extends Fragment {
} }
} }
} }
public void showZRTPDialog(final LinphoneCall call) { public void showZRTPDialog(final LinphoneCall call) {
if (getActivity() == null) { if (getActivity() == null) {
Log.w("Can't display ZRTP popup, no Activity"); 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 private void displayMediaStats(LinphoneCallParams params, LinphoneCallStats stats
, PayloadType media , View layout, TextView title, TextView codec, TextView dl , PayloadType media , View layout, TextView title, TextView codec, TextView dl
, TextView ul, TextView ice, TextView senderLossRate, TextView receiverLossRate , TextView ul, TextView ice, TextView ip, TextView senderLossRate
, TextView enc, TextView dec, TextView videoResolutionSent , TextView receiverLossRate, TextView enc, TextView dec, TextView videoResolutionSent
, TextView videoResolutionReceived, boolean isVideo) { , TextView videoResolutionReceived, boolean isVideo) {
if (stats != null) { if (stats != null) {
layout.setVisibility(View.VISIBLE); layout.setVisibility(View.VISIBLE);
@ -453,30 +459,44 @@ public class StatusFragment extends Fragment {
LinphoneManager.getInstance().getOpenH264DownloadHelper().isCodecFound()) { LinphoneManager.getInstance().getOpenH264DownloadHelper().isCodecFound()) {
mime = "OpenH264"; 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)); formatText(enc, getString(R.string.call_stats_encoder_name),
dec.setText(stats.getDecoderName(media)); stats.getEncoderName(media));
dl.setText(String.valueOf((int) stats.getDownloadBandwidth()) + " kbits/s"); formatText(dec, getString(R.string.call_stats_decoder_name),
ul.setText(String.valueOf((int) stats.getUploadBandwidth()) + " kbits/s"); stats.getDecoderName(media));
ice.setText(stats.getIceState().toString()); formatText(dl, getString(R.string.call_stats_download),
senderLossRate.setText(stats.getSenderLossRate() + "%"); String.valueOf((int) stats.getDownloadBandwidth()) + " kbits/s");
receiverLossRate.setText(stats.getReceiverLossRate()+ "%"); 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) { if (isVideo) {
videoResolutionSent.setText("\u2191 " + params.getSentVideoSize().toDisplayableString()); formatText(videoResolutionSent,
videoResolutionReceived.setText("\u2193 " + params.getReceivedVideoSize().toDisplayableString()); 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 { } else {
layout.setVisibility(View.GONE); layout.setVisibility(View.GONE);
title.setVisibility(TextView.GONE); title.setVisibility(TextView.GONE);
} }
} }
public void initCallStatsRefresher(final LinphoneCall call, final View view) { public void initCallStatsRefresher(final LinphoneCall call, final View view) {
if (mTimer != null && mTask != null) { if (mTimer != null && mTask != null) {
return; return;
} }
mTimer = new Timer(); mTimer = new Timer();
mTask = new TimerTask() { mTask = new TimerTask() {
@Override @Override
@ -506,17 +526,20 @@ public class StatusFragment extends Fragment {
final TextView receiverLossRateAudio = (TextView) view.findViewById(R.id.receiverLossRateAudio); final TextView receiverLossRateAudio = (TextView) view.findViewById(R.id.receiverLossRateAudio);
final TextView senderLossRateVideo = (TextView) view.findViewById(R.id.senderLossRateVideo); final TextView senderLossRateVideo = (TextView) view.findViewById(R.id.senderLossRateVideo);
final TextView receiverLossRateVideo = (TextView) view.findViewById(R.id.receiverLossRateVideo); 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 videoLayout = view.findViewById(R.id.callStatsVideo);
final View audioLayout = view.findViewById(R.id.callStatsAudio); final View audioLayout = view.findViewById(R.id.callStatsAudio);
if (titleAudio == null || codecAudio == null || dlVideo == null || iceAudio == null if (titleAudio == null || codecAudio == null || dlVideo == null || iceAudio == null
|| videoResolutionSent == null || videoLayout == null || titleVideo == null || videoResolutionSent == null || videoLayout == null || titleVideo == null
|| codecVideo == null || dlAudio == null || ulAudio == null || ipVideo == null || ipAudio == null || codecVideo == null
|| ulVideo == null || iceVideo == null || videoResolutionReceived == null) { || dlAudio == null || ulAudio == null || ulVideo == null || iceVideo == null
|| videoResolutionReceived == null) {
mTimer.cancel(); mTimer.cancel();
return; return;
} }
mHandler.post(new Runnable() { mHandler.post(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -534,13 +557,13 @@ public class StatusFragment extends Fragment {
displayMediaStats(params, audioStats, payloadAudio, audioLayout displayMediaStats(params, audioStats, payloadAudio, audioLayout
, titleAudio, codecAudio, dlAudio, ulAudio, iceAudio , titleAudio, codecAudio, dlAudio, ulAudio, iceAudio
, senderLossRateAudio, receiverLossRateAudio ,ipAudio, senderLossRateAudio, receiverLossRateAudio
, encoderAudio, decoderAudio, null, null , encoderAudio, decoderAudio, null, null
, false); , false);
displayMediaStats(params, videoStats, payloadVideo, videoLayout displayMediaStats(params, videoStats, payloadVideo, videoLayout
, titleVideo, codecVideo, dlVideo, ulVideo, iceVideo , titleVideo, codecVideo, dlVideo, ulVideo, iceVideo
, senderLossRateVideo, receiverLossRateVideo , ipVideo, senderLossRateVideo, receiverLossRateVideo
, encoderVideo, decoderVideo , encoderVideo, decoderVideo
, videoResolutionSent, videoResolutionReceived , videoResolutionSent, videoResolutionReceived
, true); , true);

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