- Remove not used library.
- Improve SendTransactionFragment layout to automatically adjust the camera preview to an 4:3 aspect ratio, which in turn avoids the problem that the app was not reading QR Codes.
This commit is contained in:
parent
6e4b66a5e3
commit
0c64e78e89
3 changed files with 51 additions and 63 deletions
|
@ -86,7 +86,6 @@ dependencies {
|
|||
implementation 'org.tukaani:xz:1.6'
|
||||
implementation 'com.jakewharton:butterknife:8.8.1'
|
||||
implementation 'com.github.bilthon:graphenej:0.4.6'
|
||||
implementation 'com.google.zxing:core:3.3.1'
|
||||
implementation 'me.dm7.barcodescanner:zxing:1.9.8'
|
||||
implementation 'com.github.sjaramillo10:AnimatedTabLayout:1.0.3'
|
||||
|
||||
|
|
|
@ -12,8 +12,6 @@ import android.content.Intent;
|
|||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
|
@ -42,10 +40,6 @@ import android.widget.Toast;
|
|||
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.Result;
|
||||
import com.jaredrummler.materialspinner.MaterialSpinner;
|
||||
import com.vincent.filepicker.ToastUtil;
|
||||
|
||||
import org.bitcoinj.wallet.SendRequest;
|
||||
|
||||
import java.io.File;
|
||||
import java.math.RoundingMode;
|
||||
|
@ -63,7 +57,6 @@ import butterknife.OnTextChanged;
|
|||
import cy.agorise.crystalwallet.R;
|
||||
import cy.agorise.crystalwallet.application.CrystalSecurityMonitor;
|
||||
import cy.agorise.crystalwallet.dialogs.material.CrystalDialog;
|
||||
import cy.agorise.crystalwallet.dialogs.material.ToastIt;
|
||||
import cy.agorise.crystalwallet.enums.CryptoCoin;
|
||||
import cy.agorise.crystalwallet.enums.CryptoNet;
|
||||
import cy.agorise.crystalwallet.interfaces.OnResponse;
|
||||
|
@ -95,6 +88,8 @@ import static butterknife.internal.Utils.listOf;
|
|||
|
||||
public class SendTransactionFragment extends DialogFragment implements UIValidatorListener, ZXingScannerView.ResultHandler {
|
||||
|
||||
private final String TAG = getClass().getName();
|
||||
|
||||
SendTransactionValidator sendTransactionValidator;
|
||||
|
||||
@BindView(R.id.spFrom)
|
||||
|
@ -125,11 +120,8 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
|
|||
TextView tvMemoError;
|
||||
@BindView(R.id.btnSend)
|
||||
FloatingActionButton btnSend;
|
||||
@BindView(R.id.btnCancel)
|
||||
TextView btnCancel;
|
||||
@BindView(R.id.ivPeople)
|
||||
ImageView ivPeople;
|
||||
|
||||
@BindView(R.id.ivCamera)
|
||||
ZXingScannerView mScannerView;
|
||||
|
||||
|
@ -714,7 +706,7 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
|
|||
public void beginScanQrCode(){
|
||||
//mScannerView = new ZXingScannerView(getContext());
|
||||
mScannerView.setFormats(listOf(BarcodeFormat.QR_CODE));
|
||||
mScannerView.setAspectTolerance(20f);
|
||||
mScannerView.setAspectTolerance(0.5f);
|
||||
mScannerView.setAutoFocus(true);
|
||||
mScannerView.setLaserColor(R.color.colorAccent);
|
||||
mScannerView.setMaskColor(R.color.colorAccent);
|
||||
|
@ -784,6 +776,8 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
|
|||
try {
|
||||
Invoice invoice = Invoice.fromQrCode(result.getText());
|
||||
|
||||
Log.d(TAG, "QR Code read: " + invoice.toJsonString());
|
||||
|
||||
etTo.setText(invoice.getTo());
|
||||
|
||||
for (int i = 0; i < assetAdapter.getCount(); i++) {
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<ScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/white">
|
||||
|
@ -12,6 +11,13 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="24dp">
|
||||
|
||||
<android.support.constraint.Guideline
|
||||
android:id="@+id/centeredVerticalGuideline"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintGuide_percent="0.5"/>
|
||||
|
||||
<View
|
||||
android:id="@+id/topView"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -36,6 +42,16 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/btnCancel"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:background="@drawable/ic_close"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
||||
<cy.agorise.crystalwallet.util.CircularImageView
|
||||
android:id="@+id/gravatar"
|
||||
android:layout_width="60dp"
|
||||
|
@ -188,43 +204,43 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvMemoError" />
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/fabCloseCamera"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
app:backgroundTint="@color/send_strong_orange"
|
||||
app:fabSize="mini"
|
||||
app:layout_constraintStart_toEndOf="@id/centeredVerticalGuideline"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvScan"
|
||||
app:srcCompat="@drawable/ic_close" />
|
||||
|
||||
<me.dm7.barcodescanner.zxing.ZXingScannerView
|
||||
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="180dp"
|
||||
android:layout_height="180dp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:visibility="gone"
|
||||
android:src="#666"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvScan">
|
||||
|
||||
</View>
|
||||
|
||||
<me.dm7.barcodescanner.zxing.ZXingScannerView
|
||||
android:id="@+id/ivCamera"
|
||||
android:layout_width="183dp"
|
||||
android:layout_height="176dp"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:contentDescription="@string/camera_feed_to_scan_qr"
|
||||
android:src="#666"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvScan" />
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/fabCloseCamera"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginStart="165dp"
|
||||
android:layout_marginBottom="165dp"
|
||||
app:backgroundTint="@color/send_strong_orange"
|
||||
app:fabSize="mini"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/ivCamera"
|
||||
app:layout_constraintStart_toStartOf="@+id/ivCamera"
|
||||
app:srcCompat="@drawable/ic_close" />
|
||||
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
|
||||
android:id="@+id/viewSend"
|
||||
|
@ -245,27 +261,6 @@
|
|||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/viewSend" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="600dp"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:layout_marginTop="20dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:padding="5dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/btnCancel"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="26dp"
|
||||
android:background="@drawable/ic_close"
|
||||
android:text=""
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
|
||||
</ScrollView>
|
Loading…
Reference in a new issue