Пример #1
0
        private void ReloadActivity(Shared.Models.Credit newCredit)
        {
            var intent = new Intent(this, typeof(CreditActivity));

            intent.PutExtra("idCredit", JsonConvert.SerializeObject(newCredit));
            StartActivity(intent);
            Finish();
        }
Пример #2
0
        protected override void LoadSyncElements()
        {
            base.LoadSyncElements();

            _credit          = JsonConvert.DeserializeObject <Shared.Models.Credit>(Intent.GetStringExtra("credit"));
            _avialableCredit = JsonConvert.DeserializeObject <List <Shared.Models.AvialableCredit> >(Intent.GetStringExtra("AvialableCredit"));

            _title      = FindViewById <TextView>(Resource.Id.compare_credit_title);
            _title.Text = _credit.BankName;

            _subTitle      = FindViewById <TextView>(Resource.Id.compare_credit_subtitle);
            _subTitle.Text = $"{_credit.Procent}%, {_credit.Amount} руб., на {_credit.DurationInMonth} мес.";

            _list = FindViewById <RecyclerView>(Resource.Id.compare_list);
            _list.SetLayoutManager(new NotCanScrollGridLayoutManager(this, 1));
            _list.AddItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.Vertical));
            _list.SetAdapter(new AvialableCreditAdapter(_avialableCredit));
            _list.NestedScrollingEnabled = false;

            _nestedScrollView = FindViewById <NestedScrollView>(Resource.Id.nested);
        }
Пример #3
0
        protected override void LoadSyncElements()
        {
            var local = Intent.GetStringExtra("idCredit");

            _credit   = JsonConvert.DeserializeObject <Shared.Models.Credit>(local);
            _payments = JsonConvert.DeserializeObject <List <PaymentModel> >(_credit.ListPayment ?? "");

            SupportActionBar.Title = _credit.Name;

            _bank      = FindViewById <TextView>(Resource.Id.credit_bank);
            _bank.Text = _credit.BankName;

            _type      = FindViewById <TextView>(Resource.Id.credit_type);
            _type.Text = _credit.TypeCredit;

            _duration      = FindViewById <TextView>(Resource.Id.credit_duration);
            _duration.Text = _credit.DurationInMonth.ToString();

            _startDate      = FindViewById <TextView>(Resource.Id.credit_start_date);
            _startDate.Text = _credit.StartCredit.ToString("d", new CultureInfo("ru"));

            _percent      = FindViewById <TextView>(Resource.Id.credit_percent);
            _percent.Text = _credit.Procent.ToString(new CultureInfo("ru"));

            _amount      = FindViewById <TextView>(Resource.Id.credit_amount);
            _amount.Text = _credit.Amount.ToString("N", new CultureInfo("ru"));

            _paymentView = FindViewById <RecyclerView>(Resource.Id.credit_payment);
            _paymentView.AddItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.Vertical));
            var layoutManager = new NotCanScrollGridLayoutManager(this, 1);

            _paymentView.SetLayoutManager(layoutManager);
            _paymentView.NestedScrollingEnabled = false;

            if (_payments?.Any() == true)
            {
                _paymentView.SetAdapter(new PaymentAdapter(this, _payments, _credit.ServerId, ShowLoaderInMainThread, DissmissLoaderInMainThread, ReloadActivity, ShowError, ShowErrorNotEnternet));
            }

            _nestedScrollView = FindViewById <NestedScrollView>(Resource.Id.nested);

            _findBetter        = FindViewById <Button>(Resource.Id.credit_find_better);
            _findBetter.Click += FindBetterOnClick;

            _rest      = FindViewById <TextView>(Resource.Id.credit_rest);
            _rest.Text = _credit.Rest.ToString(new CultureInfo("ru"));

            _inputPay = FindViewById <EditText>(Resource.Id.credit_input_custom_pay);

            _buttonPay        = FindViewById <Button>(Resource.Id.credit_button_custom_pay);
            _buttonPay.Click += ButtonPayOnClick;

            _payNoewButton        = FindViewById <Button>(Resource.Id.credit_payNow);
            _payNoewButton.Click += PayNowOnClick;

            _recalculationButton        = FindViewById <Button>(Resource.Id.credit_recalculation);
            _recalculationButton.Click += RecalculateOnClick;

            if (_credit.IsPay)
            {
                _recalculationButton.Visibility = ViewStates.Gone;
                _payNoewButton.Visibility       = ViewStates.Gone;
                _buttonPay.Visibility           = ViewStates.Gone;
                _inputPay.Visibility            = ViewStates.Gone;
            }
        }