Add spinner when video is asked

This commit is contained in:
Margaux Clerc 2014-09-12 16:57:27 +02:00
parent 94cd40f141
commit ea1da8d408
6 changed files with 125 additions and 27 deletions

View file

@ -80,16 +80,35 @@
android:gravity="center"
android:paddingTop="30dp" />
<TextView
android:id="@+id/video"
android:background="@drawable/video_off"
android:text="@string/button_video"
android:gravity="center"
android:paddingTop="30dp"
android:textColor="@drawable/text_incall_button_color"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center">
<TextView
android:id="@+id/video"
android:background="@drawable/video_off"
android:text="@string/button_video"
android:gravity="center"
android:paddingTop="30dp"
android:textColor="@drawable/text_incall_button_color"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<ProgressBar
android:id="@+id/videoInProgress"
style="?android:attr/progressBarStyle"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</RelativeLayout>
<TextView
android:id="@+id/micro"

View file

@ -144,7 +144,14 @@
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center">
<TextView
android:id="@+id/video"
android:background="@drawable/video_off"
android:text="@string/button_video"
@ -152,8 +159,18 @@
android:paddingTop="45dp"
android:textColor="@drawable/text_incall_button_color"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" />
android:layout_height="wrap_content" />
<ProgressBar
android:id="@+id/videoInProgress"
style="?android:attr/progressBarStyle"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</RelativeLayout>
<TextView
android:id="@+id/micro"

View file

@ -65,7 +65,13 @@
android:gravity="bottom"
android:orientation="horizontal" >
<TextView
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center">
<TextView
android:id="@+id/video"
android:background="@drawable/video_off"
android:text="@string/button_video"
@ -74,6 +80,17 @@
android:textColor="@drawable/text_incall_button_color"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<ProgressBar
android:id="@+id/videoInProgress"
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:visibility="gone" />
</RelativeLayout>
<TextView
android:id="@+id/micro"

View file

@ -64,8 +64,13 @@
android:layout_gravity="bottom"
android:gravity="bottom"
android:orientation="horizontal" >
<TextView
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center">
<TextView
android:id="@+id/video"
android:background="@drawable/video_off"
android:text="@string/button_video"
@ -74,6 +79,17 @@
android:textColor="@drawable/text_incall_button_color"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<ProgressBar
android:id="@+id/videoInProgress"
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:visibility="gone" />
</RelativeLayout>
<TextView
android:id="@+id/micro"

View file

@ -186,19 +186,35 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
android:orientation="horizontal">
<TextView
android:id="@+id/video"
android:background="@drawable/video_off"
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center">
<TextView
android:id="@+id/video"
android:background="@drawable/video_off"
android:text="@string/button_video"
android:gravity="center"
android:paddingTop="45dp"
android:textColor="@drawable/text_incall_button_color"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<ProgressBar
android:id="@+id/videoInProgress"
style="?android:attr/progressBarStyle"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" />
android:layout_height="wrap_content"/>
</RelativeLayout>
<TextView
android:id="@+id/micro"
android:background="@drawable/micro_on"
@ -209,7 +225,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" />
<TextView
android:id="@+id/speaker"
android:background="@drawable/speaker_off"

View file

@ -65,6 +65,7 @@ import android.widget.Button;
import android.widget.Chronometer;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TableLayout;
import android.widget.TextView;
import android.widget.Toast;
@ -88,6 +89,7 @@ public class InCallActivity extends FragmentActivity implements
private TextView pause, hangUp, dialer, video, micro, speaker, options, addCall, transfer, conference;
private TextView audioRoute, routeSpeaker, routeReceiver, routeBluetooth;
private LinearLayout routeLayout;
private ProgressBar videoProgress;
private StatusFragment status;
private AudioCallFragment audioCallFragment;
private VideoCallFragment videoCallFragment;
@ -230,6 +232,9 @@ public class InCallActivity extends FragmentActivity implements
dialer.setOnClickListener(this);
dialer.setEnabled(false);
numpad = (Numpad) findViewById(R.id.numpad);
videoProgress = (ProgressBar) findViewById(R.id.videoInProgress);
videoProgress.setVisibility(View.GONE);
try {
routeLayout = (LinearLayout) findViewById(R.id.routesLayout);
@ -383,7 +388,7 @@ public class InCallActivity extends FragmentActivity implements
}
if (id == R.id.video) {
enabledOrDisabledVideo(!isVideoEnabled(LinphoneManager.getLc().getCurrentCall()));
enabledOrDisabledVideo(isVideoEnabled(LinphoneManager.getLc().getCurrentCall()));
}
else if (id == R.id.micro) {
toggleMicro();
@ -464,12 +469,14 @@ public class InCallActivity extends FragmentActivity implements
mHandler.post(new Runnable() {
@Override
public void run() {
if (!isVideoEnabled) {
if (isVideoEnabled) {
video.setEnabled(true);
LinphoneCallParams params = call.getCurrentParamsCopy();
params.setVideoEnabled(false);
LinphoneManager.getLc().updateCall(call, params);
} else {
video.setEnabled(false);
videoProgress.setVisibility(View.VISIBLE);
if (!call.getRemoteParams().isLowBandwidthEnabled()) {
LinphoneManager.getInstance().addVideo();
} else {
@ -509,6 +516,9 @@ public class InCallActivity extends FragmentActivity implements
mHandler.post(new Runnable() {
@Override
public void run() {
//Check if the call is not terminated
if(call.getState() == State.CallEnd || call.getState() == State.CallReleased) return;
if (!displayVideo) {
showAudioView();
} else {
@ -540,7 +550,8 @@ public class InCallActivity extends FragmentActivity implements
}
video.setBackgroundResource(R.drawable.video_off);
video.setEnabled(true);
videoProgress.setVisibility(View.INVISIBLE);
LinphoneManager.stopProximitySensorForActivity(InCallActivity.this);
replaceFragmentAudioByVideo();
displayVideoCallControlsIfHidden();
@ -1140,7 +1151,8 @@ public class InCallActivity extends FragmentActivity implements
if (status != null) {
mHandler.post(new Runnable() {
@Override
public void run() {
public void run() {
videoProgress.setVisibility(View.GONE);
status.refreshStatusItems(call, isVideoEnabled(call));
}
});