private void loadSelection(int i) { switch (i) { case 0: CostOverviewFragment overviewFragment = new CostOverviewFragment(); toolbar.setTitle("Cost Overview"); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); Bundle bundle = new Bundle(); bundle.putParcelable("house", house); bundle.putParcelable("account", current); bundle.putInt("cost", getIntent().getBundleExtra("extra").getInt("cost")); getIntent().putExtra("extra", bundle); fragmentTransaction.replace(R.id.detailsFragmentHolder, overviewFragment); fragmentTransaction.addToBackStack(overviewFragment.getTag()); fragmentTransaction.commit(); break; case 1: PersonalCostOverview personalCostOverview = new PersonalCostOverview(); toolbar.setTitle(cost.getSplit().get(selectedUser).getName() + "'s payments"); fragmentTransaction = fragmentManager.beginTransaction(); bundle = new Bundle(); bundle.putParcelable("house", house); bundle.putParcelable("account", current); bundle.putInt("cost", getIntent().getBundleExtra("extra").getInt("cost")); bundle.putInt("selected", selectedUser); getIntent().putExtra("extra", bundle); fragmentTransaction.replace(R.id.detailsFragmentHolder, personalCostOverview); fragmentTransaction.addToBackStack(personalCostOverview.getTag()); fragmentTransaction.commit(); break; } }
private void updatePaid() { for (int i = 0; i < cost.getIntervals().get(selectedCost).paid.size(); i++) { Log.d("TEST", "onCardViewTouch: "); if (selected .getFacebookID() .equals(cost.getIntervals().get(selectedCost).paid.get(i).first)) { cost.getIntervals().get(selectedCost).setPaid(i, true); } } ArrayList<Cost> costs = house.getCost(); costs.set(costLocation, cost); house.setCosts(costs); updateItemBG(house); }
public void PayPalButtonClick(View arg0) { dialog.hide(); // Create a basic PayPal payment PayPalPayment payment = new PayPalPayment(); // Set the currency type payment.setCurrencyType("USD"); // Set the recipient for the payment (can be a phone number) payment.setRecipient("*****@*****.**"); // Set the payment amount, excluding tax and shipping costs payment.setSubtotal(new BigDecimal(cost.getAmount())); // Set the payment type--his can be PAYMENT_TYPE_GOODS, // PAYMENT_TYPE_SERVICE, PAYMENT_TYPE_PERSONAL, or PAYMENT_TYPE_NONE payment.setPaymentType(PayPal.PAYMENT_TYPE_GOODS); // PayPalInvoiceData can contain tax and shipping amounts, and an // ArrayList of PayPalInvoiceItem that you can fill out. // These are not required for any transaction. PayPalInvoiceData invoice = new PayPalInvoiceData(); // Set the tax amount invoice.setTax(new BigDecimal(0)); PayPalInvoiceItem item = new PayPalInvoiceItem(); item.setID("1"); item.setName(cost.getCategory().getName()); item.setTotalPrice(new BigDecimal(cost.getAmount())); item.setQuantity(1); ArrayList<PayPalInvoiceItem> items = new ArrayList<>(); items.add(item); invoice.setInvoiceItems(items); payment.setMerchantName("House Share"); payment.setInvoiceData(invoice); Intent checkoutIntent = PayPal.getInstance().checkout(payment, this.getContext()); startActivityForResult(checkoutIntent, REQUEST_PAYPAL_CHECKOUT); }
private void setupUI() { AppBarLayout appbar = (AppBarLayout) findViewById(R.id.details_appbar); assert appbar != null; appbar.setBackgroundColor(cost.getCategory().getColor()); toolbar = (Toolbar) findViewById(R.id.details_toolbar); setSupportActionBar(toolbar); getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_keyboard_backspace_24dp); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayUseLogoEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); getSupportActionBar().setDisplayShowTitleEnabled(false); toolbar.setTitle(current.getName()); Window window = this.getWindow(); window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.setStatusBarColor(darker(cost.getCategory().getColor())); toolbar.setBackgroundColor(cost.getCategory().getColor()); }