Better incall animation for switch camera button
8
res/anim/slide_in_top_to_bottom.xml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shareInterpolator="false">
|
||||||
|
<translate
|
||||||
|
android:fromXDelta="0%" android:toXDelta="0%"
|
||||||
|
android:fromYDelta="-100%" android:toYDelta="0%"
|
||||||
|
android:duration="350"/>
|
||||||
|
</set>
|
8
res/anim/slide_out_bottom_to_top.xml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shareInterpolator="false">
|
||||||
|
<translate
|
||||||
|
android:fromXDelta="0%" android:toXDelta="0%"
|
||||||
|
android:fromYDelta="00%" android:toYDelta="-100%"
|
||||||
|
android:duration="350"/>
|
||||||
|
</set>
|
Before Width: | Height: | Size: 6.5 KiB |
Before Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 6.6 KiB |
|
@ -1,9 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<item android:state_pressed="true"
|
|
||||||
android:drawable="@drawable/incall_contact_over" />
|
|
||||||
<item android:state_selected="true"
|
|
||||||
android:drawable="@drawable/incall_contact_over" />
|
|
||||||
<item
|
|
||||||
android:drawable="@drawable/incall_contact_actif" />
|
|
||||||
</selector>
|
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
@ -9,7 +9,6 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dip"
|
android:layout_height="0dip"
|
||||||
|
@ -21,13 +20,22 @@
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="horizontal" />
|
android:orientation="horizontal" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/switchCamera"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:contentDescription="@string/content_description_switch_camera"
|
||||||
|
android:src="@drawable/switch_camera" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/menu"
|
android:id="@+id/menu"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="150dp"
|
android:layout_height="150dp"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
|
|
@ -16,14 +16,5 @@
|
||||||
android:layout_height="145dp"
|
android:layout_height="145dp"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:layout_alignParentRight="true" />
|
android:layout_alignParentRight="true" />
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/switchCamera"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignParentLeft="true"
|
|
||||||
android:layout_alignParentTop="true"
|
|
||||||
android:contentDescription="@string/content_description_switch_camera"
|
|
||||||
android:src="@drawable/switch_camera" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
|
@ -56,9 +56,10 @@ public class InCallActivity extends FragmentActivity implements
|
||||||
private Handler mHandler = new Handler();
|
private Handler mHandler = new Handler();
|
||||||
private Handler controlsHandler = new Handler();
|
private Handler controlsHandler = new Handler();
|
||||||
private Runnable mControls;
|
private Runnable mControls;
|
||||||
private ImageView video, micro, speaker, addCall, pause, hangUp, dialer;
|
private ImageView video, micro, speaker, addCall, pause, hangUp, dialer, switchCamera;
|
||||||
private StatusFragment status;
|
private StatusFragment status;
|
||||||
private AudioCallFragment audioCallFragment;
|
private AudioCallFragment audioCallFragment;
|
||||||
|
private VideoCallFragment videoCallFragment;
|
||||||
private boolean isSpeakerEnabled, isMicMuted, isVideoEnabled;
|
private boolean isSpeakerEnabled, isMicMuted, isVideoEnabled;
|
||||||
private LinearLayout mControlsLayout;
|
private LinearLayout mControlsLayout;
|
||||||
|
|
||||||
|
@ -89,9 +90,12 @@ public class InCallActivity extends FragmentActivity implements
|
||||||
Fragment callFragment;
|
Fragment callFragment;
|
||||||
if (isVideoEnabled) {
|
if (isVideoEnabled) {
|
||||||
callFragment = new VideoCallFragment();
|
callFragment = new VideoCallFragment();
|
||||||
|
videoCallFragment = (VideoCallFragment) callFragment;
|
||||||
|
switchCamera.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
callFragment = new AudioCallFragment();
|
callFragment = new AudioCallFragment();
|
||||||
audioCallFragment = (AudioCallFragment) callFragment;
|
audioCallFragment = (AudioCallFragment) callFragment;
|
||||||
|
switchCamera.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
callFragment.setArguments(getIntent().getExtras());
|
callFragment.setArguments(getIntent().getExtras());
|
||||||
getSupportFragmentManager().beginTransaction().add(R.id.fragmentContainer, callFragment).commit();
|
getSupportFragmentManager().beginTransaction().add(R.id.fragmentContainer, callFragment).commit();
|
||||||
|
@ -116,6 +120,9 @@ public class InCallActivity extends FragmentActivity implements
|
||||||
dialer = (ImageView) findViewById(R.id.dialer);
|
dialer = (ImageView) findViewById(R.id.dialer);
|
||||||
dialer.setOnClickListener(this);
|
dialer.setOnClickListener(this);
|
||||||
|
|
||||||
|
switchCamera = (ImageView) findViewById(R.id.switchCamera);
|
||||||
|
switchCamera.setOnClickListener(this);
|
||||||
|
|
||||||
mControlsLayout = (LinearLayout) findViewById(R.id.menu);
|
mControlsLayout = (LinearLayout) findViewById(R.id.menu);
|
||||||
|
|
||||||
if (isVideoEnabled) {
|
if (isVideoEnabled) {
|
||||||
|
@ -164,6 +171,11 @@ public class InCallActivity extends FragmentActivity implements
|
||||||
else if (id == R.id.dialer) {
|
else if (id == R.id.dialer) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else if (id == R.id.switchCamera) {
|
||||||
|
if (videoCallFragment != null) {
|
||||||
|
videoCallFragment.switchCamera();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -207,11 +219,12 @@ public class InCallActivity extends FragmentActivity implements
|
||||||
}
|
}
|
||||||
|
|
||||||
private void replaceFragmentAudioByVideo() {
|
private void replaceFragmentAudioByVideo() {
|
||||||
VideoCallFragment videoCallFragment = new VideoCallFragment();
|
switchCamera.setVisibility(View.VISIBLE);
|
||||||
|
videoCallFragment = new VideoCallFragment();
|
||||||
|
|
||||||
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
|
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
|
||||||
transaction.replace(R.id.fragmentContainer, videoCallFragment);
|
transaction.replace(R.id.fragmentContainer, videoCallFragment);
|
||||||
transaction.commitAllowingStateLoss();
|
transaction.commitAllowingStateLoss();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void toogleMicro() {
|
private void toogleMicro() {
|
||||||
|
@ -270,12 +283,14 @@ public class InCallActivity extends FragmentActivity implements
|
||||||
if (mControlsLayout.getVisibility() == View.GONE) {
|
if (mControlsLayout.getVisibility() == View.GONE) {
|
||||||
if (InCallActivity.this.getResources().getBoolean(R.bool.disable_animations)) {
|
if (InCallActivity.this.getResources().getBoolean(R.bool.disable_animations)) {
|
||||||
mControlsLayout.setVisibility(View.VISIBLE);
|
mControlsLayout.setVisibility(View.VISIBLE);
|
||||||
|
switchCamera.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
Animation animation = AnimationUtils.loadAnimation(this, R.anim.slide_in_bottom_to_top);
|
Animation animation = AnimationUtils.loadAnimation(this, R.anim.slide_in_bottom_to_top);
|
||||||
animation.setAnimationListener(new AnimationListener() {
|
animation.setAnimationListener(new AnimationListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationStart(Animation animation) {
|
public void onAnimationStart(Animation animation) {
|
||||||
mControlsLayout.setVisibility(View.VISIBLE);
|
mControlsLayout.setVisibility(View.VISIBLE);
|
||||||
|
switchCamera.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -287,6 +302,7 @@ public class InCallActivity extends FragmentActivity implements
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
mControlsLayout.startAnimation(animation);
|
mControlsLayout.startAnimation(animation);
|
||||||
|
switchCamera.startAnimation(AnimationUtils.loadAnimation(this, R.anim.slide_in_top_to_bottom));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -298,6 +314,7 @@ public class InCallActivity extends FragmentActivity implements
|
||||||
public void run() {
|
public void run() {
|
||||||
if (InCallActivity.this.getResources().getBoolean(R.bool.disable_animations)) {
|
if (InCallActivity.this.getResources().getBoolean(R.bool.disable_animations)) {
|
||||||
mControlsLayout.setVisibility(View.GONE);
|
mControlsLayout.setVisibility(View.GONE);
|
||||||
|
switchCamera.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
Animation animation = AnimationUtils.loadAnimation(InCallActivity.this, R.anim.slide_out_top_to_bottom);
|
Animation animation = AnimationUtils.loadAnimation(InCallActivity.this, R.anim.slide_out_top_to_bottom);
|
||||||
animation.setAnimationListener(new AnimationListener() {
|
animation.setAnimationListener(new AnimationListener() {
|
||||||
|
@ -312,9 +329,11 @@ public class InCallActivity extends FragmentActivity implements
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationEnd(Animation animation) {
|
public void onAnimationEnd(Animation animation) {
|
||||||
mControlsLayout.setVisibility(View.GONE);
|
mControlsLayout.setVisibility(View.GONE);
|
||||||
|
switchCamera.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
mControlsLayout.startAnimation(animation);
|
mControlsLayout.startAnimation(animation);
|
||||||
|
switchCamera.startAnimation(AnimationUtils.loadAnimation(InCallActivity.this, R.anim.slide_out_bottom_to_top));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, SECONDS_BEFORE_HIDING_CONTROLS);
|
}, SECONDS_BEFORE_HIDING_CONTROLS);
|
||||||
|
@ -328,6 +347,7 @@ public class InCallActivity extends FragmentActivity implements
|
||||||
}
|
}
|
||||||
|
|
||||||
mControlsLayout.setVisibility(View.VISIBLE);
|
mControlsLayout.setVisibility(View.VISIBLE);
|
||||||
|
switchCamera.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isCallRunning(LinphoneCall call)
|
private boolean isCallRunning(LinphoneCall call)
|
||||||
|
|
|
@ -33,10 +33,8 @@ import android.view.MotionEvent;
|
||||||
import android.view.SurfaceHolder;
|
import android.view.SurfaceHolder;
|
||||||
import android.view.SurfaceView;
|
import android.view.SurfaceView;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
|
||||||
import android.view.View.OnTouchListener;
|
import android.view.View.OnTouchListener;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ImageView;
|
|
||||||
|
|
||||||
//FIXME : preview gone after coming back from audio only
|
//FIXME : preview gone after coming back from audio only
|
||||||
/**
|
/**
|
||||||
|
@ -47,7 +45,6 @@ public class VideoCallFragment extends Fragment {
|
||||||
private WakeLock mWakeLock;
|
private WakeLock mWakeLock;
|
||||||
private SurfaceView mVideoView;
|
private SurfaceView mVideoView;
|
||||||
private SurfaceView mCaptureView;
|
private SurfaceView mCaptureView;
|
||||||
private ImageView switchCamera;
|
|
||||||
private AndroidVideoWindowImpl androidVideoWindowImpl;
|
private AndroidVideoWindowImpl androidVideoWindowImpl;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -55,14 +52,6 @@ public class VideoCallFragment extends Fragment {
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
instance = this;
|
instance = this;
|
||||||
View view = inflater.inflate(R.layout.video, container, false);
|
View view = inflater.inflate(R.layout.video, container, false);
|
||||||
|
|
||||||
switchCamera = (ImageView) view.findViewById(R.id.switchCamera);
|
|
||||||
switchCamera.setOnClickListener(new OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
switchCamera();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
mVideoView = (SurfaceView) view.findViewById(R.id.videoSurface);
|
mVideoView = (SurfaceView) view.findViewById(R.id.videoSurface);
|
||||||
mCaptureView = (SurfaceView) view.findViewById(R.id.videoCaptureSurface);
|
mCaptureView = (SurfaceView) view.findViewById(R.id.videoCaptureSurface);
|
||||||
|
@ -124,7 +113,7 @@ public class VideoCallFragment extends Fragment {
|
||||||
preview.setZOrderMediaOverlay(true); // Needed to be able to display control layout over
|
preview.setZOrderMediaOverlay(true); // Needed to be able to display control layout over
|
||||||
}
|
}
|
||||||
|
|
||||||
private void switchCamera() {
|
public void switchCamera() {
|
||||||
int videoDeviceId = LinphoneManager.getLc().getVideoDevice();
|
int videoDeviceId = LinphoneManager.getLc().getVideoDevice();
|
||||||
videoDeviceId = (videoDeviceId + 1) % AndroidCameraConfiguration.retrieveCameras().length;
|
videoDeviceId = (videoDeviceId + 1) % AndroidCameraConfiguration.retrieveCameras().length;
|
||||||
LinphoneManager.getLc().setVideoDevice(videoDeviceId);
|
LinphoneManager.getLc().setVideoDevice(videoDeviceId);
|
||||||
|
|