Display message if video can't be enabled because correspondent using low bandwidth mode

This commit is contained in:
Sylvain Berfini 2013-01-08 11:04:58 +01:00
parent 78e21fe28a
commit 404bc2d789
4 changed files with 30 additions and 4 deletions

View file

@ -363,6 +363,7 @@
<string name="error_call_declined">Appel rejeté</string>
<string name="error_user_not_found">Utilisateur non trouvé</string>
<string name="error_incompatible_media">Paramètres média incompatibles</string>
<string name="error_low_bandwidth">Votre correspondant à un débit faible, la vidéo ne peut démarrer</string>
<string name="today">Aujourd\'hui</string>
<string name="yesterday">Hier</string>

View file

@ -410,6 +410,7 @@
<string name="error_call_declined">Call declined</string>
<string name="error_user_not_found">User not found</string>
<string name="error_incompatible_media">Incompatible media parameters</string>
<string name="error_low_bandwidth">Your correspondent has low bandwidth, video can\'t be started</string>
<string name="today">Today</string>
<string name="yesterday">Yesterday</string>

View file

@ -51,6 +51,7 @@ import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
@ -67,6 +68,7 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TableLayout;
import android.widget.TextView;
import android.widget.Toast;
/**
* @author Sylvain Berfini
@ -364,6 +366,25 @@ public class InCallActivity extends FragmentActivity implements
pauseOrResumeConference();
}
}
public void displayCustomToast(final String message, final int duration) {
mHandler.post(new Runnable() {
@Override
public void run() {
LayoutInflater inflater = getLayoutInflater();
View layout = inflater.inflate(R.layout.toast, (ViewGroup) findViewById(R.id.toastRoot));
TextView toastText = (TextView) layout.findViewById(R.id.toastMessage);
toastText.setText(message);
final Toast toast = new Toast(getApplicationContext());
toast.setGravity(Gravity.CENTER, 0, 0);
toast.setDuration(duration);
toast.setView(layout);
toast.show();
}
});
}
private void switchVideo(final boolean displayVideo) {
final LinphoneCall call = LinphoneManager.getLc().getCalls()[0];
@ -381,9 +402,12 @@ public class InCallActivity extends FragmentActivity implements
showAudioView();
} else {
LinphoneManager.getInstance().addVideo();
showVideoView();
if (!call.getRemoteParams().isLowBandwidthEnabled()) {
LinphoneManager.getInstance().addVideo();
showVideoView();
} else {
displayCustomToast(getString(R.string.error_low_bandwidth), Toast.LENGTH_LONG);
}
}
}
});

@ -1 +1 @@
Subproject commit 414fcf3841ee6c3b69cb9d52b35bdf6ef97a8ef7
Subproject commit 77ff807ee7f2c2a88cf12b8bfc49b3e51edc3cec