mirror of https://github.com/m2049r/xmrwallet.git
qr code is now a button
This commit is contained in:
parent
7b19e9a2bd
commit
f1f2f250be
|
@ -64,8 +64,8 @@ public class ReceiveFragment extends Fragment {
|
||||||
private TextInputLayout etPaymentId;
|
private TextInputLayout etPaymentId;
|
||||||
private ExchangeView evAmount;
|
private ExchangeView evAmount;
|
||||||
private Button bPaymentId;
|
private Button bPaymentId;
|
||||||
private Button bGenerate;
|
private TextView tvQrCode;
|
||||||
private ImageView qrCode;
|
private ImageButton qrCode;
|
||||||
private EditText etDummy;
|
private EditText etDummy;
|
||||||
private ImageButton bCopyAddress;
|
private ImageButton bCopyAddress;
|
||||||
|
|
||||||
|
@ -90,8 +90,8 @@ public class ReceiveFragment extends Fragment {
|
||||||
etPaymentId = (TextInputLayout) view.findViewById(R.id.etPaymentId);
|
etPaymentId = (TextInputLayout) view.findViewById(R.id.etPaymentId);
|
||||||
evAmount = (ExchangeView) view.findViewById(R.id.evAmount);
|
evAmount = (ExchangeView) view.findViewById(R.id.evAmount);
|
||||||
bPaymentId = (Button) view.findViewById(R.id.bPaymentId);
|
bPaymentId = (Button) view.findViewById(R.id.bPaymentId);
|
||||||
qrCode = (ImageView) view.findViewById(R.id.qrCode);
|
qrCode = (ImageButton) view.findViewById(R.id.qrCode);
|
||||||
bGenerate = (Button) view.findViewById(R.id.bGenerate);
|
tvQrCode = (TextView) view.findViewById(R.id.tvQrCode);
|
||||||
etDummy = (EditText) view.findViewById(R.id.etDummy);
|
etDummy = (EditText) view.findViewById(R.id.etDummy);
|
||||||
bCopyAddress = (ImageButton) view.findViewById(R.id.bCopyAddress);
|
bCopyAddress = (ImageButton) view.findViewById(R.id.bCopyAddress);
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ public class ReceiveFragment extends Fragment {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
bGenerate.setOnClickListener(new View.OnClickListener() {
|
qrCode.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (checkPaymentId()) {
|
if (checkPaymentId()) {
|
||||||
|
@ -195,14 +195,16 @@ public class ReceiveFragment extends Fragment {
|
||||||
|
|
||||||
void clearQR() {
|
void clearQR() {
|
||||||
if (qrValid) {
|
if (qrValid) {
|
||||||
qrCode.setImageBitmap(getMoneroLogo());
|
qrCode.setImageBitmap(null);
|
||||||
qrValid = false;
|
qrValid = false;
|
||||||
|
tvQrCode.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setQR(Bitmap qr) {
|
void setQR(Bitmap qr) {
|
||||||
qrCode.setImageBitmap(qr);
|
qrCode.setImageBitmap(qr);
|
||||||
qrValid = true;
|
qrValid = true;
|
||||||
|
tvQrCode.setVisibility(View.INVISIBLE);
|
||||||
Helper.hideKeyboard(getActivity());
|
Helper.hideKeyboard(getActivity());
|
||||||
etDummy.requestFocus();
|
etDummy.requestFocus();
|
||||||
}
|
}
|
||||||
|
@ -221,9 +223,7 @@ public class ReceiveFragment extends Fragment {
|
||||||
listenerCallback.setTitle(name);
|
listenerCallback.setTitle(name);
|
||||||
tvAddress.setText(address);
|
tvAddress.setText(address);
|
||||||
etPaymentId.setEnabled(true);
|
etPaymentId.setEnabled(true);
|
||||||
//etAmount.setEnabled(true);
|
|
||||||
bPaymentId.setEnabled(true);
|
bPaymentId.setEnabled(true);
|
||||||
bGenerate.setEnabled(true);
|
|
||||||
bCopyAddress.setEnabled(true);
|
bCopyAddress.setEnabled(true);
|
||||||
bCopyAddress.setImageResource(R.drawable.ic_content_copy_black_24dp);
|
bCopyAddress.setImageResource(R.drawable.ic_content_copy_black_24dp);
|
||||||
hideProgress();
|
hideProgress();
|
||||||
|
@ -307,7 +307,8 @@ public class ReceiveFragment extends Fragment {
|
||||||
sb.append(ScannerFragment.QR_AMOUNT).append('=').append(xmrAmount);
|
sb.append(ScannerFragment.QR_AMOUNT).append('=').append(xmrAmount);
|
||||||
}
|
}
|
||||||
String text = sb.toString();
|
String text = sb.toString();
|
||||||
Bitmap qr = generate(text, 500, 500);
|
int size = Math.min(qrCode.getHeight(), qrCode.getWidth());
|
||||||
|
Bitmap qr = generate(text, size, size);
|
||||||
if (qr != null) {
|
if (qr != null) {
|
||||||
setQR(qr);
|
setQR(qr);
|
||||||
Log.d(TAG, "SETQR");
|
Log.d(TAG, "SETQR");
|
||||||
|
|
|
@ -114,22 +114,30 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<Button
|
<FrameLayout
|
||||||
android:id="@+id/bGenerate"
|
|
||||||
style="@style/MoneroButton"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent">
|
||||||
android:layout_marginBottom="4dp"
|
|
||||||
android:layout_marginTop="4dp"
|
|
||||||
android:enabled="false"
|
|
||||||
android:minHeight="36dp"
|
|
||||||
android:text="@string/receive_generate_hint" />
|
|
||||||
|
|
||||||
<ImageView
|
<TextView
|
||||||
|
android:id="@+id/tvQrCode"
|
||||||
|
style="@style/MoneroFab"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:drawablePadding="4dp"
|
||||||
|
android:drawableStart="@drawable/ic_info_outline_gray_24dp"
|
||||||
|
android:text="@string/label_receive_gen_qr_code"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textSize="16sp" />
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
android:id="@+id/qrCode"
|
android:id="@+id/qrCode"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="match_parent"
|
||||||
android:adjustViewBounds="true" />
|
android:adjustViewBounds="true"
|
||||||
|
android:background="#00000000" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/etDummy"
|
android:id="@+id/etDummy"
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
<string name="label_close">Close</string>
|
<string name="label_close">Close</string>
|
||||||
<string name="label_wallet_advanced_details">Touch for detailed information</string>
|
<string name="label_wallet_advanced_details">Touch for detailed information</string>
|
||||||
|
|
||||||
|
<string name="label_receive_gen_qr_code">Touch for QR Code</string>
|
||||||
|
|
||||||
<string name="backup_progress">Backup in progress</string>
|
<string name="backup_progress">Backup in progress</string>
|
||||||
<string name="archive_progress">Archive in progress</string>
|
<string name="archive_progress">Archive in progress</string>
|
||||||
<string name="rename_progress">Rename in progress</string>
|
<string name="rename_progress">Rename in progress</string>
|
||||||
|
|
Loading…
Reference in New Issue