diff --git a/briar-android/src/main/java/org/briarproject/briar/android/keyagreement/ShowQrCodeFragment.java b/briar-android/src/main/java/org/briarproject/briar/android/keyagreement/ShowQrCodeFragment.java index c648a0b739a0b7abb0f4129c51c64c4db9fcdaa2..459109c1b45b57099679a507cb3c603040bf2e49 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/keyagreement/ShowQrCodeFragment.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/keyagreement/ShowQrCodeFragment.java @@ -14,6 +14,7 @@ import android.view.View; import android.view.ViewGroup; import android.view.animation.AlphaAnimation; import android.widget.ImageView; +import android.widget.LinearLayout; import android.widget.LinearLayout.LayoutParams; import android.widget.TextView; import android.widget.Toast; @@ -54,6 +55,7 @@ import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_NOSENSOR; import static android.view.View.INVISIBLE; import static android.view.View.VISIBLE; import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; +import static android.widget.LinearLayout.HORIZONTAL; import static android.widget.Toast.LENGTH_LONG; import static java.util.logging.Level.INFO; import static java.util.logging.Level.WARNING; @@ -133,20 +135,29 @@ public class ShowQrCodeFragment extends BaseEventFragment ImageView fullscreenButton = view.findViewById(R.id.fullscreen_button); fullscreenButton.setOnClickListener(v -> { View qrCodeContainer = view.findViewById(R.id.qr_code_container); + LinearLayout cameraOverlay = view.findViewById(R.id.camera_overlay); + LayoutParams statusParams, qrCodeParams; if (fullscreen) { - // Shrink the QR code container - qrCodeContainer.setLayoutParams( - new LayoutParams(MATCH_PARENT, 0, 1f)); + // Shrink the QR code container to fill half its parent + if (cameraOverlay.getOrientation() == HORIZONTAL) { + statusParams = new LayoutParams(0, MATCH_PARENT, 1f); + qrCodeParams = new LayoutParams(0, MATCH_PARENT, 1f); + } else { + statusParams = new LayoutParams(MATCH_PARENT, 0, 1f); + qrCodeParams = new LayoutParams(MATCH_PARENT, 0, 1f); + } fullscreenButton.setBackgroundResource( R.drawable.ic_fullscreen_black_48dp); } else { - // Grow the QR code container - qrCodeContainer.setLayoutParams( - new LayoutParams(MATCH_PARENT, MATCH_PARENT, 1f)); + // Grow the QR code container to fill its parent + statusParams = new LayoutParams(0, 0, 0f); + qrCodeParams = new LayoutParams(MATCH_PARENT, MATCH_PARENT, 1f); fullscreenButton.setBackgroundResource( R.drawable.ic_fullscreen_exit_black_48dp); } - view.findViewById(R.id.camera_overlay).invalidate(); + statusView.setLayoutParams(statusParams); + qrCodeContainer.setLayoutParams(qrCodeParams); + cameraOverlay.invalidate(); fullscreen = !fullscreen; }); } diff --git a/briar-android/src/main/res/layout-land/fragment_keyagreement_qr.xml b/briar-android/src/main/res/layout-land/fragment_keyagreement_qr.xml index c811b58c8b92d9fcfacc98db4157296bdf4a79b2..ba6b4421ea32ea683fc990f226dfb3b206d40167 100644 --- a/briar-android/src/main/res/layout-land/fragment_keyagreement_qr.xml +++ b/briar-android/src/main/res/layout-land/fragment_keyagreement_qr.xml @@ -15,7 +15,6 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" - android:weightSum="2" android:baselineAligned="false"> <LinearLayout diff --git a/briar-android/src/main/res/layout/fragment_keyagreement_qr.xml b/briar-android/src/main/res/layout/fragment_keyagreement_qr.xml index 456ffbca129364bf3ea4ed00ae92f3bc6b4852a5..dedb8dde937fa7882ed2c3621e2e1e07b9a2690a 100644 --- a/briar-android/src/main/res/layout/fragment_keyagreement_qr.xml +++ b/briar-android/src/main/res/layout/fragment_keyagreement_qr.xml @@ -15,7 +15,6 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" - android:weightSum="2" android:baselineAligned="false"> <LinearLayout