Пример #1
0
    public AddDialog(final Activity activity) {
      super(activity);
      this.setContentView(R.layout.add_to_address_book_dialog);
      this.setTitle(R.string.add_to_address_book_dialog_title);

      findViewById(R.id.btScan)
          .setOnClickListener(
              new android.view.View.OnClickListener() {

                @Override
                public void onClick(View v) {
                  Utils.startScannerIntent(activity, SCANNER_RESULT_CODE);
                  AddDialog.this.dismiss();
                }
              });

      Address address = Utils.addressFromString(Utils.getClipboardString(AddressBookActivity.this));
      findViewById(R.id.btClipboard).setEnabled(address != null);
      findViewById(R.id.btClipboard)
          .setOnClickListener(
              new android.view.View.OnClickListener() {

                @Override
                public void onClick(View v) {
                  String addressString = Utils.getClipboardString(AddressBookActivity.this);
                  addFromString(addressString);
                  AddDialog.this.dismiss();
                }
              });
    }
 private BigDecimal getAmountFromClipboard() {
   String content = Utils.getClipboardString(GetSendingAmountActivity.this);
   if (content.length() == 0) {
     return null;
   }
   String number = content.toString().trim();
   if (_enterFiatAmount) {
     number = Utils.truncateAndConvertDecimalString(number, 2);
     if (number == null) {
       return null;
     }
     BigDecimal value = new BigDecimal(number);
     if (value.compareTo(BigDecimal.ZERO) < 1) {
       return null;
     }
     return value;
   } else {
     number =
         Utils.truncateAndConvertDecimalString(
             number, _mbwManager.getBitcoinDenomination().getDecimalPlaces());
     if (number == null) {
       return null;
     }
     BigDecimal value = new BigDecimal(number);
     if (value.compareTo(BigDecimal.ZERO) < 1) {
       return null;
     }
     return value;
   }
 }