Increase the camera preview area to improve the QR read performance and make some UI improvements.

develop
Severiano Jaramillo 2018-11-30 19:49:40 -06:00
parent 618e71a6ac
commit 450a7c285b
2 changed files with 16 additions and 59 deletions

View File

@ -28,8 +28,6 @@ import android.text.Editable;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ImageView;
@ -139,9 +137,7 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
private FloatingActionButton fabSend;
private AlertDialog.Builder builder;
/*
Dialog for loading
*/
/* Dialog for loading */
private CrystalDialog crystalDialog;
public static SendTransactionFragment newInstance(long cryptoNetAccountId) {
@ -168,7 +164,6 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
//AlertDialog.Builder
builder = new AlertDialog.Builder(getActivity(), R.style.dialog_theme_full);
//builder.setTitle("Send");
LayoutInflater inflater = getActivity().getLayoutInflater();
View view = inflater.inflate(R.layout.send_transaction, null);
@ -176,11 +171,7 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
this.cryptoNetAccountId = getArguments().getLong("CRYPTO_NET_ACCOUNT_ID",-1);
final Activity activity = getActivity();
/*
* Add style to the spinner android
* */
/* Add style to the spinner android */
spFrom.setBackground(getContext().getDrawable(R.drawable.square_color));
if (this.cryptoNetAccountId != -1) {
@ -191,36 +182,10 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
List<CryptoNetAccount> cryptoNetAccounts = cryptoNetAccountListViewModel.getCryptoNetAccountList();
CryptoNetAccountAdapter fromSpinnerAdapter = new CryptoNetAccountAdapter(this.getContext(), android.R.layout.simple_spinner_item, cryptoNetAccounts);
/*
* If only one account block the control
* */
//if(cryptoNetAccounts.size()==1){
// spFrom.setEnabled(false);
//}
spFrom.setAdapter(fromSpinnerAdapter);
spFrom.setSelection(0);
setAccountUI();
/*
* Custom material spinner implementation
* */
//spFrom.setItems(cryptoNetAccounts);
//spFrom.setSelectedIndex(0);
//spFrom.setOnItemSelectedListener(new MaterialSpinner.OnItemSelectedListener<CryptoNetAccount>() {
// @Override
// public void onItemSelected(MaterialSpinner view, int position, long id, CryptoNetAccount item) {
// sendTransactionValidator.validate();
// }
//});
//spFrom.setOnNothingSelectedListener(new MaterialSpinner.OnNothingSelectedListener() {
// @Override public void onNothingSelected(MaterialSpinner spinner) {
// }
//});
// etFrom.setText(this.grapheneAccount.getName());
}
loadUserImage();
@ -337,12 +302,7 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
public void onResume() {
super.onResume();
mScannerView.setResultHandler(this);
mScannerView.startCamera();
// Force dialog fragment to use the full width of the screen
Window dialogWindow = getDialog().getWindow();
assert dialogWindow != null;
dialogWindow.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
loadUserImage();
}
@ -511,10 +471,7 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
if (fromAccountSelected.getCryptoNet() == CryptoNet.BITSHARES) {
/*
* this is only for graphene accounts.
*
**/
/* This is only for graphene accounts. */
GrapheneAccount grapheneAccountSelected = new GrapheneAccount(fromAccountSelected);
grapheneAccountSelected.loadInfo(db.grapheneAccountInfoDao().getByAccountId(fromAccountSelected.getId()));
@ -583,16 +540,12 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
});
}
/*
* If exists mode scurity show it and valide events in case of success or fail
* */
/* If exists mode security show it and validate events in case of success or fail */
CrystalSecurityMonitor.getInstance(this.getActivity()).callPasswordRequest(this.getActivity(), new OnResponse() {
@Override
public void onSuccess() {
/*
* Show loading dialog
* */
/* Show loading dialog */
crystalDialog = new CrystalDialog((Activity) getContext());
crystalDialog.setText("Sending");
crystalDialog.progress();
@ -623,10 +576,6 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat
// Camera Permissions
private static final int REQUEST_CAMERA_PERMISSION = 1;
private static String[] PERMISSIONS_CAMERA = {
Manifest.permission.CAMERA
};
@Override
public void onValidationSucceeded(final ValidationField field) {

View File

@ -18,6 +18,13 @@
android:orientation="vertical"
app:layout_constraintGuide_percent="0.5"/>
<android.support.constraint.Guideline
android:id="@+id/cameraVerticalGuideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.65"/>
<View
android:id="@+id/topView"
android:layout_width="match_parent"
@ -217,7 +224,7 @@
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintTop_toBottomOf="@+id/tvScan"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/centeredVerticalGuideline"/>
app:layout_constraintEnd_toStartOf="@id/cameraVerticalGuideline"/>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fabCloseCamera"
@ -225,7 +232,7 @@
android:layout_height="wrap_content"
app:backgroundTint="@color/send_strong_orange"
app:fabCustomSize="32dp"
app:layout_constraintStart_toEndOf="@id/centeredVerticalGuideline"
app:layout_constraintStart_toEndOf="@id/cameraVerticalGuideline"
app:layout_constraintTop_toBottomOf="@+id/tvScan"
app:srcCompat="@drawable/ok" />
@ -247,7 +254,8 @@
android:layout_marginEnd="0dp"
android:background="@drawable/send_transaction_send_view"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/ivCamera" />
app:layout_constraintTop_toTopOf="@id/viewCamera"
app:layout_constraintBottom_toBottomOf="@id/viewCamera"/>
<android.support.design.widget.FloatingActionButton
android:id="@+id/btnSend"