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_height="wrap_content" />
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dip"
|
||||
|
@ -21,6 +20,15 @@
|
|||
android:layout_height="match_parent"
|
||||
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
|
||||
android:id="@+id/menu"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -17,13 +17,4 @@
|
|||
android:layout_alignParentBottom="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>
|
|
@ -56,9 +56,10 @@ public class InCallActivity extends FragmentActivity implements
|
|||
private Handler mHandler = new Handler();
|
||||
private Handler controlsHandler = new Handler();
|
||||
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 AudioCallFragment audioCallFragment;
|
||||
private VideoCallFragment videoCallFragment;
|
||||
private boolean isSpeakerEnabled, isMicMuted, isVideoEnabled;
|
||||
private LinearLayout mControlsLayout;
|
||||
|
||||
|
@ -89,9 +90,12 @@ public class InCallActivity extends FragmentActivity implements
|
|||
Fragment callFragment;
|
||||
if (isVideoEnabled) {
|
||||
callFragment = new VideoCallFragment();
|
||||
videoCallFragment = (VideoCallFragment) callFragment;
|
||||
switchCamera.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
callFragment = new AudioCallFragment();
|
||||
audioCallFragment = (AudioCallFragment) callFragment;
|
||||
switchCamera.setVisibility(View.GONE);
|
||||
}
|
||||
callFragment.setArguments(getIntent().getExtras());
|
||||
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.setOnClickListener(this);
|
||||
|
||||
switchCamera = (ImageView) findViewById(R.id.switchCamera);
|
||||
switchCamera.setOnClickListener(this);
|
||||
|
||||
mControlsLayout = (LinearLayout) findViewById(R.id.menu);
|
||||
|
||||
if (isVideoEnabled) {
|
||||
|
@ -164,6 +171,11 @@ public class InCallActivity extends FragmentActivity implements
|
|||
else if (id == R.id.dialer) {
|
||||
|
||||
}
|
||||
else if (id == R.id.switchCamera) {
|
||||
if (videoCallFragment != null) {
|
||||
videoCallFragment.switchCamera();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -207,7 +219,8 @@ public class InCallActivity extends FragmentActivity implements
|
|||
}
|
||||
|
||||
private void replaceFragmentAudioByVideo() {
|
||||
VideoCallFragment videoCallFragment = new VideoCallFragment();
|
||||
switchCamera.setVisibility(View.VISIBLE);
|
||||
videoCallFragment = new VideoCallFragment();
|
||||
|
||||
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
|
||||
transaction.replace(R.id.fragmentContainer, videoCallFragment);
|
||||
|
@ -270,12 +283,14 @@ public class InCallActivity extends FragmentActivity implements
|
|||
if (mControlsLayout.getVisibility() == View.GONE) {
|
||||
if (InCallActivity.this.getResources().getBoolean(R.bool.disable_animations)) {
|
||||
mControlsLayout.setVisibility(View.VISIBLE);
|
||||
switchCamera.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
Animation animation = AnimationUtils.loadAnimation(this, R.anim.slide_in_bottom_to_top);
|
||||
animation.setAnimationListener(new AnimationListener() {
|
||||
@Override
|
||||
public void onAnimationStart(Animation animation) {
|
||||
mControlsLayout.setVisibility(View.VISIBLE);
|
||||
switchCamera.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -287,6 +302,7 @@ public class InCallActivity extends FragmentActivity implements
|
|||
}
|
||||
});
|
||||
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() {
|
||||
if (InCallActivity.this.getResources().getBoolean(R.bool.disable_animations)) {
|
||||
mControlsLayout.setVisibility(View.GONE);
|
||||
switchCamera.setVisibility(View.GONE);
|
||||
} else {
|
||||
Animation animation = AnimationUtils.loadAnimation(InCallActivity.this, R.anim.slide_out_top_to_bottom);
|
||||
animation.setAnimationListener(new AnimationListener() {
|
||||
|
@ -312,9 +329,11 @@ public class InCallActivity extends FragmentActivity implements
|
|||
@Override
|
||||
public void onAnimationEnd(Animation animation) {
|
||||
mControlsLayout.setVisibility(View.GONE);
|
||||
switchCamera.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
mControlsLayout.startAnimation(animation);
|
||||
switchCamera.startAnimation(AnimationUtils.loadAnimation(InCallActivity.this, R.anim.slide_out_bottom_to_top));
|
||||
}
|
||||
}
|
||||
}, SECONDS_BEFORE_HIDING_CONTROLS);
|
||||
|
@ -328,6 +347,7 @@ public class InCallActivity extends FragmentActivity implements
|
|||
}
|
||||
|
||||
mControlsLayout.setVisibility(View.VISIBLE);
|
||||
switchCamera.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
private boolean isCallRunning(LinphoneCall call)
|
||||
|
|
|
@ -33,10 +33,8 @@ import android.view.MotionEvent;
|
|||
import android.view.SurfaceHolder;
|
||||
import android.view.SurfaceView;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.View.OnTouchListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
//FIXME : preview gone after coming back from audio only
|
||||
/**
|
||||
|
@ -47,7 +45,6 @@ public class VideoCallFragment extends Fragment {
|
|||
private WakeLock mWakeLock;
|
||||
private SurfaceView mVideoView;
|
||||
private SurfaceView mCaptureView;
|
||||
private ImageView switchCamera;
|
||||
private AndroidVideoWindowImpl androidVideoWindowImpl;
|
||||
|
||||
@Override
|
||||
|
@ -56,14 +53,6 @@ public class VideoCallFragment extends Fragment {
|
|||
instance = this;
|
||||
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);
|
||||
mCaptureView = (SurfaceView) view.findViewById(R.id.videoCaptureSurface);
|
||||
mCaptureView.getHolder().setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); // Warning useless because value is ignored and automatically set by new APIs.
|
||||
|
@ -124,7 +113,7 @@ public class VideoCallFragment extends Fragment {
|
|||
preview.setZOrderMediaOverlay(true); // Needed to be able to display control layout over
|
||||
}
|
||||
|
||||
private void switchCamera() {
|
||||
public void switchCamera() {
|
||||
int videoDeviceId = LinphoneManager.getLc().getVideoDevice();
|
||||
videoDeviceId = (videoDeviceId + 1) % AndroidCameraConfiguration.retrieveCameras().length;
|
||||
LinphoneManager.getLc().setVideoDevice(videoDeviceId);
|
||||
|
|