Make the area that shows the camera feed to always be a square. The camera feed still has a 3:4 aspect ratio but there is a black square behind it that creates the always square illusion.

This commit is contained in:
Severiano Jaramillo 2018-11-30 11:29:27 -06:00
parent 4bf1c14bb8
commit 52f75eb3cf
2 changed files with 18 additions and 24 deletions

View file

@ -129,9 +129,6 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
@BindView(R.id.gravatar)
CircularImageView userImg;
@BindView(R.id.viewCamera)
View viewCamera;
/* Flag to control when the camera is visible and when is hidden */
private boolean cameraVisible = false;
@ -421,7 +418,6 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
* */
private void showCamera(){
/* Change visibilities of views */
viewCamera.setVisibility(View.GONE);
mScannerView.setVisibility(View.VISIBLE);
/* Change icon */
@ -440,7 +436,6 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
* */
private void hideCamera(){
/* Change visibilities of views */
viewCamera.setVisibility(View.VISIBLE);
mScannerView.setVisibility(View.INVISIBLE);
/* Change icon */

View file

@ -206,6 +206,19 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvMemoError" />
<View
android:id="@+id/viewCamera"
android:background="@color/black"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="16dp"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:visibility="visible"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintTop_toBottomOf="@+id/tvScan"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/centeredVerticalGuideline"/>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fabCloseCamera"
android:layout_width="32dp"
@ -220,26 +233,12 @@
android:id="@+id/ivCamera"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="24dp"
android:layout_marginTop="16dp"
android:contentDescription="@string/camera_feed_to_scan_qr"
android:src="#666"
app:layout_constraintDimensionRatio="h,3:4"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/centeredVerticalGuideline"
app:layout_constraintTop_toTopOf="@+id/fabCloseCamera" />
<View
android:id="@+id/viewCamera"
android:background="@color/black"
android:layout_width="0dp"
android:layout_height="0dp"
android:visibility="visible"
android:src="#666"
app:layout_constraintTop_toTopOf="@id/ivCamera"
app:layout_constraintStart_toStartOf="@id/ivCamera"
app:layout_constraintEnd_toEndOf="@id/ivCamera"
app:layout_constraintBottom_toBottomOf="@+id/ivCamera"/>
app:layout_constraintDimensionRatio="w,3:4"
app:layout_constraintTop_toTopOf="@+id/viewCamera"
app:layout_constraintBottom_toBottomOf="@id/viewCamera"
app:layout_constraintStart_toStartOf="@id/viewCamera"
app:layout_constraintEnd_toEndOf="@id/viewCamera" />
<View
android:id="@+id/viewSend"