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:
parent
4bf1c14bb8
commit
52f75eb3cf
2 changed files with 18 additions and 24 deletions
|
@ -129,9 +129,6 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
|
||||||
@BindView(R.id.gravatar)
|
@BindView(R.id.gravatar)
|
||||||
CircularImageView userImg;
|
CircularImageView userImg;
|
||||||
|
|
||||||
@BindView(R.id.viewCamera)
|
|
||||||
View viewCamera;
|
|
||||||
|
|
||||||
/* Flag to control when the camera is visible and when is hidden */
|
/* Flag to control when the camera is visible and when is hidden */
|
||||||
private boolean cameraVisible = false;
|
private boolean cameraVisible = false;
|
||||||
|
|
||||||
|
@ -421,7 +418,6 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
|
||||||
* */
|
* */
|
||||||
private void showCamera(){
|
private void showCamera(){
|
||||||
/* Change visibilities of views */
|
/* Change visibilities of views */
|
||||||
viewCamera.setVisibility(View.GONE);
|
|
||||||
mScannerView.setVisibility(View.VISIBLE);
|
mScannerView.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
/* Change icon */
|
/* Change icon */
|
||||||
|
@ -440,7 +436,6 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
|
||||||
* */
|
* */
|
||||||
private void hideCamera(){
|
private void hideCamera(){
|
||||||
/* Change visibilities of views */
|
/* Change visibilities of views */
|
||||||
viewCamera.setVisibility(View.VISIBLE);
|
|
||||||
mScannerView.setVisibility(View.INVISIBLE);
|
mScannerView.setVisibility(View.INVISIBLE);
|
||||||
|
|
||||||
/* Change icon */
|
/* Change icon */
|
||||||
|
|
|
@ -206,6 +206,19 @@
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/tvMemoError" />
|
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.support.design.widget.FloatingActionButton
|
||||||
android:id="@+id/fabCloseCamera"
|
android:id="@+id/fabCloseCamera"
|
||||||
android:layout_width="32dp"
|
android:layout_width="32dp"
|
||||||
|
@ -220,26 +233,12 @@
|
||||||
android:id="@+id/ivCamera"
|
android:id="@+id/ivCamera"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_marginStart="24dp"
|
|
||||||
android:layout_marginTop="16dp"
|
|
||||||
android:contentDescription="@string/camera_feed_to_scan_qr"
|
android:contentDescription="@string/camera_feed_to_scan_qr"
|
||||||
android:src="#666"
|
app:layout_constraintDimensionRatio="w,3:4"
|
||||||
app:layout_constraintDimensionRatio="h,3:4"
|
app:layout_constraintTop_toTopOf="@+id/viewCamera"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintBottom_toBottomOf="@id/viewCamera"
|
||||||
app:layout_constraintEnd_toStartOf="@id/centeredVerticalGuideline"
|
app:layout_constraintStart_toStartOf="@id/viewCamera"
|
||||||
app:layout_constraintTop_toTopOf="@+id/fabCloseCamera" />
|
app:layout_constraintEnd_toEndOf="@id/viewCamera" />
|
||||||
|
|
||||||
<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"/>
|
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:id="@+id/viewSend"
|
android:id="@+id/viewSend"
|
||||||
|
|
Loading…
Reference in a new issue