Search in sources :

Example 1 with CurrencyAmountView

use of de.schildbach.wallet.ui.CurrencyAmountView 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;
}
Also used : OnCheckedChangeListener(android.widget.CompoundButton.OnCheckedChangeListener) PaymentIntent(de.schildbach.wallet.data.PaymentIntent) Intent(android.content.Intent) CurrencyAmountView(de.schildbach.wallet.ui.CurrencyAmountView) AutoCompleteTextView(android.widget.AutoCompleteTextView) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) CurrencyCalculatorLink(de.schildbach.wallet.ui.CurrencyCalculatorLink) CurrencyAmountView(de.schildbach.wallet.ui.CurrencyAmountView) FrameLayout(android.widget.FrameLayout) OnClickListener(android.view.View.OnClickListener) TransactionsAdapter(de.schildbach.wallet.ui.TransactionsAdapter) CompoundButton(android.widget.CompoundButton)

Aggregations

Intent (android.content.Intent)1 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 OnClickListener (android.view.View.OnClickListener)1 AdapterView (android.widget.AdapterView)1 AutoCompleteTextView (android.widget.AutoCompleteTextView)1 CompoundButton (android.widget.CompoundButton)1 OnCheckedChangeListener (android.widget.CompoundButton.OnCheckedChangeListener)1 FrameLayout (android.widget.FrameLayout)1 TextView (android.widget.TextView)1 PaymentIntent (de.schildbach.wallet.data.PaymentIntent)1 CurrencyAmountView (de.schildbach.wallet.ui.CurrencyAmountView)1 CurrencyCalculatorLink (de.schildbach.wallet.ui.CurrencyCalculatorLink)1 TransactionsAdapter (de.schildbach.wallet.ui.TransactionsAdapter)1