diff --git a/res/layout/active_call.xml b/res/layout/active_call.xml
index 5f1c0d514..6c02c5a87 100644
--- a/res/layout/active_call.xml
+++ b/res/layout/active_call.xml
@@ -45,140 +45,11 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ android:gravity="center_horizontal|top"
+ linphone:picture="@drawable/unknown_small" />
\ No newline at end of file
diff --git a/res/layout/status.xml b/res/layout/status.xml
index 17f4f5bce..9b7f5f2ed 100644
--- a/res/layout/status.xml
+++ b/res/layout/status.xml
@@ -14,13 +14,143 @@
linphone:handle="@+id/handle"
linphone:content="@+id/content">
-
+ android:layout_height="wrap_content">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Aucun historique de chat.
Audio
+ Vidéo
Codec :
Bande passante envoi :
- Bande passante reception :
+ Bande passante réception :
Connexion ICE :
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 122e90beb..4402389a9 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -261,6 +261,7 @@
No chat history.
Audio
+ Video
Codec:
Upload bandwidth:
Download bandwidth:
diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml
index cd0c3d63e..5ac2b4d8d 100644
--- a/res/xml/preferences.xml
+++ b/res/xml/preferences.xml
@@ -86,10 +86,12 @@
+ android:title="@string/pref_codec_silk16"/>
diff --git a/src/org/linphone/AudioCallFragment.java b/src/org/linphone/AudioCallFragment.java
index 5c5f2ae5b..bf62090e0 100644
--- a/src/org/linphone/AudioCallFragment.java
+++ b/src/org/linphone/AudioCallFragment.java
@@ -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
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.LinphoneCall;
import org.linphone.core.LinphoneCall.State;
-import org.linphone.core.LinphoneCallStats;
import org.linphone.core.LinphoneCoreFactory;
import org.linphone.ui.AvatarWithShadow;
@@ -31,7 +27,6 @@ import android.app.Activity;
import android.content.res.Resources;
import android.net.Uri;
import android.os.Bundle;
-import android.os.Handler;
import android.os.SystemClock;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
@@ -45,7 +40,6 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
-import android.widget.ViewFlipper;
/**
* @author Sylvain Berfini
@@ -59,10 +53,6 @@ public class AudioCallFragment extends Fragment implements OnClickListener {
private static final int conferenceMargin = 20;
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 LayoutInflater inflater;
private ViewGroup container;
@@ -105,7 +95,7 @@ public class AudioCallFragment extends Fragment implements OnClickListener {
setContactName(callView, lAddress, sipUri, resources);
boolean hide = displayCallStatusIconAndReturnCallPaused(callView, call);
- displayOrHideContactPictureAndStats(resources, callView, pictureUri, call, hide);
+ displayOrHideContactPicture(callView, pictureUri, hide);
setRowBackgroundAndPadding(callView, resources, index, call, !hide);
registerCallDurationTimer(callView, call);
previousCallIsActive = !hide;
@@ -154,94 +144,11 @@ public class AudioCallFragment extends Fragment implements OnClickListener {
return isCallPaused || isInConference;
}
- private void displayOrHideContactPictureAndStats(Resources resources, LinearLayout callView, Uri pictureUri, LinphoneCall call, boolean hide) {
- ViewFlipper flipper = (ViewFlipper) callView.findViewById(R.id.flipper);
- flipper.setDisplayedChild(FLIPPER_AVATAR_VIEW);
-
+ private void displayOrHideContactPicture(LinearLayout callView, Uri pictureUri, boolean hide) {
AvatarWithShadow contactPicture = (AvatarWithShadow) callView.findViewById(R.id.contactPicture);
if (pictureUri != null) {
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) {
diff --git a/src/org/linphone/StatusFragment.java b/src/org/linphone/StatusFragment.java
index d966e292b..d24fe73a8 100644
--- a/src/org/linphone/StatusFragment.java
+++ b/src/org/linphone/StatusFragment.java
@@ -19,12 +19,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import java.util.ArrayList;
import java.util.List;
+import java.util.Timer;
+import java.util.TimerTask;
import org.linphone.core.LinphoneCall;
+import org.linphone.core.LinphoneCallStats;
import org.linphone.core.LinphoneCore;
import org.linphone.core.LinphoneCore.MediaEncryption;
import org.linphone.core.LinphoneCore.RegistrationState;
import org.linphone.core.LinphoneProxyConfig;
+import org.linphone.core.PayloadType;
import org.linphone.ui.SlidingDrawer;
import org.linphone.ui.SlidingDrawer.OnDrawerOpenListener;
@@ -44,6 +48,7 @@ import android.widget.BaseAdapter;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.ListView;
+import android.widget.TableLayout;
import android.widget.TextView;
import android.widget.Toast;
@@ -55,7 +60,8 @@ public class StatusFragment extends Fragment {
private Handler refreshHandler = new Handler();
private TextView statusText, exit;
private ImageView statusLed, callQuality, encryption, background;
- private ListView sliderContent;
+ private ListView sliderContentAccounts;
+ private TableLayout callStats;
private SlidingDrawer drawer;
// private LinearLayout allAccountsLed;
private Runnable mCallQualityUpdater;
@@ -76,6 +82,7 @@ public class StatusFragment extends Fragment {
encryption = (ImageView) view.findViewById(R.id.encryption);
background = (ImageView) view.findViewById(R.id.background);
// allAccountsLed = (LinearLayout) view.findViewById(R.id.moreStatusLed);
+ callStats = (TableLayout) view.findViewById(R.id.callStats);
drawer = (SlidingDrawer) view.findViewById(R.id.statusBar);
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.setOnClickListener(new OnClickListener() {
@@ -149,8 +156,18 @@ public class StatusFragment extends Fragment {
private void populateSliderContent() {
if (LinphoneManager.isInstanciated() && LinphoneManager.getLc() != null) {
- AccountsListAdapter adapter = new AccountsListAdapter();
- sliderContent.setAdapter(adapter);
+ sliderContentAccounts.setVisibility(View.GONE);
+ 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));
// setMiniLedsForEachAccount();
populateSliderContent();
- sliderContent.invalidate();
+ sliderContentAccounts.invalidate();
}
});
}
@@ -294,10 +311,6 @@ public class StatusFragment extends Fragment {
// We are obviously connected
statusLed.setImageResource(R.drawable.led_connected);
statusText.setText(getString(R.string.status_connected));
-
- if (drawer != null) {
- drawer.lock();
- }
} else {
exit.setVisibility(View.VISIBLE);
statusText.setVisibility(View.VISIBLE);
@@ -431,6 +444,71 @@ public class StatusFragment extends Fragment {
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 {
private SharedPreferences prefs;
private List checkboxes;