Search in sources :

Example 1 with TransactionsAdapter

use of de.schildbach.wallet.ui.TransactionsAdapter 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)

Example 2 with TransactionsAdapter

use of de.schildbach.wallet.ui.TransactionsAdapter in project bitcoin-wallet by bitcoin-wallet.

the class SweepWalletFragment method onCreateView.

@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
    final View view = inflater.inflate(R.layout.sweep_wallet_fragment, container);
    messageView = (TextView) view.findViewById(R.id.sweep_wallet_fragment_message);
    passwordViewGroup = view.findViewById(R.id.sweep_wallet_fragment_password_group);
    passwordView = (EditText) view.findViewById(R.id.sweep_wallet_fragment_password);
    badPasswordView = view.findViewById(R.id.sweep_wallet_fragment_bad_password);
    balanceView = (TextView) view.findViewById(R.id.sweep_wallet_fragment_balance);
    hintView = view.findViewById(R.id.sweep_wallet_fragment_hint);
    sweepTransactionView = (FrameLayout) view.findViewById(R.id.sweep_wallet_fragment_sent_transaction);
    sweepTransactionAdapter = new TransactionsAdapter(activity, application.getWallet(), false, application.maxConnectedPeers(), null);
    sweepTransactionViewHolder = sweepTransactionAdapter.createTransactionViewHolder(sweepTransactionView);
    sweepTransactionView.addView(sweepTransactionViewHolder.itemView, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    viewGo = (Button) view.findViewById(R.id.send_coins_go);
    viewGo.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(final View v) {
            if (state == State.DECODE_KEY)
                handleDecrypt();
            if (state == State.CONFIRM_SWEEP)
                handleSweep();
        }
    });
    viewCancel = (Button) view.findViewById(R.id.send_coins_cancel);
    viewCancel.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(final View v) {
            activity.finish();
        }
    });
    return view;
}
Also used : FrameLayout(android.widget.FrameLayout) View(android.view.View) TextView(android.widget.TextView) RecyclerView(android.support.v7.widget.RecyclerView) TransactionsAdapter(de.schildbach.wallet.ui.TransactionsAdapter)

Aggregations

RecyclerView (android.support.v7.widget.RecyclerView)2 View (android.view.View)2 FrameLayout (android.widget.FrameLayout)2 TextView (android.widget.TextView)2 TransactionsAdapter (de.schildbach.wallet.ui.TransactionsAdapter)2 Intent (android.content.Intent)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 PaymentIntent (de.schildbach.wallet.data.PaymentIntent)1 CurrencyAmountView (de.schildbach.wallet.ui.CurrencyAmountView)1 CurrencyCalculatorLink (de.schildbach.wallet.ui.CurrencyCalculatorLink)1