Fix default codecs + Modified call stats display
This commit is contained in:
parent
9313994e38
commit
69a4cf9f6a
7 changed files with 237 additions and 244 deletions
|
@ -45,140 +45,11 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<ViewFlipper
|
<org.linphone.ui.AvatarWithShadow
|
||||||
android:id="@+id/flipper"
|
android:id="@+id/contactPicture"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:gravity="center_horizontal|top"
|
||||||
android:paddingBottom="10dp">
|
linphone:picture="@drawable/unknown_small" />
|
||||||
|
|
||||||
<org.linphone.ui.AvatarWithShadow
|
|
||||||
android:id="@+id/contactPicture"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_horizontal|top"
|
|
||||||
linphone:picture="@drawable/unknown_small" />
|
|
||||||
|
|
||||||
<TableLayout
|
|
||||||
android:id="@+id/audioCallStats"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:padding="5dp">
|
|
||||||
|
|
||||||
<TableRow
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="left|center_vertical"
|
|
||||||
android:text="@string/call_stats_audio"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:textColor="@color/text_default"
|
|
||||||
android:textSize="18dp"/>
|
|
||||||
|
|
||||||
</TableRow>
|
|
||||||
|
|
||||||
<TableRow
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="left|center_vertical"
|
|
||||||
android:text="@string/call_stats_codec"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:textColor="@android:color/black"
|
|
||||||
android:textSize="14dp"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/audioCodec"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:paddingLeft="5dp"
|
|
||||||
android:gravity="right|center_vertical"
|
|
||||||
android:textColor="@android:color/black"
|
|
||||||
android:textSize="14dp"/>
|
|
||||||
|
|
||||||
</TableRow>
|
|
||||||
|
|
||||||
<TableRow
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="left|center_vertical"
|
|
||||||
android:text="@string/call_stats_upload"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:textColor="@android:color/black"
|
|
||||||
android:textSize="14dp"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/audioUploadBandwith"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:paddingLeft="5dp"
|
|
||||||
android:gravity="right|center_vertical"
|
|
||||||
android:textColor="@android:color/black"
|
|
||||||
android:textSize="14dp"/>
|
|
||||||
|
|
||||||
</TableRow>
|
|
||||||
|
|
||||||
<TableRow
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="left|center_vertical"
|
|
||||||
android:text="@string/call_stats_download"
|
|
||||||
android:textColor="@android:color/black"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:textSize="14dp"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/audioDownloadBandwith"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:paddingLeft="5dp"
|
|
||||||
android:gravity="right|center_vertical"
|
|
||||||
android:textColor="@android:color/black"
|
|
||||||
android:textSize="14dp"/>
|
|
||||||
|
|
||||||
</TableRow>
|
|
||||||
|
|
||||||
<TableRow
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="left|center_vertical"
|
|
||||||
android:text="@string/call_stats_ice"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:textColor="@android:color/black"
|
|
||||||
android:textSize="14dp"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/ice"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:paddingLeft="5dp"
|
|
||||||
android:gravity="right|center_vertical"
|
|
||||||
android:textColor="@android:color/black"
|
|
||||||
android:textSize="14dp"/>
|
|
||||||
|
|
||||||
</TableRow>
|
|
||||||
|
|
||||||
</TableLayout>
|
|
||||||
|
|
||||||
</ViewFlipper>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -14,13 +14,143 @@
|
||||||
linphone:handle="@+id/handle"
|
linphone:handle="@+id/handle"
|
||||||
linphone:content="@+id/content">
|
linphone:content="@+id/content">
|
||||||
|
|
||||||
<ListView
|
<RelativeLayout
|
||||||
android:id="@id/content"
|
android:id="@id/content"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content">
|
||||||
android:stackFromBottom="true"
|
|
||||||
android:paddingBottom="10dp"
|
<TableLayout
|
||||||
android:background="@android:color/black"/>
|
android:id="@+id/callStats"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:paddingBottom="10dp"
|
||||||
|
android:paddingLeft="5dp"
|
||||||
|
android:paddingRight="5dp"
|
||||||
|
android:background="@android:color/black">
|
||||||
|
|
||||||
|
<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:id="@+id/call_stats_title"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textColor="@color/text_default"
|
||||||
|
android:textSize="18dp"/>
|
||||||
|
|
||||||
|
</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_codec"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textSize="12dp"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/codec"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingLeft="5dp"
|
||||||
|
android:gravity="right|center_vertical"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textSize="12dp"/>
|
||||||
|
|
||||||
|
</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="@android:color/white"
|
||||||
|
android:textSize="12dp"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/uploadBandwith"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingLeft="5dp"
|
||||||
|
android:gravity="right|center_vertical"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textSize="12dp"/>
|
||||||
|
|
||||||
|
</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="@android:color/white"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textSize="12dp"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/downloadBandwith"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingLeft="5dp"
|
||||||
|
android:gravity="right|center_vertical"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textSize="12dp"/>
|
||||||
|
|
||||||
|
</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="@android:color/white"
|
||||||
|
android:textSize="12dp"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/ice"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingLeft="5dp"
|
||||||
|
android:gravity="right|center_vertical"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textSize="12dp"/>
|
||||||
|
|
||||||
|
</TableRow>
|
||||||
|
|
||||||
|
</TableLayout>
|
||||||
|
|
||||||
|
<ListView
|
||||||
|
android:id="@+id/accounts"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:stackFromBottom="true"
|
||||||
|
android:paddingBottom="10dp"
|
||||||
|
android:background="@android:color/black"/>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@id/handle"
|
android:id="@id/handle"
|
||||||
|
|
|
@ -211,9 +211,10 @@
|
||||||
<string name="no_chat_history">Aucun historique de chat.</string>
|
<string name="no_chat_history">Aucun historique de chat.</string>
|
||||||
|
|
||||||
<string name="call_stats_audio">Audio</string>
|
<string name="call_stats_audio">Audio</string>
|
||||||
|
<string name="call_stats_video">Vidéo</string>
|
||||||
<string name="call_stats_codec">Codec :</string>
|
<string name="call_stats_codec">Codec :</string>
|
||||||
<string name="call_stats_upload">Bande passante envoi :</string>
|
<string name="call_stats_upload">Bande passante envoi :</string>
|
||||||
<string name="call_stats_download">Bande passante reception :</string>
|
<string name="call_stats_download">Bande passante réception :</string>
|
||||||
<string name="call_stats_ice">Connexion ICE :</string>
|
<string name="call_stats_ice">Connexion ICE :</string>
|
||||||
|
|
||||||
<!-- Used by Android to help blind people by describing them images -->
|
<!-- Used by Android to help blind people by describing them images -->
|
||||||
|
|
|
@ -261,6 +261,7 @@
|
||||||
<string name="no_chat_history">No chat history.</string>
|
<string name="no_chat_history">No chat history.</string>
|
||||||
|
|
||||||
<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_codec">Codec:</string>
|
<string name="call_stats_codec">Codec:</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>
|
||||||
|
|
|
@ -86,10 +86,12 @@
|
||||||
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:key="@string/pref_codec_speex16_key"
|
android:key="@string/pref_codec_speex16_key"
|
||||||
|
android:defaultValue="true"
|
||||||
android:title="@string/pref_codec_speex16"/>
|
android:title="@string/pref_codec_speex16"/>
|
||||||
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:key="@string/pref_codec_speex8_key"
|
android:key="@string/pref_codec_speex8_key"
|
||||||
|
android:defaultValue="true"
|
||||||
android:title="@string/pref_codec_speex8"/>
|
android:title="@string/pref_codec_speex8"/>
|
||||||
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
|
@ -118,6 +120,7 @@
|
||||||
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:key="@string/pref_codec_gsm_key"
|
android:key="@string/pref_codec_gsm_key"
|
||||||
|
android:defaultValue="true"
|
||||||
android:title="@string/pref_codec_gsm"/>
|
android:title="@string/pref_codec_gsm"/>
|
||||||
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
|
@ -131,14 +134,16 @@
|
||||||
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:key="@string/pref_codec_silk16_key"
|
android:key="@string/pref_codec_silk16_key"
|
||||||
android:title="@string/pref_codec_silk16"/>
|
android:title="@string/pref_codec_silk16"/>
|
||||||
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:key="@string/pref_codec_pcmu_key"
|
android:key="@string/pref_codec_pcmu_key"
|
||||||
|
android:defaultValue="true"
|
||||||
android:title="@string/pref_codec_pcmu"/>
|
android:title="@string/pref_codec_pcmu"/>
|
||||||
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:key="@string/pref_codec_pcma_key"
|
android:key="@string/pref_codec_pcma_key"
|
||||||
|
android:defaultValue="true"
|
||||||
android:title="@string/pref_codec_pcma"/>
|
android:title="@string/pref_codec_pcma"/>
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
|
|
@ -17,13 +17,9 @@ 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
import java.util.Timer;
|
|
||||||
import java.util.TimerTask;
|
|
||||||
|
|
||||||
import org.linphone.core.LinphoneAddress;
|
import org.linphone.core.LinphoneAddress;
|
||||||
import org.linphone.core.LinphoneCall;
|
import org.linphone.core.LinphoneCall;
|
||||||
import org.linphone.core.LinphoneCall.State;
|
import org.linphone.core.LinphoneCall.State;
|
||||||
import org.linphone.core.LinphoneCallStats;
|
|
||||||
import org.linphone.core.LinphoneCoreFactory;
|
import org.linphone.core.LinphoneCoreFactory;
|
||||||
import org.linphone.ui.AvatarWithShadow;
|
import org.linphone.ui.AvatarWithShadow;
|
||||||
|
|
||||||
|
@ -31,7 +27,6 @@ import android.app.Activity;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
@ -45,7 +40,6 @@ import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.RelativeLayout;
|
import android.widget.RelativeLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.ViewFlipper;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Sylvain Berfini
|
* @author Sylvain Berfini
|
||||||
|
@ -59,10 +53,6 @@ public class AudioCallFragment extends Fragment implements OnClickListener {
|
||||||
private static final int conferenceMargin = 20;
|
private static final int conferenceMargin = 20;
|
||||||
private static final int topMarginWithImage = topMargin + rowImageHeight + botMarginIfImage;
|
private static final int topMarginWithImage = topMargin + rowImageHeight + botMarginIfImage;
|
||||||
|
|
||||||
private static final int FLIPPER_AVATAR_VIEW = 0;
|
|
||||||
private static final int FLIPPER_AUDIO_STATS_VIEW = 1;
|
|
||||||
|
|
||||||
private Handler mHandler = new Handler();
|
|
||||||
private RelativeLayout callsList;
|
private RelativeLayout callsList;
|
||||||
private LayoutInflater inflater;
|
private LayoutInflater inflater;
|
||||||
private ViewGroup container;
|
private ViewGroup container;
|
||||||
|
@ -105,7 +95,7 @@ public class AudioCallFragment extends Fragment implements OnClickListener {
|
||||||
|
|
||||||
setContactName(callView, lAddress, sipUri, resources);
|
setContactName(callView, lAddress, sipUri, resources);
|
||||||
boolean hide = displayCallStatusIconAndReturnCallPaused(callView, call);
|
boolean hide = displayCallStatusIconAndReturnCallPaused(callView, call);
|
||||||
displayOrHideContactPictureAndStats(resources, callView, pictureUri, call, hide);
|
displayOrHideContactPicture(callView, pictureUri, hide);
|
||||||
setRowBackgroundAndPadding(callView, resources, index, call, !hide);
|
setRowBackgroundAndPadding(callView, resources, index, call, !hide);
|
||||||
registerCallDurationTimer(callView, call);
|
registerCallDurationTimer(callView, call);
|
||||||
previousCallIsActive = !hide;
|
previousCallIsActive = !hide;
|
||||||
|
@ -154,94 +144,11 @@ public class AudioCallFragment extends Fragment implements OnClickListener {
|
||||||
return isCallPaused || isInConference;
|
return isCallPaused || isInConference;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void displayOrHideContactPictureAndStats(Resources resources, LinearLayout callView, Uri pictureUri, LinphoneCall call, boolean hide) {
|
private void displayOrHideContactPicture(LinearLayout callView, Uri pictureUri, boolean hide) {
|
||||||
ViewFlipper flipper = (ViewFlipper) callView.findViewById(R.id.flipper);
|
|
||||||
flipper.setDisplayedChild(FLIPPER_AVATAR_VIEW);
|
|
||||||
|
|
||||||
AvatarWithShadow contactPicture = (AvatarWithShadow) callView.findViewById(R.id.contactPicture);
|
AvatarWithShadow contactPicture = (AvatarWithShadow) callView.findViewById(R.id.contactPicture);
|
||||||
if (pictureUri != null) {
|
if (pictureUri != null) {
|
||||||
LinphoneUtils.setImagePictureFromUri(callView.getContext(), contactPicture.getView(), Uri.parse(pictureUri.toString()), R.drawable.unknown_small);
|
LinphoneUtils.setImagePictureFromUri(callView.getContext(), contactPicture.getView(), Uri.parse(pictureUri.toString()), R.drawable.unknown_small);
|
||||||
}
|
}
|
||||||
if (hide) {
|
|
||||||
flipper.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (resources.getBoolean(R.bool.display_call_stats)) {
|
|
||||||
View audioCallstats = callView.findViewById(R.id.audioCallStats);
|
|
||||||
if (call != null) {
|
|
||||||
flipper.setEnabled(true);
|
|
||||||
initAudioStatsRefresher(call, audioCallstats);
|
|
||||||
initFlipperListeners(flipper);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
flipper.setEnabled(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initAudioStatsRefresher(final LinphoneCall call, final View view) {
|
|
||||||
new Thread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
final Timer timer = new Timer();
|
|
||||||
TimerTask lTask = new TimerTask() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (call == null) {
|
|
||||||
timer.cancel();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final LinphoneCallStats audioStats = call.getAudioStats();
|
|
||||||
if (audioStats != null) {
|
|
||||||
mHandler.post(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
TextView codec = (TextView) view.findViewById(R.id.audioCodec);
|
|
||||||
TextView dl = (TextView) view.findViewById(R.id.audioDownloadBandwith);
|
|
||||||
TextView ul = (TextView) view.findViewById(R.id.audioUploadBandwith);
|
|
||||||
TextView ice = (TextView) view.findViewById(R.id.ice);
|
|
||||||
if (codec == null || dl == null || ul == null || ice == null) {
|
|
||||||
timer.cancel();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
codec.setText(call.getCurrentParamsCopy().getUsedAudioCodec().getMime());
|
|
||||||
dl.setText(String.valueOf((int) audioStats.getDownloadBandwidth()) + " kbits/s");
|
|
||||||
ul.setText(String.valueOf((int) audioStats.getUploadBandwidth()) + " kbits/s");
|
|
||||||
ice.setText(audioStats.getIceState().toString());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
timer.scheduleAtFixedRate(lTask, 0, 1500);
|
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initFlipperListeners(final ViewFlipper flipper) {
|
|
||||||
SwipeListener swipeListener = new SwipeListener() {
|
|
||||||
int currentView = FLIPPER_AVATAR_VIEW;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onLeftToRightSwipe() {
|
|
||||||
if (currentView == FLIPPER_AVATAR_VIEW) {
|
|
||||||
currentView = FLIPPER_AUDIO_STATS_VIEW;
|
|
||||||
} else {
|
|
||||||
currentView = FLIPPER_AVATAR_VIEW;
|
|
||||||
}
|
|
||||||
flipper.setDisplayedChild(currentView);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onRightToLeftSwipe() {
|
|
||||||
if (currentView == FLIPPER_AUDIO_STATS_VIEW) {
|
|
||||||
currentView = FLIPPER_AVATAR_VIEW;
|
|
||||||
} else {
|
|
||||||
currentView = FLIPPER_AUDIO_STATS_VIEW;
|
|
||||||
}
|
|
||||||
flipper.setDisplayedChild(currentView);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
flipper.setOnTouchListener(new SwipeGestureDetector(swipeListener));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setRowBackgroundAndPadding(LinearLayout callView, Resources resources, int index, LinphoneCall call, boolean active) {
|
private void setRowBackgroundAndPadding(LinearLayout callView, Resources resources, int index, LinphoneCall call, boolean active) {
|
||||||
|
|
|
@ -19,12 +19,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Timer;
|
||||||
|
import java.util.TimerTask;
|
||||||
|
|
||||||
import org.linphone.core.LinphoneCall;
|
import org.linphone.core.LinphoneCall;
|
||||||
|
import org.linphone.core.LinphoneCallStats;
|
||||||
import org.linphone.core.LinphoneCore;
|
import org.linphone.core.LinphoneCore;
|
||||||
import org.linphone.core.LinphoneCore.MediaEncryption;
|
import org.linphone.core.LinphoneCore.MediaEncryption;
|
||||||
import org.linphone.core.LinphoneCore.RegistrationState;
|
import org.linphone.core.LinphoneCore.RegistrationState;
|
||||||
import org.linphone.core.LinphoneProxyConfig;
|
import org.linphone.core.LinphoneProxyConfig;
|
||||||
|
import org.linphone.core.PayloadType;
|
||||||
import org.linphone.ui.SlidingDrawer;
|
import org.linphone.ui.SlidingDrawer;
|
||||||
import org.linphone.ui.SlidingDrawer.OnDrawerOpenListener;
|
import org.linphone.ui.SlidingDrawer.OnDrawerOpenListener;
|
||||||
|
|
||||||
|
@ -44,6 +48,7 @@ import android.widget.BaseAdapter;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
|
import android.widget.TableLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
@ -55,7 +60,8 @@ public class StatusFragment extends Fragment {
|
||||||
private Handler refreshHandler = new Handler();
|
private Handler refreshHandler = new Handler();
|
||||||
private TextView statusText, exit;
|
private TextView statusText, exit;
|
||||||
private ImageView statusLed, callQuality, encryption, background;
|
private ImageView statusLed, callQuality, encryption, background;
|
||||||
private ListView sliderContent;
|
private ListView sliderContentAccounts;
|
||||||
|
private TableLayout callStats;
|
||||||
private SlidingDrawer drawer;
|
private SlidingDrawer drawer;
|
||||||
// private LinearLayout allAccountsLed;
|
// private LinearLayout allAccountsLed;
|
||||||
private Runnable mCallQualityUpdater;
|
private Runnable mCallQualityUpdater;
|
||||||
|
@ -76,6 +82,7 @@ public class StatusFragment extends Fragment {
|
||||||
encryption = (ImageView) view.findViewById(R.id.encryption);
|
encryption = (ImageView) view.findViewById(R.id.encryption);
|
||||||
background = (ImageView) view.findViewById(R.id.background);
|
background = (ImageView) view.findViewById(R.id.background);
|
||||||
// allAccountsLed = (LinearLayout) view.findViewById(R.id.moreStatusLed);
|
// allAccountsLed = (LinearLayout) view.findViewById(R.id.moreStatusLed);
|
||||||
|
callStats = (TableLayout) view.findViewById(R.id.callStats);
|
||||||
|
|
||||||
drawer = (SlidingDrawer) view.findViewById(R.id.statusBar);
|
drawer = (SlidingDrawer) view.findViewById(R.id.statusBar);
|
||||||
drawer.setOnDrawerOpenListener(new OnDrawerOpenListener() {
|
drawer.setOnDrawerOpenListener(new OnDrawerOpenListener() {
|
||||||
|
@ -85,7 +92,7 @@ public class StatusFragment extends Fragment {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
sliderContent = (ListView) view.findViewById(R.id.content);
|
sliderContentAccounts = (ListView) view.findViewById(R.id.accounts);
|
||||||
|
|
||||||
exit = (TextView) view.findViewById(R.id.exit);
|
exit = (TextView) view.findViewById(R.id.exit);
|
||||||
exit.setOnClickListener(new OnClickListener() {
|
exit.setOnClickListener(new OnClickListener() {
|
||||||
|
@ -149,8 +156,18 @@ public class StatusFragment extends Fragment {
|
||||||
|
|
||||||
private void populateSliderContent() {
|
private void populateSliderContent() {
|
||||||
if (LinphoneManager.isInstanciated() && LinphoneManager.getLc() != null) {
|
if (LinphoneManager.isInstanciated() && LinphoneManager.getLc() != null) {
|
||||||
AccountsListAdapter adapter = new AccountsListAdapter();
|
sliderContentAccounts.setVisibility(View.GONE);
|
||||||
sliderContent.setAdapter(adapter);
|
callStats.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
if (isInCall && getResources().getBoolean(R.bool.display_call_stats)) {
|
||||||
|
callStats.setVisibility(View.VISIBLE);
|
||||||
|
LinphoneCall call = LinphoneManager.getLc().getCurrentCall();
|
||||||
|
initCallStatsRefresher(call, callStats);
|
||||||
|
} else if (!isInCall) {
|
||||||
|
sliderContentAccounts.setVisibility(View.VISIBLE);
|
||||||
|
AccountsListAdapter adapter = new AccountsListAdapter();
|
||||||
|
sliderContentAccounts.setAdapter(adapter);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,7 +183,7 @@ public class StatusFragment extends Fragment {
|
||||||
statusText.setText(getStatusIconText(state));
|
statusText.setText(getStatusIconText(state));
|
||||||
// setMiniLedsForEachAccount();
|
// setMiniLedsForEachAccount();
|
||||||
populateSliderContent();
|
populateSliderContent();
|
||||||
sliderContent.invalidate();
|
sliderContentAccounts.invalidate();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -294,10 +311,6 @@ public class StatusFragment extends Fragment {
|
||||||
// We are obviously connected
|
// We are obviously connected
|
||||||
statusLed.setImageResource(R.drawable.led_connected);
|
statusLed.setImageResource(R.drawable.led_connected);
|
||||||
statusText.setText(getString(R.string.status_connected));
|
statusText.setText(getString(R.string.status_connected));
|
||||||
|
|
||||||
if (drawer != null) {
|
|
||||||
drawer.lock();
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
exit.setVisibility(View.VISIBLE);
|
exit.setVisibility(View.VISIBLE);
|
||||||
statusText.setVisibility(View.VISIBLE);
|
statusText.setVisibility(View.VISIBLE);
|
||||||
|
@ -431,6 +444,71 @@ public class StatusFragment extends Fragment {
|
||||||
zrtpHack.start();
|
zrtpHack.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void initCallStatsRefresher(final LinphoneCall call, final View view) {
|
||||||
|
new Thread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
final Timer timer = new Timer();
|
||||||
|
TimerTask lTask = new TimerTask() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (call == null) {
|
||||||
|
timer.cancel();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final TextView title = (TextView) view.findViewById(R.id.call_stats_title);
|
||||||
|
final TextView codec = (TextView) view.findViewById(R.id.codec);
|
||||||
|
final TextView dl = (TextView) view.findViewById(R.id.downloadBandwith);
|
||||||
|
final TextView ul = (TextView) view.findViewById(R.id.uploadBandwith);
|
||||||
|
final TextView ice = (TextView) view.findViewById(R.id.ice);
|
||||||
|
if (codec == null || dl == null || ul == null || ice == null) {
|
||||||
|
timer.cancel();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (call.getCurrentParamsCopy().getVideoEnabled()) {
|
||||||
|
final LinphoneCallStats videoStats = call.getVideoStats();
|
||||||
|
if (videoStats != null) {
|
||||||
|
mHandler.post(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
title.setText(getString(R.string.call_stats_video));
|
||||||
|
PayloadType payload = call.getCurrentParamsCopy().getUsedVideoCodec();
|
||||||
|
if (payload != null) {
|
||||||
|
codec.setText(payload.getMime());
|
||||||
|
}
|
||||||
|
dl.setText(String.valueOf((int) videoStats.getDownloadBandwidth()) + " kbits/s");
|
||||||
|
ul.setText(String.valueOf((int) videoStats.getUploadBandwidth()) + " kbits/s");
|
||||||
|
ice.setText(videoStats.getIceState().toString());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
final LinphoneCallStats audioStats = call.getAudioStats();
|
||||||
|
if (audioStats != null) {
|
||||||
|
mHandler.post(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
title.setText(getString(R.string.call_stats_audio));
|
||||||
|
PayloadType payload = call.getCurrentParamsCopy().getUsedAudioCodec();
|
||||||
|
if (payload != null) {
|
||||||
|
codec.setText(payload.getMime());
|
||||||
|
}
|
||||||
|
dl.setText(String.valueOf((int) audioStats.getDownloadBandwidth()) + " kbits/s");
|
||||||
|
ul.setText(String.valueOf((int) audioStats.getUploadBandwidth()) + " kbits/s");
|
||||||
|
ice.setText(audioStats.getIceState().toString());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
timer.scheduleAtFixedRate(lTask, 0, 1500);
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
|
||||||
class AccountsListAdapter extends BaseAdapter {
|
class AccountsListAdapter extends BaseAdapter {
|
||||||
private SharedPreferences prefs;
|
private SharedPreferences prefs;
|
||||||
private List<CheckBox> checkboxes;
|
private List<CheckBox> checkboxes;
|
||||||
|
|
Loading…
Reference in a new issue