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

View file

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