use of de.schildbach.wallet.ui.CurrencyCalculatorLink in project bitcoin-wallet by bitcoin-wallet.
the class SendCoinsFragment method onCreateView.
@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.send_coins_fragment, container);
payeeGroup = view.findViewById(R.id.send_coins_payee_group);
payeeNameView = (TextView) view.findViewById(R.id.send_coins_payee_name);
payeeVerifiedByView = (TextView) view.findViewById(R.id.send_coins_payee_verified_by);
receivingAddressView = (AutoCompleteTextView) view.findViewById(R.id.send_coins_receiving_address);
receivingAddressViewAdapter = new ReceivingAddressViewAdapter(activity);
receivingAddressLoaderCallbacks = new ReceivingAddressLoaderCallbacks(activity, receivingAddressViewAdapter);
receivingAddressView.setAdapter(receivingAddressViewAdapter);
receivingAddressView.setOnFocusChangeListener(receivingAddressListener);
receivingAddressView.addTextChangedListener(receivingAddressListener);
receivingAddressView.setOnItemClickListener(receivingAddressListener);
receivingStaticView = view.findViewById(R.id.send_coins_receiving_static);
receivingStaticAddressView = (TextView) view.findViewById(R.id.send_coins_receiving_static_address);
receivingStaticLabelView = (TextView) view.findViewById(R.id.send_coins_receiving_static_label);
amountGroup = view.findViewById(R.id.send_coins_amount_group);
final CurrencyAmountView btcAmountView = (CurrencyAmountView) view.findViewById(R.id.send_coins_amount_btc);
btcAmountView.setCurrencySymbol(config.getFormat().code());
btcAmountView.setInputFormat(config.getMaxPrecisionFormat());
btcAmountView.setHintFormat(config.getFormat());
final CurrencyAmountView localAmountView = (CurrencyAmountView) view.findViewById(R.id.send_coins_amount_local);
localAmountView.setInputFormat(Constants.LOCAL_FORMAT);
localAmountView.setHintFormat(Constants.LOCAL_FORMAT);
amountCalculatorLink = new CurrencyCalculatorLink(btcAmountView, localAmountView);
amountCalculatorLink.setExchangeDirection(config.getLastExchangeDirection());
directPaymentEnableView = (CheckBox) view.findViewById(R.id.send_coins_direct_payment_enable);
directPaymentEnableView.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(final CompoundButton buttonView, final boolean isChecked) {
if (paymentIntent.isBluetoothPaymentUrl() && isChecked && !bluetoothAdapter.isEnabled()) {
// ask for permission to enable bluetooth
startActivityForResult(new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE), REQUEST_CODE_ENABLE_BLUETOOTH_FOR_DIRECT_PAYMENT);
}
}
});
hintView = (TextView) view.findViewById(R.id.send_coins_hint);
directPaymentMessageView = (TextView) view.findViewById(R.id.send_coins_direct_payment_message);
sentTransactionView = (FrameLayout) view.findViewById(R.id.send_coins_sent_transaction);
sentTransactionAdapter = new TransactionsAdapter(activity, wallet, false, application.maxConnectedPeers(), null);
sentTransactionViewHolder = sentTransactionAdapter.createTransactionViewHolder(sentTransactionView);
sentTransactionView.addView(sentTransactionViewHolder.itemView, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
privateKeyPasswordViewGroup = view.findViewById(R.id.send_coins_private_key_password_group);
privateKeyPasswordView = (EditText) view.findViewById(R.id.send_coins_private_key_password);
privateKeyBadPasswordView = view.findViewById(R.id.send_coins_private_key_bad_password);
viewGo = (Button) view.findViewById(R.id.send_coins_go);
viewGo.setOnClickListener(new OnClickListener() {
@Override
public void onClick(final View v) {
validateReceivingAddress();
if (everythingPlausible())
handleGo();
else
requestFocusFirst();
updateView();
}
});
viewCancel = (Button) view.findViewById(R.id.send_coins_cancel);
viewCancel.setOnClickListener(new OnClickListener() {
@Override
public void onClick(final View v) {
handleCancel();
}
});
return view;
}
Aggregations