Popup to ask user to add or not video if policy doesn't accept automatically call updates added
This commit is contained in:
parent
d4d0e89c65
commit
5a7dedc836
4 changed files with 98 additions and 2 deletions
36
res/layout/accept_call_update_dialog.xml
Normal file
36
res/layout/accept_call_update_dialog.xml
Normal file
|
@ -0,0 +1,36 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:text="@string/call_update_desc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<LinearLayout
|
||||
android:gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/call_update_yes"
|
||||
android:id="@+id/yes" />
|
||||
|
||||
<Button
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/call_update_no"
|
||||
android:id="@+id/no" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -285,7 +285,7 @@
|
|||
<string name="button_delete_all">Tout supprimer</string>
|
||||
|
||||
<string name="button_transfer">Transfert</string>
|
||||
<string name="button_add_call">Ajouter appel</string>
|
||||
<string name="button_add_call">+ Appel</string>
|
||||
<string name="button_video">Vidéo</string>
|
||||
<string name="button_micro">Micro</string>
|
||||
<string name="button_speaker">Haut parleur</string>
|
||||
|
@ -295,6 +295,11 @@
|
|||
<string name="button_send_picture">Img</string>
|
||||
<string name="uploading_image">Envoi en cours…</string>
|
||||
|
||||
<string name="call_update_title">Mise à jour de l'appel</string>
|
||||
<string name="call_update_desc">Votre correspondant souhaite ajouter la vidéo à l\'appel en cours.</string>
|
||||
<string name="call_update_yes">Accepter</string>
|
||||
<string name="call_update_no">Refuser</string>
|
||||
|
||||
<string name="share_picture_size_small">Petite</string>
|
||||
<string name="share_picture_size_medium">Moyenne</string>
|
||||
<string name="share_picture_size_large">Grande</string>
|
||||
|
|
|
@ -346,6 +346,11 @@
|
|||
<string name="button_send_picture">Pic</string>
|
||||
<string name="uploading_image">Uploading…</string>
|
||||
|
||||
<string name="call_update_title">Call update requested</string>
|
||||
<string name="call_update_desc">Your correspondent would like to add video to the current call.</string>
|
||||
<string name="call_update_yes">Accept</string>
|
||||
<string name="call_update_no">Decline</string>
|
||||
|
||||
<string name="share_picture_size_small">Small</string>
|
||||
<string name="share_picture_size_medium">Medium</string>
|
||||
<string name="share_picture_size_large">Large</string>
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.linphone.core.LinphoneCall.State;
|
|||
import org.linphone.core.LinphoneCallParams;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCoreException;
|
||||
import org.linphone.core.Log;
|
||||
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
|
||||
import org.linphone.ui.Numpad;
|
||||
|
||||
|
@ -38,10 +39,13 @@ import android.os.Bundle;
|
|||
import android.os.CountDownTimer;
|
||||
import android.os.Handler;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
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.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -50,6 +54,7 @@ import android.view.animation.Animation;
|
|||
import android.view.animation.Animation.AnimationListener;
|
||||
import android.view.animation.AnimationUtils;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
@ -79,6 +84,7 @@ public class InCallActivity extends FragmentActivity implements
|
|||
private int cameraNumber;
|
||||
private Animation slideOutLeftToRight, slideInRightToLeft, slideInBottomToTop, slideInTopToBottom, slideOutBottomToTop, slideOutTopToBottom;
|
||||
private CountDownTimer timer;
|
||||
private AcceptCallUpdateDialog callUpdateDialog;
|
||||
|
||||
public static InCallActivity instance() {
|
||||
return instance;
|
||||
|
@ -817,6 +823,10 @@ public class InCallActivity extends FragmentActivity implements
|
|||
timer.cancel();
|
||||
}
|
||||
|
||||
if (callUpdateDialog != null) {
|
||||
callUpdateDialog.dismissAllowingStateLoss();
|
||||
}
|
||||
|
||||
LinphoneCall call = LinphoneManager.getLc().getCurrentCall();
|
||||
if (call == null) {
|
||||
return;
|
||||
|
@ -890,7 +900,7 @@ public class InCallActivity extends FragmentActivity implements
|
|||
if (remoteVideo && !localVideo && !autoAcceptCameraPolicy && !LinphoneManager.getLc().isInConference()) {
|
||||
mHandler.post(new Runnable() {
|
||||
public void run() {
|
||||
//TODO: ask the user it's choice
|
||||
showAcceptCallUpdateDialog();
|
||||
|
||||
// We let 30 secs for the user to decide
|
||||
timer = new CountDownTimer(30000, 1000) {
|
||||
|
@ -914,6 +924,12 @@ public class InCallActivity extends FragmentActivity implements
|
|||
transfer.setEnabled(LinphoneManager.getLc().getCurrentCall() != null);
|
||||
}
|
||||
|
||||
private void showAcceptCallUpdateDialog() {
|
||||
FragmentManager fm = getSupportFragmentManager();
|
||||
callUpdateDialog = new AcceptCallUpdateDialog();
|
||||
callUpdateDialog.show(fm, "Accept Call Update Dialog");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCallEncryptionChanged(final LinphoneCall call, boolean encrypted, String authenticationToken) {
|
||||
if (status != null) {
|
||||
|
@ -998,4 +1014,38 @@ public class InCallActivity extends FragmentActivity implements
|
|||
public void bindVideoFragment(VideoCallFragment fragment) {
|
||||
videoCallFragment = fragment;
|
||||
}
|
||||
|
||||
class AcceptCallUpdateDialog extends DialogFragment {
|
||||
|
||||
public AcceptCallUpdateDialog() {
|
||||
// Empty constructor required for DialogFragment
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.accept_call_update_dialog, container);
|
||||
|
||||
getDialog().setTitle(R.string.call_update_title);
|
||||
|
||||
Button yes = (Button) view.findViewById(R.id.yes);
|
||||
yes.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Log.d("Call Update Accepted");
|
||||
acceptCallUpdate(true);
|
||||
}
|
||||
});
|
||||
|
||||
Button no = (Button) view.findViewById(R.id.no);
|
||||
no.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Log.d("Call Update Denied");
|
||||
acceptCallUpdate(false);
|
||||
}
|
||||
});
|
||||
|
||||
return view;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue