Exemple #1
0
 private void SearchEditView_TextChanged(object sender, Android.Text.TextChangedEventArgs e)
 {
     addressBookAdapter.Filter(e.Text.ToString());
 }
        private void CreateTextViewsAndButtons(View view)
        {
            amountLayout  = view.FindViewById <TextInputLayout>(Resource.Id.amountLayoutFrag);
            addressLayout = view.FindViewById <TextInputLayout>(Resource.Id.userNameLayoutFrag);
            labelLayout   = view.FindViewById <TextInputLayout>(Resource.Id.labelLayoutFrag);

            amountEdit           = view.FindViewById <TextInputEditText>(Resource.Id.amountEditFrag);
            addressEdit          = view.FindViewById <TextInputEditText>(Resource.Id.userNameTextEditFrag);
            labelEdit            = view.FindViewById <TextInputEditText>(Resource.Id.labelEditFrag);
            dollarAmountTextView = view.FindViewById <TextView>(Resource.Id.dollarAmountTextViewFrag);

            amountEdit.ClearFocus();

            amountEdit.RequestFocus();

            //@@todo: convert to lambda functions
            amountEdit.FocusChange += AmountTextView_FocusChange;

            dollarAmountTextView.SetTextColor(Color.Red);

            amountEdit.TextChanged += (sender, e) =>
            {
                string amount = amountEdit.Text;

                if (!amount.Any(char.IsDigit))
                {
                    return;
                }

                decimal value = System.Convert.ToDecimal(amount) * coinDollarValue;
                dollarAmountTextView.Text = value.ToString("C");
            };

            addressEdit.FocusChange += AddressTextView_FocusChange;
            addressEdit.TextChanged += (sender, e) =>
            {
                addressBookAdapter.Filter(e.Text.ToString());
            };

            //@@todo: convert to lambda functions
            labelEdit.FocusChange += LabelTextView_FocusChange;

            buttonLayout = view.FindViewById <LinearLayout>(Resource.Id.buttonLayoutFrag);

            addressBookButton = view.FindViewById <Button>(Resource.Id.addressBookFrag);
            qrCodeButton      = view.FindViewById <Button>(Resource.Id.qrCodeFrag);
            clearButton       = view.FindViewById <Button>(Resource.Id.clearFrag);

            clearButton.Click += (sender, e) =>
            {
                addressEdit.Text = null;
            };

            //@@todo: convert to lambda functions
            addressBookButton.Click += AddressBookButton_Click;

            sendButton         = view.FindViewById <Button>(Resource.Id.sendFrag);
            radioGroup         = view.FindViewById <RadioGroup>(Resource.Id.feesRadioGroup);
            topView            = view.FindViewById <View>(Resource.Id.topView);
            transactionFeeText = view.FindViewById <TextView>(Resource.Id.transactionFeeText);
            bottomView         = view.FindViewById <View>(Resource.Id.bottomView);

            //@@todo: convert to lambda functions
            sendButton.Click += async(sender, e) =>
            {
                if (!UserInputsFilled())
                {
                    return;
                }

                switch (transactionState)
                {
                case TransactionEnum.RECEIVE:
                    HandleReceiveTask();
                    break;

                case TransactionEnum.SEND:
                    await HandleSendTaks();

                    break;

                default:
                    break;
                }
            };
        }