Fix zooming issue on some devices + use same menu layout for settings view

This commit is contained in:
Sylvain Berfini 2012-08-07 15:37:29 +02:00
parent f79633ca4b
commit 796026f061
2 changed files with 90 additions and 70 deletions

View file

@ -10,74 +10,94 @@
android:paddingBottom="75dp" />
<LinearLayout
android:id="@+id/menu"
android:layout_width="match_parent"
android:layout_height="90dp"
android:layout_alignParentBottom="true"
android:orientation="horizontal">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.2">
<ImageView
android:contentDescription="@string/content_description_history"
android:id="@+id/history"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="fitXY"
android:src="@drawable/history" />
<TextView
android:id="@+id/missedCalls"
android:layout_width="25dp"
android:layout_height="25dp"
android:gravity="center"
android:textSize="20dp"
android:visibility="gone"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:background="@drawable/missed_calls_bg" />
</RelativeLayout>
<ImageView
android:contentDescription="@string/content_description_contacts"
android:id="@+id/contacts"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.2"
android:scaleType="fitXY"
android:src="@drawable/contacts" />
android:id="@+id/menu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal">
<ImageView
android:contentDescription="@string/content_description_dialer"
android:id="@+id/dialer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.2"
android:scaleType="fitXY"
android:src="@drawable/dialer" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.2">
<ImageView
android:contentDescription="@string/content_description_settings"
android:id="@+id/settings"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.2"
android:scaleType="fitXY"
android:src="@drawable/settings" />
<ImageView
android:id="@+id/history"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:contentDescription="@string/content_description_history"
android:scaleType="fitXY"
android:src="@drawable/history" />
<ImageView
android:contentDescription="@string/content_description_chat"
android:id="@+id/chat"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.2"
android:scaleType="fitXY"
android:src="@drawable/chat" />
</LinearLayout>
<TextView
android:id="@+id/missedCalls"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:background="@drawable/missed_calls_bg"
android:gravity="center"
android:textSize="20dp"
android:visibility="gone" />
</RelativeLayout>
<ImageView
android:id="@+id/contacts"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:adjustViewBounds="true"
android:contentDescription="@string/content_description_contacts"
android:scaleType="fitXY"
android:src="@drawable/contacts" />
<ImageView
android:id="@+id/dialer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.2"
android:adjustViewBounds="true"
android:contentDescription="@string/content_description_dialer"
android:scaleType="fitXY"
android:src="@drawable/dialer" />
<ImageView
android:id="@+id/settings"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:adjustViewBounds="true"
android:contentDescription="@string/content_description_settings"
android:scaleType="fitXY"
android:src="@drawable/settings" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.2">
<ImageView
android:id="@+id/chat"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:contentDescription="@string/content_description_chat"
android:scaleType="fitXY"
android:src="@drawable/chat" />
<TextView
android:id="@+id/missedChats"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:background="@drawable/missed_calls_bg"
android:gravity="center"
android:textSize="20dp"
android:visibility="gone" />
</RelativeLayout>
</LinearLayout>
</RelativeLayout>

View file

@ -171,7 +171,7 @@ public class VideoCallFragment extends Fragment implements OnGestureListener, On
public boolean onScale(CompatibilityScaleGestureDetector detector) {
mZoomFactor *= detector.getScaleFactor();
// Don't let the object get too small or too large.
mZoomFactor = Math.max(0.1f, Math.min(mZoomFactor, mVideoView.getHeight() / LinphoneManager.getLc().getPreferredVideoSize().height));
mZoomFactor = Math.max(0.1f, Math.min(mZoomFactor, ((float) mVideoView.getHeight()) / LinphoneManager.getLc().getPreferredVideoSize().height));
LinphoneManager.getLc().getCurrentCall().zoomVideo(mZoomFactor, mZoomCenterX, mZoomCenterY);
return true;
@ -204,9 +204,9 @@ public class VideoCallFragment extends Fragment implements OnGestureListener, On
@Override
public boolean onDoubleTap(MotionEvent e) {
if (LinphoneUtils.isCallEstablished(LinphoneManager.getLc().getCurrentCall())) {
if (mZoomFactor == 1) {
if (mZoomFactor == 1.f) {
// Zoom to make the video fill the screen in height
mZoomFactor = mVideoView.getHeight() / LinphoneManager.getLc().getPreferredVideoSize().height;
mZoomFactor = ((float) mVideoView.getHeight()) / LinphoneManager.getLc().getPreferredVideoSize().height;
}
else {
resetZoom();
@ -220,7 +220,7 @@ public class VideoCallFragment extends Fragment implements OnGestureListener, On
}
private void resetZoom() {
mZoomFactor = 1;
mZoomFactor = 1.f;
mZoomCenterX = mZoomCenterY = 0.5f;
}